@scaleflex/ui-tw 0.0.1
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/LICENSE +33 -0
- package/README.md +28 -0
- package/core/accordion/accordion.component.d.ts +3 -0
- package/core/accordion/accordion.component.js +50 -0
- package/core/accordion/accordion.props.d.ts +13 -0
- package/core/accordion/accordion.props.js +1 -0
- package/core/accordion/accordion.styles.d.ts +6 -0
- package/core/accordion/accordion.styles.js +12 -0
- package/core/accordion/index.d.ts +2 -0
- package/core/accordion/index.js +1 -0
- package/core/accordion-details/accordion-details.component.d.ts +3 -0
- package/core/accordion-details/accordion-details.component.js +16 -0
- package/core/accordion-details/accordion-details.props.d.ts +4 -0
- package/core/accordion-details/accordion-details.props.js +1 -0
- package/core/accordion-details/accordion-details.styles.d.ts +6 -0
- package/core/accordion-details/accordion-details.styles.js +12 -0
- package/core/accordion-details/index.d.ts +2 -0
- package/core/accordion-details/index.js +1 -0
- package/core/accordion-header/accordion-header.component.d.ts +3 -0
- package/core/accordion-header/accordion-header.component.js +48 -0
- package/core/accordion-header/accordion-header.props.d.ts +11 -0
- package/core/accordion-header/accordion-header.props.js +1 -0
- package/core/accordion-header/accordion-header.styles.d.ts +19 -0
- package/core/accordion-header/accordion-header.styles.js +44 -0
- package/core/accordion-header/index.d.ts +2 -0
- package/core/accordion-header/index.js +1 -0
- package/core/arrow/arrow.component.d.ts +3 -0
- package/core/arrow/arrow.component.js +23 -0
- package/core/arrow/arrow.mixin.d.ts +6 -0
- package/core/arrow/arrow.mixin.js +4 -0
- package/core/arrow/arrow.props.d.ts +14 -0
- package/core/arrow/arrow.props.js +6 -0
- package/core/arrow/arrow.styles.d.ts +9 -0
- package/core/arrow/arrow.styles.js +18 -0
- package/core/arrow/index.d.ts +2 -0
- package/core/arrow/index.js +1 -0
- package/core/arrow-tick/arrow-tick.component.d.ts +3 -0
- package/core/arrow-tick/arrow-tick.component.js +28 -0
- package/core/arrow-tick/arrow-tick.mixin.d.ts +6 -0
- package/core/arrow-tick/arrow-tick.mixin.js +4 -0
- package/core/arrow-tick/arrow-tick.props.d.ts +14 -0
- package/core/arrow-tick/arrow-tick.props.js +6 -0
- package/core/arrow-tick/arrow-tick.styles.d.ts +7 -0
- package/core/arrow-tick/arrow-tick.styles.js +18 -0
- package/core/arrow-tick/index.d.ts +2 -0
- package/core/arrow-tick/index.js +1 -0
- package/core/button/button.component.d.ts +9 -0
- package/core/button/button.component.js +71 -0
- package/core/button/button.types.d.ts +34 -0
- package/core/button/button.types.js +21 -0
- package/core/button/button.utils.d.ts +3 -0
- package/core/button/button.utils.js +18 -0
- package/core/button/components/end-icon.d.ts +12 -0
- package/core/button/components/end-icon.js +33 -0
- package/core/button/components/start-icon.d.ts +14 -0
- package/core/button/components/start-icon.js +40 -0
- package/core/button/index.d.ts +4 -0
- package/core/button/index.js +3 -0
- package/core/check-box/check-box.component.d.ts +3 -0
- package/core/check-box/check-box.component.js +62 -0
- package/core/check-box/check-box.mixin.d.ts +4 -0
- package/core/check-box/check-box.mixin.js +8 -0
- package/core/check-box/check-box.props.d.ts +15 -0
- package/core/check-box/check-box.props.js +1 -0
- package/core/check-box/check-box.styles.d.ts +19 -0
- package/core/check-box/check-box.styles.js +42 -0
- package/core/check-box/check-box.utils.d.ts +3 -0
- package/core/check-box/check-box.utils.js +21 -0
- package/core/check-box/index.d.ts +2 -0
- package/core/check-box/index.js +1 -0
- package/core/check-box/types/index.d.ts +2 -0
- package/core/check-box/types/index.js +2 -0
- package/core/check-box/types/size.d.ts +4 -0
- package/core/check-box/types/size.js +4 -0
- package/core/check-box/types/type.d.ts +4 -0
- package/core/check-box/types/type.js +4 -0
- package/core/check-box-group/check-box-group.component.d.ts +3 -0
- package/core/check-box-group/check-box-group.component.js +74 -0
- package/core/check-box-group/check-box-group.mixin.d.ts +5 -0
- package/core/check-box-group/check-box-group.mixin.js +10 -0
- package/core/check-box-group/check-box-group.props.d.ts +19 -0
- package/core/check-box-group/check-box-group.props.js +1 -0
- package/core/check-box-group/check-box-group.styles.d.ts +19 -0
- package/core/check-box-group/check-box-group.styles.js +33 -0
- package/core/check-box-group/index.d.ts +2 -0
- package/core/check-box-group/index.js +1 -0
- package/core/check-box-group/types/index.d.ts +1 -0
- package/core/check-box-group/types/index.js +1 -0
- package/core/check-box-group/types/label-position.d.ts +4 -0
- package/core/check-box-group/types/label-position.js +4 -0
- package/core/cross-button/cross-button.component.d.ts +3 -0
- package/core/cross-button/cross-button.component.js +35 -0
- package/core/cross-button/cross-button.props.d.ts +8 -0
- package/core/cross-button/cross-button.props.js +1 -0
- package/core/cross-button/cross-button.styles.d.ts +9 -0
- package/core/cross-button/cross-button.styles.js +21 -0
- package/core/cross-button/index.d.ts +2 -0
- package/core/cross-button/index.js +1 -0
- package/core/cross-button/types/index.d.ts +1 -0
- package/core/cross-button/types/index.js +1 -0
- package/core/cross-button/types/size.d.ts +6 -0
- package/core/cross-button/types/size.js +6 -0
- package/core/dot/dot.component.d.ts +3 -0
- package/core/dot/dot.component.js +17 -0
- package/core/dot/dot.props.d.ts +4 -0
- package/core/dot/dot.props.js +1 -0
- package/core/dot/dot.styles.d.ts +18 -0
- package/core/dot/dot.styles.js +32 -0
- package/core/dot/index.d.ts +2 -0
- package/core/dot/index.js +1 -0
- package/core/dots-navigation/dots-navigation.component.d.ts +3 -0
- package/core/dots-navigation/dots-navigation.component.js +24 -0
- package/core/dots-navigation/dots-navigation.props.d.ts +5 -0
- package/core/dots-navigation/dots-navigation.props.js +1 -0
- package/core/dots-navigation/dots-navigation.styles.d.ts +6 -0
- package/core/dots-navigation/dots-navigation.styles.js +15 -0
- package/core/dots-navigation/index.d.ts +2 -0
- package/core/dots-navigation/index.js +1 -0
- package/core/input/index.d.ts +2 -0
- package/core/input/index.js +1 -0
- package/core/input/input.component.d.ts +3 -0
- package/core/input/input.component.js +293 -0
- package/core/input/input.mixin.d.ts +18 -0
- package/core/input/input.mixin.js +25 -0
- package/core/input/input.props.d.ts +40 -0
- package/core/input/input.props.js +1 -0
- package/core/input/input.styles.d.ts +78 -0
- package/core/input/input.styles.js +148 -0
- package/core/input/input.utils.d.ts +4 -0
- package/core/input/input.utils.js +30 -0
- package/core/input/types/index.d.ts +1 -0
- package/core/input/types/index.js +1 -0
- package/core/input/types/type.d.ts +4 -0
- package/core/input/types/type.js +4 -0
- package/core/modal/index.d.ts +2 -0
- package/core/modal/index.js +1 -0
- package/core/modal/modal-menu-context.d.ts +5 -0
- package/core/modal/modal-menu-context.js +10 -0
- package/core/modal/modal.component.d.ts +3 -0
- package/core/modal/modal.component.js +97 -0
- package/core/modal/modal.mixin.d.ts +7 -0
- package/core/modal/modal.mixin.js +4 -0
- package/core/modal/modal.props.d.ts +16 -0
- package/core/modal/modal.props.js +1 -0
- package/core/modal/modal.styles.d.ts +22 -0
- package/core/modal/modal.styles.js +51 -0
- package/core/modal/modal.utils.d.ts +1 -0
- package/core/modal/modal.utils.js +4 -0
- package/core/modal/types/index.d.ts +1 -0
- package/core/modal/types/index.js +1 -0
- package/core/modal/types/size.d.ts +7 -0
- package/core/modal/types/size.js +7 -0
- package/core/modal-actions/index.d.ts +2 -0
- package/core/modal-actions/index.js +1 -0
- package/core/modal-actions/modal-actions.component.d.ts +3 -0
- package/core/modal-actions/modal-actions.component.js +18 -0
- package/core/modal-actions/modal-actions.props.d.ts +8 -0
- package/core/modal-actions/modal-actions.props.js +1 -0
- package/core/modal-actions/modal-actions.styles.d.ts +7 -0
- package/core/modal-actions/modal-actions.styles.js +17 -0
- package/core/modal-actions/types/align.d.ts +5 -0
- package/core/modal-actions/types/align.js +5 -0
- package/core/modal-actions/types/index.d.ts +1 -0
- package/core/modal-actions/types/index.js +1 -0
- package/core/modal-content/index.d.ts +2 -0
- package/core/modal-content/index.js +1 -0
- package/core/modal-content/modal-content.component.d.ts +3 -0
- package/core/modal-content/modal-content.component.js +15 -0
- package/core/modal-content/modal-content.props.d.ts +4 -0
- package/core/modal-content/modal-content.props.js +1 -0
- package/core/modal-content/modal-content.styles.d.ts +6 -0
- package/core/modal-content/modal-content.styles.js +12 -0
- package/core/modal-title/index.d.ts +2 -0
- package/core/modal-title/index.js +1 -0
- package/core/modal-title/modal-title.component.d.ts +6 -0
- package/core/modal-title/modal-title.component.js +37 -0
- package/core/modal-title/modal-title.props.d.ts +14 -0
- package/core/modal-title/modal-title.props.js +1 -0
- package/core/modal-title/modal-title.styles.d.ts +31 -0
- package/core/modal-title/modal-title.styles.js +64 -0
- package/core/modal-title/types/index.d.ts +1 -0
- package/core/modal-title/types/index.js +1 -0
- package/core/modal-title/types/variant.d.ts +4 -0
- package/core/modal-title/types/variant.js +4 -0
- package/core/pagination/index.d.ts +2 -0
- package/core/pagination/index.js +1 -0
- package/core/pagination/pagination.component.d.ts +3 -0
- package/core/pagination/pagination.component.js +81 -0
- package/core/pagination/pagination.props.d.ts +11 -0
- package/core/pagination/pagination.props.js +1 -0
- package/core/pagination/pagination.styles.d.ts +19 -0
- package/core/pagination/pagination.styles.js +36 -0
- package/core/popper/index.d.ts +2 -0
- package/core/popper/index.js +1 -0
- package/core/popper/popper.component.d.ts +3 -0
- package/core/popper/popper.component.js +150 -0
- package/core/popper/popper.mixin.d.ts +17 -0
- package/core/popper/popper.mixin.js +5 -0
- package/core/popper/popper.props.d.ts +41 -0
- package/core/popper/popper.props.js +1 -0
- package/core/popper/popper.styles.d.ts +25 -0
- package/core/popper/popper.styles.js +48 -0
- package/core/popper/popper.utils.d.ts +1 -0
- package/core/popper/popper.utils.js +10 -0
- package/core/popper/types/index.d.ts +3 -0
- package/core/popper/types/index.js +3 -0
- package/core/popper/types/phases.d.ts +11 -0
- package/core/popper/types/phases.js +11 -0
- package/core/popper/types/position.d.ts +17 -0
- package/core/popper/types/position.js +17 -0
- package/core/popper/types/strategy.d.ts +4 -0
- package/core/popper/types/strategy.js +4 -0
- package/core/radio/index.d.ts +3 -0
- package/core/radio/index.js +2 -0
- package/core/radio/radio.component.d.ts +3 -0
- package/core/radio/radio.component.js +38 -0
- package/core/radio/radio.mixin.d.ts +13 -0
- package/core/radio/radio.mixin.js +13 -0
- package/core/radio/radio.props.d.ts +13 -0
- package/core/radio/radio.props.js +1 -0
- package/core/radio/radio.styles.d.ts +19 -0
- package/core/radio/radio.styles.js +44 -0
- package/core/radio/size.d.ts +4 -0
- package/core/radio/size.js +4 -0
- package/core/radio-group/index.d.ts +2 -0
- package/core/radio-group/index.js +1 -0
- package/core/radio-group/radio-group.component.d.ts +3 -0
- package/core/radio-group/radio-group.component.js +48 -0
- package/core/radio-group/radio-group.props.d.ts +15 -0
- package/core/radio-group/radio-group.props.js +1 -0
- package/core/radio-group/radio-group.styles.d.ts +14 -0
- package/core/radio-group/radio-group.styles.js +30 -0
- package/core/switcher/index.d.ts +3 -0
- package/core/switcher/index.js +2 -0
- package/core/switcher/switcher-size.d.ts +5 -0
- package/core/switcher/switcher-size.js +5 -0
- package/core/switcher/switcher.component.d.ts +3 -0
- package/core/switcher/switcher.component.js +54 -0
- package/core/switcher/switcher.mixin.d.ts +21 -0
- package/core/switcher/switcher.mixin.js +17 -0
- package/core/switcher/switcher.props.d.ts +14 -0
- package/core/switcher/switcher.props.js +1 -0
- package/core/switcher/switcher.styles.d.ts +27 -0
- package/core/switcher/switcher.styles.js +54 -0
- package/core/switcher/switcher.utils.d.ts +4 -0
- package/core/switcher/switcher.utils.js +37 -0
- package/core/switcher-group/index.d.ts +2 -0
- package/core/switcher-group/index.js +1 -0
- package/core/switcher-group/switcher-group.component.d.ts +3 -0
- package/core/switcher-group/switcher-group.component.js +41 -0
- package/core/switcher-group/switcher-group.props.d.ts +13 -0
- package/core/switcher-group/switcher-group.props.js +1 -0
- package/core/switcher-group/switcher-group.styles.d.ts +10 -0
- package/core/switcher-group/switcher-group.styles.js +30 -0
- package/core/tab/index.d.ts +2 -0
- package/core/tab/index.js +1 -0
- package/core/tab/tab.component.d.ts +6 -0
- package/core/tab/tab.component.js +52 -0
- package/core/tab/tab.mixin.d.ts +11 -0
- package/core/tab/tab.mixin.js +15 -0
- package/core/tab/tab.props.d.ts +15 -0
- package/core/tab/tab.props.js +1 -0
- package/core/tab/tab.styles.d.ts +26 -0
- package/core/tab/tab.styles.js +61 -0
- package/core/tab/types/index.d.ts +1 -0
- package/core/tab/types/index.js +1 -0
- package/core/tab/types/size.d.ts +5 -0
- package/core/tab/types/size.js +5 -0
- package/core/tab-panel/index.d.ts +2 -0
- package/core/tab-panel/index.js +1 -0
- package/core/tab-panel/tab-panel.component.d.ts +3 -0
- package/core/tab-panel/tab-panel.component.js +18 -0
- package/core/tab-panel/tab-panel.props.d.ts +6 -0
- package/core/tab-panel/tab-panel.props.js +1 -0
- package/core/tab-panel/tab-panel.styles.d.ts +6 -0
- package/core/tab-panel/tab-panel.styles.js +12 -0
- package/core/upload-input/index.d.ts +2 -0
- package/core/upload-input/index.js +1 -0
- package/core/upload-input/upload-input.component.d.ts +3 -0
- package/core/upload-input/upload-input.component.js +68 -0
- package/core/upload-input/upload-input.props.d.ts +9 -0
- package/core/upload-input/upload-input.props.js +1 -0
- package/core/upload-input/upload-input.styles.d.ts +11 -0
- package/core/upload-input/upload-input.styles.js +53 -0
- package/hooks/README.md +26 -0
- package/hooks/use-controlled.d.ts +1 -0
- package/hooks/use-controlled.js +20 -0
- package/hooks/use-debounce.d.ts +2 -0
- package/hooks/use-debounce.js +19 -0
- package/hooks/use-drag.d.ts +5 -0
- package/hooks/use-drag.js +37 -0
- package/hooks/use-enhanced-effect.d.ts +3 -0
- package/hooks/use-enhanced-effect.js +3 -0
- package/hooks/use-event-callback.d.ts +4 -0
- package/hooks/use-event-callback.js +19 -0
- package/hooks/use-pagination.d.ts +3 -0
- package/hooks/use-pagination.js +106 -0
- package/hooks/use-portal.d.ts +14 -0
- package/hooks/use-portal.js +75 -0
- package/package.json +63 -0
- package/theme/README.md +46 -0
- package/theme/entity/index.d.ts +1 -0
- package/theme/entity/index.js +1 -0
- package/theme/entity/theme.d.ts +34 -0
- package/theme/hooks/index.d.ts +2 -0
- package/theme/hooks/index.js +2 -0
- package/theme/hooks/use-media-query.d.ts +1 -0
- package/theme/hooks/use-media-query.js +27 -0
- package/theme/hooks/use-theme.d.ts +2 -0
- package/theme/hooks/use-theme.js +4 -0
- package/theme/index.d.ts +3 -0
- package/theme/index.js +1 -0
- package/theme/roots/breakpoints/entity/breakpoints-map.d.ts +8 -0
- package/theme/roots/breakpoints/entity/breakpoints.d.ts +73 -0
- package/theme/roots/breakpoints/entity/create-breakpoints.d.ts +3 -0
- package/theme/roots/breakpoints/entity/create-breakpoints.js +65 -0
- package/theme/roots/breakpoints/entity/default-breakpoints.d.ts +26 -0
- package/theme/roots/breakpoints/entity/default-breakpoints.js +22 -0
- package/theme/roots/breakpoints/entity/index.d.ts +3 -0
- package/theme/roots/breakpoints/entity/index.js +2 -0
- package/theme/roots/breakpoints/index.d.ts +3 -0
- package/theme/roots/breakpoints/index.js +1 -0
- package/theme/roots/common-styles.d.ts +2 -0
- package/theme/roots/common-styles.js +6 -0
- package/theme/roots/index.d.ts +2 -0
- package/theme/roots/index.js +2 -0
- package/theme/roots/palette/entity/colors-map.d.ts +4 -0
- package/theme/roots/palette/entity/default-palette.d.ts +282 -0
- package/theme/roots/palette/entity/default-palette.js +22 -0
- package/theme/roots/palette/entity/index.d.ts +2 -0
- package/theme/roots/palette/entity/index.js +2 -0
- package/theme/roots/palette/index.d.ts +2 -0
- package/theme/roots/palette/index.js +1 -0
- package/theme/roots/shadows/entity/default-shadows.d.ts +16 -0
- package/theme/roots/shadows/entity/default-shadows.js +5 -0
- package/theme/roots/shadows/entity/index.d.ts +2 -0
- package/theme/roots/shadows/entity/index.js +2 -0
- package/theme/roots/shadows/entity/shadows-map.d.ts +4 -0
- package/theme/roots/shadows/index.d.ts +2 -0
- package/theme/roots/shadows/index.js +1 -0
- package/theme/roots/shape/index.d.ts +1 -0
- package/theme/roots/shape/index.js +1 -0
- package/theme/roots/shape/shape.props.d.ts +5 -0
- package/theme/roots/shape/shape.props.js +1 -0
- package/theme/roots/typography/entity/default-typography.d.ts +398 -0
- package/theme/roots/typography/entity/default-typography.js +237 -0
- package/theme/roots/typography/entity/index.d.ts +1 -0
- package/theme/roots/typography/entity/index.js +1 -0
- package/theme/roots/typography/index.d.ts +3 -0
- package/theme/roots/typography/index.js +2 -0
- package/theme/roots/typography/typography.component.d.ts +2 -0
- package/theme/roots/typography/typography.component.js +7 -0
- package/theme/roots/typography/typography.props.d.ts +15 -0
- package/theme/roots/typography/typography.props.js +1 -0
- package/theme/theme-provider/index.d.ts +2 -0
- package/theme/theme-provider/index.js +1 -0
- package/theme/theme-provider/theme-provider.context.d.ts +4 -0
- package/theme/theme-provider/theme-provider.context.js +48 -0
- package/theme/theme-provider/theme-provider.props.d.ts +6 -0
- package/theme/theme-provider/theme-provider.props.js +1 -0
- package/theme/theme.css +100 -0
- package/tsconfig.json +22 -0
- package/utils/README.md +11 -0
- package/utils/functions/apply-display-names.d.ts +6 -0
- package/utils/functions/apply-display-names.js +12 -0
- package/utils/functions/apply-polymorphic-function-prop.d.ts +6 -0
- package/utils/functions/apply-polymorphic-function-prop.js +11 -0
- package/utils/functions/color-picker/color-converters.d.ts +11 -0
- package/utils/functions/color-picker/color-converters.js +159 -0
- package/utils/functions/color-picker/map-number.d.ts +1 -0
- package/utils/functions/color-picker/map-number.js +3 -0
- package/utils/functions/color-picker/restrict-number.d.ts +1 -0
- package/utils/functions/color-picker/restrict-number.js +8 -0
- package/utils/functions/convert-to-string.d.ts +1 -0
- package/utils/functions/convert-to-string.js +3 -0
- package/utils/functions/escape-regexp.d.ts +1 -0
- package/utils/functions/escape-regexp.js +3 -0
- package/utils/functions/generate-class-names.d.ts +1 -0
- package/utils/functions/generate-class-names.js +22 -0
- package/utils/functions/get-elem-document-coords.d.ts +6 -0
- package/utils/functions/get-elem-document-coords.js +21 -0
- package/utils/functions/ignore-event.d.ts +1 -0
- package/utils/functions/ignore-event.js +9 -0
- package/utils/functions/index.d.ts +14 -0
- package/utils/functions/index.js +15 -0
- package/utils/functions/intrinsic-component.d.ts +0 -0
- package/utils/functions/intrinsic-component.js +28 -0
- package/utils/functions/object-keys.d.ts +6 -0
- package/utils/functions/object-keys.js +6 -0
- package/utils/functions/object-values.d.ts +7 -0
- package/utils/functions/object-values.js +6 -0
- package/utils/functions/on-click-by-mouse-down.d.ts +2 -0
- package/utils/functions/on-click-by-mouse-down.js +9 -0
- package/utils/functions/scrollbar.d.ts +2 -0
- package/utils/functions/scrollbar.js +6 -0
- package/utils/functions/set-ref.d.ts +8 -0
- package/utils/functions/set-ref.js +13 -0
- package/utils/functions/shadcn-utils.d.ts +2 -0
- package/utils/functions/shadcn-utils.js +8 -0
- package/utils/functions/slider/utils.d.ts +47 -0
- package/utils/functions/slider/utils.js +124 -0
- package/utils/functions/use-fork-ref.d.ts +2 -0
- package/utils/functions/use-fork-ref.js +18 -0
- package/utils/types/color/icon-button-color.d.ts +5 -0
- package/utils/types/color/icon-button-color.js +5 -0
- package/utils/types/color/index.d.ts +2 -0
- package/utils/types/color/index.js +2 -0
- package/utils/types/color/input-background-color.d.ts +4 -0
- package/utils/types/color/input-background-color.js +4 -0
- package/utils/types/css/align.d.ts +11 -0
- package/utils/types/css/align.js +11 -0
- package/utils/types/css/breakpoint.d.ts +18 -0
- package/utils/types/css/breakpoint.js +18 -0
- package/utils/types/css/direction.d.ts +8 -0
- package/utils/types/css/direction.js +4 -0
- package/utils/types/css/index.d.ts +4 -0
- package/utils/types/css/index.js +4 -0
- package/utils/types/css/position.d.ts +6 -0
- package/utils/types/css/position.js +6 -0
- package/utils/types/index.d.ts +8 -0
- package/utils/types/index.js +3 -0
- package/utils/types/intrinsic-component.d.ts +1 -0
- package/utils/types/keys.d.ts +4 -0
- package/utils/types/palette/color.d.ts +133 -0
- package/utils/types/palette/color.js +133 -0
- package/utils/types/palette/index.d.ts +1 -0
- package/utils/types/palette/index.js +1 -0
- package/utils/types/position/index.d.ts +1 -0
- package/utils/types/position/index.js +1 -0
- package/utils/types/position/position.d.ts +6 -0
- package/utils/types/position/position.js +6 -0
- package/utils/types/prop-types/index.d.ts +1 -0
- package/utils/types/prop-types/index.js +1 -0
- package/utils/types/prop-types/record.d.ts +1 -0
- package/utils/types/prop-types/record.js +6 -0
- package/utils/types/shadows/index.d.ts +1 -0
- package/utils/types/shadows/index.js +1 -0
- package/utils/types/shadows/shadows.d.ts +14 -0
- package/utils/types/shadows/shadows.js +14 -0
- package/utils/types/shape/border-radius-size.d.ts +5 -0
- package/utils/types/shape/border-radius-size.js +5 -0
- package/utils/types/shape/index.d.ts +1 -0
- package/utils/types/shape/index.js +1 -0
- package/utils/types/size/index.d.ts +1 -0
- package/utils/types/size/index.js +1 -0
- package/utils/types/size/input-size.d.ts +4 -0
- package/utils/types/size/input-size.js +4 -0
- package/utils/types/stylable-component.d.ts +7 -0
- package/utils/types/typography/font-variant.d.ts +58 -0
- package/utils/types/typography/font-variant.js +58 -0
- package/utils/types/typography/font-weight.d.ts +11 -0
- package/utils/types/typography/font-weight.js +11 -0
- package/utils/types/typography/index.d.ts +4 -0
- package/utils/types/typography/index.js +4 -0
- package/utils/types/typography/text-align.d.ts +5 -0
- package/utils/types/typography/text-align.js +5 -0
- package/utils/types/typography/text-decoration.d.ts +5 -0
- package/utils/types/typography/text-decoration.js +5 -0
- package/utils/types/values.d.ts +4 -0
- package/utils/types/with.d.ts +4 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["className", "children", "size", "startIcon", "endIcon", "variant", "loading", "asChild", "disabled"];
|
|
5
|
+
var _buttonVariantOptions;
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
8
|
+
import EndIcon from '@scaleflex/ui-tw/core/button/components/end-icon';
|
|
9
|
+
import StartIcon, { startIconVariants } from '@scaleflex/ui-tw/core/button/components/start-icon';
|
|
10
|
+
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
11
|
+
import { cva } from 'class-variance-authority';
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { ButtonSize, ButtonVariant } from './button.types';
|
|
14
|
+
import { getIconSize, isLinkBasicVariant } from './button.utils';
|
|
15
|
+
var buttonVariantOptions = (_buttonVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.Primary, 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-primary/90 hover:text-primary-foreground'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-secondary-foreground hover:text-secondary-foreground/80 hover:border-secondary-foreground/80'), ButtonVariant.LinkPrimary, 'text-primary hover:text-primary/80'), ButtonVariant.LinkSecondary, 'text-secondary-foreground hover:text-secondary-foreground/80'), ButtonVariant.LinkBasicPrimary, 'text-primary hover:text-primary/80 font-normal'), ButtonVariant.LinkBasicSecondary, 'text-secondary-foreground font-normal hover:text-secondary-foreground/80'), ButtonVariant.LinkError, 'text-destructive hover:text-destructive/80'), ButtonVariant.LinkWarning, 'text-warning hover:text-warning/80'), ButtonVariant.ErrorPrimary, 'bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/90'), _defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.ErrorOutline, 'border bg-background text-secondary-foreground shadow-xs border-secondary-foreground hover:bg-destructive hover:text-primary-foreground hover:border-transparent hover:border-destructive'), ButtonVariant.WarningPrimary, 'bg-warning text-primary-foreground shadow-xs hover:bg-warning/90'), ButtonVariant.WarningOutline, 'border bg-background text-secondary-foreground shadow-xs border-secondary-foreground hover:bg-warning hover:text-primary-foreground hover:border-transparent hover:border-warning'));
|
|
16
|
+
var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-sm'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg');
|
|
17
|
+
var buttonVariants = cva("cursor-pointer inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
18
|
+
variants: {
|
|
19
|
+
variant: buttonVariantOptions,
|
|
20
|
+
size: buttonSizeOptions
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: ButtonVariant.Primary,
|
|
24
|
+
size: ButtonSize.Md
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
function Button(_ref) {
|
|
28
|
+
var className = _ref.className,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
_ref$size = _ref.size,
|
|
31
|
+
size = _ref$size === void 0 ? ButtonSize.Md : _ref$size,
|
|
32
|
+
startIcon = _ref.startIcon,
|
|
33
|
+
endIcon = _ref.endIcon,
|
|
34
|
+
_ref$variant = _ref.variant,
|
|
35
|
+
variant = _ref$variant === void 0 ? ButtonVariant.Primary : _ref$variant,
|
|
36
|
+
_ref$loading = _ref.loading,
|
|
37
|
+
loading = _ref$loading === void 0 ? false : _ref$loading,
|
|
38
|
+
_ref$asChild = _ref.asChild,
|
|
39
|
+
asChild = _ref$asChild === void 0 ? false : _ref$asChild,
|
|
40
|
+
_ref$disabled = _ref.disabled,
|
|
41
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
42
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
var Comp = asChild ? Slot : 'button';
|
|
44
|
+
return /*#__PURE__*/React.createElement(Comp, _extends({
|
|
45
|
+
"data-slot": "button",
|
|
46
|
+
className: cn(buttonVariants({
|
|
47
|
+
variant: variant,
|
|
48
|
+
size: size,
|
|
49
|
+
className: className
|
|
50
|
+
}), loading && 'pointer-events-none opacity-50', isLinkBasicVariant(variant) && 'font-normal'),
|
|
51
|
+
disabled: disabled
|
|
52
|
+
}, rest), startIcon || endIcon || loading ? /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
className: "flex items-center"
|
|
54
|
+
}, startIcon && /*#__PURE__*/React.createElement(StartIcon, {
|
|
55
|
+
size: size,
|
|
56
|
+
loading: loading,
|
|
57
|
+
icon: startIcon
|
|
58
|
+
}), loading && !startIcon && /*#__PURE__*/React.createElement("span", {
|
|
59
|
+
className: startIconVariants({
|
|
60
|
+
size: size
|
|
61
|
+
})
|
|
62
|
+
}, /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
63
|
+
size: getIconSize(size),
|
|
64
|
+
className: "animate-spin"
|
|
65
|
+
})), children, endIcon && /*#__PURE__*/React.createElement(EndIcon, {
|
|
66
|
+
size: size,
|
|
67
|
+
icon: endIcon
|
|
68
|
+
})) : children);
|
|
69
|
+
}
|
|
70
|
+
export { buttonVariants };
|
|
71
|
+
export default Button;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
+
import { buttonVariants } from '@scaleflex/ui-tw/core/button/button.component';
|
|
3
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
5
|
+
export declare const ButtonVariant: {
|
|
6
|
+
readonly Primary: "primary";
|
|
7
|
+
readonly Secondary: "secondary";
|
|
8
|
+
readonly Outline: "outline";
|
|
9
|
+
readonly LinkPrimary: "link-primary";
|
|
10
|
+
readonly LinkSecondary: "link-secondary";
|
|
11
|
+
readonly LinkBasicPrimary: "link-basic-primary";
|
|
12
|
+
readonly LinkBasicSecondary: "link-basic-secondary";
|
|
13
|
+
readonly LinkError: "link-error";
|
|
14
|
+
readonly LinkWarning: "link-warning";
|
|
15
|
+
readonly ErrorPrimary: "error-primary";
|
|
16
|
+
readonly ErrorOutline: "error-outline";
|
|
17
|
+
readonly WarningPrimary: "warning-primary";
|
|
18
|
+
readonly WarningOutline: "warning-outline";
|
|
19
|
+
};
|
|
20
|
+
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
21
|
+
asChild?: boolean;
|
|
22
|
+
startIcon?: ReactNode | ((props: IconProps) => ReactNode);
|
|
23
|
+
endIcon?: ReactNode | ((props: IconProps) => ReactNode);
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const ButtonSize: {
|
|
28
|
+
readonly Xs: "xs";
|
|
29
|
+
readonly Sm: "sm";
|
|
30
|
+
readonly Md: "md";
|
|
31
|
+
readonly Lg: "lg";
|
|
32
|
+
};
|
|
33
|
+
export type ButtonSizeType = (typeof ButtonSize)[keyof typeof ButtonSize];
|
|
34
|
+
export type ButtonVariantType = (typeof ButtonVariant)[keyof typeof ButtonVariant];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var ButtonVariant = {
|
|
2
|
+
Primary: 'primary',
|
|
3
|
+
Secondary: 'secondary',
|
|
4
|
+
Outline: 'outline',
|
|
5
|
+
LinkPrimary: 'link-primary',
|
|
6
|
+
LinkSecondary: 'link-secondary',
|
|
7
|
+
LinkBasicPrimary: 'link-basic-primary',
|
|
8
|
+
LinkBasicSecondary: 'link-basic-secondary',
|
|
9
|
+
LinkError: 'link-error',
|
|
10
|
+
LinkWarning: 'link-warning',
|
|
11
|
+
ErrorPrimary: 'error-primary',
|
|
12
|
+
ErrorOutline: 'error-outline',
|
|
13
|
+
WarningPrimary: 'warning-primary',
|
|
14
|
+
WarningOutline: 'warning-outline'
|
|
15
|
+
};
|
|
16
|
+
export var ButtonSize = {
|
|
17
|
+
Xs: 'xs',
|
|
18
|
+
Sm: 'sm',
|
|
19
|
+
Md: 'md',
|
|
20
|
+
Lg: 'lg'
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ButtonSize, ButtonVariant } from '@scaleflex/ui-tw/core/button/button.types';
|
|
2
|
+
export var getIconSize = function getIconSize(sizeName) {
|
|
3
|
+
switch (sizeName) {
|
|
4
|
+
case ButtonSize.Lg:
|
|
5
|
+
return 18;
|
|
6
|
+
case ButtonSize.Md:
|
|
7
|
+
return 16;
|
|
8
|
+
case ButtonSize.Sm:
|
|
9
|
+
return 14;
|
|
10
|
+
case ButtonSize.Xs:
|
|
11
|
+
return 12;
|
|
12
|
+
default:
|
|
13
|
+
return 16;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export var isLinkBasicVariant = function isLinkBasicVariant(variant) {
|
|
17
|
+
return variant === ButtonVariant.LinkBasicPrimary || variant === ButtonVariant.LinkBasicSecondary;
|
|
18
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import React, { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
declare const endIconVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "xs" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
interface EndIconProps extends ComponentProps<'span'>, VariantProps<typeof endIconVariants> {
|
|
7
|
+
icon?: ReactNode | ((props: {
|
|
8
|
+
size: number;
|
|
9
|
+
}) => ReactNode);
|
|
10
|
+
}
|
|
11
|
+
declare const EndIcon: (props: EndIconProps) => React.JSX.Element;
|
|
12
|
+
export default EndIcon;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["size", "icon"];
|
|
5
|
+
import { ButtonSize } from '@scaleflex/ui-tw/core/button';
|
|
6
|
+
import { getIconSize } from '@scaleflex/ui-tw/core/button/button.utils';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
import React, { useMemo } from 'react';
|
|
9
|
+
var endIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-0.5'), ButtonSize.Sm, 'ml-1'), ButtonSize.Md, 'ml-1.5'), ButtonSize.Lg, 'ml-2');
|
|
10
|
+
var endIconVariants = cva('flex', {
|
|
11
|
+
variants: {
|
|
12
|
+
size: endIconSizes
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: ButtonSize.Md
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var EndIcon = function EndIcon(props) {
|
|
19
|
+
var size = props.size,
|
|
20
|
+
icon = props.icon,
|
|
21
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
22
|
+
var iconSize = useMemo(function () {
|
|
23
|
+
return getIconSize(size);
|
|
24
|
+
}, [size]);
|
|
25
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
26
|
+
className: endIconVariants({
|
|
27
|
+
size: size
|
|
28
|
+
})
|
|
29
|
+
}, rest), typeof icon === 'function' ? icon({
|
|
30
|
+
size: iconSize
|
|
31
|
+
}) : icon);
|
|
32
|
+
};
|
|
33
|
+
export default EndIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import React, { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
declare const startIconVariants: (props?: ({
|
|
4
|
+
size?: "sm" | "md" | "xs" | "lg" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
+
interface StartIconProps extends ComponentProps<'span'>, VariantProps<typeof startIconVariants> {
|
|
7
|
+
icon?: ReactNode | ((props: {
|
|
8
|
+
size: number;
|
|
9
|
+
}) => ReactNode);
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const StartIcon: (props: StartIconProps) => React.JSX.Element;
|
|
13
|
+
export { startIconVariants };
|
|
14
|
+
export default StartIcon;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _excluded = ["size", "icon", "loading"];
|
|
5
|
+
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
6
|
+
import { ButtonSize } from '@scaleflex/ui-tw/core/button';
|
|
7
|
+
import { getIconSize } from '@scaleflex/ui-tw/core/button/button.utils';
|
|
8
|
+
import { cva } from 'class-variance-authority';
|
|
9
|
+
import React, { useMemo } from 'react';
|
|
10
|
+
var startIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-0.5'), ButtonSize.Sm, 'mr-1'), ButtonSize.Md, 'mr-1.5'), ButtonSize.Lg, 'mr-2');
|
|
11
|
+
var startIconVariants = cva('flex', {
|
|
12
|
+
variants: {
|
|
13
|
+
size: startIconSizes
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: ButtonSize.Md
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var StartIcon = function StartIcon(props) {
|
|
20
|
+
var size = props.size,
|
|
21
|
+
icon = props.icon,
|
|
22
|
+
_props$loading = props.loading,
|
|
23
|
+
loading = _props$loading === void 0 ? false : _props$loading,
|
|
24
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
var iconSize = useMemo(function () {
|
|
26
|
+
return getIconSize(size);
|
|
27
|
+
}, [size]);
|
|
28
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
29
|
+
className: startIconVariants({
|
|
30
|
+
size: size
|
|
31
|
+
})
|
|
32
|
+
}, rest), loading ? /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
33
|
+
size: iconSize,
|
|
34
|
+
className: "animate-spin"
|
|
35
|
+
}) : typeof icon === 'function' ? icon({
|
|
36
|
+
size: iconSize
|
|
37
|
+
}) : icon);
|
|
38
|
+
};
|
|
39
|
+
export { startIconVariants };
|
|
40
|
+
export default StartIcon;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["size", "type", "checked", "onChange", "checkBoxProps", "readOnly", "disabled", "ref"];
|
|
4
|
+
import Intermediate from '@scaleflex/icons-tw/intermediate';
|
|
5
|
+
import Tick from '@scaleflex/icons-tw/tick';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { lightPalette } from '../../theme/roots/palette';
|
|
8
|
+
import { ignoreEvent } from '../../utils/functions';
|
|
9
|
+
import { cn } from '../../utils/functions/shadcn-utils';
|
|
10
|
+
import { Color } from '../../utils/types/palette';
|
|
11
|
+
import { getCheckboxIconSize } from './check-box.utils';
|
|
12
|
+
import { Size, Type } from './types';
|
|
13
|
+
var CheckBox = function CheckBox(_ref) {
|
|
14
|
+
var _ref$size = _ref.size,
|
|
15
|
+
size = _ref$size === void 0 ? Size.Md : _ref$size,
|
|
16
|
+
_ref$type = _ref.type,
|
|
17
|
+
type = _ref$type === void 0 ? Type.Checkbox : _ref$type,
|
|
18
|
+
_ref$checked = _ref.checked,
|
|
19
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
20
|
+
onChange = _ref.onChange,
|
|
21
|
+
checkBoxProps = _ref.checkBoxProps,
|
|
22
|
+
_ref$readOnly = _ref.readOnly,
|
|
23
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
24
|
+
_ref$disabled = _ref.disabled,
|
|
25
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
26
|
+
ref = _ref.ref,
|
|
27
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var getIcon = function getIcon(props) {
|
|
29
|
+
switch (type) {
|
|
30
|
+
case Type.Checkbox:
|
|
31
|
+
return /*#__PURE__*/React.createElement(Tick, props);
|
|
32
|
+
case Type.Intermediate:
|
|
33
|
+
return /*#__PURE__*/React.createElement(Intermediate, props);
|
|
34
|
+
default:
|
|
35
|
+
return /*#__PURE__*/React.createElement(Tick, props);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
39
|
+
var ownTransitionClasses = 'transition-all duration-100 ease-out';
|
|
40
|
+
var checkBoxWrapperClasses = cn('relative flex items-center justify-center border-1 border-solid border-borders-secondary', "".concat(checked ? 'bg-accent-primary border-accent-primary' : 'bg-background-stateless border-borders-primary-stateless'), "".concat(size === Size.Sm ? 'min-h-4 max-h-4 min-w-4 max-w-4' : ''), "".concat(size === Size.Md ? 'min-h-5 max-h-5 min-w-5 max-w-5' : ''), "".concat(disabled ? 'border-1 border-solid' : ''), "".concat(disabled ? checked ? 'bg-accent-2-8-Opacity border-transparent' : 'bg-background-active border-borders-secondary' : ''), cursorStyleClasses, ownTransitionClasses);
|
|
41
|
+
var inputClasses = cn('peer absolute top-0 left-0 z-1 m-0 h-full w-full p-0 opacity-0', cursorStyleClasses);
|
|
42
|
+
var unCheckedIconClasses = cn('flex opacity-0', "".concat(disabled ? '' : 'peer-hover:opacity-100'), ownTransitionClasses);
|
|
43
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
44
|
+
className: checkBoxWrapperClasses,
|
|
45
|
+
ref: ref
|
|
46
|
+
}, rest), /*#__PURE__*/React.createElement("input", _extends({
|
|
47
|
+
type: "checkbox",
|
|
48
|
+
className: inputClasses,
|
|
49
|
+
checked: checked,
|
|
50
|
+
disabled: disabled,
|
|
51
|
+
onChange: readOnly || disabled ? ignoreEvent : onChange
|
|
52
|
+
}, checkBoxProps)), checked ? getIcon({
|
|
53
|
+
size: getCheckboxIconSize(size),
|
|
54
|
+
color: lightPalette[Color.ButtonPrimaryText]
|
|
55
|
+
}) : /*#__PURE__*/React.createElement("span", {
|
|
56
|
+
className: unCheckedIconClasses
|
|
57
|
+
}, getIcon({
|
|
58
|
+
size: getCheckboxIconSize(size),
|
|
59
|
+
color: lightPalette[Color.Accent_4_0_Opacity]
|
|
60
|
+
})));
|
|
61
|
+
};
|
|
62
|
+
export default CheckBox;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
import { Size } from './types';
|
|
4
|
+
export var sizeCheckboxMixin = _defineProperty(_defineProperty({}, Size.Sm, function () {
|
|
5
|
+
return css(["min-height:16px;max-height:16px;min-width:16px;max-width:16px;"]);
|
|
6
|
+
}), Size.Md, function () {
|
|
7
|
+
return css(["min-height:20px;max-height:20px;min-width:20px;max-width:20px;"]);
|
|
8
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ChangeEvent, Ref } from 'react';
|
|
2
|
+
import type { Values } from '../../utils/types';
|
|
3
|
+
import { Size, Type } from './types';
|
|
4
|
+
export type CheckBoxSizeType = Values<typeof Size>;
|
|
5
|
+
export type CheckBoxType = Values<typeof Type>;
|
|
6
|
+
export interface CheckBoxProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
9
|
+
checkBoxProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
size?: CheckBoxSizeType;
|
|
13
|
+
type?: CheckBoxType;
|
|
14
|
+
ref?: Ref<HTMLSpanElement>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CheckBoxProps, CheckBoxSizeType } from './check-box.props';
|
|
2
|
+
declare const Styled: {
|
|
3
|
+
CheckBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
5
|
+
}>, never>, {
|
|
6
|
+
$size: CheckBoxSizeType;
|
|
7
|
+
checked: boolean;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
} & {
|
|
10
|
+
theme: import("styled-components").DefaultTheme;
|
|
11
|
+
}>> & string;
|
|
12
|
+
Input: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
|
|
13
|
+
ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
|
|
14
|
+
}>, never>, never>> & string;
|
|
15
|
+
UnCheckedIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
16
|
+
ref?: ((instance: HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
17
|
+
}>, never>, CheckBoxProps>> & string;
|
|
18
|
+
};
|
|
19
|
+
export default Styled;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { applyDisplayNames, generateClassNames } from '../../utils/functions';
|
|
3
|
+
import { Color as PColor } from '../../utils/types/palette';
|
|
4
|
+
import { sizeCheckboxMixin } from './check-box.mixin';
|
|
5
|
+
import { Size } from './types';
|
|
6
|
+
var baseClassName = 'CheckBox';
|
|
7
|
+
var Input = /*#__PURE__*/styled.input.attrs({
|
|
8
|
+
className: generateClassNames(baseClassName, 'Input'),
|
|
9
|
+
type: 'checkbox'
|
|
10
|
+
}).withConfig({
|
|
11
|
+
componentId: "sc-1cs9pmq-0"
|
|
12
|
+
})(function (_ref) {
|
|
13
|
+
var _ref$disabled = _ref.disabled,
|
|
14
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
15
|
+
return css(["position:absolute;top:0;left:0;width:100%;height:100%;margin:0;opacity:0;padding:0;cursor:", ";z-index:1;"], disabled ? 'default' : 'pointer');
|
|
16
|
+
});
|
|
17
|
+
var UnCheckedIcon = /*#__PURE__*/styled.span.attrs({
|
|
18
|
+
className: generateClassNames(baseClassName, 'icon')
|
|
19
|
+
}).withConfig({
|
|
20
|
+
componentId: "sc-1cs9pmq-1"
|
|
21
|
+
})(function () {
|
|
22
|
+
return css(["display:flex;opacity:0;transition:all 100ms ease-out;"]);
|
|
23
|
+
});
|
|
24
|
+
var CheckBox = /*#__PURE__*/styled.span.attrs({
|
|
25
|
+
className: generateClassNames(baseClassName, 'root')
|
|
26
|
+
}).withConfig({
|
|
27
|
+
componentId: "sc-1cs9pmq-2"
|
|
28
|
+
})(function (_ref2) {
|
|
29
|
+
var palette = _ref2.theme.palette,
|
|
30
|
+
_ref2$$size = _ref2.$size,
|
|
31
|
+
$size = _ref2$$size === void 0 ? Size.Sm : _ref2$$size,
|
|
32
|
+
checked = _ref2.checked,
|
|
33
|
+
_ref2$disabled = _ref2.disabled,
|
|
34
|
+
disabled = _ref2$disabled === void 0 ? false : _ref2$disabled;
|
|
35
|
+
return css(["position:relative;display:flex;align-items:center;justify-content:center;background:", ";border:1px solid ", ";border-radius:1px;outline:none;text-align:center;transition:all 100ms ease-out;cursor:", ";", " &:hover{", "{", "}}", ""], checked ? palette[PColor.AccentPrimary] : palette[PColor.BackgroundStateless], checked ? palette[PColor.AccentPrimary] : palette[PColor.BackgroundPrimaryStateless], disabled ? 'default' : 'pointer', sizeCheckboxMixin[$size], UnCheckedIcon, !disabled && css(["opacity:1;"]), disabled && css(["background:", ";border:1px solid ", ";"], checked ? palette[PColor.Accent_2_8_Opacity] : palette[PColor.BackgroundActive], checked ? 'transparent' : palette[PColor.BordersSecondary]));
|
|
36
|
+
});
|
|
37
|
+
var Styled = applyDisplayNames({
|
|
38
|
+
CheckBox: CheckBox,
|
|
39
|
+
Input: Input,
|
|
40
|
+
UnCheckedIcon: UnCheckedIcon
|
|
41
|
+
});
|
|
42
|
+
export default Styled;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Size } from './types';
|
|
2
|
+
export var getCheckboxIconSize = function getCheckboxIconSize(size) {
|
|
3
|
+
switch (size) {
|
|
4
|
+
case Size.Md:
|
|
5
|
+
return 14;
|
|
6
|
+
case Size.Sm:
|
|
7
|
+
return 10;
|
|
8
|
+
default:
|
|
9
|
+
return 10;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export var getCheckboxInfoIconSize = function getCheckboxInfoIconSize(size) {
|
|
13
|
+
switch (size) {
|
|
14
|
+
case Size.Md:
|
|
15
|
+
return 14;
|
|
16
|
+
case Size.Sm:
|
|
17
|
+
return 12;
|
|
18
|
+
default:
|
|
19
|
+
return 12;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './check-box.component';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CheckBoxGroupProps } from './check-box-group.props';
|
|
2
|
+
declare const CheckBoxGroup: ({ size, label, checkBoxProps, checkBoxGroupProps, readOnly, disabled, labelPosition, icon, checked, ref, ...rest }: CheckBoxGroupProps) => JSX.Element;
|
|
3
|
+
export default CheckBoxGroup;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["size", "label", "checkBoxProps", "checkBoxGroupProps", "readOnly", "disabled", "labelPosition", "icon", "checked", "ref"];
|
|
5
|
+
import React, { useRef, useState } from 'react';
|
|
6
|
+
import { lightPalette } from '../../theme/roots/palette';
|
|
7
|
+
import { cn } from '../../utils/functions/shadcn-utils';
|
|
8
|
+
import { Color } from '../../utils/types/palette';
|
|
9
|
+
import CheckBox from '../check-box';
|
|
10
|
+
import { getCheckboxInfoIconSize } from '../check-box/check-box.utils';
|
|
11
|
+
import { Size } from '../check-box/types';
|
|
12
|
+
import { LabelPosition } from './types';
|
|
13
|
+
var CheckBoxGroup = function CheckBoxGroup(_ref) {
|
|
14
|
+
var _ref$size = _ref.size,
|
|
15
|
+
size = _ref$size === void 0 ? Size.Sm : _ref$size,
|
|
16
|
+
label = _ref.label,
|
|
17
|
+
checkBoxProps = _ref.checkBoxProps,
|
|
18
|
+
checkBoxGroupProps = _ref.checkBoxGroupProps,
|
|
19
|
+
_ref$readOnly = _ref.readOnly,
|
|
20
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
21
|
+
_ref$disabled = _ref.disabled,
|
|
22
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
23
|
+
_ref$labelPosition = _ref.labelPosition,
|
|
24
|
+
labelPosition = _ref$labelPosition === void 0 ? LabelPosition.After : _ref$labelPosition,
|
|
25
|
+
icon = _ref.icon,
|
|
26
|
+
_ref$checked = _ref.checked,
|
|
27
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
28
|
+
ref = _ref.ref,
|
|
29
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
30
|
+
var textRef = useRef(null);
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
isEllipsisActive = _useState2[0],
|
|
34
|
+
setIsEllipsisActive = _useState2[1];
|
|
35
|
+
var getTextTooltip = function getTextTooltip() {
|
|
36
|
+
if (typeof label === 'string' && isEllipsisActive) {
|
|
37
|
+
return label;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var handleTextTooltip = function handleTextTooltip() {
|
|
41
|
+
if (textRef.current !== null && textRef.current) {
|
|
42
|
+
var _textRef$current, _textRef$current2;
|
|
43
|
+
setIsEllipsisActive((textRef === null || textRef === void 0 || (_textRef$current = textRef.current) === null || _textRef$current === void 0 ? void 0 : _textRef$current.offsetWidth) < (textRef === null || textRef === void 0 || (_textRef$current2 = textRef.current) === null || _textRef$current2 === void 0 ? void 0 : _textRef$current2.scrollWidth));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
|
|
47
|
+
var checkBoxGroupClasses = cn('relative inline-flex max-w-full items-center gap-1', cursorStyleClasses);
|
|
48
|
+
var labelWrapClasses = cn('inline-block flex gap-2 items-center overflow-hidden text-ellipsis whitespace-nowrap text-textprimary',
|
|
49
|
+
//TODO: add data about fonts from ${sizeCheckboxGroupMixin[size]}
|
|
50
|
+
cursorStyleClasses);
|
|
51
|
+
var labelTextClasses = "label-text ".concat(labelPosition === 'before' ? '-order-1' : '');
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
|
53
|
+
className: checkBoxGroupClasses,
|
|
54
|
+
ref: ref
|
|
55
|
+
}, checkBoxGroupProps, rest), /*#__PURE__*/React.createElement("label", {
|
|
56
|
+
key: "label",
|
|
57
|
+
title: getTextTooltip(),
|
|
58
|
+
onMouseOver: handleTextTooltip,
|
|
59
|
+
ref: textRef,
|
|
60
|
+
className: labelWrapClasses
|
|
61
|
+
}, /*#__PURE__*/React.createElement(CheckBox, {
|
|
62
|
+
checkBoxProps: checkBoxProps,
|
|
63
|
+
readOnly: readOnly,
|
|
64
|
+
disabled: disabled,
|
|
65
|
+
checked: checked,
|
|
66
|
+
size: size
|
|
67
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
68
|
+
className: labelTextClasses
|
|
69
|
+
}, label)), typeof icon === 'function' ? icon({
|
|
70
|
+
size: getCheckboxInfoIconSize(size),
|
|
71
|
+
color: lightPalette[Color.IconsSecondary]
|
|
72
|
+
}) : icon);
|
|
73
|
+
};
|
|
74
|
+
export default CheckBoxGroup;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { WithTheme } from '../../theme/entity';
|
|
2
|
+
export declare const sizeCheckboxGroupMixin: {
|
|
3
|
+
sm: ({ theme: { typography: { font }, }, }: WithTheme) => import("styled-components").CSSObject;
|
|
4
|
+
md: ({ theme: { typography: { font }, }, }: WithTheme) => import("styled-components").CSSObject;
|
|
5
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { FontVariant as FV } from '../../utils/types/typography';
|
|
3
|
+
import { Size } from '../check-box/types';
|
|
4
|
+
export var sizeCheckboxGroupMixin = _defineProperty(_defineProperty({}, Size.Sm, function (_ref) {
|
|
5
|
+
var font = _ref.theme.typography.font;
|
|
6
|
+
return font[FV.LabelMedium];
|
|
7
|
+
}), Size.Md, function (_ref2) {
|
|
8
|
+
var font = _ref2.theme.typography.font;
|
|
9
|
+
return font[FV.LabelLarge];
|
|
10
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import type { Values } from '../../utils/types';
|
|
4
|
+
import type { CheckBoxProps } from '../check-box';
|
|
5
|
+
import { CheckBoxSizeType, CheckBoxType } from '../check-box/check-box.props';
|
|
6
|
+
import { LabelPosition } from './types';
|
|
7
|
+
export type LabelPositionType = Values<typeof LabelPosition>;
|
|
8
|
+
export interface CheckBoxGroupProps extends CheckBoxProps {
|
|
9
|
+
label?: string;
|
|
10
|
+
checkBoxProps?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
11
|
+
checkBoxGroupProps?: React.LabelHTMLAttributes<HTMLLabelElement>;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
labelPosition?: LabelPositionType;
|
|
15
|
+
size?: CheckBoxSizeType;
|
|
16
|
+
type?: CheckBoxType;
|
|
17
|
+
icon?: React.ReactNode | ((props: IconProps) => React.ReactNode);
|
|
18
|
+
ref?: Ref<HTMLLabelElement>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|