@nextui-org/react 1.0.2-alpha.2 → 1.0.2-beta.4
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 +10 -5
- package/cjs/avatar/avatar-group.js +1 -35
- package/cjs/avatar/avatar-group.styles.js +1 -52
- package/cjs/avatar/avatar.js +1 -75
- package/cjs/avatar/avatar.styles.js +1 -334
- package/cjs/avatar/index.js +1 -22
- package/cjs/backdrop/backdrop.js +1 -137
- package/cjs/backdrop/backdrop.styles.js +1 -119
- package/cjs/backdrop/index.js +1 -16
- package/cjs/button/button-group-context.js +1 -21
- package/cjs/button/button-group.js +1 -81
- package/cjs/button/button-group.styles.js +1 -136
- package/cjs/button/button-icon.js +1 -68
- package/cjs/button/button.js +1 -145
- package/cjs/button/button.styles.js +1 -695
- package/cjs/button/index.js +1 -25
- package/cjs/button/utils.js +1 -27
- package/cjs/card/card.js +1 -117
- package/cjs/card/card.styles.js +1 -267
- package/cjs/card/index.js +1 -24
- package/cjs/checkbox/checkbox-context.js +1 -25
- package/cjs/checkbox/checkbox-group.js +1 -89
- package/cjs/checkbox/checkbox.js +1 -192
- package/cjs/checkbox/checkbox.styles.js +1 -563
- package/cjs/checkbox/index.js +1 -26
- package/cjs/code/code.js +1 -42
- package/cjs/code/code.styles.js +1 -14
- package/cjs/code/index.js +1 -15
- package/cjs/col/col.js +1 -46
- package/cjs/col/col.styles.js +1 -16
- package/cjs/col/index.js +1 -14
- package/cjs/collapse/collapse-context.js +1 -20
- package/cjs/collapse/collapse-group.js +1 -90
- package/cjs/collapse/collapse-icon.js +1 -41
- package/cjs/collapse/collapse.js +1 -190
- package/cjs/collapse/collapse.styles.js +1 -254
- package/cjs/collapse/index.js +1 -22
- package/cjs/container/container.js +1 -91
- package/cjs/container/container.styles.js +1 -45
- package/cjs/container/index.js +1 -14
- package/cjs/css-baseline/css-baseline.js +1 -247
- package/cjs/css-baseline/index.js +1 -11
- package/cjs/divider/divider.js +1 -82
- package/cjs/divider/divider.styles.js +1 -77
- package/cjs/divider/index.js +1 -15
- package/cjs/grid/grid-container.js +1 -60
- package/cjs/grid/grid-item.js +1 -123
- package/cjs/grid/grid.js +1 -29
- package/cjs/grid/grid.styles.js +1 -15
- package/cjs/grid/index.js +1 -18
- package/cjs/image/image.js +1 -150
- package/cjs/image/image.skeleton.js +1 -50
- package/cjs/image/image.styles.js +1 -57
- package/cjs/image/index.js +1 -16
- package/cjs/index.js +1 -435
- package/cjs/input/index.js +1 -30
- package/cjs/input/input-password.js +1 -80
- package/cjs/input/input-props.js +1 -30
- package/cjs/input/input.js +1 -317
- package/cjs/input/input.styles.js +1 -878
- package/cjs/input/password-icon.js +1 -51
- package/cjs/link/icon.js +1 -42
- package/cjs/link/index.js +1 -15
- package/cjs/link/link.js +1 -42
- package/cjs/link/link.styles.js +1 -135
- package/cjs/loading/index.js +1 -24
- package/cjs/loading/loading.js +1 -80
- package/cjs/loading/loading.styles.js +1 -438
- package/cjs/loading/spinner.js +1 -47
- package/cjs/modal/index.js +1 -28
- package/cjs/modal/modal-body.js +1 -62
- package/cjs/modal/modal-close-button.js +1 -49
- package/cjs/modal/modal-context.js +1 -18
- package/cjs/modal/modal-footer.js +1 -69
- package/cjs/modal/modal-header.js +1 -69
- package/cjs/modal/modal-wrapper.js +1 -153
- package/cjs/modal/modal.js +1 -159
- package/cjs/modal/modal.styles.js +1 -243
- package/cjs/modal/use-modal.js +1 -25
- package/cjs/pagination/index.js +1 -19
- package/cjs/pagination/pagination-ellipsis.js +1 -86
- package/cjs/pagination/pagination-highlight.js +1 -52
- package/cjs/pagination/pagination-icon.js +1 -59
- package/cjs/pagination/pagination-item.js +1 -104
- package/cjs/pagination/pagination.js +1 -169
- package/cjs/pagination/pagination.styles.js +1 -361
- package/cjs/progress/index.js +1 -15
- package/cjs/progress/progress.js +1 -101
- package/cjs/progress/progress.styles.js +1 -165
- package/cjs/radio/index.js +1 -24
- package/cjs/radio/radio-context.js +1 -24
- package/cjs/radio/radio-group.js +1 -78
- package/cjs/radio/radio.js +1 -156
- package/cjs/radio/radio.styles.js +1 -240
- package/cjs/row/index.js +1 -14
- package/cjs/row/row.js +1 -54
- package/cjs/row/row.styles.js +1 -25
- package/cjs/snippet/index.js +1 -16
- package/cjs/snippet/snippet-icon.js +1 -52
- package/cjs/snippet/snippet.js +1 -137
- package/cjs/snippet/snippet.styles.js +1 -141
- package/cjs/spacer/index.js +1 -14
- package/cjs/spacer/spacer.js +1 -49
- package/cjs/spacer/spacer.styles.js +1 -24
- package/cjs/switch/index.js +1 -17
- package/cjs/switch/switch.js +1 -142
- package/cjs/switch/switch.styles.js +1 -283
- package/cjs/text/child.js +1 -83
- package/cjs/text/index.js +1 -14
- package/cjs/text/text.js +1 -124
- package/cjs/text/text.styles.js +1 -41
- package/cjs/textarea/index.js +1 -12
- package/cjs/textarea/textarea.js +1 -126
- package/cjs/textarea/utils.js +1 -126
- package/cjs/theme/common.js +1 -490
- package/cjs/theme/dark-theme.js +1 -38
- package/cjs/theme/index.js +1 -31
- package/cjs/theme/light-theme.js +1 -33
- package/cjs/theme/stitches.config.js +1 -88
- package/cjs/theme/theme-context.js +1 -22
- package/cjs/theme/theme-provider.js +1 -115
- package/cjs/theme/types.js +1 -3
- package/cjs/theme/utils.js +1 -113
- package/cjs/tooltip/index.js +1 -17
- package/cjs/tooltip/placement.js +1 -193
- package/cjs/tooltip/tooltip-content.js +1 -135
- package/cjs/tooltip/tooltip.js +1 -141
- package/cjs/tooltip/tooltip.styles.js +1 -159
- package/cjs/use-body-scroll/index.js +1 -12
- package/cjs/use-body-scroll/use-body-scroll.js +1 -77
- package/cjs/use-click-anywhere/index.js +1 -12
- package/cjs/use-click-anywhere/use-click-anywhere.js +1 -19
- package/cjs/use-click-away/index.js +1 -12
- package/cjs/use-click-away/use-click-away.js +1 -23
- package/cjs/use-clipboard/index.js +1 -12
- package/cjs/use-clipboard/use-clipboard.js +1 -57
- package/cjs/use-current-state/index.js +1 -12
- package/cjs/use-current-state/use-current-state.js +1 -28
- package/cjs/use-drip/index.js +1 -12
- package/cjs/use-drip/use-drip.js +1 -38
- package/cjs/use-input/index.js +1 -12
- package/cjs/use-input/use-input.js +1 -32
- package/cjs/use-keyboard/codes.js +1 -104
- package/cjs/use-keyboard/helper.js +1 -35
- package/cjs/use-keyboard/index.js +1 -15
- package/cjs/use-keyboard/use-keyboard.js +1 -76
- package/cjs/use-pagination/index.js +1 -88
- package/cjs/use-portal/index.js +1 -12
- package/cjs/use-portal/use-portal.js +1 -43
- package/cjs/use-real-shape/index.js +1 -12
- package/cjs/use-real-shape/use-real-shape.js +1 -55
- package/cjs/use-resize/index.js +1 -12
- package/cjs/use-resize/use-resize.js +1 -23
- package/cjs/use-ssr/index.js +1 -12
- package/cjs/use-ssr/use-ssr.js +1 -25
- package/cjs/use-theme/index.js +1 -12
- package/cjs/use-theme/use-theme.js +1 -16
- package/cjs/use-warning/index.js +1 -12
- package/cjs/use-warning/use-warning.js +1 -23
- package/cjs/user/index.js +1 -21
- package/cjs/user/user-link.js +1 -46
- package/cjs/user/user.js +1 -63
- package/cjs/user/user.styles.js +1 -56
- package/cjs/utils/assertion.js +1 -42
- package/cjs/utils/clear-icon.js +1 -70
- package/cjs/utils/clsx.js +1 -57
- package/cjs/utils/collections.js +1 -110
- package/cjs/utils/color.js +1 -187
- package/cjs/utils/css-transition.js +1 -76
- package/cjs/utils/deep-merge.js +1 -33
- package/cjs/utils/dimensions.js +1 -10
- package/cjs/utils/dom.js +1 -110
- package/cjs/utils/drip.js +1 -116
- package/cjs/utils/expand.js +1 -109
- package/cjs/utils/icons.js +1 -481
- package/cjs/utils/numbers.js +1 -23
- package/cjs/utils/object.js +1 -40
- package/cjs/utils/prop-types.js +1 -56
- package/cjs/utils/react.js +1 -24
- package/cjs/utils/strings.js +1 -18
- package/cjs/utils/types.d.js +1 -3
- package/cjs/utils/with-defaults.js +1 -13
- package/esm/avatar/avatar-group.js +1 -35
- package/esm/avatar/avatar-group.styles.js +1 -52
- package/esm/avatar/avatar.js +1 -75
- package/esm/avatar/avatar.styles.js +1 -334
- package/esm/avatar/index.js +1 -22
- package/esm/backdrop/backdrop.js +1 -137
- package/esm/backdrop/backdrop.styles.js +1 -119
- package/esm/backdrop/index.js +1 -16
- package/esm/button/button-group-context.js +1 -21
- package/esm/button/button-group.js +1 -81
- package/esm/button/button-group.styles.js +1 -136
- package/esm/button/button-icon.js +1 -68
- package/esm/button/button.js +1 -145
- package/esm/button/button.styles.js +1 -695
- package/esm/button/index.js +1 -25
- package/esm/button/utils.js +1 -27
- package/esm/card/card.js +1 -117
- package/esm/card/card.styles.js +1 -267
- package/esm/card/index.js +1 -24
- package/esm/checkbox/checkbox-context.js +1 -25
- package/esm/checkbox/checkbox-group.js +1 -89
- package/esm/checkbox/checkbox.js +1 -192
- package/esm/checkbox/checkbox.styles.js +1 -563
- package/esm/checkbox/index.js +1 -26
- package/esm/code/code.js +1 -42
- package/esm/code/code.styles.js +1 -14
- package/esm/code/index.js +1 -15
- package/esm/col/col.js +1 -46
- package/esm/col/col.styles.js +1 -16
- package/esm/col/index.js +1 -14
- package/esm/collapse/collapse-context.js +1 -20
- package/esm/collapse/collapse-group.js +1 -90
- package/esm/collapse/collapse-icon.js +1 -41
- package/esm/collapse/collapse.js +1 -190
- package/esm/collapse/collapse.styles.js +1 -254
- package/esm/collapse/index.js +1 -22
- package/esm/container/container.js +1 -91
- package/esm/container/container.styles.js +1 -45
- package/esm/container/index.js +1 -14
- package/esm/css-baseline/css-baseline.js +1 -247
- package/esm/css-baseline/index.js +1 -11
- package/esm/divider/divider.js +1 -82
- package/esm/divider/divider.styles.js +1 -77
- package/esm/divider/index.js +1 -15
- package/esm/grid/grid-container.js +1 -60
- package/esm/grid/grid-item.js +1 -123
- package/esm/grid/grid.js +1 -29
- package/esm/grid/grid.styles.js +1 -15
- package/esm/grid/index.js +1 -18
- package/esm/image/image.js +1 -150
- package/esm/image/image.skeleton.js +1 -50
- package/esm/image/image.styles.js +1 -57
- package/esm/image/index.js +1 -16
- package/esm/index.js +1 -435
- package/esm/input/index.js +1 -30
- package/esm/input/input-password.js +1 -80
- package/esm/input/input-props.js +1 -30
- package/esm/input/input.js +1 -317
- package/esm/input/input.styles.js +1 -878
- package/esm/input/password-icon.js +1 -51
- package/esm/link/icon.js +1 -42
- package/esm/link/index.js +1 -15
- package/esm/link/link.js +1 -42
- package/esm/link/link.styles.js +1 -135
- package/esm/loading/index.js +1 -24
- package/esm/loading/loading.js +1 -80
- package/esm/loading/loading.styles.js +1 -438
- package/esm/loading/spinner.js +1 -47
- package/esm/modal/index.js +1 -28
- package/esm/modal/modal-body.js +1 -62
- package/esm/modal/modal-close-button.js +1 -49
- package/esm/modal/modal-context.js +1 -18
- package/esm/modal/modal-footer.js +1 -69
- package/esm/modal/modal-header.js +1 -69
- package/esm/modal/modal-wrapper.js +1 -153
- package/esm/modal/modal.js +1 -159
- package/esm/modal/modal.styles.js +1 -243
- package/esm/modal/use-modal.js +1 -25
- package/esm/pagination/index.js +1 -19
- package/esm/pagination/pagination-ellipsis.js +1 -86
- package/esm/pagination/pagination-highlight.js +1 -52
- package/esm/pagination/pagination-icon.js +1 -59
- package/esm/pagination/pagination-item.js +1 -104
- package/esm/pagination/pagination.js +1 -169
- package/esm/pagination/pagination.styles.js +1 -361
- package/esm/progress/index.js +1 -15
- package/esm/progress/progress.js +1 -101
- package/esm/progress/progress.styles.js +1 -165
- package/esm/radio/index.js +1 -24
- package/esm/radio/radio-context.js +1 -24
- package/esm/radio/radio-group.js +1 -78
- package/esm/radio/radio.js +1 -156
- package/esm/radio/radio.styles.js +1 -240
- package/esm/row/index.js +1 -14
- package/esm/row/row.js +1 -54
- package/esm/row/row.styles.js +1 -25
- package/esm/snippet/index.js +1 -16
- package/esm/snippet/snippet-icon.js +1 -52
- package/esm/snippet/snippet.js +1 -137
- package/esm/snippet/snippet.styles.js +1 -141
- package/esm/spacer/index.js +1 -14
- package/esm/spacer/spacer.js +1 -49
- package/esm/spacer/spacer.styles.js +1 -24
- package/esm/switch/index.js +1 -17
- package/esm/switch/switch.js +1 -142
- package/esm/switch/switch.styles.js +1 -283
- package/esm/text/child.js +1 -83
- package/esm/text/index.js +1 -14
- package/esm/text/text.js +1 -124
- package/esm/text/text.styles.js +1 -41
- package/esm/textarea/index.js +1 -12
- package/esm/textarea/textarea.js +1 -126
- package/esm/textarea/utils.js +1 -126
- package/esm/theme/common.js +1 -490
- package/esm/theme/dark-theme.js +1 -38
- package/esm/theme/index.js +1 -31
- package/esm/theme/light-theme.js +1 -33
- package/esm/theme/stitches.config.js +1 -88
- package/esm/theme/theme-context.js +1 -22
- package/esm/theme/theme-provider.js +1 -115
- package/esm/theme/types.js +1 -3
- package/esm/theme/utils.js +1 -113
- package/esm/tooltip/index.js +1 -17
- package/esm/tooltip/placement.js +1 -193
- package/esm/tooltip/tooltip-content.js +1 -135
- package/esm/tooltip/tooltip.js +1 -141
- package/esm/tooltip/tooltip.styles.js +1 -159
- package/esm/use-body-scroll/index.js +1 -12
- package/esm/use-body-scroll/use-body-scroll.js +1 -77
- package/esm/use-click-anywhere/index.js +1 -12
- package/esm/use-click-anywhere/use-click-anywhere.js +1 -19
- package/esm/use-click-away/index.js +1 -12
- package/esm/use-click-away/use-click-away.js +1 -23
- package/esm/use-clipboard/index.js +1 -12
- package/esm/use-clipboard/use-clipboard.js +1 -57
- package/esm/use-current-state/index.js +1 -12
- package/esm/use-current-state/use-current-state.js +1 -28
- package/esm/use-drip/index.js +1 -12
- package/esm/use-drip/use-drip.js +1 -38
- package/esm/use-input/index.js +1 -12
- package/esm/use-input/use-input.js +1 -32
- package/esm/use-keyboard/codes.js +1 -104
- package/esm/use-keyboard/helper.js +1 -35
- package/esm/use-keyboard/index.js +1 -15
- package/esm/use-keyboard/use-keyboard.js +1 -76
- package/esm/use-pagination/index.js +1 -88
- package/esm/use-portal/index.js +1 -12
- package/esm/use-portal/use-portal.js +1 -43
- package/esm/use-real-shape/index.js +1 -12
- package/esm/use-real-shape/use-real-shape.js +1 -55
- package/esm/use-resize/index.js +1 -12
- package/esm/use-resize/use-resize.js +1 -23
- package/esm/use-ssr/index.js +1 -12
- package/esm/use-ssr/use-ssr.js +1 -25
- package/esm/use-theme/index.js +1 -12
- package/esm/use-theme/use-theme.js +1 -16
- package/esm/use-warning/index.js +1 -12
- package/esm/use-warning/use-warning.js +1 -23
- package/esm/user/index.js +1 -21
- package/esm/user/user-link.js +1 -46
- package/esm/user/user.js +1 -63
- package/esm/user/user.styles.js +1 -56
- package/esm/utils/assertion.js +1 -42
- package/esm/utils/clear-icon.js +1 -70
- package/esm/utils/clsx.js +1 -57
- package/esm/utils/collections.js +1 -110
- package/esm/utils/color.js +1 -187
- package/esm/utils/css-transition.js +1 -76
- package/esm/utils/deep-merge.js +1 -33
- package/esm/utils/dimensions.js +1 -10
- package/esm/utils/dom.js +1 -110
- package/esm/utils/drip.js +1 -116
- package/esm/utils/expand.js +1 -109
- package/esm/utils/icons.js +1 -481
- package/esm/utils/numbers.js +1 -23
- package/esm/utils/object.js +1 -40
- package/esm/utils/prop-types.js +1 -56
- package/esm/utils/react.js +1 -24
- package/esm/utils/strings.js +1 -18
- package/esm/utils/types.d.js +1 -3
- package/esm/utils/with-defaults.js +1 -13
- package/package.json +8 -3
- package/{cjs → types}/avatar/avatar-group.d.ts +0 -0
- package/{cjs → types}/avatar/avatar-group.styles.d.ts +82 -0
- package/{cjs → types}/avatar/avatar.d.ts +0 -0
- package/{esm → types}/avatar/avatar.styles.d.ts +41 -0
- package/{cjs → types}/avatar/index.d.ts +0 -0
- package/{cjs → types}/backdrop/backdrop.d.ts +1 -1
- package/{cjs → types}/backdrop/backdrop.styles.d.ts +123 -0
- package/{cjs → types}/backdrop/index.d.ts +0 -0
- package/{cjs → types}/button/button-group-context.d.ts +0 -0
- package/{cjs → types}/button/button-group.d.ts +0 -0
- package/{cjs → types}/button/button-group.styles.d.ts +41 -0
- package/{esm → types}/button/button-icon.d.ts +42 -0
- package/{cjs → types}/button/button.d.ts +1 -0
- package/{esm/backdrop/backdrop.styles.d.ts → types/button/button.styles.d.ts} +1286 -898
- package/{cjs → types}/button/index.d.ts +0 -0
- package/{cjs → types}/button/utils.d.ts +0 -0
- package/{cjs → types}/card/card.d.ts +0 -0
- package/{cjs → types}/card/card.styles.d.ts +164 -0
- package/{cjs → types}/card/index.d.ts +0 -0
- package/{cjs → types}/checkbox/checkbox-context.d.ts +0 -0
- package/{cjs → types}/checkbox/checkbox-group.d.ts +0 -0
- package/{cjs → types}/checkbox/checkbox.d.ts +0 -0
- package/{cjs → types}/checkbox/checkbox.styles.d.ts +369 -0
- package/{cjs → types}/checkbox/index.d.ts +0 -0
- package/{cjs → types}/code/code.d.ts +0 -0
- package/{esm → types}/code/code.styles.d.ts +82 -0
- package/{cjs → types}/code/index.d.ts +0 -0
- package/{cjs → types}/col/col.d.ts +0 -0
- package/{cjs → types}/col/col.styles.d.ts +41 -0
- package/{cjs → types}/col/index.d.ts +0 -0
- package/{cjs → types}/collapse/collapse-context.d.ts +0 -0
- package/{cjs → types}/collapse/collapse-group.d.ts +0 -0
- package/{cjs → types}/collapse/collapse-icon.d.ts +0 -0
- package/{esm → types}/collapse/collapse.d.ts +5 -3
- package/{esm → types}/collapse/collapse.styles.d.ts +205 -0
- package/{cjs → types}/collapse/index.d.ts +0 -0
- package/{cjs → types}/container/container.d.ts +0 -0
- package/{cjs → types}/container/container.styles.d.ts +41 -0
- package/{cjs → types}/container/index.d.ts +0 -0
- package/{cjs → types}/css-baseline/css-baseline.d.ts +0 -0
- package/{cjs → types}/css-baseline/index.d.ts +0 -0
- package/{cjs → types}/divider/divider.d.ts +0 -0
- package/{esm → types}/divider/divider.styles.d.ts +82 -0
- package/{cjs → types}/divider/index.d.ts +0 -0
- package/{cjs → types}/grid/grid-container.d.ts +0 -0
- package/{cjs → types}/grid/grid-item.d.ts +0 -0
- package/{cjs → types}/grid/grid.d.ts +0 -0
- package/{cjs → types}/grid/grid.styles.d.ts +82 -0
- package/{cjs → types}/grid/index.d.ts +0 -0
- package/{cjs → types}/image/image.d.ts +0 -0
- package/{cjs → types}/image/image.skeleton.d.ts +0 -0
- package/{esm → types}/image/image.styles.d.ts +123 -0
- package/{cjs → types}/image/index.d.ts +0 -0
- package/{cjs → types}/index.d.ts +0 -0
- package/{cjs → types}/input/index.d.ts +0 -0
- package/{cjs → types}/input/input-password.d.ts +0 -0
- package/{cjs → types}/input/input-props.d.ts +0 -0
- package/{cjs → types}/input/input.d.ts +0 -0
- package/{cjs → types}/input/input.styles.d.ts +451 -0
- package/{cjs → types}/input/password-icon.d.ts +0 -0
- package/{cjs → types}/link/icon.d.ts +0 -0
- package/{cjs → types}/link/index.d.ts +0 -0
- package/{cjs → types}/link/link.d.ts +1 -1
- package/{cjs → types}/link/link.styles.d.ts +83 -1
- package/{cjs → types}/loading/index.d.ts +0 -0
- package/{cjs → types}/loading/loading.d.ts +0 -0
- package/{esm → types}/loading/loading.styles.d.ts +246 -0
- package/{cjs → types}/loading/spinner.d.ts +0 -0
- package/{cjs → types}/modal/index.d.ts +0 -0
- package/{cjs → types}/modal/modal-body.d.ts +0 -0
- package/{cjs → types}/modal/modal-close-button.d.ts +0 -0
- package/{cjs → types}/modal/modal-context.d.ts +0 -0
- package/{cjs → types}/modal/modal-footer.d.ts +0 -0
- package/{cjs → types}/modal/modal-header.d.ts +0 -0
- package/{cjs → types}/modal/modal-wrapper.d.ts +0 -0
- package/{cjs → types}/modal/modal.d.ts +0 -0
- package/{cjs → types}/modal/modal.styles.d.ts +246 -0
- package/{cjs → types}/modal/use-modal.d.ts +0 -0
- package/{cjs → types}/pagination/index.d.ts +0 -0
- package/{cjs → types}/pagination/pagination-ellipsis.d.ts +0 -0
- package/{cjs → types}/pagination/pagination-highlight.d.ts +0 -0
- package/{cjs → types}/pagination/pagination-icon.d.ts +0 -0
- package/{cjs → types}/pagination/pagination-item.d.ts +0 -0
- package/{cjs → types}/pagination/pagination.d.ts +0 -0
- package/{esm → types}/pagination/pagination.styles.d.ts +246 -0
- package/{cjs → types}/progress/index.d.ts +0 -0
- package/{esm → types}/progress/progress.d.ts +1 -1
- package/{esm → types}/progress/progress.styles.d.ts +83 -1
- package/{cjs → types}/radio/index.d.ts +0 -0
- package/{cjs → types}/radio/radio-context.d.ts +0 -0
- package/{cjs → types}/radio/radio-group.d.ts +0 -0
- package/{cjs → types}/radio/radio.d.ts +0 -0
- package/{cjs → types}/radio/radio.styles.d.ts +246 -0
- package/{cjs → types}/row/index.d.ts +0 -0
- package/{cjs → types}/row/row.d.ts +0 -0
- package/{cjs → types}/row/row.styles.d.ts +41 -0
- package/{cjs → types}/snippet/index.d.ts +0 -0
- package/{cjs → types}/snippet/snippet-icon.d.ts +0 -0
- package/{cjs → types}/snippet/snippet.d.ts +0 -0
- package/{esm → types}/snippet/snippet.styles.d.ts +164 -0
- package/{cjs → types}/spacer/index.d.ts +0 -0
- package/{cjs → types}/spacer/spacer.d.ts +0 -0
- package/{cjs → types}/spacer/spacer.styles.d.ts +41 -0
- package/{cjs → types}/switch/index.d.ts +1 -1
- package/{cjs → types}/switch/switch.d.ts +0 -0
- package/{cjs → types}/switch/switch.styles.d.ts +164 -0
- package/{esm → types}/text/child.d.ts +2 -0
- package/{cjs → types}/text/index.d.ts +0 -0
- package/{cjs → types}/text/text.d.ts +3 -3
- package/{cjs → types}/text/text.styles.d.ts +41 -0
- package/{cjs → types}/textarea/index.d.ts +0 -0
- package/{cjs → types}/textarea/textarea.d.ts +0 -0
- package/{cjs → types}/textarea/utils.d.ts +0 -0
- package/{cjs → types}/theme/common.d.ts +76 -0
- package/{cjs → types}/theme/dark-theme.d.ts +10 -0
- package/{cjs → types}/theme/light-theme.d.ts +0 -0
- package/{cjs → types}/theme/stitches.config.d.ts +5411 -4087
- package/{cjs → types}/theme/theme-context.d.ts +0 -0
- package/{cjs → types}/theme/theme-provider.d.ts +0 -0
- package/{cjs → types}/theme/types.d.ts +1 -0
- package/{cjs → types}/theme/utils.d.ts +0 -0
- package/{cjs → types}/tooltip/index.d.ts +0 -0
- package/{cjs → types}/tooltip/placement.d.ts +0 -0
- package/{cjs → types}/tooltip/tooltip-content.d.ts +0 -0
- package/{esm → types}/tooltip/tooltip.d.ts +4 -1
- package/{esm → types}/tooltip/tooltip.styles.d.ts +164 -0
- package/{cjs → types}/use-body-scroll/index.d.ts +0 -0
- package/{cjs → types}/use-body-scroll/use-body-scroll.d.ts +0 -0
- package/{cjs → types}/use-click-anywhere/index.d.ts +0 -0
- package/{cjs → types}/use-click-anywhere/use-click-anywhere.d.ts +0 -0
- package/{cjs → types}/use-click-away/index.d.ts +0 -0
- package/{cjs → types}/use-click-away/use-click-away.d.ts +0 -0
- package/{cjs → types}/use-clipboard/index.d.ts +0 -0
- package/{cjs → types}/use-clipboard/use-clipboard.d.ts +0 -0
- package/{cjs → types}/use-current-state/index.d.ts +0 -0
- package/{cjs → types}/use-current-state/use-current-state.d.ts +0 -0
- package/{cjs → types}/use-drip/index.d.ts +0 -0
- package/{cjs → types}/use-drip/use-drip.d.ts +0 -0
- package/{cjs → types}/use-input/index.d.ts +0 -0
- package/{cjs → types}/use-input/use-input.d.ts +0 -0
- package/{cjs → types}/use-keyboard/codes.d.ts +0 -0
- package/{cjs → types}/use-keyboard/helper.d.ts +0 -0
- package/{cjs → types}/use-keyboard/index.d.ts +0 -0
- package/{cjs → types}/use-keyboard/use-keyboard.d.ts +0 -0
- package/{cjs → types}/use-pagination/index.d.ts +0 -0
- package/{cjs → types}/use-portal/index.d.ts +0 -0
- package/{cjs → types}/use-portal/use-portal.d.ts +0 -0
- package/{cjs → types}/use-real-shape/index.d.ts +0 -0
- package/{cjs → types}/use-real-shape/use-real-shape.d.ts +0 -0
- package/{cjs → types}/use-resize/index.d.ts +0 -0
- package/{cjs → types}/use-resize/use-resize.d.ts +0 -0
- package/{cjs → types}/use-ssr/index.d.ts +0 -0
- package/{cjs → types}/use-ssr/use-ssr.d.ts +0 -0
- package/{cjs → types}/use-theme/index.d.ts +0 -0
- package/{cjs → types}/use-theme/use-theme.d.ts +0 -0
- package/{cjs → types}/use-warning/index.d.ts +0 -0
- package/{cjs → types}/use-warning/use-warning.d.ts +0 -0
- package/{cjs → types}/user/index.d.ts +0 -0
- package/{cjs → types}/user/user-link.d.ts +0 -0
- package/{cjs → types}/user/user.d.ts +0 -0
- package/{cjs → types}/user/user.styles.d.ts +205 -0
- package/{cjs → types}/utils/assertion.d.ts +0 -0
- package/{cjs → types}/utils/clear-icon.d.ts +0 -0
- package/{cjs → types}/utils/clsx.d.ts +0 -0
- package/{cjs → types}/utils/collections.d.ts +0 -0
- package/{cjs → types}/utils/color.d.ts +0 -0
- package/{cjs → types}/utils/css-transition.d.ts +0 -0
- package/{cjs → types}/utils/deep-merge.d.ts +0 -0
- package/{cjs → types}/utils/dimensions.d.ts +0 -0
- package/{cjs → types}/utils/drip.d.ts +41 -0
- package/{cjs → types}/utils/expand.d.ts +0 -0
- package/{cjs → types}/utils/numbers.d.ts +0 -0
- package/{cjs → types}/utils/object.d.ts +0 -0
- package/{cjs → types}/utils/prop-types.d.ts +0 -0
- package/{cjs → types}/utils/with-defaults.d.ts +0 -0
- package/umd/nextui.js +4532 -602
- package/umd/nextui.min.js +1 -1
- package/cjs/avatar/avatar.styles.d.ts +0 -904
- package/cjs/button/button-icon.d.ts +0 -909
- package/cjs/button/button.styles.d.ts +0 -907
- package/cjs/code/code.styles.d.ts +0 -1782
- package/cjs/collapse/collapse.d.ts +0 -41
- package/cjs/collapse/collapse.styles.d.ts +0 -4472
- package/cjs/divider/divider.styles.d.ts +0 -1787
- package/cjs/image/image.styles.d.ts +0 -2676
- package/cjs/loading/loading.styles.d.ts +0 -5356
- package/cjs/pagination/pagination.styles.d.ts +0 -5369
- package/cjs/progress/progress.d.ts +0 -65
- package/cjs/progress/progress.styles.d.ts +0 -1793
- package/cjs/snippet/snippet.styles.d.ts +0 -3570
- package/cjs/text/child.d.ts +0 -21
- package/cjs/theme/ssr-provider.d.ts +0 -7
- package/cjs/theme/ssr-provider.js +0 -51
- package/cjs/tooltip/tooltip.d.ts +0 -56
- package/cjs/tooltip/tooltip.styles.d.ts +0 -3571
- package/esm/avatar/avatar-group.d.ts +0 -13
- package/esm/avatar/avatar-group.styles.d.ts +0 -1785
- package/esm/avatar/avatar.d.ts +0 -21
- package/esm/avatar/index.d.ts +0 -7
- package/esm/backdrop/backdrop.d.ts +0 -37
- package/esm/backdrop/index.d.ts +0 -5
- package/esm/button/button-group-context.d.ts +0 -20
- package/esm/button/button-group.d.ts +0 -34
- package/esm/button/button-group.styles.d.ts +0 -899
- package/esm/button/button.d.ts +0 -30
- package/esm/button/button.styles.d.ts +0 -907
- package/esm/button/index.d.ts +0 -10
- package/esm/button/utils.d.ts +0 -4
- package/esm/card/card.d.ts +0 -23
- package/esm/card/card.styles.d.ts +0 -3575
- package/esm/card/index.d.ts +0 -5
- package/esm/checkbox/checkbox-context.d.ts +0 -13
- package/esm/checkbox/checkbox-group.d.ts +0 -29
- package/esm/checkbox/checkbox.d.ts +0 -58
- package/esm/checkbox/checkbox.styles.d.ts +0 -8054
- package/esm/checkbox/index.d.ts +0 -6
- package/esm/code/code.d.ts +0 -15
- package/esm/code/index.d.ts +0 -5
- package/esm/col/col.d.ts +0 -20
- package/esm/col/col.styles.d.ts +0 -893
- package/esm/col/index.d.ts +0 -5
- package/esm/collapse/collapse-context.d.ts +0 -9
- package/esm/collapse/collapse-group.d.ts +0 -18
- package/esm/collapse/collapse-icon.d.ts +0 -19
- package/esm/collapse/index.d.ts +0 -6
- package/esm/container/container.d.ts +0 -40
- package/esm/container/container.styles.d.ts +0 -896
- package/esm/container/index.d.ts +0 -5
- package/esm/css-baseline/css-baseline.d.ts +0 -9
- package/esm/css-baseline/index.d.ts +0 -1
- package/esm/divider/divider.d.ts +0 -22
- package/esm/divider/index.d.ts +0 -5
- package/esm/grid/grid-container.d.ts +0 -22
- package/esm/grid/grid-item.d.ts +0 -37
- package/esm/grid/grid.d.ts +0 -9
- package/esm/grid/grid.styles.d.ts +0 -1783
- package/esm/grid/index.d.ts +0 -7
- package/esm/image/image.d.ts +0 -29
- package/esm/image/image.skeleton.d.ts +0 -19
- package/esm/image/index.d.ts +0 -5
- package/esm/index.d.ts +0 -79
- package/esm/input/index.d.ts +0 -7
- package/esm/input/input-password.d.ts +0 -98
- package/esm/input/input-props.d.ts +0 -66
- package/esm/input/input.d.ts +0 -18
- package/esm/input/input.styles.d.ts +0 -9854
- package/esm/input/password-icon.d.ts +0 -6
- package/esm/link/icon.d.ts +0 -4
- package/esm/link/index.d.ts +0 -5
- package/esm/link/link.d.ts +0 -43
- package/esm/link/link.styles.d.ts +0 -1788
- package/esm/loading/index.d.ts +0 -7
- package/esm/loading/loading.d.ts +0 -24
- package/esm/loading/spinner.d.ts +0 -17
- package/esm/modal/index.d.ts +0 -8
- package/esm/modal/modal-body.d.ts +0 -45
- package/esm/modal/modal-close-button.d.ts +0 -13
- package/esm/modal/modal-context.d.ts +0 -8
- package/esm/modal/modal-footer.d.ts +0 -24
- package/esm/modal/modal-header.d.ts +0 -24
- package/esm/modal/modal-wrapper.d.ts +0 -24
- package/esm/modal/modal.d.ts +0 -42
- package/esm/modal/modal.styles.d.ts +0 -5362
- package/esm/modal/use-modal.d.ts +0 -11
- package/esm/pagination/index.d.ts +0 -7
- package/esm/pagination/pagination-ellipsis.d.ts +0 -11
- package/esm/pagination/pagination-highlight.d.ts +0 -14
- package/esm/pagination/pagination-icon.d.ts +0 -16
- package/esm/pagination/pagination-item.d.ts +0 -22
- package/esm/pagination/pagination.d.ts +0 -46
- package/esm/progress/index.d.ts +0 -5
- package/esm/radio/index.d.ts +0 -4
- package/esm/radio/radio-context.d.ts +0 -13
- package/esm/radio/radio-group.d.ts +0 -30
- package/esm/radio/radio.d.ts +0 -45
- package/esm/radio/radio.styles.d.ts +0 -5357
- package/esm/row/index.d.ts +0 -5
- package/esm/row/row.d.ts +0 -21
- package/esm/row/row.styles.d.ts +0 -895
- package/esm/snippet/index.d.ts +0 -5
- package/esm/snippet/snippet-icon.d.ts +0 -21
- package/esm/snippet/snippet.d.ts +0 -35
- package/esm/spacer/index.d.ts +0 -5
- package/esm/spacer/spacer.d.ts +0 -41
- package/esm/spacer/spacer.styles.d.ts +0 -894
- package/esm/switch/index.d.ts +0 -5
- package/esm/switch/switch.d.ts +0 -82
- package/esm/switch/switch.styles.d.ts +0 -3576
- package/esm/text/index.d.ts +0 -4
- package/esm/text/text.d.ts +0 -59
- package/esm/text/text.styles.d.ts +0 -894
- package/esm/textarea/index.d.ts +0 -3
- package/esm/textarea/textarea.d.ts +0 -42
- package/esm/textarea/utils.d.ts +0 -13
- package/esm/theme/common.d.ts +0 -1584
- package/esm/theme/dark-theme.d.ts +0 -33
- package/esm/theme/light-theme.d.ts +0 -28
- package/esm/theme/ssr-provider.d.ts +0 -7
- package/esm/theme/ssr-provider.js +0 -51
- package/esm/theme/stitches.config.d.ts +0 -8700
- package/esm/theme/theme-context.d.ts +0 -5
- package/esm/theme/theme-provider.d.ts +0 -14
- package/esm/theme/types.d.ts +0 -75
- package/esm/theme/utils.d.ts +0 -16
- package/esm/tooltip/index.d.ts +0 -6
- package/esm/tooltip/placement.d.ts +0 -39
- package/esm/tooltip/tooltip-content.d.ts +0 -27
- package/esm/use-body-scroll/index.d.ts +0 -3
- package/esm/use-body-scroll/use-body-scroll.d.ts +0 -9
- package/esm/use-click-anywhere/index.d.ts +0 -2
- package/esm/use-click-anywhere/use-click-anywhere.d.ts +0 -2
- package/esm/use-click-away/index.d.ts +0 -2
- package/esm/use-click-away/use-click-away.d.ts +0 -3
- package/esm/use-clipboard/index.d.ts +0 -3
- package/esm/use-clipboard/use-clipboard.d.ts +0 -8
- package/esm/use-current-state/index.d.ts +0 -2
- package/esm/use-current-state/use-current-state.d.ts +0 -8
- package/esm/use-drip/index.d.ts +0 -2
- package/esm/use-drip/use-drip.d.ts +0 -9
- package/esm/use-input/index.d.ts +0 -2
- package/esm/use-input/use-input.d.ts +0 -13
- package/esm/use-keyboard/codes.d.ts +0 -92
- package/esm/use-keyboard/helper.d.ts +0 -3
- package/esm/use-keyboard/index.d.ts +0 -5
- package/esm/use-keyboard/use-keyboard.d.ts +0 -22
- package/esm/use-pagination/index.d.ts +0 -20
- package/esm/use-portal/index.d.ts +0 -2
- package/esm/use-portal/use-portal.d.ts +0 -2
- package/esm/use-real-shape/index.d.ts +0 -2
- package/esm/use-real-shape/use-real-shape.d.ts +0 -9
- package/esm/use-resize/index.d.ts +0 -2
- package/esm/use-resize/use-resize.d.ts +0 -2
- package/esm/use-ssr/index.d.ts +0 -2
- package/esm/use-ssr/use-ssr.d.ts +0 -6
- package/esm/use-theme/index.d.ts +0 -2
- package/esm/use-theme/use-theme.d.ts +0 -3
- package/esm/use-warning/index.d.ts +0 -2
- package/esm/use-warning/use-warning.d.ts +0 -2
- package/esm/user/index.d.ts +0 -6
- package/esm/user/user-link.d.ts +0 -32
- package/esm/user/user.d.ts +0 -35
- package/esm/user/user.styles.d.ts +0 -4456
- package/esm/utils/assertion.d.ts +0 -8
- package/esm/utils/clear-icon.d.ts +0 -16
- package/esm/utils/clsx.d.ts +0 -1
- package/esm/utils/collections.d.ts +0 -12
- package/esm/utils/color.d.ts +0 -28
- package/esm/utils/css-transition.d.ts +0 -27
- package/esm/utils/deep-merge.d.ts +0 -1
- package/esm/utils/dimensions.d.ts +0 -1
- package/esm/utils/drip.d.ts +0 -936
- package/esm/utils/expand.d.ts +0 -20
- package/esm/utils/numbers.d.ts +0 -9
- package/esm/utils/object.d.ts +0 -11
- package/esm/utils/prop-types.d.ts +0 -54
- package/esm/utils/with-defaults.d.ts +0 -3
package/esm/user/index.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.default = exports.StyledUserSocial = exports.StyledUserName = exports.StyledUserLink = exports.StyledUserInfo = exports.StyledUser = void 0;
|
|
7
|
-
|
|
8
|
-
var _user = _interopRequireDefault(require("./user"));
|
|
9
|
-
|
|
10
|
-
var _userLink = _interopRequireDefault(require("./user-link"));
|
|
11
|
-
|
|
12
|
-
var _user2 = require("./user.styles");
|
|
13
|
-
|
|
14
|
-
exports.StyledUser = _user2.StyledUser;
|
|
15
|
-
exports.StyledUserInfo = _user2.StyledUserInfo;
|
|
16
|
-
exports.StyledUserName = _user2.StyledUserName;
|
|
17
|
-
exports.StyledUserSocial = _user2.StyledUserSocial;
|
|
18
|
-
exports.StyledUserLink = _user2.StyledUserLink;
|
|
19
|
-
_user.default.Link = _userLink.default;
|
|
20
|
-
var _default = _user.default;
|
|
21
|
-
exports.default = _default;
|
|
1
|
+
import e from"./user";import r from"./user-link";e.Link=r;export{StyledUser,StyledUserInfo,StyledUserName,StyledUserSocial,StyledUserLink}from"./user.styles";export default e;
|
package/esm/user/user-link.js
CHANGED
|
@@ -1,46 +1 @@
|
|
|
1
|
-
"
|
|
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 _link = _interopRequireDefault(require("../link"));
|
|
11
|
-
|
|
12
|
-
var _user = require("./user.styles");
|
|
13
|
-
|
|
14
|
-
var _assertion = require("../utils/assertion");
|
|
15
|
-
|
|
16
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
|
-
const UserLink = /*#__PURE__*/_react.default.forwardRef(({
|
|
19
|
-
href,
|
|
20
|
-
className,
|
|
21
|
-
children,
|
|
22
|
-
...props
|
|
23
|
-
}, ref) => {
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_user.StyledUserLink, { ...props,
|
|
25
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_link.default, {
|
|
26
|
-
ref: ref,
|
|
27
|
-
href: href,
|
|
28
|
-
color: "primary",
|
|
29
|
-
target: "_blank",
|
|
30
|
-
rel: "noopener",
|
|
31
|
-
children: children
|
|
32
|
-
})
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
if (_assertion.__DEV__) {
|
|
37
|
-
UserLink.displayName = 'NextUI - UserLink';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
UserLink.toString = () => '.nextui-user-link';
|
|
41
|
-
|
|
42
|
-
const MemoUserLink = /*#__PURE__*/_react.default.memo(UserLink);
|
|
43
|
-
|
|
44
|
-
var _default = MemoUserLink;
|
|
45
|
-
exports.default = _default;
|
|
46
|
-
module.exports = exports.default;
|
|
1
|
+
import r from"react";import e from"../link";import{StyledUserLink as o}from"./user.styles";import{__DEV__ as t}from"../utils/assertion";import{jsx as i}from"react/jsx-runtime";const m=r.forwardRef((({href:r,className:t,children:m,...s},n)=>i(o,{...s,children:i(e,{ref:n,href:r,color:"primary",target:"_blank",rel:"noopener",children:m})})));t&&(m.displayName="NextUI - UserLink"),m.toString=()=>".nextui-user-link";const s=r.memo(m);export default s;
|
package/esm/user/user.js
CHANGED
|
@@ -1,63 +1 @@
|
|
|
1
|
-
"
|
|
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 _index = require("../index");
|
|
11
|
-
|
|
12
|
-
var _user = require("./user.styles");
|
|
13
|
-
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
|
-
const defaultProps = {
|
|
17
|
-
size: 'lg',
|
|
18
|
-
squared: false,
|
|
19
|
-
bordered: false
|
|
20
|
-
};
|
|
21
|
-
const preClass = 'nextui-user';
|
|
22
|
-
|
|
23
|
-
const User = ({
|
|
24
|
-
src,
|
|
25
|
-
text,
|
|
26
|
-
name,
|
|
27
|
-
children,
|
|
28
|
-
altText,
|
|
29
|
-
color,
|
|
30
|
-
squared,
|
|
31
|
-
bordered,
|
|
32
|
-
size,
|
|
33
|
-
...props
|
|
34
|
-
}) => {
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_user.StyledUser, { ...props,
|
|
36
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Avatar, {
|
|
37
|
-
className: `${preClass}-avatar`,
|
|
38
|
-
src: src,
|
|
39
|
-
color: color,
|
|
40
|
-
squared: squared,
|
|
41
|
-
bordered: bordered,
|
|
42
|
-
text: text,
|
|
43
|
-
size: size,
|
|
44
|
-
alt: altText
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_user.StyledUserInfo, {
|
|
46
|
-
className: `${preClass}-info`,
|
|
47
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_user.StyledUserName, {
|
|
48
|
-
className: `${preClass}-name`,
|
|
49
|
-
children: name
|
|
50
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_user.StyledUserSocial, {
|
|
51
|
-
className: `${preClass}-social`,
|
|
52
|
-
children: children
|
|
53
|
-
})]
|
|
54
|
-
})]
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
User.toString = () => '.nextui-user';
|
|
59
|
-
|
|
60
|
-
var _default = /*#__PURE__*/_react.default.memo(User);
|
|
61
|
-
|
|
62
|
-
exports.default = _default;
|
|
63
|
-
module.exports = exports.default;
|
|
1
|
+
import e from"react";import{Avatar as r}from"../index";import{StyledUser as s,StyledUserInfo as t,StyledUserName as a,StyledUserSocial as i}from"./user.styles";import{jsx as o}from"react/jsx-runtime";import{jsxs as m}from"react/jsx-runtime";const c=({src:e,text:c,name:n,children:l,altText:u,color:x,squared:d,bordered:f,size:p,...h})=>m(s,{...h,children:[o(r,{className:"nextui-user-avatar",src:e,color:x,squared:d,bordered:f,text:c,size:p,alt:u}),m(t,{className:"nextui-user-info",children:[o(a,{className:"nextui-user-name",children:n}),o(i,{className:"nextui-user-social",children:l})]})]});c.toString=()=>".nextui-user";export default e.memo(c);
|
package/esm/user/user.styles.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.StyledUserSocial = exports.StyledUserName = exports.StyledUserLink = exports.StyledUserInfo = exports.StyledUser = void 0;
|
|
5
|
-
|
|
6
|
-
var _stitches = require("../theme/stitches.config");
|
|
7
|
-
|
|
8
|
-
const StyledUser = (0, _stitches.styled)('div', {
|
|
9
|
-
d: 'inline-flex',
|
|
10
|
-
p: '0 $sm',
|
|
11
|
-
jc: 'center',
|
|
12
|
-
ai: 'center',
|
|
13
|
-
w: 'max-content',
|
|
14
|
-
maxWidth: '100%'
|
|
15
|
-
});
|
|
16
|
-
exports.StyledUser = StyledUser;
|
|
17
|
-
const StyledUserInfo = (0, _stitches.styled)('div', {
|
|
18
|
-
ml: '$sm',
|
|
19
|
-
d: 'inline-flex',
|
|
20
|
-
fd: 'column',
|
|
21
|
-
whiteSpace: 'nowrap'
|
|
22
|
-
});
|
|
23
|
-
exports.StyledUserInfo = StyledUserInfo;
|
|
24
|
-
const StyledUserName = (0, _stitches.styled)('span', {
|
|
25
|
-
fontSize: '$xs',
|
|
26
|
-
color: '$text',
|
|
27
|
-
lh: '$sm',
|
|
28
|
-
tt: 'capitalize',
|
|
29
|
-
fontWeight: '$medium',
|
|
30
|
-
maxW: '$60',
|
|
31
|
-
to: 'ellipsis',
|
|
32
|
-
// text overflow
|
|
33
|
-
ov: 'hidden' // overflow
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
exports.StyledUserName = StyledUserName;
|
|
37
|
-
const StyledUserSocial = (0, _stitches.styled)('span', {
|
|
38
|
-
fontSize: '$tiny',
|
|
39
|
-
color: '$accents4',
|
|
40
|
-
'*:first-child': {
|
|
41
|
-
mt: 0
|
|
42
|
-
},
|
|
43
|
-
'*:last-child': {
|
|
44
|
-
mb: 0
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
exports.StyledUserSocial = StyledUserSocial;
|
|
48
|
-
const StyledUserLink = (0, _stitches.styled)('a', {
|
|
49
|
-
a: {
|
|
50
|
-
'&:hover': {
|
|
51
|
-
opacity: 0.7
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}); // types
|
|
55
|
-
|
|
56
|
-
exports.StyledUserLink = StyledUserLink;
|
|
1
|
+
import{styled as t}from"../theme/stitches.config";export const StyledUser=t("div",{d:"inline-flex",p:"0 $sm",jc:"center",ai:"center",w:"max-content",maxWidth:"100%"});export const StyledUserInfo=t("div",{ml:"$sm",d:"inline-flex",fd:"column",whiteSpace:"nowrap"});export const StyledUserName=t("span",{fontSize:"$xs",color:"$text",lh:"$sm",tt:"capitalize",fontWeight:"$medium",maxW:"$60",to:"ellipsis",ov:"hidden"});export const StyledUserSocial=t("span",{fontSize:"$tiny",color:"$accents4","*:first-child":{mt:0},"*:last-child":{mb:0}});export const StyledUserLink=t("a",{a:{"&:hover":{opacity:.7}}});
|
package/esm/utils/assertion.js
CHANGED
|
@@ -1,42 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.__TEST__ = exports.__DEV__ = void 0;
|
|
5
|
-
exports.isArray = isArray;
|
|
6
|
-
exports.isEmpty = isEmpty;
|
|
7
|
-
exports.isEmptyArray = isEmptyArray;
|
|
8
|
-
exports.isEmptyObject = isEmptyObject;
|
|
9
|
-
exports.isObject = isObject;
|
|
10
|
-
|
|
11
|
-
const __DEV__ = process.env.NODE_ENV !== 'production';
|
|
12
|
-
|
|
13
|
-
exports.__DEV__ = __DEV__;
|
|
14
|
-
|
|
15
|
-
const __TEST__ = process.env.NODE_ENV === 'test';
|
|
16
|
-
|
|
17
|
-
exports.__TEST__ = __TEST__;
|
|
18
|
-
|
|
19
|
-
function isArray(value) {
|
|
20
|
-
return Array.isArray(value);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function isEmptyArray(value) {
|
|
24
|
-
return isArray(value) && value.length === 0;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function isObject(value) {
|
|
28
|
-
const type = typeof value;
|
|
29
|
-
return value != null && (type === 'object' || type === 'function') && !isArray(value);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function isEmptyObject(value) {
|
|
33
|
-
return isObject(value) && Object.keys(value).length === 0;
|
|
34
|
-
} // Empty assertions
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function isEmpty(value) {
|
|
38
|
-
if (isArray(value)) return isEmptyArray(value);
|
|
39
|
-
if (isObject(value)) return isEmptyObject(value);
|
|
40
|
-
if (value == null || value === '') return true;
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
1
|
+
export const __DEV__="production"!==process.env.NODE_ENV;export const __TEST__="test"===process.env.NODE_ENV;export function isArray(t){return Array.isArray(t)}export function isEmptyArray(t){return isArray(t)&&0===t.length}export function isObject(t){const r=typeof t;return null!=t&&("object"===r||"function"===r)&&!isArray(t)}export function isEmptyObject(t){return isObject(t)&&0===Object.keys(t).length}export function isEmpty(t){return isArray(t)?isEmptyArray(t):isObject(t)?isEmptyObject(t):null==t||""===t}
|
package/esm/utils/clear-icon.js
CHANGED
|
@@ -1,70 +1 @@
|
|
|
1
|
-
"
|
|
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("./with-defaults"));
|
|
11
|
-
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
|
|
14
|
-
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); }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
const defaultProps = {
|
|
19
|
-
width: 24,
|
|
20
|
-
height: 24,
|
|
21
|
-
plain: false,
|
|
22
|
-
className: ''
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const Close = ({
|
|
26
|
-
size,
|
|
27
|
-
fill,
|
|
28
|
-
plain,
|
|
29
|
-
width,
|
|
30
|
-
height,
|
|
31
|
-
className,
|
|
32
|
-
...props
|
|
33
|
-
}) => {
|
|
34
|
-
if (plain) {
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
36
|
-
width: size || width,
|
|
37
|
-
height: size || height,
|
|
38
|
-
viewBox: "0 0 24 24",
|
|
39
|
-
fill: "none",
|
|
40
|
-
stroke: fill,
|
|
41
|
-
strokeWidth: 2,
|
|
42
|
-
strokeLinecap: "round",
|
|
43
|
-
strokeLinejoin: "round",
|
|
44
|
-
className: className,
|
|
45
|
-
...props,
|
|
46
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
47
|
-
d: "M18 6L6 18M6 6l12 12"
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
53
|
-
width: size || width,
|
|
54
|
-
height: size || height,
|
|
55
|
-
viewBox: "0 0 24 24",
|
|
56
|
-
className: className,
|
|
57
|
-
...props,
|
|
58
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
59
|
-
d: "M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z",
|
|
60
|
-
fill: fill
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const MemoClose = /*#__PURE__*/React.memo(Close);
|
|
66
|
-
|
|
67
|
-
var _default = (0, _withDefaults.default)(MemoClose, defaultProps);
|
|
68
|
-
|
|
69
|
-
exports.default = _default;
|
|
70
|
-
module.exports = exports.default;
|
|
1
|
+
import*as e from"react";import i from"./with-defaults";import{jsx as t}from"react/jsx-runtime";const a=({size:e,fill:i,plain:a,width:l,height:s,className:o,...h})=>t("svg",a?{width:e||l,height:e||s,viewBox:"0 0 24 24",fill:"none",stroke:i,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:o,...h,children:t("path",{d:"M18 6L6 18M6 6l12 12"})}:{width:e||l,height:e||s,viewBox:"0 0 24 24",className:o,...h,children:t("path",{d:"M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z",fill:i})}),l=e.memo(a);export default i(l,{width:24,height:24,plain:!1,className:""});
|
package/esm/utils/clsx.js
CHANGED
|
@@ -1,57 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.default = _default;
|
|
5
|
-
|
|
6
|
-
/* eslint-disable no-shadow-restricted-names */
|
|
7
|
-
|
|
8
|
-
/* eslint-disable no-plusplus */
|
|
9
|
-
function toVal(mix) {
|
|
10
|
-
var k,
|
|
11
|
-
y,
|
|
12
|
-
str = '';
|
|
13
|
-
|
|
14
|
-
if (typeof mix === 'string' || typeof mix === 'number') {
|
|
15
|
-
str += mix;
|
|
16
|
-
} else if (typeof mix === 'object') {
|
|
17
|
-
if (Array.isArray(mix)) {
|
|
18
|
-
for (k = 0; k < mix.length; k++) {
|
|
19
|
-
if (mix[k]) {
|
|
20
|
-
if (y = toVal(mix[k])) {
|
|
21
|
-
str && (str += ' ');
|
|
22
|
-
str += y;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
for (k in mix) {
|
|
28
|
-
if (mix[k]) {
|
|
29
|
-
str && (str += ' ');
|
|
30
|
-
str += k;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return str;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function _default(...args) {
|
|
40
|
-
var i = 0,
|
|
41
|
-
tmp,
|
|
42
|
-
x,
|
|
43
|
-
str = '';
|
|
44
|
-
|
|
45
|
-
while (i < args.length) {
|
|
46
|
-
if (tmp = args[i++]) {
|
|
47
|
-
if (x = toVal(tmp)) {
|
|
48
|
-
str && (str += ' ');
|
|
49
|
-
str += x;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return str;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module.exports = exports.default;
|
|
1
|
+
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}export default function(...e){for(var t,f,n=0,o="";n<e.length;)(t=e[n++])&&(f=r(t))&&(o&&(o+=" "),o+=f);return o}
|
package/esm/utils/collections.js
CHANGED
|
@@ -1,110 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
exports.__esModule = true;
|
|
6
|
-
exports.setChildrenIndex = exports.pickChild = exports.pick = exports.isMac = exports.isChildElement = exports.isBrowser = exports.hasChild = exports.getId = exports.flattenArray = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
const getId = () => {
|
|
11
|
-
return Math.random().toString(32).slice(2, 10);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.getId = getId;
|
|
15
|
-
|
|
16
|
-
const hasChild = (children, child) => {
|
|
17
|
-
const types = _react.default.Children.map(children, item => {
|
|
18
|
-
if (! /*#__PURE__*/_react.default.isValidElement(item)) return null;
|
|
19
|
-
return item.type;
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return (types || []).includes(child);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
exports.hasChild = hasChild;
|
|
26
|
-
|
|
27
|
-
const pick = (props, obj) => props.reduce((acc, prop) => {
|
|
28
|
-
acc[prop] = obj[prop];
|
|
29
|
-
return acc;
|
|
30
|
-
}, {});
|
|
31
|
-
|
|
32
|
-
exports.pick = pick;
|
|
33
|
-
|
|
34
|
-
const pickChild = (children, targetChild) => {
|
|
35
|
-
let target = [];
|
|
36
|
-
|
|
37
|
-
const withoutTargetChildren = _react.default.Children.map(children, item => {
|
|
38
|
-
if (! /*#__PURE__*/_react.default.isValidElement(item)) return item;
|
|
39
|
-
|
|
40
|
-
if (item.type === targetChild) {
|
|
41
|
-
target.push(item);
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return item;
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const targetChildren = target.length >= 0 ? target : undefined;
|
|
49
|
-
return [withoutTargetChildren, targetChildren];
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
exports.pickChild = pickChild;
|
|
53
|
-
|
|
54
|
-
const isChildElement = (parent, child) => {
|
|
55
|
-
if (!parent || !child) return false; // eslint-disable-next-line no-undef
|
|
56
|
-
|
|
57
|
-
let node = child;
|
|
58
|
-
|
|
59
|
-
while (node) {
|
|
60
|
-
if (node === parent) return true;
|
|
61
|
-
node = node.parentNode;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return false;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
exports.isChildElement = isChildElement;
|
|
68
|
-
|
|
69
|
-
const isBrowser = () => {
|
|
70
|
-
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
exports.isBrowser = isBrowser;
|
|
74
|
-
|
|
75
|
-
const isMac = () => {
|
|
76
|
-
if (!isBrowser()) return false;
|
|
77
|
-
return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
exports.isMac = isMac;
|
|
81
|
-
|
|
82
|
-
const setChildrenIndex = (children, targetComponents = []) => {
|
|
83
|
-
if (_react.default.Children.count(children) === 0) return [];
|
|
84
|
-
const allowAll = targetComponents.length === 0;
|
|
85
|
-
|
|
86
|
-
const clone = (child, props = {}) => /*#__PURE__*/_react.default.cloneElement(child, props);
|
|
87
|
-
|
|
88
|
-
let index = 0;
|
|
89
|
-
return _react.default.Children.map(children, item => {
|
|
90
|
-
if (! /*#__PURE__*/_react.default.isValidElement(item)) return item;
|
|
91
|
-
index = index + 1;
|
|
92
|
-
if (allowAll) return clone(item, {
|
|
93
|
-
index
|
|
94
|
-
});
|
|
95
|
-
const isAllowed = targetComponents.find(child => child === item.type);
|
|
96
|
-
if (isAllowed) return clone(item, {
|
|
97
|
-
index
|
|
98
|
-
});
|
|
99
|
-
index = index - 1;
|
|
100
|
-
return item;
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
exports.setChildrenIndex = setChildrenIndex;
|
|
105
|
-
|
|
106
|
-
const flattenArray = arr => {
|
|
107
|
-
return arr.reduce((acc, val) => acc.concat(Array.isArray(val) ? flattenArray(val) : val), []);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
exports.flattenArray = flattenArray;
|
|
1
|
+
import e from"react";export const getId=()=>Math.random().toString(32).slice(2,10);export const hasChild=(t,n)=>(e.Children.map(t,(t=>e.isValidElement(t)?t.type:null))||[]).includes(n);export const pick=(e,t)=>e.reduce(((e,n)=>(e[n]=t[n],e)),{});export const pickChild=(t,n)=>{let r=[];return[e.Children.map(t,(t=>e.isValidElement(t)&&t.type===n?(r.push(t),null):t)),r.length>=0?r:void 0]};export const isChildElement=(e,t)=>{if(!e||!t)return!1;let n=t;for(;n;){if(n===e)return!0;n=n.parentNode}return!1};export const isBrowser=()=>Boolean("undefined"!=typeof window&&window.document&&window.document.createElement);export const isMac=()=>!!Boolean("undefined"!=typeof window&&window.document&&window.document.createElement)&&navigator.platform.toUpperCase().indexOf("MAC")>=0;export const setChildrenIndex=(t,n=[])=>{if(0===e.Children.count(t))return[];const r=0===n.length,o=(t,n={})=>e.cloneElement(t,n);let i=0;return e.Children.map(t,(t=>{if(!e.isValidElement(t))return t;if(i+=1,r)return o(t,{index:i});return n.find((e=>e===t.type))?o(t,{index:i}):(i-=1,t)}))};export const flattenArray=e=>e.reduce(((e,t)=>e.concat(Array.isArray(t)?flattenArray(t):t)),[]);
|
package/esm/utils/color.js
CHANGED
|
@@ -1,187 +1 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.isNormalColor = exports.isHex = exports.isCssVar = exports.isColor = exports.invertHex = exports.hexToRgb = exports.hexToRGBA = exports.hexFromString = exports.getCssVar = exports.colorToRgbValues = exports.addColorAlpha = void 0;
|
|
5
|
-
|
|
6
|
-
var _propTypes = require("./prop-types");
|
|
7
|
-
|
|
8
|
-
const getCssVar = name => {
|
|
9
|
-
if (typeof document !== 'undefined' || !name) {
|
|
10
|
-
const property = isCssVar(name) ? name.replace('var(', '').replace(')', '') : `--${name}`;
|
|
11
|
-
return getComputedStyle(document.documentElement).getPropertyValue(property);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return '';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
exports.getCssVar = getCssVar;
|
|
18
|
-
|
|
19
|
-
const isCssVar = property => {
|
|
20
|
-
return property && (property == null ? void 0 : property.indexOf('var(')) === 0 ? true : false;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* This function allows validate if a string is a hexadecimal
|
|
24
|
-
* value
|
|
25
|
-
* @param str [string] hexadecimal value
|
|
26
|
-
* @returns result [boolean]
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports.isCssVar = isCssVar;
|
|
31
|
-
|
|
32
|
-
const isHex = str => {
|
|
33
|
-
const exp = /#[a-fA-F0-9]{3,6}/g;
|
|
34
|
-
return exp.test(str);
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @param hex [string]
|
|
39
|
-
* @param alpha [number]
|
|
40
|
-
* @returns [string]
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
exports.isHex = isHex;
|
|
45
|
-
|
|
46
|
-
const hexToRGBA = (hex, alpha = 1) => {
|
|
47
|
-
let r = 0,
|
|
48
|
-
g = 0,
|
|
49
|
-
b = 0; // 3 digits
|
|
50
|
-
|
|
51
|
-
if (hex.length == 4) {
|
|
52
|
-
r = '0x' + hex[1] + hex[1];
|
|
53
|
-
g = '0x' + hex[2] + hex[2];
|
|
54
|
-
b = '0x' + hex[3] + hex[3]; // 6 digits
|
|
55
|
-
} else if (hex.length == 7) {
|
|
56
|
-
r = '0x' + hex[1] + hex[2];
|
|
57
|
-
g = '0x' + hex[3] + hex[4];
|
|
58
|
-
b = '0x' + hex[5] + hex[6];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return `rgba(${+r}, ${+g},${+b},${alpha})`;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
exports.hexToRGBA = hexToRGBA;
|
|
65
|
-
|
|
66
|
-
const isNormalColor = color => {
|
|
67
|
-
let found = _propTypes.normalColors.find(el => el === color);
|
|
68
|
-
|
|
69
|
-
return found !== undefined && found !== null;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Function that checks color name support in the current browser
|
|
73
|
-
* @param strColor
|
|
74
|
-
* @returns boolean
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
exports.isNormalColor = isNormalColor;
|
|
79
|
-
|
|
80
|
-
const isColor = strColor => {
|
|
81
|
-
let s = new Option().style;
|
|
82
|
-
s.color = strColor;
|
|
83
|
-
return s.color == strColor;
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
exports.isColor = isColor;
|
|
87
|
-
|
|
88
|
-
const hexToRgb = color => {
|
|
89
|
-
const fullReg = /^#?([a-f\d])([a-f\d])([a-f\d])$/i;
|
|
90
|
-
const full = color.replace(fullReg, (_, r, g, b) => `${r}${r}${g}${g}${b}${b}`);
|
|
91
|
-
const values = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(full);
|
|
92
|
-
|
|
93
|
-
if (!values) {
|
|
94
|
-
throw new Error(`Next UI: Unsupported ${color} color.`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return [Number.parseInt(values[1], 16), Number.parseInt(values[2], 16), Number.parseInt(values[3], 16)];
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
exports.hexToRgb = hexToRgb;
|
|
101
|
-
|
|
102
|
-
const hexFromString = (str, defaultColor = '', returnLast = false) => {
|
|
103
|
-
const fullReg = /#[a-fA-F0-9]{6}|#[a-fA-F0-9]{3}$/g;
|
|
104
|
-
const hexCodes = str.match(fullReg);
|
|
105
|
-
|
|
106
|
-
if (hexCodes && hexCodes.length > 0) {
|
|
107
|
-
return returnLast ? hexCodes[hexCodes.length - 1] : hexCodes;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return defaultColor;
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
exports.hexFromString = hexFromString;
|
|
114
|
-
|
|
115
|
-
const colorToRgbValues = colorProp => {
|
|
116
|
-
const color = isCssVar(colorProp) ? getCssVar(colorProp) : colorProp;
|
|
117
|
-
if (color.charAt(0) === '#') return hexToRgb(color);
|
|
118
|
-
const safeColor = color.replace(/ /g, '');
|
|
119
|
-
const colorType = color.substr(0, 4);
|
|
120
|
-
const regArray = safeColor.match(/\((.+)\)/);
|
|
121
|
-
|
|
122
|
-
if (!colorType.startsWith('rgb') || !regArray) {
|
|
123
|
-
throw new Error(`Next UI: Only support ["RGB", "RGBA", "HEX"] color.`);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return regArray[1].split(',').map(str => Number.parseFloat(str));
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
exports.colorToRgbValues = colorToRgbValues;
|
|
130
|
-
|
|
131
|
-
const addColorAlpha = (colorProp, alpha = 1) => {
|
|
132
|
-
if (!colorProp) return '';
|
|
133
|
-
const color = isCssVar(colorProp) ? getCssVar(colorProp) : colorProp;
|
|
134
|
-
|
|
135
|
-
if (isHex(color)) {
|
|
136
|
-
return hexToRGBA(color, alpha);
|
|
137
|
-
} else if (!/^#|rgb|RGB/.test(color)) {
|
|
138
|
-
return color;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
const [r, g, b] = colorToRgbValues(color);
|
|
142
|
-
const safeAlpha = alpha > 1 ? 1 : alpha < 0 ? 0 : alpha;
|
|
143
|
-
return `rgba(${r}, ${g}, ${b}, ${safeAlpha})`;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
exports.addColorAlpha = addColorAlpha;
|
|
147
|
-
|
|
148
|
-
function padZero(str, len) {
|
|
149
|
-
len = len || 2;
|
|
150
|
-
var zeros = new Array(len).join('0');
|
|
151
|
-
return (zeros + str).slice(-len);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const invertHex = (hexProp, smooth = true) => {
|
|
155
|
-
let hex = isCssVar(hexProp) ? getCssVar(hexProp) : hexProp;
|
|
156
|
-
|
|
157
|
-
if (hex.indexOf('#') === 0) {
|
|
158
|
-
hex = hex.slice(1);
|
|
159
|
-
} // convert 3-digit hex to 6-digits.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (hex.length === 3) {
|
|
163
|
-
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (hex.length !== 6) {
|
|
167
|
-
return hexProp;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let r = parseInt(hex.slice(0, 2), 16),
|
|
171
|
-
g = parseInt(hex.slice(2, 4), 16),
|
|
172
|
-
b = parseInt(hex.slice(4, 6), 16);
|
|
173
|
-
|
|
174
|
-
if (smooth) {
|
|
175
|
-
// http://stackoverflow.com/a/3943023/112731
|
|
176
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF';
|
|
177
|
-
} // invert color components
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
r = 255 - r;
|
|
181
|
-
g = 255 - g;
|
|
182
|
-
b = 255 - b; // pad each with zeros and return
|
|
183
|
-
|
|
184
|
-
return '#' + padZero(r.toString(16)) + padZero(g.toString(16)) + padZero(b.toString(16));
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
exports.invertHex = invertHex;
|
|
1
|
+
import{normalColors as t}from"./prop-types";export const getCssVar=t=>{if("undefined"!=typeof document||!t){const r=isCssVar(t)?t.replace("var(","").replace(")",""):`--${t}`;return getComputedStyle(document.documentElement).getPropertyValue(r)}return""};export const isCssVar=t=>!(!t||0!==(null==t?void 0:t.indexOf("var(")));export const isHex=t=>/#[a-fA-F0-9]{3,6}/g.test(t);export const hexToRGBA=(t,r=1)=>{let e=0,o=0,n=0;return 4==t.length?(e="0x"+t[1]+t[1],o="0x"+t[2]+t[2],n="0x"+t[3]+t[3]):7==t.length&&(e="0x"+t[1]+t[2],o="0x"+t[3]+t[4],n="0x"+t[5]+t[6]),`rgba(${+e}, ${+o},${+n},${r})`};export const isNormalColor=r=>{let e=t.find((t=>t===r));return null!=e};export const isColor=t=>{let r=(new Option).style;return r.color=t,r.color==t};export const hexToRgb=t=>{const r=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,r,e,o)=>`${r}${r}${e}${e}${o}${o}`)),e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);if(!e)throw new Error(`Next UI: Unsupported ${t} color.`);return[Number.parseInt(e[1],16),Number.parseInt(e[2],16),Number.parseInt(e[3],16)]};export const hexFromString=(t,r="",e=!1)=>{const o=t.match(/#[a-fA-F0-9]{6}|#[a-fA-F0-9]{3}$/g);return o&&o.length>0?e?o[o.length-1]:o:r};export const colorToRgbValues=t=>{const r=isCssVar(t)?getCssVar(t):t;if("#"===r.charAt(0))return hexToRgb(r);const e=r.replace(/ /g,""),o=r.substr(0,4),n=e.match(/\((.+)\)/);if(!o.startsWith("rgb")||!n)throw new Error('Next UI: Only support ["RGB", "RGBA", "HEX"] color.');return n[1].split(",").map((t=>Number.parseFloat(t)))};export const addColorAlpha=(t,r=1)=>{if(!t)return"";const e=isCssVar(t)?getCssVar(t):t;if(/#[a-fA-F0-9]{3,6}/g.test(e))return hexToRGBA(e,r);if(!/^#|rgb|RGB/.test(e))return e;const[o,n,s]=colorToRgbValues(e);return`rgba(${o}, ${n}, ${s}, ${r>1?1:r<0?0:r})`};function r(t,r){return r=r||2,(new Array(r).join("0")+t).slice(-r)}export const invertHex=(t,e=!0)=>{let o=isCssVar(t)?getCssVar(t):t;if(0===o.indexOf("#")&&(o=o.slice(1)),3===o.length&&(o=o[0]+o[0]+o[1]+o[1]+o[2]+o[2]),6!==o.length)return t;let n=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),a=parseInt(o.slice(4,6),16);return e?.299*n+.587*s+.114*a>186?"#000000":"#FFFFFF":(n=255-n,s=255-s,a=255-a,"#"+r(n.toString(16))+r(s.toString(16))+r(a.toString(16)))};
|