Skip to content

Commit

Permalink
Vendor dialog-polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Jun 6, 2024
1 parent 821c802 commit f00d326
Show file tree
Hide file tree
Showing 9 changed files with 1,041 additions and 30 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ package-lock.json
# disable linting for templates because it will have its own rules when used in a new app
packages/cna-template/template
packages/astro-template/src/env.d.ts
packages/circuit-ui/vendor
28 changes: 0 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/circuit-ui/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ __reports__/
*rc.js
tsconfig.json
scripts/
vendor/
2 changes: 1 addition & 1 deletion packages/circuit-ui/components/Toggletip/Toggletip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ import {
type Placement,
type Side,
} from '@floating-ui/react-dom';
import dialogPolyfill from 'dialog-polyfill-universal';

import dialogPolyfill from '../../vendor/dialog-polyfill/index.js';
import type { ClickEvent } from '../../types/events.js';
import { clsx } from '../../styles/clsx.js';
import { applyMultipleRefs } from '../../util/refs.js';
Expand Down
1 change: 0 additions & 1 deletion packages/circuit-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@floating-ui/react-dom": "^2.1.0",
"@nanostores/react": "^0.7.2",
"nanostores": "^0.10.3",
"dialog-polyfill-universal": "^0.1.1",
"react-modal": "^3.16.1",
"react-number-format": "5.3.0",
"temporal-polyfill": "^0.2.5"
Expand Down
27 changes: 27 additions & 0 deletions packages/circuit-ui/vendor/dialog-polyfill/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 3 additions & 0 deletions packages/circuit-ui/vendor/dialog-polyfill/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# dialog-polyfill

This code was copied from [GoogleChrome/dialog-polyfill](https://github.com/GoogleChrome/dialog-polyfill), specifically [GoogleChrome/dialog-polyfill#231](https://github.com/GoogleChrome/dialog-polyfill/pull/231), which adds support for safely importing the polyfill in isomorphic environments.
17 changes: 17 additions & 0 deletions packages/circuit-ui/vendor/dialog-polyfill/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
interface DialogPolyfillType {
registerDialog(dialog: HTMLDialogElement): void;
forceRegisterDialog(dialog: HTMLDialogElement): void;
}

/**
* If used as CJS, then "dialogPolyfill" is added to the global scope. Just assert it exists.
*/
declare global {
const dialogPolyfill: DialogPolyfillType;
}

/**
* If used as ESM, then we export a const of type "DialogPolyfillType" as the default.
*/
declare const dialogPolyfill: DialogPolyfillType;
export default dialogPolyfill;
Loading

0 comments on commit f00d326

Please sign in to comment.