@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,48 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import merge from 'lodash.merge';
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { ThemeProvider as SCThemeProvider } from 'styled-components';
|
|
7
|
+
import { applyPolymorphicFunctionProp } from '../../utils/functions';
|
|
8
|
+
import { BorderRadiusSize } from '../../utils/types/shape';
|
|
9
|
+
import { CommonStyles, Typography } from '../roots';
|
|
10
|
+
import createBreakpoints from '../roots/breakpoints/entity/create-breakpoints';
|
|
11
|
+
import { defaultPalette } from '../roots/palette';
|
|
12
|
+
import { defaultShadows } from '../roots/shadows';
|
|
13
|
+
import { getDefaultTypography } from '../roots/typography';
|
|
14
|
+
var defaultShape = {
|
|
15
|
+
borderRadius: _defineProperty(_defineProperty(_defineProperty({}, BorderRadiusSize.Sm, '2px'), BorderRadiusSize.Md, '4px'), BorderRadiusSize.Lg, '8px')
|
|
16
|
+
};
|
|
17
|
+
var ThemeProvider = function ThemeProvider(_ref) {
|
|
18
|
+
var children = _ref.children,
|
|
19
|
+
_ref$theme = _ref.theme,
|
|
20
|
+
theme = _ref$theme === void 0 ? {} : _ref$theme;
|
|
21
|
+
var _theme$palette = theme.palette,
|
|
22
|
+
paletteOverride = _theme$palette === void 0 ? {} : _theme$palette,
|
|
23
|
+
_theme$breakpoints = theme.breakpoints,
|
|
24
|
+
breakpointsOverride = _theme$breakpoints === void 0 ? {} : _theme$breakpoints,
|
|
25
|
+
_theme$typography = theme.typography,
|
|
26
|
+
typographyOverride = _theme$typography === void 0 ? {} : _theme$typography,
|
|
27
|
+
_theme$shape = theme.shape,
|
|
28
|
+
shapeOverride = _theme$shape === void 0 ? {} : _theme$shape,
|
|
29
|
+
_theme$shadows = theme.shadows,
|
|
30
|
+
shadowsOverride = _theme$shadows === void 0 ? {} : _theme$shadows;
|
|
31
|
+
var finalTheme = useMemo(function () {
|
|
32
|
+
var palette = _objectSpread(_objectSpread({}, defaultPalette), paletteOverride);
|
|
33
|
+
var breakpoints = createBreakpoints(breakpointsOverride);
|
|
34
|
+
var shadows = _objectSpread(_objectSpread({}, defaultShadows), shadowsOverride);
|
|
35
|
+
return {
|
|
36
|
+
palette: palette,
|
|
37
|
+
breakpoints: breakpoints,
|
|
38
|
+
typography: getDefaultTypography(typographyOverride),
|
|
39
|
+
shape: _objectSpread({}, merge(_objectSpread({}, defaultShape), _objectSpread({}, shapeOverride))),
|
|
40
|
+
shadows: shadows
|
|
41
|
+
};
|
|
42
|
+
}, [JSON.stringify(theme)]);
|
|
43
|
+
var renderedChildren = applyPolymorphicFunctionProp(children, finalTheme);
|
|
44
|
+
return /*#__PURE__*/React.createElement(SCThemeProvider, {
|
|
45
|
+
theme: finalTheme
|
|
46
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, renderedChildren, /*#__PURE__*/React.createElement(CommonStyles, null), /*#__PURE__*/React.createElement(Typography, null)));
|
|
47
|
+
};
|
|
48
|
+
export default ThemeProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/theme/theme.css
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@import "tw-animate-css";
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
--background: oklch(1 0 0); /* Background stateless #ffffff */
|
|
6
|
+
--foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
7
|
+
--card: oklch(1 0 0); /* Background hover F9FBFC */
|
|
8
|
+
--card-foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
9
|
+
--popover: oklch(1 0 0); /* Background stateless #ffffff */
|
|
10
|
+
--popover-foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
11
|
+
--primary: oklch(0.6662 0.2007 280.88); /* Accent Stateless #6879EB */
|
|
12
|
+
--primary-foreground: oklch(1 0 0); /* Text Button Primary #ffffff */
|
|
13
|
+
--secondary: oklch(98.16% 0.002 247.84); /* Background active #F8F9FA */
|
|
14
|
+
--secondary-foreground: oklch(53.03% 0.039 249.89);
|
|
15
|
+
--muted: oklch(0.95 0.01 285); /* Background active #F3F7FA */
|
|
16
|
+
--muted-foreground: oklch(68.54% 0.033 249.82);
|
|
17
|
+
--accent: oklch(0.9641 0.0065 231.29); /* Background active #F3F7FA */
|
|
18
|
+
--accent-foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
19
|
+
--success: oklch(0.7487 0.1799 154.83); /* #26C17A */
|
|
20
|
+
--success-foreground: oklch(0.4238 0.1235 165.45); /* #006D3B */
|
|
21
|
+
--destructive: oklch(0.6291 0.2616 26.16); /* #FB2C36 */
|
|
22
|
+
--destructive-foreground: oklch(0.3963 0.1994 27.40); /* #82181A */
|
|
23
|
+
--info: oklch(0.6632 0.1896 241.34); /* #0090E4 */
|
|
24
|
+
--info-foreground: oklch(0.3902 0.1177 248.61); /* #024A71 */
|
|
25
|
+
--warning: oklch(0.7963 0.2226 83.96); /* #F6A609 */
|
|
26
|
+
--warning-foreground: oklch(0.4429 0.1617 63.95); /* #733E0A */
|
|
27
|
+
--border: oklch(92.86% 0.009 247.92); /* Borders Secondary #E3E8ED */
|
|
28
|
+
--input: oklch(0.8625 0.0257 248.73); /* Border Primary Stateless #CCD6DE */
|
|
29
|
+
--ring: oklch(0.6662 0.2007 280.88); /* Borders Base #6879EB */
|
|
30
|
+
--shadow: oklch(26.18% 0.024 256.43 / 0.1);
|
|
31
|
+
--chart-1: oklch(0.646 0.222 41.116); /* Chart 1 - Orange/Yellow Base - approx #DA9834 */
|
|
32
|
+
--chart-2: oklch(0.6 0.118 184.704); /* Chart 2 - Teal/Greenish-Blue Base - approx #4BA3AD */
|
|
33
|
+
--chart-3: oklch(0.398 0.07 227.392); /* Chart 3 - Muted Blue Base - approx #435C9A */
|
|
34
|
+
--chart-4: oklch(0.828 0.189 84.429); /* Chart 4 - Bright Lime-Yellow Base - approx #E2E14D */
|
|
35
|
+
--chart-5: oklch(0.769 0.188 70.08); /* Chart 5 - Golden-Yellow Base - approx #E3C442 */
|
|
36
|
+
--sidebar: oklch(1 0 0); /* Background stateless #ffffff */
|
|
37
|
+
--sidebar-foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
38
|
+
--sidebar-primary: oklch(0.6662 0.2007 280.88); /* Accent Stateless #6879EB */
|
|
39
|
+
--sidebar-primary-foreground: oklch(1 0 0); /* Text Button Primary #ffffff */
|
|
40
|
+
--sidebar-accent: oklch(0.9641 0.0065 231.29); /* Background active #F3F7FA */
|
|
41
|
+
--sidebar-accent-foreground: oklch(0.3687 0.0313 264.55); /* Text Primary #37414B */
|
|
42
|
+
--sidebar-border: oklch(0.9103 0.0177 246.73); /* Borders Secondary #DFE7ED */
|
|
43
|
+
--sidebar-ring: oklch(0.6662 0.2007 280.88); /* Borders Base #6879EB */
|
|
44
|
+
--panel: oklch(0.5202 0.2024 278.91); /* Background Accent Active #4958BC */
|
|
45
|
+
--panel-foreground: oklch(1 0 0); /* Text Button Primary #ffffff */
|
|
46
|
+
--panel-primary: oklch(0.5202 0.2024 278.91); /* Background Accent Active #4958BC */
|
|
47
|
+
--panel-primary-foreground: oklch(1 0 0); /* Text Button Primary #ffffff */
|
|
48
|
+
--panel-input: oklch(1 0 0); /* Background stateless #ffffff */
|
|
49
|
+
--panel-ring: oklch(0.6662 0.2007 280.88); /* Borders Base #6879EB */
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@theme inline {
|
|
53
|
+
--color-background: var(--background);
|
|
54
|
+
--color-foreground: var(--foreground);
|
|
55
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
56
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
57
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
58
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
59
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
60
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
61
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
62
|
+
--color-sidebar: var(--sidebar);
|
|
63
|
+
--color-chart-5: var(--chart-5);
|
|
64
|
+
--color-chart-4: var(--chart-4);
|
|
65
|
+
--color-chart-3: var(--chart-3);
|
|
66
|
+
--color-chart-2: var(--chart-2);
|
|
67
|
+
--color-chart-1: var(--chart-1);
|
|
68
|
+
--color-ring: var(--ring);
|
|
69
|
+
--color-input: var(--input);
|
|
70
|
+
--color-border: var(--border);
|
|
71
|
+
--color-shadow: var(--shadow);
|
|
72
|
+
--color-destructive: var(--destructive);
|
|
73
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
74
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
75
|
+
--color-accent: var(--accent);
|
|
76
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
77
|
+
--color-muted: var(--muted);
|
|
78
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
79
|
+
--color-secondary: var(--secondary);
|
|
80
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
81
|
+
--color-primary: var(--primary);
|
|
82
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
83
|
+
--color-popover: var(--popover);
|
|
84
|
+
--color-card-foreground: var(--card-foreground);
|
|
85
|
+
--color-card: var(--card);
|
|
86
|
+
|
|
87
|
+
--color-success: var(--success);
|
|
88
|
+
--color-success-foreground: var(--success-foreground);
|
|
89
|
+
--color-info: var(--info);
|
|
90
|
+
--color-info-foreground: var(--info-foreground);
|
|
91
|
+
--color-warning: var(--warning);
|
|
92
|
+
--color-warning-foreground: var(--warning-foreground);
|
|
93
|
+
|
|
94
|
+
--color-panel: var(--panel);
|
|
95
|
+
--color-panel-foreground: var(--panel-foreground);
|
|
96
|
+
--color-panel-primary: var(--panel-primary);
|
|
97
|
+
--color-panel-primary-foreground: var(--panel-primary-foreground);
|
|
98
|
+
--color-panel-input: var(--panel-input);
|
|
99
|
+
--color-panel-ring: var(--panel-ring);
|
|
100
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"lib": [
|
|
7
|
+
"esnext",
|
|
8
|
+
"dom"
|
|
9
|
+
],
|
|
10
|
+
"jsx": "react",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"strictNullChecks": true,
|
|
15
|
+
"strictFunctionTypes": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"noImplicitAny": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"allowSyntheticDefaultImports": true
|
|
21
|
+
}
|
|
22
|
+
}
|
package/utils/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @scaleflex/ui-tw/utils
|
|
2
|
+
|
|
3
|
+
Utility functions and types for Scaleflex UI.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
This package provides two parts: `functions` and `types`. The latter is intended to be used with TypeScript only, the former contains different utilities that are used under the hood of most of our packages.
|
|
10
|
+
|
|
11
|
+
Using those consider their predisposition for internal usage in the Scaleflex UI ecosystem.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IStyledComponent } from 'styled-components';
|
|
2
|
+
/**
|
|
3
|
+
* If you are using a namespace for your styled components, this can come in handy giving each
|
|
4
|
+
* styled component in this namespace a displayName which gives better debugging experience
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyDisplayNames<S extends Record<string, IStyledComponent<any, any>>>(styledObject: S): S;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
/**
|
|
3
|
+
* If you are using a namespace for your styled components, this can come in handy giving each
|
|
4
|
+
* styled component in this namespace a displayName which gives better debugging experience
|
|
5
|
+
*/
|
|
6
|
+
export function applyDisplayNames(styledObject) {
|
|
7
|
+
return Object.keys(styledObject).reduce(function (newStyledObject, styledComponentName) {
|
|
8
|
+
var styledComponent = styledObject[styledComponentName];
|
|
9
|
+
styledComponent.displayName = "".concat(styledComponentName);
|
|
10
|
+
return Object.assign(newStyledObject, _defineProperty({}, styledComponentName, styledComponent));
|
|
11
|
+
}, {});
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If your prop can be either a function or a plain value, this function handles
|
|
3
|
+
* its usage for you – just provide the reference for a 'maybe function' and the arguments
|
|
4
|
+
* to call it with
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyPolymorphicFunctionProp<T, F extends (...args: any[]) => T>(prop: F | T | undefined, ...args: Parameters<F>): Exclude<typeof prop, F>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* If your prop can be either a function or a plain value, this function handles
|
|
3
|
+
* its usage for you – just provide the reference for a 'maybe function' and the arguments
|
|
4
|
+
* to call it with
|
|
5
|
+
*/
|
|
6
|
+
export function applyPolymorphicFunctionProp(prop) {
|
|
7
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8
|
+
args[_key - 1] = arguments[_key];
|
|
9
|
+
}
|
|
10
|
+
return typeof prop === 'function' ? prop.apply(void 0, args) : prop;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const rgbStringToArray: (rgbColorString: string) => number[];
|
|
2
|
+
export declare const hexToRgb: (hexColor: string) => number[];
|
|
3
|
+
export declare const rgbToHex: (...rgbColor: any) => string;
|
|
4
|
+
export declare const hslToHex: (h: number, s: number, l: number) => string;
|
|
5
|
+
export declare const rgbToHsl: (...rgbColor: any) => number[];
|
|
6
|
+
export declare const colorToHsl: (color: string) => number[];
|
|
7
|
+
export declare const colorToRgb: (color: string) => number[];
|
|
8
|
+
export declare const colorToHex: (color: string) => string;
|
|
9
|
+
export declare const hsvToHsl: (h: number, s: number, v: number) => number[];
|
|
10
|
+
export declare const hslToHsv: (h: number, s: number, l: number) => Array<number>;
|
|
11
|
+
export declare const validateHex: (color: string) => boolean;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
export var rgbStringToArray = function rgbStringToArray(rgbColorString) {
|
|
3
|
+
return rgbColorString.replaceAll(/[^\d,]/gi, '').split(',').map(function (n) {
|
|
4
|
+
return +n;
|
|
5
|
+
});
|
|
6
|
+
};
|
|
7
|
+
export var hexToRgb = function hexToRgb(hexColor) {
|
|
8
|
+
// if (!hexColor) return { r: 0, g: 0, b: 0 };
|
|
9
|
+
if (!hexColor) return [0, 0, 0];
|
|
10
|
+
return [Number.parseInt(hexColor.slice(1, 3), 16), Number.parseInt(hexColor.slice(3, 5), 16), Number.parseInt(hexColor.slice(5, 7), 16)];
|
|
11
|
+
};
|
|
12
|
+
var rgbChannelToHex = function rgbChannelToHex(channel) {
|
|
13
|
+
return channel.toString(16).padStart(2, '0');
|
|
14
|
+
};
|
|
15
|
+
export var rgbToHex = function rgbToHex() {
|
|
16
|
+
for (var _len = arguments.length, rgbColor = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
17
|
+
rgbColor[_key] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
return "#".concat(rgbColor.map(rgbChannelToHex).join(''));
|
|
20
|
+
};
|
|
21
|
+
export var hslToHex = function hslToHex(h, s, l) {
|
|
22
|
+
var dividedL = l / 100;
|
|
23
|
+
var a = s * Math.min(dividedL, 1 - dividedL) / 100;
|
|
24
|
+
var f = function f(n) {
|
|
25
|
+
var k = (n + h / 30) % 12;
|
|
26
|
+
var color = dividedL - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
27
|
+
return rgbChannelToHex(Math.round(255 * color));
|
|
28
|
+
};
|
|
29
|
+
return "#".concat(f(0)).concat(f(8)).concat(f(4));
|
|
30
|
+
};
|
|
31
|
+
export var rgbToHsl = function rgbToHsl() {
|
|
32
|
+
for (var _len2 = arguments.length, rgbColor = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
33
|
+
rgbColor[_key2] = arguments[_key2];
|
|
34
|
+
}
|
|
35
|
+
var r = rgbColor[0],
|
|
36
|
+
g = rgbColor[1],
|
|
37
|
+
b = rgbColor[2];
|
|
38
|
+
r /= 255;
|
|
39
|
+
g /= 255;
|
|
40
|
+
b /= 255;
|
|
41
|
+
var min = Math.min(r, g, b);
|
|
42
|
+
var max = Math.max(r, g, b);
|
|
43
|
+
var h;
|
|
44
|
+
var s;
|
|
45
|
+
var l = (max + min) / 2;
|
|
46
|
+
if (max === min) {
|
|
47
|
+
h = 0;
|
|
48
|
+
s = 0;
|
|
49
|
+
} else {
|
|
50
|
+
var diff = max - min;
|
|
51
|
+
s = l > 0.5 ? diff / (2 - max - min) : diff / (max + min);
|
|
52
|
+
switch (max) {
|
|
53
|
+
case r:
|
|
54
|
+
h = (g - b) / diff + (g < b ? 6 : 0);
|
|
55
|
+
break;
|
|
56
|
+
case g:
|
|
57
|
+
h = (b - r) / diff + 2;
|
|
58
|
+
break;
|
|
59
|
+
case b:
|
|
60
|
+
h = (r - g) / diff + 4;
|
|
61
|
+
break;
|
|
62
|
+
default:
|
|
63
|
+
h = 0;
|
|
64
|
+
}
|
|
65
|
+
h /= 6;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// * 360 for having the hue in degrees
|
|
69
|
+
return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)];
|
|
70
|
+
};
|
|
71
|
+
export var colorToHsl = function colorToHsl(color) {
|
|
72
|
+
if (color.startsWith('#')) {
|
|
73
|
+
var hex = color;
|
|
74
|
+
if (color.length === 4) {
|
|
75
|
+
hex = "#".concat(color[1]).concat(color[1]).concat(color[2]).concat(color[2]).concat(color[3]).concat(color[3]);
|
|
76
|
+
}
|
|
77
|
+
return rgbToHsl.apply(void 0, _toConsumableArray(hexToRgb(hex)));
|
|
78
|
+
}
|
|
79
|
+
if (color.startsWith('rgb')) {
|
|
80
|
+
var colorInRgb = rgbStringToArray(color);
|
|
81
|
+
return rgbToHsl.apply(void 0, _toConsumableArray(colorInRgb));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// if the color is in text and no one from previous then return the default color which is black
|
|
85
|
+
if (typeof color === 'string') {
|
|
86
|
+
return [0, 0, 0];
|
|
87
|
+
}
|
|
88
|
+
return color;
|
|
89
|
+
};
|
|
90
|
+
export var colorToRgb = function colorToRgb(color) {
|
|
91
|
+
// we are not handling (hsl/color name) here cause we are accepting only HEX and RGB colors as default colors from user.
|
|
92
|
+
if (color.startsWith('#')) {
|
|
93
|
+
return hexToRgb(color);
|
|
94
|
+
}
|
|
95
|
+
if (color.startsWith('rgb')) {
|
|
96
|
+
return rgbStringToArray(color);
|
|
97
|
+
}
|
|
98
|
+
if (typeof color === 'string') {
|
|
99
|
+
return [0, 0, 0];
|
|
100
|
+
}
|
|
101
|
+
return color;
|
|
102
|
+
};
|
|
103
|
+
export var colorToHex = function colorToHex(color) {
|
|
104
|
+
if (color.startsWith('#')) {
|
|
105
|
+
if (color.length === 7) {
|
|
106
|
+
return color;
|
|
107
|
+
}
|
|
108
|
+
return "#".concat(color[0]).concat(color[0]).concat(color[1]).concat(color[1]).concat(color[2]).concat(color[2]);
|
|
109
|
+
}
|
|
110
|
+
if (color.startsWith('rgb')) {
|
|
111
|
+
return rgbToHex.apply(void 0, _toConsumableArray(rgbStringToArray(color)));
|
|
112
|
+
}
|
|
113
|
+
if (typeof color === 'string') {
|
|
114
|
+
return '#000000';
|
|
115
|
+
}
|
|
116
|
+
return color;
|
|
117
|
+
};
|
|
118
|
+
var checkIsBlack = function checkIsBlack(s, l) {
|
|
119
|
+
return l === 0 && (s === 0 || s === 1);
|
|
120
|
+
};
|
|
121
|
+
var checkIsWhite = function checkIsWhite(s, l) {
|
|
122
|
+
return s === 0 && l === 1;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// both hsv and hsl values are in [0, 1] except h is in [0, 360]
|
|
126
|
+
export var hsvToHsl = function hsvToHsl(h, s, v) {
|
|
127
|
+
var newS = s;
|
|
128
|
+
var l = (2 - s) * v / 2;
|
|
129
|
+
if (l !== 0) {
|
|
130
|
+
if (l === 1) {
|
|
131
|
+
newS = 0;
|
|
132
|
+
} else if (l < 0.5) {
|
|
133
|
+
newS = newS * v / (l * 2);
|
|
134
|
+
} else {
|
|
135
|
+
newS = newS * v / (2 - l * 2);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
var isBlack = checkIsBlack(newS, l);
|
|
139
|
+
return [isBlack || checkIsWhite(newS, l) ? 0 : h, isBlack ? 0 : Math.round(newS * 100), Math.round(l * 100)];
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// both hsv and hsl values are in [0, 1] except h is in [0, 360]
|
|
143
|
+
export var hslToHsv = function hslToHsv(h, s, l) {
|
|
144
|
+
var newS = s;
|
|
145
|
+
var newL = l * 2;
|
|
146
|
+
newS *= newL <= 1 ? newL : 2 - newL;
|
|
147
|
+
var v = (newL + newS) / 2;
|
|
148
|
+
newS = 2 * newS / (newL + newS);
|
|
149
|
+
|
|
150
|
+
// return [h, newS, v];
|
|
151
|
+
var isBlack = checkIsBlack(newS, l);
|
|
152
|
+
return [isBlack || checkIsWhite(newS, l) ? 0 : h, isBlack ? 0 : Math.round(newS * 100), Math.round(v * 100)];
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// TODO: validating 3 color code for Hex
|
|
156
|
+
// /^#([\da-f]{3}){1,2}$/i.test(color)colorToHex
|
|
157
|
+
export var validateHex = function validateHex(color) {
|
|
158
|
+
return /^#[\da-f]{6}$/i.test(color);
|
|
159
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapNumber(number: number, oldMin: number, oldMax: number, newMin: number, newMax: number): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function restrictNumber(number: number, min: number | undefined, max: number): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function restrictNumber(number) {
|
|
2
|
+
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
3
|
+
var max = arguments.length > 2 ? arguments[2] : undefined;
|
|
4
|
+
// we are not assigning default value for it as if max was null it will override the default value.
|
|
5
|
+
var currentMax = max || 1000000;
|
|
6
|
+
var convertedNumber = +number;
|
|
7
|
+
return Math.min(Math.max(min, convertedNumber), currentMax);
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function convertToString(text: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeRegExp(text: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateClassNames(componentName: string, subClassNames?: string | string[]): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
export function generateClassNames(componentName, subClassNames) {
|
|
3
|
+
var generateClassName = function generateClassName(subClassName) {
|
|
4
|
+
return "Sfx".concat(componentName).concat(subClassName ? "-".concat(subClassName) : '');
|
|
5
|
+
};
|
|
6
|
+
var classNameArray = [];
|
|
7
|
+
if (subClassNames) {
|
|
8
|
+
if (Array.isArray(subClassNames)) {
|
|
9
|
+
classNameArray.push.apply(classNameArray, _toConsumableArray(subClassNames.filter(function (subClassName) {
|
|
10
|
+
return typeof subClassName === 'string';
|
|
11
|
+
}).map(function (subClassName) {
|
|
12
|
+
return generateClassName(subClassName);
|
|
13
|
+
})));
|
|
14
|
+
} else if (typeof subClassNames === 'string') {
|
|
15
|
+
classNameArray.push(generateClassName(subClassNames));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (classNameArray.length === 0) {
|
|
19
|
+
classNameArray.push(generateClassName());
|
|
20
|
+
}
|
|
21
|
+
return classNameArray.join(' ');
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function getElemDocumentCoords(elem) {
|
|
2
|
+
if (!elem) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
var box = elem.getBoundingClientRect();
|
|
6
|
+
var _document = document,
|
|
7
|
+
body = _document.body;
|
|
8
|
+
var docEl = document.documentElement;
|
|
9
|
+
var scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop;
|
|
10
|
+
var scrollLeft = window.pageXOffset || docEl.scrollLeft || body.scrollLeft;
|
|
11
|
+
var clientTop = docEl.clientTop || body.clientTop || 0;
|
|
12
|
+
var clientLeft = docEl.clientLeft || body.clientLeft || 0;
|
|
13
|
+
var top = box.top + scrollTop - clientTop;
|
|
14
|
+
var left = box.left + scrollLeft - clientLeft;
|
|
15
|
+
return {
|
|
16
|
+
top: Math.round(top),
|
|
17
|
+
left: Math.round(left),
|
|
18
|
+
width: box.width,
|
|
19
|
+
height: box.height
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ignoreEvent: (event: any) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './generate-class-names';
|
|
2
|
+
export * from './object-keys';
|
|
3
|
+
export * from './object-values';
|
|
4
|
+
export * from './apply-polymorphic-function-prop';
|
|
5
|
+
export * from './apply-display-names';
|
|
6
|
+
export * from './use-fork-ref';
|
|
7
|
+
export * from './color-picker/restrict-number';
|
|
8
|
+
export * from './color-picker/map-number';
|
|
9
|
+
export * from './color-picker/color-converters';
|
|
10
|
+
export * from './get-elem-document-coords';
|
|
11
|
+
export * from './slider/utils';
|
|
12
|
+
export * from './scrollbar';
|
|
13
|
+
export * from './escape-regexp';
|
|
14
|
+
export * from './ignore-event';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './generate-class-names';
|
|
2
|
+
// export * from './intrinsic-component';
|
|
3
|
+
export * from './object-keys';
|
|
4
|
+
export * from './object-values';
|
|
5
|
+
export * from './apply-polymorphic-function-prop';
|
|
6
|
+
export * from './apply-display-names';
|
|
7
|
+
export * from './use-fork-ref';
|
|
8
|
+
export * from './color-picker/restrict-number';
|
|
9
|
+
export * from './color-picker/map-number';
|
|
10
|
+
export * from './color-picker/color-converters';
|
|
11
|
+
export * from './get-elem-document-coords';
|
|
12
|
+
export * from './slider/utils';
|
|
13
|
+
export * from './scrollbar';
|
|
14
|
+
export * from './escape-regexp';
|
|
15
|
+
export * from './ignore-event';
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// DEPRECATED after React upgrade to v19
|
|
2
|
+
// import {
|
|
3
|
+
// forwardRef,
|
|
4
|
+
// ForwardRefExoticComponent,
|
|
5
|
+
// ForwardRefRenderFunction,
|
|
6
|
+
// MutableRefObject,
|
|
7
|
+
// PropsWithoutRef,
|
|
8
|
+
// ReactElement,
|
|
9
|
+
// RefAttributes,
|
|
10
|
+
// } from 'react';
|
|
11
|
+
|
|
12
|
+
// interface RenderFunction<P, E>
|
|
13
|
+
// extends Pick<ForwardRefRenderFunction<E, P>, 'defaultProps' | 'displayName' | 'propTypes'> {
|
|
14
|
+
// (props: P, ref: ((instance: E | null) => void) | MutableRefObject<E | null> | null): ReactElement | null;
|
|
15
|
+
// }
|
|
16
|
+
|
|
17
|
+
// /**
|
|
18
|
+
// * Wrapper around React's `forwardRef` function, which adds a `displayName` to each component
|
|
19
|
+
// * created using it
|
|
20
|
+
// */
|
|
21
|
+
// export function intrinsicComponent<P = Record<string, unknown>, E = HTMLElement>(
|
|
22
|
+
// render: RenderFunction<P, E>,
|
|
23
|
+
// displayName?: string
|
|
24
|
+
// ): ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<E>> {
|
|
25
|
+
// const component = forwardRef<E, P>(render);
|
|
26
|
+
// component.displayName = displayName || render.name;
|
|
27
|
+
// return component;
|
|
28
|
+
// }
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { Color as PaletteColor } from '../types/palette';
|
|
3
|
+
export var scrollBar = function scrollBar(_ref) {
|
|
4
|
+
var palette = _ref.theme.palette;
|
|
5
|
+
return css(["&::-webkit-scrollbar{width:12px;}&::-webkit-scrollbar-thumb{background:", ";border:4px solid ", ";border-radius:99px;height:92px;padding:4px 6px;}"], palette[PaletteColor.BorderPrimaryStateless], palette[PaletteColor.ActiveSecondary]);
|
|
6
|
+
};
|