@nextui-org/react 1.0.1-alpha.7 → 1.0.2-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -45
- package/avatar/package.json +6 -0
- package/backdrop/package.json +6 -0
- package/button/package.json +6 -0
- package/card/package.json +6 -0
- package/checkbox/package.json +6 -0
- package/cjs/avatar/avatar-group.d.ts +13 -0
- package/cjs/avatar/avatar-group.js +35 -0
- package/cjs/avatar/avatar-group.styles.d.ts +1785 -0
- package/cjs/avatar/avatar-group.styles.js +52 -0
- package/cjs/avatar/avatar.d.ts +21 -0
- package/cjs/avatar/avatar.js +75 -0
- package/cjs/avatar/avatar.styles.d.ts +904 -0
- package/cjs/avatar/avatar.styles.js +334 -0
- package/cjs/avatar/index.d.ts +7 -0
- package/cjs/avatar/index.js +22 -0
- package/cjs/backdrop/backdrop.d.ts +37 -0
- package/cjs/backdrop/backdrop.js +137 -0
- package/cjs/backdrop/backdrop.styles.d.ts +2677 -0
- package/cjs/backdrop/backdrop.styles.js +119 -0
- package/cjs/backdrop/index.d.ts +5 -0
- package/cjs/backdrop/index.js +16 -0
- package/{dist/components → cjs}/button/button-group-context.d.ts +3 -2
- package/cjs/button/button-group-context.js +21 -0
- package/cjs/button/button-group.d.ts +34 -0
- package/cjs/button/button-group.js +81 -0
- package/cjs/button/button-group.styles.d.ts +899 -0
- package/cjs/button/button-group.styles.js +136 -0
- package/cjs/button/button-icon.d.ts +909 -0
- package/cjs/button/button-icon.js +68 -0
- package/cjs/button/button.d.ts +30 -0
- package/cjs/button/button.js +145 -0
- package/cjs/button/button.styles.d.ts +907 -0
- package/cjs/button/button.styles.js +695 -0
- package/cjs/button/index.d.ts +10 -0
- package/cjs/button/index.js +25 -0
- package/{dist/components → cjs}/button/utils.d.ts +2 -2
- package/cjs/button/utils.js +27 -0
- package/cjs/card/card.d.ts +23 -0
- package/cjs/card/card.js +117 -0
- package/cjs/card/card.styles.d.ts +3575 -0
- package/cjs/card/card.styles.js +267 -0
- package/cjs/card/index.d.ts +5 -0
- package/cjs/card/index.js +24 -0
- package/{dist/components → cjs}/checkbox/checkbox-context.d.ts +3 -2
- package/cjs/checkbox/checkbox-context.js +25 -0
- package/cjs/checkbox/checkbox-group.d.ts +29 -0
- package/cjs/checkbox/checkbox-group.js +89 -0
- package/{dist/components → cjs}/checkbox/checkbox.d.ts +21 -10
- package/cjs/checkbox/checkbox.js +192 -0
- package/cjs/checkbox/checkbox.styles.d.ts +8054 -0
- package/cjs/checkbox/checkbox.styles.js +563 -0
- package/cjs/checkbox/index.d.ts +6 -0
- package/cjs/checkbox/index.js +26 -0
- package/cjs/code/code.d.ts +15 -0
- package/cjs/code/code.js +42 -0
- package/cjs/code/code.styles.d.ts +1782 -0
- package/cjs/code/code.styles.js +14 -0
- package/cjs/code/index.d.ts +5 -0
- package/cjs/code/index.js +15 -0
- package/{dist/components → cjs}/col/col.d.ts +5 -7
- package/cjs/col/col.js +46 -0
- package/cjs/col/col.styles.d.ts +893 -0
- package/cjs/col/col.styles.js +16 -0
- package/cjs/col/index.d.ts +5 -0
- package/cjs/col/index.js +14 -0
- package/cjs/collapse/collapse-context.d.ts +9 -0
- package/cjs/collapse/collapse-context.js +20 -0
- package/cjs/collapse/collapse-group.d.ts +18 -0
- package/cjs/collapse/collapse-group.js +90 -0
- package/cjs/collapse/collapse-icon.d.ts +19 -0
- package/cjs/collapse/collapse-icon.js +41 -0
- package/cjs/collapse/collapse.d.ts +41 -0
- package/cjs/collapse/collapse.js +190 -0
- package/cjs/collapse/collapse.styles.d.ts +4472 -0
- package/cjs/collapse/collapse.styles.js +254 -0
- package/cjs/collapse/index.d.ts +6 -0
- package/cjs/collapse/index.js +22 -0
- package/cjs/container/container.d.ts +40 -0
- package/cjs/container/container.js +91 -0
- package/cjs/container/container.styles.d.ts +896 -0
- package/cjs/container/container.styles.js +45 -0
- package/cjs/container/index.d.ts +5 -0
- package/cjs/container/index.js +14 -0
- package/{dist/components → cjs}/css-baseline/css-baseline.d.ts +2 -2
- package/cjs/css-baseline/css-baseline.js +247 -0
- package/{dist/components → cjs}/css-baseline/index.d.ts +0 -0
- package/cjs/css-baseline/index.js +11 -0
- package/cjs/divider/divider.d.ts +22 -0
- package/cjs/divider/divider.js +82 -0
- package/cjs/divider/divider.styles.d.ts +1787 -0
- package/cjs/divider/divider.styles.js +77 -0
- package/cjs/divider/index.d.ts +5 -0
- package/cjs/divider/index.js +15 -0
- package/cjs/grid/grid-container.d.ts +22 -0
- package/cjs/grid/grid-container.js +60 -0
- package/{dist/components/grid/basic-item.d.ts → cjs/grid/grid-item.d.ts} +14 -5
- package/cjs/grid/grid-item.js +123 -0
- package/cjs/grid/grid.d.ts +9 -0
- package/cjs/grid/grid.js +29 -0
- package/cjs/grid/grid.styles.d.ts +1783 -0
- package/cjs/grid/grid.styles.js +15 -0
- package/cjs/grid/index.d.ts +7 -0
- package/cjs/grid/index.js +18 -0
- package/{dist/components → cjs}/image/image.d.ts +17 -15
- package/cjs/image/image.js +150 -0
- package/cjs/image/image.skeleton.d.ts +19 -0
- package/cjs/image/image.skeleton.js +50 -0
- package/cjs/image/image.styles.d.ts +2676 -0
- package/cjs/image/image.styles.js +57 -0
- package/cjs/image/index.d.ts +5 -0
- package/cjs/image/index.js +16 -0
- package/cjs/index.d.ts +79 -0
- package/cjs/index.js +435 -0
- package/cjs/input/index.d.ts +7 -0
- package/cjs/input/index.js +30 -0
- package/cjs/input/input-password.d.ts +98 -0
- package/cjs/input/input-password.js +80 -0
- package/cjs/input/input-props.d.ts +66 -0
- package/cjs/input/input-props.js +30 -0
- package/cjs/input/input.d.ts +18 -0
- package/cjs/input/input.js +317 -0
- package/cjs/input/input.styles.d.ts +9854 -0
- package/cjs/input/input.styles.js +878 -0
- package/cjs/input/password-icon.d.ts +6 -0
- package/cjs/input/password-icon.js +51 -0
- package/{dist/components → cjs}/link/icon.d.ts +0 -0
- package/cjs/link/icon.js +42 -0
- package/cjs/link/index.d.ts +5 -0
- package/cjs/link/index.js +15 -0
- package/cjs/link/link.d.ts +43 -0
- package/cjs/link/link.js +42 -0
- package/cjs/link/link.styles.d.ts +1788 -0
- package/cjs/link/link.styles.js +135 -0
- package/cjs/loading/index.d.ts +7 -0
- package/cjs/loading/index.js +24 -0
- package/{dist/components → cjs}/loading/loading.d.ts +11 -9
- package/cjs/loading/loading.js +80 -0
- package/cjs/loading/loading.styles.d.ts +5356 -0
- package/cjs/loading/loading.styles.js +438 -0
- package/cjs/loading/spinner.d.ts +17 -0
- package/cjs/loading/spinner.js +47 -0
- package/cjs/modal/index.d.ts +8 -0
- package/cjs/modal/index.js +28 -0
- package/cjs/modal/modal-body.d.ts +45 -0
- package/cjs/modal/modal-body.js +62 -0
- package/cjs/modal/modal-close-button.d.ts +13 -0
- package/cjs/modal/modal-close-button.js +49 -0
- package/cjs/modal/modal-context.d.ts +8 -0
- package/cjs/modal/modal-context.js +18 -0
- package/cjs/modal/modal-footer.d.ts +24 -0
- package/cjs/modal/modal-footer.js +69 -0
- package/cjs/modal/modal-header.d.ts +24 -0
- package/cjs/modal/modal-header.js +69 -0
- package/cjs/modal/modal-wrapper.d.ts +24 -0
- package/cjs/modal/modal-wrapper.js +153 -0
- package/cjs/modal/modal.d.ts +42 -0
- package/cjs/modal/modal.js +159 -0
- package/cjs/modal/modal.styles.d.ts +5362 -0
- package/cjs/modal/modal.styles.js +243 -0
- package/cjs/modal/use-modal.d.ts +11 -0
- package/cjs/modal/use-modal.js +25 -0
- package/cjs/pagination/index.d.ts +7 -0
- package/cjs/pagination/index.js +19 -0
- package/cjs/pagination/pagination-ellipsis.d.ts +11 -0
- package/cjs/pagination/pagination-ellipsis.js +86 -0
- package/cjs/pagination/pagination-highlight.d.ts +14 -0
- package/cjs/pagination/pagination-highlight.js +52 -0
- package/cjs/pagination/pagination-icon.d.ts +16 -0
- package/cjs/pagination/pagination-icon.js +59 -0
- package/cjs/pagination/pagination-item.d.ts +22 -0
- package/cjs/pagination/pagination-item.js +104 -0
- package/cjs/pagination/pagination.d.ts +46 -0
- package/cjs/pagination/pagination.js +169 -0
- package/cjs/pagination/pagination.styles.d.ts +5369 -0
- package/cjs/pagination/pagination.styles.js +361 -0
- package/cjs/progress/index.d.ts +5 -0
- package/cjs/progress/index.js +15 -0
- package/cjs/progress/progress.d.ts +65 -0
- package/cjs/progress/progress.js +101 -0
- package/cjs/progress/progress.styles.d.ts +1793 -0
- package/cjs/progress/progress.styles.js +165 -0
- package/cjs/radio/index.d.ts +4 -0
- package/cjs/radio/index.js +24 -0
- package/{dist/components → cjs}/radio/radio-context.d.ts +3 -2
- package/cjs/radio/radio-context.js +24 -0
- package/cjs/radio/radio-group.d.ts +30 -0
- package/cjs/radio/radio-group.js +78 -0
- package/{dist/components → cjs}/radio/radio.d.ts +19 -16
- package/cjs/radio/radio.js +156 -0
- package/cjs/radio/radio.styles.d.ts +5357 -0
- package/cjs/radio/radio.styles.js +240 -0
- package/cjs/row/index.d.ts +5 -0
- package/cjs/row/index.js +14 -0
- package/cjs/row/row.d.ts +21 -0
- package/cjs/row/row.js +54 -0
- package/cjs/row/row.styles.d.ts +895 -0
- package/cjs/row/row.styles.js +25 -0
- package/cjs/snippet/index.d.ts +5 -0
- package/cjs/snippet/index.js +16 -0
- package/{dist/components → cjs}/snippet/snippet-icon.d.ts +5 -2
- package/cjs/snippet/snippet-icon.js +52 -0
- package/cjs/snippet/snippet.d.ts +35 -0
- package/cjs/snippet/snippet.js +137 -0
- package/cjs/snippet/snippet.styles.d.ts +3570 -0
- package/cjs/snippet/snippet.styles.js +141 -0
- package/cjs/spacer/index.d.ts +5 -0
- package/cjs/spacer/index.js +14 -0
- package/cjs/spacer/spacer.d.ts +41 -0
- package/cjs/spacer/spacer.js +49 -0
- package/cjs/spacer/spacer.styles.d.ts +894 -0
- package/cjs/spacer/spacer.styles.js +24 -0
- package/cjs/switch/index.d.ts +5 -0
- package/cjs/switch/index.js +17 -0
- package/cjs/switch/switch.d.ts +82 -0
- package/cjs/switch/switch.js +142 -0
- package/cjs/switch/switch.styles.d.ts +3576 -0
- package/cjs/switch/switch.styles.js +283 -0
- package/cjs/text/child.d.ts +21 -0
- package/cjs/text/child.js +83 -0
- package/cjs/text/index.d.ts +4 -0
- package/cjs/text/index.js +14 -0
- package/{dist/components → cjs}/text/text.d.ts +13 -17
- package/cjs/text/text.js +124 -0
- package/cjs/text/text.styles.d.ts +894 -0
- package/cjs/text/text.styles.js +41 -0
- package/cjs/textarea/index.d.ts +3 -0
- package/cjs/textarea/index.js +12 -0
- package/cjs/textarea/textarea.d.ts +42 -0
- package/cjs/textarea/textarea.js +126 -0
- package/cjs/textarea/utils.d.ts +13 -0
- package/cjs/textarea/utils.js +126 -0
- package/cjs/theme/common.d.ts +1584 -0
- package/cjs/theme/common.js +490 -0
- package/cjs/theme/dark-theme.d.ts +33 -0
- package/cjs/theme/dark-theme.js +38 -0
- package/cjs/theme/index.js +31 -0
- package/cjs/theme/light-theme.d.ts +28 -0
- package/cjs/theme/light-theme.js +33 -0
- package/cjs/theme/ssr-provider.d.ts +7 -0
- package/cjs/theme/ssr-provider.js +51 -0
- package/cjs/theme/stitches.config.d.ts +8700 -0
- package/cjs/theme/stitches.config.js +88 -0
- package/cjs/theme/theme-context.d.ts +5 -0
- package/cjs/theme/theme-context.js +22 -0
- package/cjs/theme/theme-provider.d.ts +14 -0
- package/cjs/theme/theme-provider.js +115 -0
- package/cjs/theme/types.d.ts +75 -0
- package/cjs/theme/types.js +3 -0
- package/cjs/theme/utils.d.ts +16 -0
- package/cjs/theme/utils.js +113 -0
- package/cjs/tooltip/index.d.ts +6 -0
- package/cjs/tooltip/index.js +17 -0
- package/cjs/tooltip/placement.d.ts +39 -0
- package/cjs/tooltip/placement.js +193 -0
- package/cjs/tooltip/tooltip-content.d.ts +27 -0
- package/cjs/tooltip/tooltip-content.js +135 -0
- package/cjs/tooltip/tooltip.d.ts +56 -0
- package/cjs/tooltip/tooltip.js +141 -0
- package/cjs/tooltip/tooltip.styles.d.ts +3571 -0
- package/cjs/tooltip/tooltip.styles.js +159 -0
- package/cjs/use-body-scroll/index.d.ts +3 -0
- package/cjs/use-body-scroll/index.js +12 -0
- package/cjs/use-body-scroll/use-body-scroll.d.ts +9 -0
- package/cjs/use-body-scroll/use-body-scroll.js +77 -0
- package/cjs/use-click-anywhere/index.d.ts +2 -0
- package/cjs/use-click-anywhere/index.js +12 -0
- package/cjs/use-click-anywhere/use-click-anywhere.d.ts +2 -0
- package/cjs/use-click-anywhere/use-click-anywhere.js +19 -0
- package/cjs/use-click-away/index.d.ts +2 -0
- package/cjs/use-click-away/index.js +12 -0
- package/cjs/use-click-away/use-click-away.d.ts +3 -0
- package/cjs/use-click-away/use-click-away.js +23 -0
- package/cjs/use-clipboard/index.d.ts +3 -0
- package/cjs/use-clipboard/index.js +12 -0
- package/{dist/hooks → cjs/use-clipboard}/use-clipboard.d.ts +0 -0
- package/cjs/use-clipboard/use-clipboard.js +57 -0
- package/cjs/use-current-state/index.d.ts +2 -0
- package/cjs/use-current-state/index.js +12 -0
- package/{dist/hooks → cjs/use-current-state}/use-current-state.d.ts +0 -0
- package/cjs/use-current-state/use-current-state.js +28 -0
- package/cjs/use-drip/index.d.ts +2 -0
- package/cjs/use-drip/index.js +12 -0
- package/cjs/use-drip/use-drip.d.ts +9 -0
- package/cjs/use-drip/use-drip.js +38 -0
- package/cjs/use-input/index.d.ts +2 -0
- package/cjs/use-input/index.js +12 -0
- package/cjs/use-input/use-input.d.ts +13 -0
- package/cjs/use-input/use-input.js +32 -0
- package/cjs/use-keyboard/codes.d.ts +92 -0
- package/cjs/use-keyboard/codes.js +104 -0
- package/cjs/use-keyboard/helper.d.ts +3 -0
- package/cjs/use-keyboard/helper.js +35 -0
- package/cjs/use-keyboard/index.d.ts +5 -0
- package/cjs/use-keyboard/index.js +15 -0
- package/cjs/use-keyboard/use-keyboard.d.ts +22 -0
- package/cjs/use-keyboard/use-keyboard.js +76 -0
- package/cjs/use-pagination/index.d.ts +20 -0
- package/cjs/use-pagination/index.js +88 -0
- package/cjs/use-portal/index.d.ts +2 -0
- package/cjs/use-portal/index.js +12 -0
- package/{dist/hooks → cjs/use-portal}/use-portal.d.ts +0 -0
- package/cjs/use-portal/use-portal.js +43 -0
- package/cjs/use-real-shape/index.d.ts +2 -0
- package/cjs/use-real-shape/index.js +12 -0
- package/{dist/hooks → cjs/use-real-shape}/use-real-shape.d.ts +0 -0
- package/cjs/use-real-shape/use-real-shape.js +55 -0
- package/cjs/use-resize/index.d.ts +2 -0
- package/cjs/use-resize/index.js +12 -0
- package/{dist/hooks → cjs/use-resize}/use-resize.d.ts +0 -0
- package/cjs/use-resize/use-resize.js +23 -0
- package/cjs/use-ssr/index.d.ts +2 -0
- package/cjs/use-ssr/index.js +12 -0
- package/{dist/hooks → cjs/use-ssr}/use-ssr.d.ts +0 -0
- package/cjs/use-ssr/use-ssr.js +25 -0
- package/cjs/use-theme/index.d.ts +2 -0
- package/cjs/use-theme/index.js +12 -0
- package/cjs/use-theme/use-theme.d.ts +3 -0
- package/cjs/use-theme/use-theme.js +16 -0
- package/cjs/use-warning/index.d.ts +2 -0
- package/cjs/use-warning/index.js +12 -0
- package/{dist/hooks → cjs/use-warning}/use-warning.d.ts +0 -0
- package/cjs/use-warning/use-warning.js +23 -0
- package/cjs/user/index.d.ts +6 -0
- package/cjs/user/index.js +21 -0
- package/cjs/user/user-link.d.ts +32 -0
- package/cjs/user/user-link.js +46 -0
- package/{dist/components → cjs}/user/user.d.ts +12 -7
- package/cjs/user/user.js +63 -0
- package/cjs/user/user.styles.d.ts +4456 -0
- package/cjs/user/user.styles.js +56 -0
- package/cjs/utils/assertion.d.ts +8 -0
- package/cjs/utils/assertion.js +42 -0
- package/cjs/utils/clear-icon.d.ts +16 -0
- package/cjs/utils/clear-icon.js +70 -0
- package/cjs/utils/clsx.d.ts +1 -0
- package/cjs/utils/clsx.js +57 -0
- package/cjs/utils/collections.d.ts +12 -0
- package/cjs/utils/collections.js +110 -0
- package/{dist → cjs}/utils/color.d.ts +6 -6
- package/cjs/utils/color.js +187 -0
- package/cjs/utils/css-transition.d.ts +27 -0
- package/cjs/utils/css-transition.js +76 -0
- package/cjs/utils/deep-merge.d.ts +1 -0
- package/cjs/utils/deep-merge.js +33 -0
- package/{dist → cjs}/utils/dimensions.d.ts +0 -0
- package/cjs/utils/dimensions.js +10 -0
- package/cjs/utils/dom.js +110 -0
- package/cjs/utils/drip.d.ts +936 -0
- package/cjs/utils/drip.js +116 -0
- package/cjs/utils/expand.d.ts +20 -0
- package/cjs/utils/expand.js +109 -0
- package/cjs/utils/icons.js +481 -0
- package/cjs/utils/numbers.d.ts +9 -0
- package/cjs/utils/numbers.js +23 -0
- package/cjs/utils/object.d.ts +11 -0
- package/cjs/utils/object.js +40 -0
- package/cjs/utils/prop-types.d.ts +54 -0
- package/cjs/utils/prop-types.js +56 -0
- package/cjs/utils/react.js +24 -0
- package/cjs/utils/strings.js +18 -0
- package/cjs/utils/types.d.js +3 -0
- package/{dist → cjs}/utils/with-defaults.d.ts +0 -0
- package/cjs/utils/with-defaults.js +13 -0
- package/code/package.json +6 -0
- package/col/package.json +6 -0
- package/collapse/package.json +6 -0
- package/container/package.json +6 -0
- package/css-baseline/package.json +6 -0
- package/divider/package.json +6 -0
- package/esm/avatar/avatar-group.d.ts +13 -0
- package/esm/avatar/avatar-group.js +35 -0
- package/esm/avatar/avatar-group.styles.d.ts +1785 -0
- package/esm/avatar/avatar-group.styles.js +52 -0
- package/esm/avatar/avatar.d.ts +21 -0
- package/esm/avatar/avatar.js +75 -0
- package/esm/avatar/avatar.styles.d.ts +904 -0
- package/esm/avatar/avatar.styles.js +334 -0
- package/esm/avatar/index.d.ts +7 -0
- package/esm/avatar/index.js +22 -0
- package/esm/backdrop/backdrop.d.ts +37 -0
- package/esm/backdrop/backdrop.js +137 -0
- package/esm/backdrop/backdrop.styles.d.ts +2677 -0
- package/esm/backdrop/backdrop.styles.js +119 -0
- package/esm/backdrop/index.d.ts +5 -0
- package/esm/backdrop/index.js +16 -0
- package/esm/button/button-group-context.d.ts +20 -0
- package/esm/button/button-group-context.js +21 -0
- package/esm/button/button-group.d.ts +34 -0
- package/esm/button/button-group.js +81 -0
- package/esm/button/button-group.styles.d.ts +899 -0
- package/esm/button/button-group.styles.js +136 -0
- package/esm/button/button-icon.d.ts +909 -0
- package/esm/button/button-icon.js +68 -0
- package/esm/button/button.d.ts +30 -0
- package/esm/button/button.js +145 -0
- package/esm/button/button.styles.d.ts +907 -0
- package/esm/button/button.styles.js +695 -0
- package/esm/button/index.d.ts +10 -0
- package/esm/button/index.js +25 -0
- package/esm/button/utils.d.ts +4 -0
- package/esm/button/utils.js +27 -0
- package/esm/card/card.d.ts +23 -0
- package/esm/card/card.js +117 -0
- package/esm/card/card.styles.d.ts +3575 -0
- package/esm/card/card.styles.js +267 -0
- package/esm/card/index.d.ts +5 -0
- package/esm/card/index.js +24 -0
- package/esm/checkbox/checkbox-context.d.ts +13 -0
- package/esm/checkbox/checkbox-context.js +25 -0
- package/esm/checkbox/checkbox-group.d.ts +29 -0
- package/esm/checkbox/checkbox-group.js +89 -0
- package/esm/checkbox/checkbox.d.ts +58 -0
- package/esm/checkbox/checkbox.js +192 -0
- package/esm/checkbox/checkbox.styles.d.ts +8054 -0
- package/esm/checkbox/checkbox.styles.js +563 -0
- package/esm/checkbox/index.d.ts +6 -0
- package/esm/checkbox/index.js +26 -0
- package/esm/code/code.d.ts +15 -0
- package/esm/code/code.js +42 -0
- package/esm/code/code.styles.d.ts +1782 -0
- package/esm/code/code.styles.js +14 -0
- package/esm/code/index.d.ts +5 -0
- package/esm/code/index.js +15 -0
- package/esm/col/col.d.ts +20 -0
- package/esm/col/col.js +46 -0
- package/esm/col/col.styles.d.ts +893 -0
- package/esm/col/col.styles.js +16 -0
- package/esm/col/index.d.ts +5 -0
- package/esm/col/index.js +14 -0
- package/esm/collapse/collapse-context.d.ts +9 -0
- package/esm/collapse/collapse-context.js +20 -0
- package/esm/collapse/collapse-group.d.ts +18 -0
- package/esm/collapse/collapse-group.js +90 -0
- package/esm/collapse/collapse-icon.d.ts +19 -0
- package/esm/collapse/collapse-icon.js +41 -0
- package/esm/collapse/collapse.d.ts +41 -0
- package/esm/collapse/collapse.js +190 -0
- package/esm/collapse/collapse.styles.d.ts +4472 -0
- package/esm/collapse/collapse.styles.js +254 -0
- package/esm/collapse/index.d.ts +6 -0
- package/esm/collapse/index.js +22 -0
- package/esm/container/container.d.ts +40 -0
- package/esm/container/container.js +91 -0
- package/esm/container/container.styles.d.ts +896 -0
- package/esm/container/container.styles.js +45 -0
- package/esm/container/index.d.ts +5 -0
- package/esm/container/index.js +14 -0
- package/esm/css-baseline/css-baseline.d.ts +9 -0
- package/esm/css-baseline/css-baseline.js +247 -0
- package/esm/css-baseline/index.d.ts +1 -0
- package/esm/css-baseline/index.js +11 -0
- package/esm/divider/divider.d.ts +22 -0
- package/esm/divider/divider.js +82 -0
- package/esm/divider/divider.styles.d.ts +1787 -0
- package/esm/divider/divider.styles.js +77 -0
- package/esm/divider/index.d.ts +5 -0
- package/esm/divider/index.js +15 -0
- package/esm/grid/grid-container.d.ts +22 -0
- package/esm/grid/grid-container.js +60 -0
- package/esm/grid/grid-item.d.ts +37 -0
- package/esm/grid/grid-item.js +123 -0
- package/esm/grid/grid.d.ts +9 -0
- package/esm/grid/grid.js +29 -0
- package/esm/grid/grid.styles.d.ts +1783 -0
- package/esm/grid/grid.styles.js +15 -0
- package/esm/grid/index.d.ts +7 -0
- package/esm/grid/index.js +18 -0
- package/esm/image/image.d.ts +29 -0
- package/esm/image/image.js +150 -0
- package/esm/image/image.skeleton.d.ts +19 -0
- package/esm/image/image.skeleton.js +50 -0
- package/esm/image/image.styles.d.ts +2676 -0
- package/esm/image/image.styles.js +57 -0
- package/esm/image/index.d.ts +5 -0
- package/esm/image/index.js +16 -0
- package/esm/index.d.ts +79 -0
- package/esm/index.js +435 -0
- package/esm/input/index.d.ts +7 -0
- package/esm/input/index.js +30 -0
- package/esm/input/input-password.d.ts +98 -0
- package/esm/input/input-password.js +80 -0
- package/esm/input/input-props.d.ts +66 -0
- package/esm/input/input-props.js +30 -0
- package/esm/input/input.d.ts +18 -0
- package/esm/input/input.js +317 -0
- package/esm/input/input.styles.d.ts +9854 -0
- package/esm/input/input.styles.js +878 -0
- package/esm/input/password-icon.d.ts +6 -0
- package/esm/input/password-icon.js +51 -0
- package/esm/link/icon.d.ts +4 -0
- package/esm/link/icon.js +42 -0
- package/esm/link/index.d.ts +5 -0
- package/esm/link/index.js +15 -0
- package/esm/link/link.d.ts +43 -0
- package/esm/link/link.js +42 -0
- package/esm/link/link.styles.d.ts +1788 -0
- package/esm/link/link.styles.js +135 -0
- package/esm/loading/index.d.ts +7 -0
- package/esm/loading/index.js +24 -0
- package/esm/loading/loading.d.ts +24 -0
- package/esm/loading/loading.js +80 -0
- package/esm/loading/loading.styles.d.ts +5356 -0
- package/esm/loading/loading.styles.js +438 -0
- package/esm/loading/spinner.d.ts +17 -0
- package/esm/loading/spinner.js +47 -0
- package/esm/modal/index.d.ts +8 -0
- package/esm/modal/index.js +28 -0
- package/esm/modal/modal-body.d.ts +45 -0
- package/esm/modal/modal-body.js +62 -0
- package/esm/modal/modal-close-button.d.ts +13 -0
- package/esm/modal/modal-close-button.js +49 -0
- package/esm/modal/modal-context.d.ts +8 -0
- package/esm/modal/modal-context.js +18 -0
- package/esm/modal/modal-footer.d.ts +24 -0
- package/esm/modal/modal-footer.js +69 -0
- package/esm/modal/modal-header.d.ts +24 -0
- package/esm/modal/modal-header.js +69 -0
- package/esm/modal/modal-wrapper.d.ts +24 -0
- package/esm/modal/modal-wrapper.js +153 -0
- package/esm/modal/modal.d.ts +42 -0
- package/esm/modal/modal.js +159 -0
- package/esm/modal/modal.styles.d.ts +5362 -0
- package/esm/modal/modal.styles.js +243 -0
- package/esm/modal/use-modal.d.ts +11 -0
- package/esm/modal/use-modal.js +25 -0
- package/esm/pagination/index.d.ts +7 -0
- package/esm/pagination/index.js +19 -0
- package/esm/pagination/pagination-ellipsis.d.ts +11 -0
- package/esm/pagination/pagination-ellipsis.js +86 -0
- package/esm/pagination/pagination-highlight.d.ts +14 -0
- package/esm/pagination/pagination-highlight.js +52 -0
- package/esm/pagination/pagination-icon.d.ts +16 -0
- package/esm/pagination/pagination-icon.js +59 -0
- package/esm/pagination/pagination-item.d.ts +22 -0
- package/esm/pagination/pagination-item.js +104 -0
- package/esm/pagination/pagination.d.ts +46 -0
- package/esm/pagination/pagination.js +169 -0
- package/esm/pagination/pagination.styles.d.ts +5369 -0
- package/esm/pagination/pagination.styles.js +361 -0
- package/esm/progress/index.d.ts +5 -0
- package/esm/progress/index.js +15 -0
- package/esm/progress/progress.d.ts +65 -0
- package/esm/progress/progress.js +101 -0
- package/esm/progress/progress.styles.d.ts +1793 -0
- package/esm/progress/progress.styles.js +165 -0
- package/esm/radio/index.d.ts +4 -0
- package/esm/radio/index.js +24 -0
- package/esm/radio/radio-context.d.ts +13 -0
- package/esm/radio/radio-context.js +24 -0
- package/esm/radio/radio-group.d.ts +30 -0
- package/esm/radio/radio-group.js +78 -0
- package/esm/radio/radio.d.ts +45 -0
- package/esm/radio/radio.js +156 -0
- package/esm/radio/radio.styles.d.ts +5357 -0
- package/esm/radio/radio.styles.js +240 -0
- package/esm/row/index.d.ts +5 -0
- package/esm/row/index.js +14 -0
- package/esm/row/row.d.ts +21 -0
- package/esm/row/row.js +54 -0
- package/esm/row/row.styles.d.ts +895 -0
- package/esm/row/row.styles.js +25 -0
- package/esm/snippet/index.d.ts +5 -0
- package/esm/snippet/index.js +16 -0
- package/esm/snippet/snippet-icon.d.ts +21 -0
- package/esm/snippet/snippet-icon.js +52 -0
- package/esm/snippet/snippet.d.ts +35 -0
- package/esm/snippet/snippet.js +137 -0
- package/esm/snippet/snippet.styles.d.ts +3570 -0
- package/esm/snippet/snippet.styles.js +141 -0
- package/esm/spacer/index.d.ts +5 -0
- package/esm/spacer/index.js +14 -0
- package/esm/spacer/spacer.d.ts +41 -0
- package/esm/spacer/spacer.js +49 -0
- package/esm/spacer/spacer.styles.d.ts +894 -0
- package/esm/spacer/spacer.styles.js +24 -0
- package/esm/switch/index.d.ts +5 -0
- package/esm/switch/index.js +17 -0
- package/esm/switch/switch.d.ts +82 -0
- package/esm/switch/switch.js +142 -0
- package/esm/switch/switch.styles.d.ts +3576 -0
- package/esm/switch/switch.styles.js +283 -0
- package/esm/text/child.d.ts +21 -0
- package/esm/text/child.js +83 -0
- package/esm/text/index.d.ts +4 -0
- package/esm/text/index.js +14 -0
- package/esm/text/text.d.ts +59 -0
- package/esm/text/text.js +124 -0
- package/esm/text/text.styles.d.ts +894 -0
- package/esm/text/text.styles.js +41 -0
- package/esm/textarea/index.d.ts +3 -0
- package/esm/textarea/index.js +12 -0
- package/esm/textarea/textarea.d.ts +42 -0
- package/esm/textarea/textarea.js +126 -0
- package/esm/textarea/utils.d.ts +13 -0
- package/esm/textarea/utils.js +126 -0
- package/esm/theme/common.d.ts +1584 -0
- package/esm/theme/common.js +490 -0
- package/esm/theme/dark-theme.d.ts +33 -0
- package/esm/theme/dark-theme.js +38 -0
- package/esm/theme/index.js +31 -0
- package/esm/theme/light-theme.d.ts +28 -0
- package/esm/theme/light-theme.js +33 -0
- package/esm/theme/ssr-provider.d.ts +7 -0
- package/esm/theme/ssr-provider.js +51 -0
- package/esm/theme/stitches.config.d.ts +8700 -0
- package/esm/theme/stitches.config.js +88 -0
- package/esm/theme/theme-context.d.ts +5 -0
- package/esm/theme/theme-context.js +22 -0
- package/esm/theme/theme-provider.d.ts +14 -0
- package/esm/theme/theme-provider.js +115 -0
- package/esm/theme/types.d.ts +75 -0
- package/esm/theme/types.js +3 -0
- package/esm/theme/utils.d.ts +16 -0
- package/esm/theme/utils.js +113 -0
- package/esm/tooltip/index.d.ts +6 -0
- package/esm/tooltip/index.js +17 -0
- package/esm/tooltip/placement.d.ts +39 -0
- package/esm/tooltip/placement.js +193 -0
- package/esm/tooltip/tooltip-content.d.ts +27 -0
- package/esm/tooltip/tooltip-content.js +135 -0
- package/esm/tooltip/tooltip.d.ts +56 -0
- package/esm/tooltip/tooltip.js +141 -0
- package/esm/tooltip/tooltip.styles.d.ts +3571 -0
- package/esm/tooltip/tooltip.styles.js +159 -0
- package/esm/use-body-scroll/index.d.ts +3 -0
- package/esm/use-body-scroll/index.js +12 -0
- package/esm/use-body-scroll/use-body-scroll.d.ts +9 -0
- package/esm/use-body-scroll/use-body-scroll.js +77 -0
- package/esm/use-click-anywhere/index.d.ts +2 -0
- package/esm/use-click-anywhere/index.js +12 -0
- package/esm/use-click-anywhere/use-click-anywhere.d.ts +2 -0
- package/esm/use-click-anywhere/use-click-anywhere.js +19 -0
- package/esm/use-click-away/index.d.ts +2 -0
- package/esm/use-click-away/index.js +12 -0
- package/esm/use-click-away/use-click-away.d.ts +3 -0
- package/esm/use-click-away/use-click-away.js +23 -0
- package/esm/use-clipboard/index.d.ts +3 -0
- package/esm/use-clipboard/index.js +12 -0
- package/esm/use-clipboard/use-clipboard.d.ts +8 -0
- package/esm/use-clipboard/use-clipboard.js +57 -0
- package/esm/use-current-state/index.d.ts +2 -0
- package/esm/use-current-state/index.js +12 -0
- package/esm/use-current-state/use-current-state.d.ts +8 -0
- package/esm/use-current-state/use-current-state.js +28 -0
- package/esm/use-drip/index.d.ts +2 -0
- package/esm/use-drip/index.js +12 -0
- package/esm/use-drip/use-drip.d.ts +9 -0
- package/esm/use-drip/use-drip.js +38 -0
- package/esm/use-input/index.d.ts +2 -0
- package/esm/use-input/index.js +12 -0
- package/esm/use-input/use-input.d.ts +13 -0
- package/esm/use-input/use-input.js +32 -0
- package/esm/use-keyboard/codes.d.ts +92 -0
- package/esm/use-keyboard/codes.js +104 -0
- package/esm/use-keyboard/helper.d.ts +3 -0
- package/esm/use-keyboard/helper.js +35 -0
- package/esm/use-keyboard/index.d.ts +5 -0
- package/esm/use-keyboard/index.js +15 -0
- package/esm/use-keyboard/use-keyboard.d.ts +22 -0
- package/esm/use-keyboard/use-keyboard.js +76 -0
- package/esm/use-pagination/index.d.ts +20 -0
- package/esm/use-pagination/index.js +88 -0
- package/esm/use-portal/index.d.ts +2 -0
- package/esm/use-portal/index.js +12 -0
- package/esm/use-portal/use-portal.d.ts +2 -0
- package/esm/use-portal/use-portal.js +43 -0
- package/esm/use-real-shape/index.d.ts +2 -0
- package/esm/use-real-shape/index.js +12 -0
- package/esm/use-real-shape/use-real-shape.d.ts +9 -0
- package/esm/use-real-shape/use-real-shape.js +55 -0
- package/esm/use-resize/index.d.ts +2 -0
- package/esm/use-resize/index.js +12 -0
- package/esm/use-resize/use-resize.d.ts +2 -0
- package/esm/use-resize/use-resize.js +23 -0
- package/esm/use-ssr/index.d.ts +2 -0
- package/esm/use-ssr/index.js +12 -0
- package/esm/use-ssr/use-ssr.d.ts +6 -0
- package/esm/use-ssr/use-ssr.js +25 -0
- package/esm/use-theme/index.d.ts +2 -0
- package/esm/use-theme/index.js +12 -0
- package/esm/use-theme/use-theme.d.ts +3 -0
- package/esm/use-theme/use-theme.js +16 -0
- package/esm/use-warning/index.d.ts +2 -0
- package/esm/use-warning/index.js +12 -0
- package/esm/use-warning/use-warning.d.ts +2 -0
- package/esm/use-warning/use-warning.js +23 -0
- package/esm/user/index.d.ts +6 -0
- package/esm/user/index.js +21 -0
- package/esm/user/user-link.d.ts +32 -0
- package/esm/user/user-link.js +46 -0
- package/esm/user/user.d.ts +35 -0
- package/esm/user/user.js +63 -0
- package/esm/user/user.styles.d.ts +4456 -0
- package/esm/user/user.styles.js +56 -0
- package/esm/utils/assertion.d.ts +8 -0
- package/esm/utils/assertion.js +42 -0
- package/esm/utils/clear-icon.d.ts +16 -0
- package/esm/utils/clear-icon.js +70 -0
- package/esm/utils/clsx.d.ts +1 -0
- package/esm/utils/clsx.js +57 -0
- package/esm/utils/collections.d.ts +12 -0
- package/esm/utils/collections.js +110 -0
- package/esm/utils/color.d.ts +28 -0
- package/esm/utils/color.js +187 -0
- package/esm/utils/css-transition.d.ts +27 -0
- package/esm/utils/css-transition.js +76 -0
- package/esm/utils/deep-merge.d.ts +1 -0
- package/esm/utils/deep-merge.js +33 -0
- package/esm/utils/dimensions.d.ts +1 -0
- package/esm/utils/dimensions.js +10 -0
- package/esm/utils/dom.js +110 -0
- package/esm/utils/drip.d.ts +936 -0
- package/esm/utils/drip.js +116 -0
- package/esm/utils/expand.d.ts +20 -0
- package/esm/utils/expand.js +109 -0
- package/esm/utils/icons.js +481 -0
- package/esm/utils/numbers.d.ts +9 -0
- package/esm/utils/numbers.js +23 -0
- package/esm/utils/object.d.ts +11 -0
- package/esm/utils/object.js +40 -0
- package/esm/utils/prop-types.d.ts +54 -0
- package/esm/utils/prop-types.js +56 -0
- package/esm/utils/react.js +24 -0
- package/esm/utils/strings.js +18 -0
- package/esm/utils/types.d.js +3 -0
- package/esm/utils/with-defaults.d.ts +3 -0
- package/esm/utils/with-defaults.js +13 -0
- package/grid/package.json +6 -0
- package/image/package.json +6 -0
- package/input/package.json +6 -0
- package/link/package.json +6 -0
- package/loading/package.json +6 -0
- package/modal/package.json +6 -0
- package/package.json +16 -76
- package/pagination/package.json +6 -0
- package/progress/package.json +6 -0
- package/radio/package.json +6 -0
- package/row/package.json +6 -0
- package/snippet/package.json +6 -0
- package/spacer/package.json +6 -0
- package/switch/package.json +6 -0
- package/text/package.json +6 -0
- package/textarea/package.json +6 -0
- package/tooltip/package.json +6 -0
- package/umd/nextui.js +14059 -0
- package/umd/nextui.min.js +2 -0
- package/umd/nextui.min.js.LICENSE.txt +14 -0
- package/use-body-scroll/package.json +6 -0
- package/use-click-anywhere/package.json +6 -0
- package/use-click-away/package.json +6 -0
- package/use-clipboard/package.json +6 -0
- package/use-current-state/package.json +6 -0
- package/use-drip/package.json +6 -0
- package/use-input/package.json +6 -0
- package/use-keyboard/package.json +6 -0
- package/use-portal/package.json +6 -0
- package/use-real-shape/package.json +6 -0
- package/use-resize/package.json +6 -0
- package/use-ssr/package.json +6 -0
- package/use-theme/package.json +6 -0
- package/use-warning/package.json +6 -0
- package/user/package.json +6 -0
- package/utils/package.json +6 -0
- package/dist/components/avatar/avatar-group.d.ts +0 -17
- package/dist/components/avatar/avatar.d.ts +0 -33
- package/dist/components/avatar/index.d.ts +0 -2
- package/dist/components/button/button-group.d.ts +0 -56
- package/dist/components/button/button-icon.d.ts +0 -17
- package/dist/components/button/button-loading.d.ts +0 -18
- package/dist/components/button/button.d.ts +0 -51
- package/dist/components/button/button.drip.d.ts +0 -20
- package/dist/components/button/index.d.ts +0 -2
- package/dist/components/button/styles.d.ts +0 -40
- package/dist/components/card/card-content.d.ts +0 -13
- package/dist/components/card/card-footer.d.ts +0 -16
- package/dist/components/card/card.d.ts +0 -33
- package/dist/components/card/index.d.ts +0 -2
- package/dist/components/card/styles.d.ts +0 -12
- package/dist/components/checkbox/checkbox-group.d.ts +0 -31
- package/dist/components/checkbox/index.d.ts +0 -5
- package/dist/components/checkbox/styles.d.ts +0 -4
- package/dist/components/code/code.d.ts +0 -17
- package/dist/components/code/index.d.ts +0 -4
- package/dist/components/col/index.d.ts +0 -4
- package/dist/components/container/container.d.ts +0 -39
- package/dist/components/container/index.d.ts +0 -2
- package/dist/components/divider/divider.d.ts +0 -30
- package/dist/components/divider/index.d.ts +0 -2
- package/dist/components/grid/grid-container.d.ts +0 -18
- package/dist/components/grid/grid.d.ts +0 -16
- package/dist/components/grid/index.d.ts +0 -2
- package/dist/components/image/image-browser-https-icon.d.ts +0 -3
- package/dist/components/image/image-browser.d.ts +0 -31
- package/dist/components/image/image.skeleton.d.ts +0 -12
- package/dist/components/image/index.d.ts +0 -2
- package/dist/components/image/styles.d.ts +0 -9
- package/dist/components/index.d.ts +0 -20
- package/dist/components/link/index.d.ts +0 -4
- package/dist/components/link/link.d.ts +0 -39
- package/dist/components/loading/index.d.ts +0 -2
- package/dist/components/loading/spinner.d.ts +0 -16
- package/dist/components/loading/styles.d.ts +0 -18
- package/dist/components/radio/index.d.ts +0 -2
- package/dist/components/radio/radio-description.d.ts +0 -13
- package/dist/components/radio/radio-group.d.ts +0 -33
- package/dist/components/row/index.d.ts +0 -4
- package/dist/components/row/row.d.ts +0 -32
- package/dist/components/snippet/index.d.ts +0 -2
- package/dist/components/snippet/snippet.d.ts +0 -36
- package/dist/components/snippet/styles.d.ts +0 -8
- package/dist/components/spacer/index.d.ts +0 -4
- package/dist/components/spacer/spacer.d.ts +0 -27
- package/dist/components/switch/index.d.ts +0 -2
- package/dist/components/switch/styles.d.ts +0 -6
- package/dist/components/switch/switch.d.ts +0 -50
- package/dist/components/text/child.d.ts +0 -22
- package/dist/components/text/index.d.ts +0 -4
- package/dist/components/user/index.d.ts +0 -2
- package/dist/components/user/user-link.d.ts +0 -16
- package/dist/hooks/index.d.ts +0 -5
- package/dist/hooks/use-theme.d.ts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -1
- package/dist/index.min.js +0 -1
- package/dist/theme/common.d.ts +0 -63
- package/dist/theme/dark.d.ts +0 -8
- package/dist/theme/default.d.ts +0 -8
- package/dist/theme/index.d.ts +0 -2
- package/dist/theme/shared.d.ts +0 -4
- package/dist/theme/theme-context.d.ts +0 -4
- package/dist/theme/theme-provider.d.ts +0 -7
- package/dist/theme/types.d.ts +0 -94
- package/dist/theme/utils.d.ts +0 -7
- package/dist/utils/collections.d.ts +0 -4
- package/dist/utils/object.d.ts +0 -5
- package/dist/utils/prop-types.d.ts +0 -37
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _clearIcon = _interopRequireDefault(require("../utils/clear-icon"));
|
|
11
|
+
|
|
12
|
+
var _modal = require("./modal.styles");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
const ModalCloseButton = ({
|
|
17
|
+
onClick,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const clickHandler = event => {
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
24
|
+
onClick && onClick(event);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_modal.StyledModalCloseButton, {
|
|
28
|
+
type: "button",
|
|
29
|
+
onClick: clickHandler,
|
|
30
|
+
className: "nextui-modal-close-icon",
|
|
31
|
+
"aria-label": "Close",
|
|
32
|
+
...props,
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_clearIcon.default, {
|
|
34
|
+
plain: true,
|
|
35
|
+
size: 18,
|
|
36
|
+
className: "nextui-modal-close-icon-svg",
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
"aria-hidden": true
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
ModalCloseButton.toString = () => '.nextui-modal-close-icon';
|
|
44
|
+
|
|
45
|
+
const MemoModalCloseButton = /*#__PURE__*/_react.default.memo(ModalCloseButton);
|
|
46
|
+
|
|
47
|
+
var _default = MemoModalCloseButton;
|
|
48
|
+
exports.default = _default;
|
|
49
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.useModalContext = exports.ModalContext = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
const defaultContext = {};
|
|
11
|
+
|
|
12
|
+
const ModalContext = /*#__PURE__*/_react.default.createContext(defaultContext);
|
|
13
|
+
|
|
14
|
+
exports.ModalContext = ModalContext;
|
|
15
|
+
|
|
16
|
+
const useModalContext = () => _react.default.useContext(ModalContext);
|
|
17
|
+
|
|
18
|
+
exports.useModalContext = useModalContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Justify } from '../utils/prop-types';
|
|
3
|
+
import { CSS } from '../theme/stitches.config';
|
|
4
|
+
import { ModalFooterVariantsProps } from './modal.styles';
|
|
5
|
+
interface Props {
|
|
6
|
+
className?: string;
|
|
7
|
+
justify?: Justify;
|
|
8
|
+
autoMargin?: boolean;
|
|
9
|
+
css?: CSS;
|
|
10
|
+
as?: keyof JSX.IntrinsicElements;
|
|
11
|
+
}
|
|
12
|
+
declare const defaultProps: {
|
|
13
|
+
className: string;
|
|
14
|
+
justify: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
15
|
+
autoMargin: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
|
|
18
|
+
export declare type ModalFooterProps = Props & typeof defaultProps & NativeAttrs & ModalFooterVariantsProps;
|
|
19
|
+
declare const _default: React.ComponentType<Partial<{
|
|
20
|
+
className: string;
|
|
21
|
+
justify: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
22
|
+
autoMargin: boolean;
|
|
23
|
+
}> & Omit<ModalFooterProps, "justify" | "className" | "autoMargin">>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _withDefaults = _interopRequireDefault(require("../utils/with-defaults"));
|
|
11
|
+
|
|
12
|
+
var _modalContext = require("./modal-context");
|
|
13
|
+
|
|
14
|
+
var _modal = require("./modal.styles");
|
|
15
|
+
|
|
16
|
+
var _clsx = _interopRequireDefault(require("../utils/clsx"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
className: '',
|
|
26
|
+
justify: 'flex-end',
|
|
27
|
+
autoMargin: true
|
|
28
|
+
};
|
|
29
|
+
const preClass = 'nextui-modal-footer';
|
|
30
|
+
|
|
31
|
+
const ModalFooter = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
justify,
|
|
35
|
+
autoMargin: autoMarginProp,
|
|
36
|
+
css,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
autoMargin: autoMarginContext,
|
|
41
|
+
noPadding
|
|
42
|
+
} = (0, _react.useContext)(_modalContext.ModalContext);
|
|
43
|
+
const autoMargin = (0, _react.useMemo)(() => {
|
|
44
|
+
return autoMarginContext !== undefined ? autoMarginContext : autoMarginProp;
|
|
45
|
+
}, [autoMarginProp, autoMarginContext]);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_modal.StyledModalFooter, {
|
|
47
|
+
className: (0, _clsx.default)(preClass, {
|
|
48
|
+
[`${preClass}-auto-margin`]: autoMargin,
|
|
49
|
+
[`${preClass}-no-padding`]: noPadding
|
|
50
|
+
}, className),
|
|
51
|
+
noPadding: noPadding,
|
|
52
|
+
autoMargin: autoMargin,
|
|
53
|
+
css: {
|
|
54
|
+
justifyContent: justify,
|
|
55
|
+
...css
|
|
56
|
+
},
|
|
57
|
+
...props,
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
ModalFooter.toString = () => '.nextui-modal-footer';
|
|
63
|
+
|
|
64
|
+
const MemoModalFooter = /*#__PURE__*/_react.default.memo(ModalFooter);
|
|
65
|
+
|
|
66
|
+
var _default = (0, _withDefaults.default)(MemoModalFooter, defaultProps);
|
|
67
|
+
|
|
68
|
+
exports.default = _default;
|
|
69
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Justify } from '../utils/prop-types';
|
|
3
|
+
import { CSS } from '../theme/stitches.config';
|
|
4
|
+
import { ModalHeaderVariantsProps } from './modal.styles';
|
|
5
|
+
interface Props {
|
|
6
|
+
className?: string;
|
|
7
|
+
justify?: Justify;
|
|
8
|
+
autoMargin?: boolean;
|
|
9
|
+
css?: CSS;
|
|
10
|
+
as?: keyof JSX.IntrinsicElements;
|
|
11
|
+
}
|
|
12
|
+
declare const defaultProps: {
|
|
13
|
+
className: string;
|
|
14
|
+
justify: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
15
|
+
autoMargin: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare type NativeAttrs = Omit<React.HTMLAttributes<unknown>, keyof Props>;
|
|
18
|
+
export declare type ModalHeaderProps = Props & typeof defaultProps & NativeAttrs & ModalHeaderVariantsProps;
|
|
19
|
+
declare const _default: React.ComponentType<Partial<{
|
|
20
|
+
className: string;
|
|
21
|
+
justify: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly";
|
|
22
|
+
autoMargin: boolean;
|
|
23
|
+
}> & Omit<ModalHeaderProps, "justify" | "className" | "autoMargin">>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _withDefaults = _interopRequireDefault(require("../utils/with-defaults"));
|
|
11
|
+
|
|
12
|
+
var _modalContext = require("./modal-context");
|
|
13
|
+
|
|
14
|
+
var _modal = require("./modal.styles");
|
|
15
|
+
|
|
16
|
+
var _clsx = _interopRequireDefault(require("../utils/clsx"));
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
className: '',
|
|
26
|
+
justify: 'center',
|
|
27
|
+
autoMargin: true
|
|
28
|
+
};
|
|
29
|
+
const preClass = 'nextui-modal-header';
|
|
30
|
+
|
|
31
|
+
const ModalHeader = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
justify,
|
|
35
|
+
autoMargin: autoMarginProp,
|
|
36
|
+
css,
|
|
37
|
+
...props
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
autoMargin: autoMarginContext,
|
|
41
|
+
noPadding
|
|
42
|
+
} = (0, _react.useContext)(_modalContext.ModalContext);
|
|
43
|
+
const autoMargin = (0, _react.useMemo)(() => {
|
|
44
|
+
return autoMarginContext !== undefined ? autoMarginContext : autoMarginProp;
|
|
45
|
+
}, [autoMarginProp, autoMarginContext]);
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_modal.StyledModalHeader, {
|
|
47
|
+
className: (0, _clsx.default)(preClass, {
|
|
48
|
+
[`${preClass}-auto-margin`]: autoMargin,
|
|
49
|
+
[`${preClass}-no-padding`]: noPadding
|
|
50
|
+
}, className),
|
|
51
|
+
noPadding: noPadding,
|
|
52
|
+
autoMargin: autoMargin,
|
|
53
|
+
css: {
|
|
54
|
+
justifyContent: justify,
|
|
55
|
+
...css
|
|
56
|
+
},
|
|
57
|
+
...props,
|
|
58
|
+
children: children
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
ModalHeader.toString = () => '.nextui-modal-header';
|
|
63
|
+
|
|
64
|
+
const MemoModalHeader = /*#__PURE__*/_react.default.memo(ModalHeader);
|
|
65
|
+
|
|
66
|
+
var _default = (0, _withDefaults.default)(MemoModalHeader, defaultProps);
|
|
67
|
+
|
|
68
|
+
exports.default = _default;
|
|
69
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CSS } from '../theme/stitches.config';
|
|
3
|
+
import { ModalVariantsProps } from './modal.styles';
|
|
4
|
+
interface Props {
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
scroll?: boolean;
|
|
7
|
+
rebound?: boolean;
|
|
8
|
+
animated?: boolean;
|
|
9
|
+
fullScreen?: boolean;
|
|
10
|
+
closeButton?: boolean;
|
|
11
|
+
as?: keyof JSX.IntrinsicElements;
|
|
12
|
+
className?: string;
|
|
13
|
+
onCloseButtonClick?: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare type NativeAttrs = Omit<React.DialogHTMLAttributes<unknown>, keyof Props>;
|
|
16
|
+
export declare type ModalWrapperProps = Props & NativeAttrs & ModalVariantsProps & {
|
|
17
|
+
css?: CSS;
|
|
18
|
+
};
|
|
19
|
+
declare const _default: React.ComponentType<Partial<{
|
|
20
|
+
className: string;
|
|
21
|
+
visible: boolean;
|
|
22
|
+
rebound: boolean;
|
|
23
|
+
}> & Omit<React.PropsWithChildren<ModalWrapperProps>, "visible" | "className" | "rebound">>;
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _withDefaults = _interopRequireDefault(require("../utils/with-defaults"));
|
|
11
|
+
|
|
12
|
+
var _cssTransition = _interopRequireDefault(require("../utils/css-transition"));
|
|
13
|
+
|
|
14
|
+
var _collections = require("../utils/collections");
|
|
15
|
+
|
|
16
|
+
var _modalCloseButton = _interopRequireDefault(require("./modal-close-button"));
|
|
17
|
+
|
|
18
|
+
var _useKeyboard = require("../use-keyboard");
|
|
19
|
+
|
|
20
|
+
var _useTheme = _interopRequireDefault(require("../use-theme"));
|
|
21
|
+
|
|
22
|
+
var _modal = require("./modal.styles");
|
|
23
|
+
|
|
24
|
+
var _clsx = _interopRequireDefault(require("../utils/clsx"));
|
|
25
|
+
|
|
26
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
const defaultProps = {
|
|
33
|
+
className: '',
|
|
34
|
+
visible: false,
|
|
35
|
+
rebound: false
|
|
36
|
+
};
|
|
37
|
+
const preClass = 'nextui-modal';
|
|
38
|
+
|
|
39
|
+
const ModalWrapper = ({
|
|
40
|
+
className,
|
|
41
|
+
children,
|
|
42
|
+
visible,
|
|
43
|
+
fullScreen,
|
|
44
|
+
closeButton,
|
|
45
|
+
rebound,
|
|
46
|
+
animated,
|
|
47
|
+
onCloseButtonClick,
|
|
48
|
+
scroll,
|
|
49
|
+
...props
|
|
50
|
+
}) => {
|
|
51
|
+
const modalContent = (0, _react.useRef)(null);
|
|
52
|
+
const tabStart = (0, _react.useRef)(null);
|
|
53
|
+
const tabEnd = (0, _react.useRef)(null);
|
|
54
|
+
const [rendered, setRendered] = (0, _react.useState)(false);
|
|
55
|
+
const {
|
|
56
|
+
isDark
|
|
57
|
+
} = (0, _useTheme.default)();
|
|
58
|
+
(0, _react.useEffect)(() => {
|
|
59
|
+
const timer = setTimeout(() => {
|
|
60
|
+
setRendered(true);
|
|
61
|
+
clearTimeout(timer);
|
|
62
|
+
}, 300);
|
|
63
|
+
return () => clearTimeout(timer);
|
|
64
|
+
}, []);
|
|
65
|
+
(0, _react.useEffect)(() => {
|
|
66
|
+
if (!visible) return;
|
|
67
|
+
const activeElement = document.activeElement;
|
|
68
|
+
const isChild = (0, _collections.isChildElement)(modalContent.current, activeElement);
|
|
69
|
+
if (isChild) return;
|
|
70
|
+
tabStart.current && tabStart.current.focus();
|
|
71
|
+
}, [visible]);
|
|
72
|
+
|
|
73
|
+
const onKeyDown = event => {
|
|
74
|
+
const isTabDown = event.keyCode === _useKeyboard.KeyCode.Tab;
|
|
75
|
+
if (!visible || !isTabDown) return;
|
|
76
|
+
const activeElement = document.activeElement;
|
|
77
|
+
|
|
78
|
+
if (event.shiftKey) {
|
|
79
|
+
if (activeElement === tabStart.current) {
|
|
80
|
+
tabEnd.current && tabEnd.current.focus();
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
if (activeElement === tabEnd.current) {
|
|
84
|
+
tabStart.current && tabStart.current.focus();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleClose = () => {
|
|
90
|
+
onCloseButtonClick && onCloseButtonClick();
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const getState = (0, _react.useMemo)(() => {
|
|
94
|
+
return visible ? 'open' : 'closed';
|
|
95
|
+
}, [visible]);
|
|
96
|
+
const renderChildren = (0, _react.useMemo)(() => {
|
|
97
|
+
return (
|
|
98
|
+
/*#__PURE__*/
|
|
99
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
100
|
+
(0, _jsxRuntime.jsxs)(_modal.StyledModal, {
|
|
101
|
+
role: "dialog",
|
|
102
|
+
tabIndex: -1,
|
|
103
|
+
"aria-modal": visible,
|
|
104
|
+
ref: modalContent,
|
|
105
|
+
"data-state": getState,
|
|
106
|
+
fullScreen: fullScreen,
|
|
107
|
+
scroll: scroll,
|
|
108
|
+
closeButton: closeButton,
|
|
109
|
+
isDark: isDark,
|
|
110
|
+
className: (0, _clsx.default)(preClass, `${preClass}--${getState}`, {
|
|
111
|
+
[`${preClass}-fullscreen`]: fullScreen,
|
|
112
|
+
[`${preClass}-with-close-button`]: closeButton,
|
|
113
|
+
[`${preClass}-rebound`]: rebound,
|
|
114
|
+
[`${preClass}-rendered`]: rendered
|
|
115
|
+
}, className),
|
|
116
|
+
...props,
|
|
117
|
+
onKeyDown: onKeyDown,
|
|
118
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_modal.StyledModalHideTab, {
|
|
119
|
+
role: "button",
|
|
120
|
+
tabIndex: 0,
|
|
121
|
+
className: `${preClass}-hide-tab`,
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
ref: tabStart
|
|
124
|
+
}), closeButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_modalCloseButton.default, {
|
|
125
|
+
onClick: handleClose
|
|
126
|
+
}), children, /*#__PURE__*/(0, _jsxRuntime.jsx)(_modal.StyledModalHideTab, {
|
|
127
|
+
role: "button",
|
|
128
|
+
tabIndex: 0,
|
|
129
|
+
className: `${preClass}-hide-tab`,
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
ref: tabEnd
|
|
132
|
+
})]
|
|
133
|
+
})
|
|
134
|
+
);
|
|
135
|
+
}, [rebound, children]);
|
|
136
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
137
|
+
children: animated ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_cssTransition.default, {
|
|
138
|
+
name: `${preClass}-wrapper`,
|
|
139
|
+
visible: visible,
|
|
140
|
+
enterTime: 20,
|
|
141
|
+
leaveTime: 20,
|
|
142
|
+
clearTime: 300,
|
|
143
|
+
children: renderChildren
|
|
144
|
+
}) : visible ? renderChildren : null
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
ModalWrapper.toString = () => '.nextui-modal-wrapper';
|
|
149
|
+
|
|
150
|
+
var _default = (0, _withDefaults.default)(ModalWrapper, defaultProps);
|
|
151
|
+
|
|
152
|
+
exports.default = _default;
|
|
153
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ModalBody from './modal-body';
|
|
3
|
+
import ModalHeader from './modal-header';
|
|
4
|
+
import ModalFooter from './modal-footer';
|
|
5
|
+
import { ModalWrapperProps } from './modal-wrapper';
|
|
6
|
+
interface Props {
|
|
7
|
+
open?: boolean;
|
|
8
|
+
scroll?: boolean;
|
|
9
|
+
blur?: boolean;
|
|
10
|
+
noPadding?: boolean;
|
|
11
|
+
closeButton?: boolean;
|
|
12
|
+
animated?: boolean;
|
|
13
|
+
fullScreen?: boolean;
|
|
14
|
+
autoMargin?: boolean;
|
|
15
|
+
width?: string;
|
|
16
|
+
preventClose?: boolean;
|
|
17
|
+
onOpen?: () => void;
|
|
18
|
+
onClose?: () => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
as?: keyof JSX.IntrinsicElements;
|
|
21
|
+
}
|
|
22
|
+
declare const defaultProps: {
|
|
23
|
+
width: string;
|
|
24
|
+
className: string;
|
|
25
|
+
preventClose: boolean;
|
|
26
|
+
fullScreen: boolean;
|
|
27
|
+
closeButton: boolean;
|
|
28
|
+
animated: boolean;
|
|
29
|
+
blur: boolean;
|
|
30
|
+
scroll: boolean;
|
|
31
|
+
noPadding: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare type NativeAttrs = Omit<React.DialogHTMLAttributes<unknown>, keyof Props>;
|
|
34
|
+
export declare type ModalProps = Props & typeof defaultProps & NativeAttrs & ModalWrapperProps;
|
|
35
|
+
declare type ModalComponent<P = {}> = React.FC<P> & {
|
|
36
|
+
Header: typeof ModalHeader;
|
|
37
|
+
Body: typeof ModalBody;
|
|
38
|
+
Footer: typeof ModalFooter;
|
|
39
|
+
};
|
|
40
|
+
declare type ComponentProps = Partial<typeof defaultProps> & Omit<Props, keyof typeof defaultProps> & NativeAttrs;
|
|
41
|
+
declare const _default: ModalComponent<ComponentProps>;
|
|
42
|
+
export default _default;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactDom = require("react-dom");
|
|
11
|
+
|
|
12
|
+
var _usePortal = _interopRequireDefault(require("../use-portal"));
|
|
13
|
+
|
|
14
|
+
var _modalWrapper = _interopRequireDefault(require("./modal-wrapper"));
|
|
15
|
+
|
|
16
|
+
var _backdrop = _interopRequireDefault(require("../backdrop"));
|
|
17
|
+
|
|
18
|
+
var _modalContext = require("./modal-context");
|
|
19
|
+
|
|
20
|
+
var _useBodyScroll = _interopRequireDefault(require("../use-body-scroll"));
|
|
21
|
+
|
|
22
|
+
var _useCurrentState = _interopRequireDefault(require("../use-current-state"));
|
|
23
|
+
|
|
24
|
+
var _useKeyboard = _interopRequireWildcard(require("../use-keyboard"));
|
|
25
|
+
|
|
26
|
+
var _assertion = require("../utils/assertion");
|
|
27
|
+
|
|
28
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
29
|
+
|
|
30
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
|
+
|
|
32
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
+
|
|
34
|
+
const defaultProps = {
|
|
35
|
+
width: '400px',
|
|
36
|
+
className: '',
|
|
37
|
+
preventClose: false,
|
|
38
|
+
fullScreen: false,
|
|
39
|
+
closeButton: false,
|
|
40
|
+
animated: true,
|
|
41
|
+
blur: false,
|
|
42
|
+
scroll: false,
|
|
43
|
+
noPadding: false
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const Modal = ({
|
|
47
|
+
children,
|
|
48
|
+
onClose,
|
|
49
|
+
onOpen,
|
|
50
|
+
open,
|
|
51
|
+
autoMargin,
|
|
52
|
+
width: wrapperWidth,
|
|
53
|
+
className,
|
|
54
|
+
preventClose,
|
|
55
|
+
blur,
|
|
56
|
+
animated,
|
|
57
|
+
fullScreen,
|
|
58
|
+
noPadding,
|
|
59
|
+
...props
|
|
60
|
+
}) => {
|
|
61
|
+
const portal = (0, _usePortal.default)('modal');
|
|
62
|
+
const [, setBodyHidden] = (0, _useBodyScroll.default)(null, {
|
|
63
|
+
scrollLayer: true
|
|
64
|
+
});
|
|
65
|
+
const [visible, setVisible, visibleRef] = (0, _useCurrentState.default)(false);
|
|
66
|
+
const [rebound, setRebound] = (0, _react.useState)(false);
|
|
67
|
+
|
|
68
|
+
const closeModal = () => {
|
|
69
|
+
onClose && onClose();
|
|
70
|
+
setVisible(false);
|
|
71
|
+
setBodyHidden(false);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
(0, _react.useEffect)(() => {
|
|
75
|
+
if (open === undefined) return;
|
|
76
|
+
|
|
77
|
+
if (open) {
|
|
78
|
+
onOpen && onOpen();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!open && visibleRef.current) {
|
|
82
|
+
onClose && onClose();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setVisible(open);
|
|
86
|
+
setBodyHidden(open);
|
|
87
|
+
}, [open]);
|
|
88
|
+
|
|
89
|
+
const toggleRebound = () => {
|
|
90
|
+
setRebound(true);
|
|
91
|
+
const timer = setTimeout(() => {
|
|
92
|
+
setRebound(false);
|
|
93
|
+
clearTimeout(timer);
|
|
94
|
+
}, 300);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const {
|
|
98
|
+
bindings
|
|
99
|
+
} = (0, _useKeyboard.default)(() => {
|
|
100
|
+
if (preventClose) {
|
|
101
|
+
toggleRebound();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
closeModal();
|
|
106
|
+
}, _useKeyboard.KeyCode.Escape, {
|
|
107
|
+
disableGlobalEvent: true,
|
|
108
|
+
preventDefault: true
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const closeFromBackdrop = () => {
|
|
112
|
+
if (preventClose) {
|
|
113
|
+
toggleRebound();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
closeModal();
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const modalConfig = (0, _react.useMemo)(() => ({
|
|
121
|
+
close: closeModal,
|
|
122
|
+
autoMargin,
|
|
123
|
+
noPadding
|
|
124
|
+
}), []);
|
|
125
|
+
if (!portal) return null;
|
|
126
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_modalContext.ModalContext.Provider, {
|
|
127
|
+
value: modalConfig,
|
|
128
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_backdrop.default, {
|
|
129
|
+
onClick: closeFromBackdrop,
|
|
130
|
+
visible: visible,
|
|
131
|
+
maxWidth: wrapperWidth,
|
|
132
|
+
fullScreen: fullScreen,
|
|
133
|
+
blur: blur,
|
|
134
|
+
animated: animated,
|
|
135
|
+
...bindings,
|
|
136
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_modalWrapper.default, {
|
|
137
|
+
visible: visible,
|
|
138
|
+
onCloseButtonClick: closeModal,
|
|
139
|
+
className: className,
|
|
140
|
+
fullScreen: fullScreen,
|
|
141
|
+
rebound: rebound,
|
|
142
|
+
animated: animated,
|
|
143
|
+
...props,
|
|
144
|
+
children: children
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}), portal);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
if (_assertion.__DEV__) {
|
|
151
|
+
_backdrop.default.displayName = 'NextUI - Modal';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Modal.toString = () => '.nextui-modal';
|
|
155
|
+
|
|
156
|
+
Modal.defaultProps = defaultProps;
|
|
157
|
+
var _default = Modal;
|
|
158
|
+
exports.default = _default;
|
|
159
|
+
module.exports = exports.default;
|