@blockle/blocks 0.19.1 → 0.20.0-alpha1.0
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/dist/components/accessibility/VisuallyHidden/VisuallyHidden.cjs +20 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.d.ts +5 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.js +20 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.spec.d.ts +1 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.stories.d.ts +6 -0
- package/dist/components/accessibility/VisuallyHidden/index.d.ts +1 -0
- package/dist/{styles/components/Accessibility → components/accessibility}/VisuallyHidden/visually-hidden.css.cjs +3 -2
- package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.d.ts +1 -0
- package/dist/{styles/components/Accessibility/VisuallyHidden/visually-hidden.css.mjs → components/accessibility/VisuallyHidden/visually-hidden.css.js} +2 -2
- package/dist/components/display/Divider/Divider.cjs +26 -0
- package/dist/components/display/Divider/Divider.d.ts +7 -0
- package/dist/components/display/Divider/Divider.js +26 -0
- package/dist/components/display/Divider/Divider.spec.d.ts +1 -0
- package/dist/components/display/Divider/Divider.stories.d.ts +6 -0
- package/dist/{styles/components → components}/display/Divider/divider.css.cjs +4 -3
- package/dist/components/display/Divider/divider.css.d.ts +1 -0
- package/dist/{styles/components/display/Divider/divider.css.mjs → components/display/Divider/divider.css.js} +2 -2
- package/dist/components/display/Divider/index.d.ts +1 -0
- package/dist/components/feedback/Progress/Progress.cjs +54 -0
- package/dist/components/feedback/Progress/Progress.d.ts +16 -0
- package/dist/components/feedback/Progress/Progress.js +54 -0
- package/dist/components/feedback/Progress/Progress.stories.d.ts +5 -0
- package/dist/components/feedback/Progress/index.d.ts +1 -0
- package/dist/components/feedback/Spinner/Spinner.cjs +26 -0
- package/dist/components/feedback/Spinner/Spinner.d.ts +9 -0
- package/dist/components/feedback/Spinner/Spinner.js +26 -0
- package/dist/components/feedback/Spinner/Spinner.stories.d.ts +5 -0
- package/dist/components/feedback/Spinner/index.d.ts +1 -0
- package/dist/components/form/Button/Button.cjs +59 -0
- package/dist/{styles/components → components}/form/Button/Button.css.cjs +4 -3
- package/dist/components/form/Button/Button.css.d.ts +1 -0
- package/dist/{styles/components/form/Button/Button.css.mjs → components/form/Button/Button.css.js} +2 -2
- package/dist/components/form/Button/Button.d.ts +21 -0
- package/dist/{styles/components/form/Button/Button.mjs → components/form/Button/Button.js} +16 -14
- package/dist/components/form/Button/Button.spec.d.ts +1 -0
- package/dist/components/form/Button/Button.stories.d.ts +7 -0
- package/dist/components/form/Button/index.d.ts +1 -0
- package/dist/components/form/Checkbox/Checkbox.cjs +79 -0
- package/dist/components/form/Checkbox/Checkbox.d.ts +9 -0
- package/dist/components/form/Checkbox/Checkbox.js +79 -0
- package/dist/components/form/Checkbox/Checkbox.spec.d.ts +1 -0
- package/dist/components/form/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/{styles/components → components}/form/Checkbox/checkbox.css.cjs +7 -6
- package/dist/components/form/Checkbox/checkbox.css.d.ts +3 -0
- package/dist/{styles/components/form/Checkbox/checkbox.css.mjs → components/form/Checkbox/checkbox.css.js} +4 -4
- package/dist/components/form/Checkbox/index.d.ts +1 -0
- package/dist/components/form/Input/Input.cjs +51 -0
- package/dist/components/form/Input/Input.d.ts +11 -0
- package/dist/components/form/Input/Input.js +51 -0
- package/dist/components/form/Input/Input.spec.d.ts +1 -0
- package/dist/components/form/Input/Input.stories.d.ts +5 -0
- package/dist/components/form/Input/index.d.ts +1 -0
- package/dist/{styles/components → components}/form/Input/input.css.cjs +4 -3
- package/dist/components/form/Input/input.css.d.ts +1 -0
- package/dist/{styles/components/form/Input/input.css.mjs → components/form/Input/input.css.js} +2 -2
- package/dist/components/form/Label/Label.cjs +30 -0
- package/dist/components/form/Label/Label.d.ts +18 -0
- package/dist/components/form/Label/Label.js +30 -0
- package/dist/components/form/Label/Label.spec.d.ts +1 -0
- package/dist/components/form/Label/Label.stories.d.ts +6 -0
- package/dist/components/form/Label/index.d.ts +1 -0
- package/dist/components/form/Radio/Radio.cjs +48 -0
- package/dist/components/form/Radio/Radio.d.ts +8 -0
- package/dist/components/form/Radio/Radio.js +48 -0
- package/dist/components/form/Radio/Radio.spec.d.ts +1 -0
- package/dist/components/form/Radio/Radio.stories.d.ts +6 -0
- package/dist/components/form/Radio/RadioGroup.d.ts +8 -0
- package/dist/components/form/Radio/index.d.ts +2 -0
- package/dist/{styles/components → components}/form/Radio/radio.css.cjs +7 -6
- package/dist/components/form/Radio/radio.css.d.ts +3 -0
- package/dist/{styles/components/form/Radio/radio.css.mjs → components/form/Radio/radio.css.js} +4 -4
- package/dist/components/form/Select/Select.cjs +65 -0
- package/dist/components/form/Select/Select.d.ts +10 -0
- package/dist/{styles/components/form/Select/Select.mjs → components/form/Select/Select.js} +24 -7
- package/dist/components/form/Select/Select.stories.d.ts +5 -0
- package/dist/components/form/Select/index.d.ts +1 -0
- package/dist/{styles/components → components}/form/Select/select.css.cjs +8 -7
- package/dist/components/form/Select/select.css.d.ts +3 -0
- package/dist/{styles/components/form/Select/select.css.mjs → components/form/Select/select.css.js} +4 -4
- package/dist/components/form/Slider/Slider.cjs +141 -0
- package/dist/components/form/Slider/Slider.d.ts +20 -0
- package/dist/components/form/Slider/Slider.js +141 -0
- package/dist/components/form/Slider/Slider.spec.d.ts +1 -0
- package/dist/components/form/Slider/Slider.stories.d.ts +6 -0
- package/dist/components/form/Slider/index.d.ts +1 -0
- package/dist/{styles/components → components}/form/Slider/slider.css.cjs +12 -11
- package/dist/components/form/Slider/slider.css.d.ts +5 -0
- package/dist/{styles/components/form/Slider/slider.css.mjs → components/form/Slider/slider.css.js} +6 -6
- package/dist/components/form/Slider/usePointerProgress.cjs +47 -0
- package/dist/components/form/Slider/usePointerProgress.d.ts +11 -0
- package/dist/components/form/Slider/usePointerProgress.js +47 -0
- package/dist/{styles/components → components}/form/Switch/Switch.cjs +12 -8
- package/dist/components/form/Switch/Switch.d.ts +6 -0
- package/dist/{styles/components/form/Switch/Switch.mjs → components/form/Switch/Switch.js} +9 -6
- package/dist/components/form/Switch/Switch.stories.d.ts +5 -0
- package/dist/components/form/Switch/index.d.ts +1 -0
- package/dist/{styles/components → components}/form/Switch/switch.css.cjs +6 -5
- package/dist/components/form/Switch/switch.css.d.ts +2 -0
- package/dist/{styles/components/form/Switch/switch.css.mjs → components/form/Switch/switch.css.js} +3 -3
- package/dist/components/layout/Box/Box.cjs +28 -0
- package/dist/components/layout/Box/Box.d.ts +11 -0
- package/dist/components/layout/Box/Box.js +28 -0
- package/dist/components/layout/Box/Box.spec.d.ts +1 -0
- package/dist/components/layout/Box/Box.stories.d.ts +6 -0
- package/dist/components/layout/Box/index.d.ts +1 -0
- package/dist/components/layout/Inline/Inline.cjs +30 -0
- package/dist/components/layout/Inline/Inline.d.ts +13 -0
- package/dist/components/layout/Inline/Inline.js +30 -0
- package/dist/components/layout/Inline/Inline.stories.d.ts +6 -0
- package/dist/components/layout/Inline/index.d.ts +1 -0
- package/dist/components/layout/Stack/Stack.cjs +30 -0
- package/dist/components/layout/Stack/Stack.d.ts +17 -0
- package/dist/components/layout/Stack/Stack.js +30 -0
- package/dist/components/layout/Stack/Stack.stories.d.ts +6 -0
- package/dist/components/layout/Stack/index.d.ts +1 -0
- package/dist/components/navigation/Link/Link.cjs +32 -0
- package/dist/components/navigation/Link/Link.d.ts +11 -0
- package/dist/components/navigation/Link/Link.js +32 -0
- package/dist/components/navigation/Link/Link.stories.d.ts +6 -0
- package/dist/components/navigation/Link/index.d.ts +1 -0
- package/dist/components/other/BlocksProvider/BlocksProvider.cjs +38 -0
- package/dist/components/other/BlocksProvider/BlocksProvider.d.ts +8 -0
- package/dist/{styles/components/other/BlocksProvider/BlocksProvider.mjs → components/other/BlocksProvider/BlocksProvider.js} +12 -6
- package/dist/components/other/BlocksProvider/context.cjs +6 -0
- package/dist/components/other/BlocksProvider/context.d.ts +4 -0
- package/dist/components/other/BlocksProvider/context.js +6 -0
- package/dist/components/other/BlocksProvider/index.d.ts +2 -0
- package/dist/components/other/Portal/Portal.cjs +8 -0
- package/dist/components/other/Portal/Portal.d.ts +5 -0
- package/dist/components/other/Portal/Portal.js +8 -0
- package/dist/components/other/Portal/index.d.ts +1 -0
- package/dist/components/overlay/Dialog/Dialog.cjs +79 -0
- package/dist/components/overlay/Dialog/Dialog.d.ts +10 -0
- package/dist/components/overlay/Dialog/Dialog.js +79 -0
- package/dist/components/overlay/Dialog/Dialog.stories.d.ts +7 -0
- package/dist/{styles/components → components}/overlay/Dialog/dialog.css.cjs +4 -3
- package/dist/components/overlay/Dialog/dialog.css.d.ts +1 -0
- package/dist/{styles/components/overlay/Dialog/dialog.css.mjs → components/overlay/Dialog/dialog.css.js} +2 -2
- package/dist/components/overlay/Dialog/dialogHelper.cjs +22 -0
- package/dist/components/overlay/Dialog/dialogHelper.d.ts +6 -0
- package/dist/components/overlay/Dialog/dialogHelper.js +22 -0
- package/dist/components/overlay/Dialog/index.d.ts +1 -0
- package/dist/components/overlay/Popover/Popover.cjs +113 -0
- package/dist/components/overlay/Popover/Popover.d.ts +12 -0
- package/dist/components/overlay/Popover/Popover.js +113 -0
- package/dist/components/overlay/Popover/Popover.stories.d.ts +5 -0
- package/dist/components/overlay/Popover/popover-utils.cjs +62 -0
- package/dist/components/overlay/Popover/popover-utils.d.ts +2 -0
- package/dist/components/overlay/Popover/popover-utils.js +62 -0
- package/dist/components/overlay/Tooltip/Tooltip.cjs +73 -0
- package/dist/components/overlay/Tooltip/Tooltip.d.ts +11 -0
- package/dist/components/overlay/Tooltip/Tooltip.js +73 -0
- package/dist/components/overlay/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/components/overlay/Tooltip/index.d.ts +1 -0
- package/dist/components/typography/Heading/Heading.cjs +24 -0
- package/dist/components/typography/Heading/Heading.d.ts +8 -0
- package/dist/components/typography/Heading/Heading.js +24 -0
- package/dist/{styles/components → components}/typography/Heading/heading.css.cjs +4 -3
- package/dist/components/typography/Heading/heading.css.d.ts +1 -0
- package/dist/{styles/components/typography/Heading/heading.css.mjs → components/typography/Heading/heading.css.js} +2 -2
- package/dist/components/typography/Heading/heading.stories.d.ts +12 -0
- package/dist/components/typography/Heading/index.d.ts +1 -0
- package/dist/components/typography/Text/Text.cjs +21 -0
- package/dist/components/typography/Text/Text.d.ts +12 -0
- package/dist/{styles/components/typography/Text/Text.mjs → components/typography/Text/Text.js} +3 -3
- package/dist/components/typography/Text/Text.stories.d.ts +5 -0
- package/dist/components/typography/Text/index.d.ts +1 -0
- package/dist/{styles/components → components}/typography/Text/text.css.cjs +4 -3
- package/dist/components/typography/Text/text.css.d.ts +1 -0
- package/dist/{styles/components/typography/Text/text.css.mjs → components/typography/Text/text.css.js} +2 -2
- package/dist/entries/reset.d.ts +0 -0
- package/dist/entries/themes/momotaro.d.ts +1 -0
- package/dist/hooks/useClickOutside/useClickOutside.cjs +24 -0
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +6 -0
- package/dist/hooks/useClickOutside/useClickOutside.js +24 -0
- package/dist/hooks/useControlledValue/useControlledValue.cjs +33 -0
- package/dist/hooks/useControlledValue/useControlledValue.d.ts +8 -0
- package/dist/hooks/useControlledValue/useControlledValue.js +33 -0
- package/dist/hooks/useFocusLock/index.d.ts +1 -0
- package/dist/hooks/useFocusLock/useFocusLock.d.ts +6 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.ts +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +6 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +5 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.js +6 -0
- package/dist/hooks/useKeyboard/index.d.ts +1 -0
- package/dist/hooks/useKeyboard/useKeyboard.cjs +21 -0
- package/dist/hooks/useKeyboard/useKeyboard.d.ts +6 -0
- package/dist/hooks/useKeyboard/useKeyboard.js +21 -0
- package/dist/hooks/useLayer/index.d.ts +1 -0
- package/dist/hooks/useLayer/useLayer.cjs +27 -0
- package/dist/hooks/useLayer/useLayer.d.ts +1 -0
- package/dist/hooks/useLayer/useLayer.js +27 -0
- package/dist/hooks/usePreventBodyScroll/index.d.ts +1 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.cjs +30 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.d.ts +1 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.js +30 -0
- package/dist/hooks/useRestoreFocus/index.d.ts +1 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.cjs +19 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.d.ts +4 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.js +19 -0
- package/dist/hooks/useRootAriaHidden/index.d.ts +1 -0
- package/dist/hooks/useRootAriaHidden/useRootAriaHidden.cjs +12 -0
- package/dist/hooks/useRootAriaHidden/useRootAriaHidden.d.ts +7 -0
- package/dist/hooks/useRootAriaHidden/useRootAriaHidden.js +12 -0
- package/dist/hooks/useVisibilityState/index.d.ts +1 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.cjs +17 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.d.ts +3 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.js +17 -0
- package/dist/index.cjs +71 -444
- package/dist/index.d.ts +36 -1
- package/dist/index.js +73 -0
- package/dist/lib/asChildRenderer/createAsChildTemplate.cjs +73 -0
- package/dist/lib/asChildRenderer/createAsChildTemplate.d.ts +34 -0
- package/dist/lib/asChildRenderer/createAsChildTemplate.js +73 -0
- package/dist/lib/asChildRenderer/createAsChildTemplate.spec.d.ts +1 -0
- package/dist/lib/css/atoms/atomTypes.d.ts +37 -0
- package/dist/{styles/lib → lib}/css/atoms/atomicProperties.cjs +29 -22
- package/dist/lib/css/atoms/atomicProperties.d.ts +286 -0
- package/dist/{styles/lib/css/atoms/atomicProperties.mjs → lib/css/atoms/atomicProperties.js} +8 -2
- package/dist/lib/css/atoms/atoms.d.ts +1 -0
- package/dist/{styles/lib → lib}/css/atoms/breakpoints.cjs +2 -0
- package/dist/lib/css/atoms/breakpoints.d.ts +9 -0
- package/dist/{styles/lib/css/atoms/breakpoints.mjs → lib/css/atoms/breakpoints.js} +1 -0
- package/dist/lib/css/atoms/index.d.ts +2 -0
- package/dist/lib/css/atoms/sprinkles.css.cjs +52 -0
- package/dist/lib/css/atoms/sprinkles.css.d.ts +233 -0
- package/dist/{styles/lib/css/atoms/sprinkles.css.mjs → lib/css/atoms/sprinkles.css.js} +18 -5
- package/dist/lib/css/flexbox/flexbox.cjs +17 -0
- package/dist/lib/css/flexbox/flexbox.d.ts +15 -0
- package/dist/lib/css/flexbox/flexbox.js +17 -0
- package/dist/{styles/lib → lib}/css/layers/layers.css.cjs +1 -0
- package/dist/lib/css/layers/layers.css.d.ts +1 -0
- package/dist/lib/css/reset/reset.css.d.ts +1 -0
- package/dist/{styles/lib → lib}/css/style/style.cjs +4 -3
- package/dist/lib/css/style/style.d.ts +12 -0
- package/dist/{styles/lib/css/style/style.mjs → lib/css/style/style.js} +1 -1
- package/dist/{styles/lib → lib}/css/utils/cssUtils.cjs +1 -0
- package/dist/lib/css/utils/cssUtils.d.ts +1 -0
- package/dist/lib/react/mergeProps.cjs +43 -0
- package/dist/lib/react/mergeProps.d.ts +4 -0
- package/dist/lib/react/mergeProps.js +43 -0
- package/dist/lib/react/refs.cjs +17 -0
- package/dist/lib/react/refs.d.ts +3 -0
- package/dist/lib/react/refs.js +17 -0
- package/dist/lib/theme/componentThemes.d.ts +134 -0
- package/dist/{styles/lib → lib}/theme/makeComponentTheme.cjs +1 -0
- package/dist/lib/theme/makeComponentTheme.d.ts +49 -0
- package/dist/lib/theme/makeTheme.cjs +13 -0
- package/dist/lib/theme/makeTheme.d.ts +14 -0
- package/dist/{styles/lib/theme/makeTheme.mjs → lib/theme/makeTheme.js} +2 -2
- package/dist/{styles/lib → lib}/theme/makeVanillaTheme.cjs +1 -0
- package/dist/lib/theme/makeVanillaTheme.d.ts +16 -0
- package/dist/lib/theme/store/theme.cjs +93 -0
- package/dist/lib/theme/store/theme.d.ts +13 -0
- package/dist/lib/theme/store/theme.js +93 -0
- package/dist/{styles/lib → lib}/theme/tokens.cjs +1 -0
- package/dist/lib/theme/tokens.d.ts +2 -0
- package/dist/lib/theme/tokensType.d.ts +33 -0
- package/dist/lib/theme/vars.css.cjs +10 -0
- package/dist/lib/theme/vars.css.d.ts +75 -0
- package/dist/{styles/lib/theme/vars.css.mjs → lib/theme/vars.css.js} +2 -2
- package/dist/{styles/lib → lib}/utils/atom-props.cjs +3 -2
- package/dist/lib/utils/atom-props.d.ts +4 -0
- package/dist/{styles/lib/utils/atom-props.mjs → lib/utils/atom-props.js} +1 -1
- package/dist/lib/utils/classnames.cjs +7 -0
- package/dist/lib/utils/classnames.d.ts +3 -0
- package/dist/lib/utils/classnames.js +7 -0
- package/dist/lib/utils/dom-focus.d.ts +2 -0
- package/dist/lib/utils/dom.cjs +13 -0
- package/dist/lib/utils/dom.d.ts +4 -0
- package/dist/lib/utils/dom.js +13 -0
- package/dist/lib/utils/helpers.d.ts +9 -0
- package/dist/lib/utils/math.cjs +13 -0
- package/dist/lib/utils/math.d.ts +2 -0
- package/dist/lib/utils/math.js +13 -0
- package/dist/lib/utils/utils.d.ts +3 -0
- package/dist/reset.cjs +2 -2
- package/dist/reset.js +2 -0
- package/dist/themes/momotaro/components/button.css.cjs +110 -0
- package/dist/themes/momotaro/components/button.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/button.css.mjs → themes/momotaro/components/button.css.js} +45 -39
- package/dist/themes/momotaro/components/checkbox.css.cjs +64 -0
- package/dist/themes/momotaro/components/checkbox.css.d.ts +1 -0
- package/dist/themes/momotaro/components/checkbox.css.js +64 -0
- package/dist/themes/momotaro/components/dialog.css.cjs +82 -0
- package/dist/themes/momotaro/components/dialog.css.d.ts +1 -0
- package/dist/themes/momotaro/components/dialog.css.js +82 -0
- package/dist/{styles/themes → themes}/momotaro/components/divider.css.cjs +4 -3
- package/dist/themes/momotaro/components/divider.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/divider.css.mjs → themes/momotaro/components/divider.css.js} +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/helpers.css.cjs +13 -9
- package/dist/themes/momotaro/components/helpers.css.d.ts +8 -0
- package/dist/{styles/themes/momotaro/components/helpers.css.mjs → themes/momotaro/components/helpers.css.js} +10 -7
- package/dist/themes/momotaro/components/index.cjs +35 -0
- package/dist/themes/momotaro/components/index.d.ts +2 -0
- package/dist/themes/momotaro/components/index.js +35 -0
- package/dist/themes/momotaro/components/input.css.cjs +48 -0
- package/dist/themes/momotaro/components/input.css.d.ts +1 -0
- package/dist/themes/momotaro/components/input.css.js +48 -0
- package/dist/themes/momotaro/components/label.css.cjs +34 -0
- package/dist/themes/momotaro/components/label.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/label.css.mjs → themes/momotaro/components/label.css.js} +7 -7
- package/dist/themes/momotaro/components/link.css.cjs +57 -0
- package/dist/themes/momotaro/components/link.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/link.css.mjs → themes/momotaro/components/link.css.js} +27 -24
- package/dist/{styles/themes → themes}/momotaro/components/popover.css.cjs +5 -4
- package/dist/themes/momotaro/components/popover.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/popover.css.mjs → themes/momotaro/components/popover.css.js} +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/progress.css.cjs +22 -18
- package/dist/themes/momotaro/components/progress.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/progress.css.mjs → themes/momotaro/components/progress.css.js} +18 -15
- package/dist/themes/momotaro/components/radio.css.cjs +65 -0
- package/dist/themes/momotaro/components/radio.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/radio.css.mjs → themes/momotaro/components/radio.css.js} +31 -27
- package/dist/themes/momotaro/components/select.css.cjs +48 -0
- package/dist/themes/momotaro/components/select.css.d.ts +1 -0
- package/dist/themes/momotaro/components/select.css.js +48 -0
- package/dist/themes/momotaro/components/slider.css.cjs +93 -0
- package/dist/themes/momotaro/components/slider.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/slider.css.mjs → themes/momotaro/components/slider.css.js} +31 -28
- package/dist/{styles/themes → themes}/momotaro/components/spinner.css.cjs +8 -7
- package/dist/themes/momotaro/components/spinner.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/spinner.css.mjs → themes/momotaro/components/spinner.css.js} +6 -6
- package/dist/themes/momotaro/components/switch.css.cjs +62 -0
- package/dist/themes/momotaro/components/switch.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/switch.css.mjs → themes/momotaro/components/switch.css.js} +31 -28
- package/dist/{styles/themes → themes}/momotaro/components/tooltip.css.cjs +7 -6
- package/dist/themes/momotaro/components/tooltip.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/components/tooltip.css.mjs → themes/momotaro/components/tooltip.css.js} +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/transitions.cjs +1 -0
- package/dist/themes/momotaro/components/transitions.d.ts +1 -0
- package/dist/themes/momotaro/index.d.ts +1 -0
- package/dist/themes/momotaro/momotaro.css.cjs +14 -0
- package/dist/themes/momotaro/momotaro.css.d.ts +1 -0
- package/dist/{styles/themes/momotaro/momotaro.css.mjs → themes/momotaro/momotaro.css.js} +3 -3
- package/dist/{styles/themes → themes}/momotaro/tokens.css.cjs +12 -11
- package/dist/themes/momotaro/tokens.css.d.ts +2 -0
- package/dist/{styles/themes/momotaro/tokens.css.mjs → themes/momotaro/tokens.css.js} +1 -1
- package/dist/themes/momotaro.cjs +2 -2
- package/dist/themes/momotaro.js +4 -0
- package/package.json +17 -28
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +0 -451
- package/dist/momotaro.chunk.d.ts +0 -922
- package/dist/reset.d.mts +0 -2
- package/dist/reset.d.ts +0 -2
- package/dist/reset.mjs +0 -2
- package/dist/styles/components/Accessibility/VisuallyHidden/VisuallyHidden.cjs +0 -16
- package/dist/styles/components/Accessibility/VisuallyHidden/VisuallyHidden.mjs +0 -17
- package/dist/styles/components/display/Divider/Divider.cjs +0 -239
- package/dist/styles/components/display/Divider/Divider.mjs +0 -240
- package/dist/styles/components/form/Button/Button.cjs +0 -56
- package/dist/styles/components/form/Checkbox/Checkbox.cjs +0 -84
- package/dist/styles/components/form/Checkbox/Checkbox.mjs +0 -85
- package/dist/styles/components/form/Input/Input.cjs +0 -37
- package/dist/styles/components/form/Input/Input.mjs +0 -38
- package/dist/styles/components/form/Radio/Radio.cjs +0 -23
- package/dist/styles/components/form/Radio/Radio.mjs +0 -24
- package/dist/styles/components/form/Select/Select.cjs +0 -47
- package/dist/styles/components/form/Slider/Slider.cjs +0 -205
- package/dist/styles/components/form/Slider/Slider.mjs +0 -206
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +0 -31
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +0 -172
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +0 -173
- package/dist/styles/components/typography/Heading/Heading.cjs +0 -15
- package/dist/styles/components/typography/Heading/Heading.mjs +0 -16
- package/dist/styles/components/typography/Text/Text.cjs +0 -20
- package/dist/styles/lib/css/atoms/atoms.cjs +0 -2
- package/dist/styles/lib/css/atoms/atoms.mjs +0 -1
- package/dist/styles/lib/css/atoms/index.cjs +0 -2
- package/dist/styles/lib/css/atoms/index.mjs +0 -1
- package/dist/styles/lib/css/atoms/sprinkles.css.cjs +0 -38
- package/dist/styles/lib/theme/makeTheme.cjs +0 -12
- package/dist/styles/lib/theme/vars.css.cjs +0 -9
- package/dist/styles/themes/momotaro/components/button.css.cjs +0 -103
- package/dist/styles/themes/momotaro/components/checkbox.css.cjs +0 -59
- package/dist/styles/themes/momotaro/components/checkbox.css.mjs +0 -60
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +0 -78
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +0 -79
- package/dist/styles/themes/momotaro/components/index.cjs +0 -34
- package/dist/styles/themes/momotaro/components/index.mjs +0 -35
- package/dist/styles/themes/momotaro/components/input.css.cjs +0 -41
- package/dist/styles/themes/momotaro/components/input.css.mjs +0 -42
- package/dist/styles/themes/momotaro/components/label.css.cjs +0 -33
- package/dist/styles/themes/momotaro/components/link.css.cjs +0 -53
- package/dist/styles/themes/momotaro/components/radio.css.cjs +0 -60
- package/dist/styles/themes/momotaro/components/select.css.cjs +0 -44
- package/dist/styles/themes/momotaro/components/select.css.mjs +0 -45
- package/dist/styles/themes/momotaro/components/slider.css.cjs +0 -89
- package/dist/styles/themes/momotaro/components/switch.css.cjs +0 -58
- package/dist/styles/themes/momotaro/index.cjs +0 -2
- package/dist/styles/themes/momotaro/index.mjs +0 -1
- package/dist/styles/themes/momotaro/momotaro.css.cjs +0 -13
- package/dist/themes/momotaro.d.mts +0 -1
- package/dist/themes/momotaro.d.ts +0 -1
- package/dist/themes/momotaro.mjs +0 -4
- package/reset/index.d.ts +0 -1
- package/reset/package.json +0 -5
- /package/dist/{styles/lib/css/layers/layers.css.mjs → lib/css/layers/layers.css.js} +0 -0
- /package/dist/{styles/lib → lib}/css/reset/reset.css.cjs +0 -0
- /package/dist/{styles/lib/css/reset/reset.css.mjs → lib/css/reset/reset.css.js} +0 -0
- /package/dist/{styles/lib/css/utils/cssUtils.mjs → lib/css/utils/cssUtils.js} +0 -0
- /package/dist/{styles/lib/theme/makeComponentTheme.mjs → lib/theme/makeComponentTheme.js} +0 -0
- /package/dist/{styles/lib/theme/makeVanillaTheme.mjs → lib/theme/makeVanillaTheme.js} +0 -0
- /package/dist/{styles/lib/theme/tokens.mjs → lib/theme/tokens.js} +0 -0
- /package/dist/{styles/themes/momotaro/components/transitions.mjs → themes/momotaro/components/transitions.js} +0 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Atoms } from '../css/atoms';
|
|
2
|
+
import { RecordLike } from '../utils/helpers';
|
|
3
|
+
export type ButtonTheme = {
|
|
4
|
+
base: string;
|
|
5
|
+
variants: {
|
|
6
|
+
variant: 'solid' | 'outline' | 'ghost';
|
|
7
|
+
intent: 'neutral' | 'danger';
|
|
8
|
+
size: 'small' | 'medium' | 'large';
|
|
9
|
+
loading: boolean;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type LinkTheme = {
|
|
14
|
+
base: string;
|
|
15
|
+
variants: {
|
|
16
|
+
variant: 'inherit' | 'primary' | 'secondary';
|
|
17
|
+
underline: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type SpinnerTheme = {
|
|
21
|
+
base: string;
|
|
22
|
+
variants: {
|
|
23
|
+
size: 'small' | 'medium' | 'large';
|
|
24
|
+
color: Exclude<Atoms['color'], undefined>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type DividerTheme = {
|
|
28
|
+
base?: string;
|
|
29
|
+
variants: {
|
|
30
|
+
color: Exclude<Atoms['color'], undefined>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type DialogTheme = {
|
|
34
|
+
dialog: string;
|
|
35
|
+
variants: {
|
|
36
|
+
size: 'small' | 'medium' | 'large';
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type InputTheme = {
|
|
40
|
+
container: string;
|
|
41
|
+
input: string;
|
|
42
|
+
variants: {
|
|
43
|
+
variant: 'solid' | 'outline';
|
|
44
|
+
disabled: boolean;
|
|
45
|
+
required: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export type CheckboxTheme = {
|
|
49
|
+
base: string;
|
|
50
|
+
icon: string;
|
|
51
|
+
label: string;
|
|
52
|
+
variants: {
|
|
53
|
+
required: boolean;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type RadioTheme = {
|
|
57
|
+
base: string;
|
|
58
|
+
icon: string;
|
|
59
|
+
label: string;
|
|
60
|
+
};
|
|
61
|
+
export type LabelTheme = {
|
|
62
|
+
base: string;
|
|
63
|
+
variants: {
|
|
64
|
+
size: 'small' | 'medium' | 'large';
|
|
65
|
+
required: boolean;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export type ProgressTheme = {
|
|
69
|
+
base: string;
|
|
70
|
+
bar: string;
|
|
71
|
+
variants: {
|
|
72
|
+
indeterminate: boolean;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export type SwitchTheme = {
|
|
76
|
+
base: string;
|
|
77
|
+
slider: string;
|
|
78
|
+
};
|
|
79
|
+
export type PopoverTheme = {
|
|
80
|
+
base: string;
|
|
81
|
+
};
|
|
82
|
+
export type SelectTheme = {
|
|
83
|
+
wrapper?: string;
|
|
84
|
+
select: string;
|
|
85
|
+
icon: string;
|
|
86
|
+
variants: {
|
|
87
|
+
variant: 'solid' | 'outline';
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
export type SliderTheme = {
|
|
91
|
+
base: string;
|
|
92
|
+
track: string;
|
|
93
|
+
filledTrack: string;
|
|
94
|
+
thumb: string;
|
|
95
|
+
variants: {
|
|
96
|
+
size: 'small' | 'medium' | 'large';
|
|
97
|
+
colorScheme: 'primary' | 'secondary';
|
|
98
|
+
disabled: boolean;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
export type TooltipTheme = {
|
|
102
|
+
base: string;
|
|
103
|
+
variants: {
|
|
104
|
+
colorScheme: 'primary' | 'secondary';
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
export type ComponentThemes = {
|
|
108
|
+
button: ButtonTheme;
|
|
109
|
+
checkbox: CheckboxTheme;
|
|
110
|
+
dialog: DialogTheme;
|
|
111
|
+
divider: DividerTheme;
|
|
112
|
+
input: InputTheme;
|
|
113
|
+
label: LabelTheme;
|
|
114
|
+
link: LinkTheme;
|
|
115
|
+
popover: PopoverTheme;
|
|
116
|
+
progress: ProgressTheme;
|
|
117
|
+
radio: RadioTheme;
|
|
118
|
+
select: SelectTheme;
|
|
119
|
+
slider: SliderTheme;
|
|
120
|
+
spinner: SpinnerTheme;
|
|
121
|
+
switch: SwitchTheme;
|
|
122
|
+
tooltip: TooltipTheme;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
|
|
126
|
+
*/
|
|
127
|
+
export type ComponentThemeProps<T extends RecordLike> = Omit<{
|
|
128
|
+
[K in keyof T]?: Exclude<T[K], undefined> extends string ? boolean : never;
|
|
129
|
+
}, 'variants'> & {
|
|
130
|
+
variants?: T['variants'] extends RecordLike ? Partial<T['variants']> : never;
|
|
131
|
+
};
|
|
132
|
+
export type ComponentThemesProps = {
|
|
133
|
+
[K in keyof ComponentThemes]: ComponentThemeProps<ComponentThemes[K]>;
|
|
134
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { RecordLike } from '../utils/helpers';
|
|
2
|
+
import { ComponentThemes } from './componentThemes';
|
|
3
|
+
/**
|
|
4
|
+
* Helper generic to convert a component theme to a styles object
|
|
5
|
+
*
|
|
6
|
+
* export type ThemeIn = {
|
|
7
|
+
* base: string;
|
|
8
|
+
* variants: {
|
|
9
|
+
* intent: 'neutral' | 'danger';
|
|
10
|
+
* level?: 1 | 2;
|
|
11
|
+
* loading: boolean;
|
|
12
|
+
* };
|
|
13
|
+
* };
|
|
14
|
+
* export type ThemeOut = {
|
|
15
|
+
* base: string;
|
|
16
|
+
* variants: {
|
|
17
|
+
* intent: Record<'neutral' | 'danger', string>;
|
|
18
|
+
* level?: Record<1 | 2, string>;
|
|
19
|
+
* loading: string;
|
|
20
|
+
* };
|
|
21
|
+
* };
|
|
22
|
+
*/
|
|
23
|
+
type VariantsToStyle<T extends RecordLike> = {
|
|
24
|
+
[K in keyof T]?: T[K] extends string | number ? Partial<Record<T[K], string>> : T[K] extends boolean ? string : never;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* ComponentThemeToStyles is a helper type to define the props passed to useComponentStyles.
|
|
28
|
+
*/
|
|
29
|
+
export type ComponentThemeToStyles<T extends RecordLike> = Omit<T, 'variants'> & {
|
|
30
|
+
variants?: T['variants'] extends RecordLike ? VariantsToStyle<T['variants']> : never;
|
|
31
|
+
};
|
|
32
|
+
export type ComponentThemeCompoundVariants<T extends RecordLike> = T['variants'] extends RecordLike ? {
|
|
33
|
+
variants: {
|
|
34
|
+
[K in keyof T['variants']]?: T['variants'][K];
|
|
35
|
+
};
|
|
36
|
+
style: string;
|
|
37
|
+
}[] : never;
|
|
38
|
+
export type ComponentThemeDefaultVariants<T extends RecordLike> = T['variants'] extends RecordLike ? {
|
|
39
|
+
[K in keyof T['variants']]?: T['variants'][K];
|
|
40
|
+
} : never;
|
|
41
|
+
export type ComponentTheme<T extends RecordLike> = ComponentThemeToStyles<T> & {
|
|
42
|
+
compoundVariants?: ComponentThemeCompoundVariants<T>;
|
|
43
|
+
defaultVariants?: ComponentThemeDefaultVariants<T>;
|
|
44
|
+
};
|
|
45
|
+
export type ThemeComponentsStyles = {
|
|
46
|
+
[K in keyof ComponentThemes]?: ComponentTheme<ComponentThemes[K]>;
|
|
47
|
+
};
|
|
48
|
+
export declare function makeComponentTheme<T extends keyof ThemeComponentsStyles>(component: T, componentTheme: ThemeComponentsStyles[T]): ThemeComponentsStyles[T];
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const makeVanillaTheme = require("./makeVanillaTheme.cjs");
|
|
5
|
+
const vars_css = require("./vars.css.cjs");
|
|
6
|
+
function makeTheme(theme) {
|
|
7
|
+
return {
|
|
8
|
+
name: theme.name,
|
|
9
|
+
vars: css.createTheme(vars_css.vars, makeVanillaTheme.makeVanillaTheme(theme.tokens)),
|
|
10
|
+
components: theme.components
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
exports.makeTheme = makeTheme;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ThemeComponentsStyles } from './makeComponentTheme';
|
|
2
|
+
import { ThemeTokens } from './tokensType';
|
|
3
|
+
type ThemeInput = {
|
|
4
|
+
name: string;
|
|
5
|
+
tokens: ThemeTokens;
|
|
6
|
+
components: ThemeComponentsStyles;
|
|
7
|
+
};
|
|
8
|
+
export type Theme = {
|
|
9
|
+
name: string;
|
|
10
|
+
vars: string;
|
|
11
|
+
components: ThemeComponentsStyles;
|
|
12
|
+
};
|
|
13
|
+
export declare function makeTheme(theme: ThemeInput): Theme;
|
|
14
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTheme } from "@vanilla-extract/css";
|
|
2
|
-
import { makeVanillaTheme } from "./makeVanillaTheme.
|
|
3
|
-
import { vars } from "./vars.css.
|
|
2
|
+
import { makeVanillaTheme } from "./makeVanillaTheme.js";
|
|
3
|
+
import { vars } from "./vars.css.js";
|
|
4
4
|
function makeTheme(theme) {
|
|
5
5
|
return {
|
|
6
6
|
name: theme.name,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ThemeTokens } from './tokensType';
|
|
2
|
+
export declare const makeVanillaTheme: (tokens: ThemeTokens) => {
|
|
3
|
+
space: Record<keyof typeof tokens.spacing, string>;
|
|
4
|
+
borderRadius: Record<keyof typeof tokens.border.radius, string>;
|
|
5
|
+
color: Record<keyof typeof tokens.color, string>;
|
|
6
|
+
borderWidth: Record<keyof typeof tokens.border.width, string>;
|
|
7
|
+
fontFamily: Record<keyof typeof tokens.typography.fontFamily, string>;
|
|
8
|
+
fontSize: Record<keyof typeof tokens.typography.fontSize, string>;
|
|
9
|
+
fontWeight: Record<keyof typeof tokens.typography.fontWeight, string>;
|
|
10
|
+
lineHeight: Record<keyof typeof tokens.typography.lineHeight, string>;
|
|
11
|
+
transition: Record<keyof typeof tokens.transition, string>;
|
|
12
|
+
shadow: Record<keyof typeof tokens.shadow, string>;
|
|
13
|
+
focus: {
|
|
14
|
+
boxShadow: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
let currentTheme = null;
|
|
4
|
+
function setTheme(theme) {
|
|
5
|
+
currentTheme = theme;
|
|
6
|
+
}
|
|
7
|
+
function getTheme() {
|
|
8
|
+
if (!currentTheme) {
|
|
9
|
+
throw new Error("No theme has been set. Use setTheme() to set a theme.");
|
|
10
|
+
}
|
|
11
|
+
return currentTheme;
|
|
12
|
+
}
|
|
13
|
+
function getComponentStyles(name, props, useDefaultVariants = true) {
|
|
14
|
+
const { components } = getTheme();
|
|
15
|
+
const component = components[name];
|
|
16
|
+
if (!component) {
|
|
17
|
+
console.warn(`Component ${name} is not defined in the theme`);
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
const classNames = [];
|
|
21
|
+
const variants = props.variants ?? {};
|
|
22
|
+
const variantsWithDefaults = { ...variants };
|
|
23
|
+
for (const key in props) {
|
|
24
|
+
const value = props[key];
|
|
25
|
+
if (typeof value === "boolean" && value) {
|
|
26
|
+
classNames.push(
|
|
27
|
+
// biome-ignore lint/suspicious/noExplicitAny: This is a type assertion for a dynamic key
|
|
28
|
+
component[key]
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!component.variants) {
|
|
33
|
+
return classNames.join(" ");
|
|
34
|
+
}
|
|
35
|
+
const { defaultVariants } = component;
|
|
36
|
+
if (useDefaultVariants && defaultVariants) {
|
|
37
|
+
const keys2 = Object.keys(defaultVariants);
|
|
38
|
+
for (const key of keys2) {
|
|
39
|
+
if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
|
|
40
|
+
variantsWithDefaults[key] = defaultVariants[key];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const keys = Object.keys(variantsWithDefaults);
|
|
45
|
+
const componentVariants = component.variants;
|
|
46
|
+
for (const key of keys) {
|
|
47
|
+
const value = variantsWithDefaults[key];
|
|
48
|
+
if (value === void 0 || componentVariants[key] === void 0) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (typeof value === "boolean") {
|
|
52
|
+
if (value && componentVariants[key]) {
|
|
53
|
+
classNames.push(componentVariants[key]);
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const variant = componentVariants[key][value];
|
|
58
|
+
if (variant) {
|
|
59
|
+
classNames.push(variant);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const { compoundVariants } = component;
|
|
63
|
+
if (compoundVariants) {
|
|
64
|
+
for (const compoundVariant of compoundVariants) {
|
|
65
|
+
const keys2 = Object.keys(
|
|
66
|
+
compoundVariant.variants
|
|
67
|
+
);
|
|
68
|
+
const matches = keys2.every((key) => {
|
|
69
|
+
const value = variantsWithDefaults[key];
|
|
70
|
+
if (value === void 0) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return value === compoundVariant.variants[key];
|
|
74
|
+
});
|
|
75
|
+
if (matches) {
|
|
76
|
+
classNames.push(compoundVariant.style);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return classNames.join(" ");
|
|
81
|
+
}
|
|
82
|
+
function getComponentStyleDefaults(name) {
|
|
83
|
+
const { components } = getTheme();
|
|
84
|
+
const component = components[name];
|
|
85
|
+
if (!component) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
return component.defaultVariants ?? {};
|
|
89
|
+
}
|
|
90
|
+
exports.getComponentStyleDefaults = getComponentStyleDefaults;
|
|
91
|
+
exports.getComponentStyles = getComponentStyles;
|
|
92
|
+
exports.getTheme = getTheme;
|
|
93
|
+
exports.setTheme = setTheme;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RecordLike } from '../../utils/helpers';
|
|
2
|
+
import { ComponentThemesProps } from '../componentThemes';
|
|
3
|
+
import { ThemeComponentsStyles } from '../makeComponentTheme';
|
|
4
|
+
import { Theme } from '../makeTheme';
|
|
5
|
+
export declare function setTheme(theme: Theme): void;
|
|
6
|
+
export declare function getTheme(): Theme;
|
|
7
|
+
export declare function getComponentStyles<T extends keyof ComponentThemesProps>(name: T, props: ComponentThemesProps[T], useDefaultVariants?: boolean): string;
|
|
8
|
+
type ThemeComponentsStylesRequired = Required<ThemeComponentsStyles>;
|
|
9
|
+
type Components = {
|
|
10
|
+
[K in keyof ThemeComponentsStylesRequired]: ThemeComponentsStylesRequired[K] extends RecordLike ? Required<ThemeComponentsStylesRequired[K]>['defaultVariants'] extends RecordLike ? ThemeComponentsStylesRequired[K]['defaultVariants'] extends undefined ? never : Exclude<ThemeComponentsStylesRequired[K]['defaultVariants'], undefined> : never : never;
|
|
11
|
+
};
|
|
12
|
+
export declare function getComponentStyleDefaults<T extends keyof ThemeComponentsStyles>(name: T): Components[T];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
let currentTheme = null;
|
|
2
|
+
function setTheme(theme) {
|
|
3
|
+
currentTheme = theme;
|
|
4
|
+
}
|
|
5
|
+
function getTheme() {
|
|
6
|
+
if (!currentTheme) {
|
|
7
|
+
throw new Error("No theme has been set. Use setTheme() to set a theme.");
|
|
8
|
+
}
|
|
9
|
+
return currentTheme;
|
|
10
|
+
}
|
|
11
|
+
function getComponentStyles(name, props, useDefaultVariants = true) {
|
|
12
|
+
const { components } = getTheme();
|
|
13
|
+
const component = components[name];
|
|
14
|
+
if (!component) {
|
|
15
|
+
console.warn(`Component ${name} is not defined in the theme`);
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
const classNames = [];
|
|
19
|
+
const variants = props.variants ?? {};
|
|
20
|
+
const variantsWithDefaults = { ...variants };
|
|
21
|
+
for (const key in props) {
|
|
22
|
+
const value = props[key];
|
|
23
|
+
if (typeof value === "boolean" && value) {
|
|
24
|
+
classNames.push(
|
|
25
|
+
// biome-ignore lint/suspicious/noExplicitAny: This is a type assertion for a dynamic key
|
|
26
|
+
component[key]
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!component.variants) {
|
|
31
|
+
return classNames.join(" ");
|
|
32
|
+
}
|
|
33
|
+
const { defaultVariants } = component;
|
|
34
|
+
if (useDefaultVariants && defaultVariants) {
|
|
35
|
+
const keys2 = Object.keys(defaultVariants);
|
|
36
|
+
for (const key of keys2) {
|
|
37
|
+
if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
|
|
38
|
+
variantsWithDefaults[key] = defaultVariants[key];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const keys = Object.keys(variantsWithDefaults);
|
|
43
|
+
const componentVariants = component.variants;
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const value = variantsWithDefaults[key];
|
|
46
|
+
if (value === void 0 || componentVariants[key] === void 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value === "boolean") {
|
|
50
|
+
if (value && componentVariants[key]) {
|
|
51
|
+
classNames.push(componentVariants[key]);
|
|
52
|
+
}
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const variant = componentVariants[key][value];
|
|
56
|
+
if (variant) {
|
|
57
|
+
classNames.push(variant);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const { compoundVariants } = component;
|
|
61
|
+
if (compoundVariants) {
|
|
62
|
+
for (const compoundVariant of compoundVariants) {
|
|
63
|
+
const keys2 = Object.keys(
|
|
64
|
+
compoundVariant.variants
|
|
65
|
+
);
|
|
66
|
+
const matches = keys2.every((key) => {
|
|
67
|
+
const value = variantsWithDefaults[key];
|
|
68
|
+
if (value === void 0) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return value === compoundVariant.variants[key];
|
|
72
|
+
});
|
|
73
|
+
if (matches) {
|
|
74
|
+
classNames.push(compoundVariant.style);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return classNames.join(" ");
|
|
79
|
+
}
|
|
80
|
+
function getComponentStyleDefaults(name) {
|
|
81
|
+
const { components } = getTheme();
|
|
82
|
+
const component = components[name];
|
|
83
|
+
if (!component) {
|
|
84
|
+
return {};
|
|
85
|
+
}
|
|
86
|
+
return component.defaultVariants ?? {};
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
getComponentStyleDefaults,
|
|
90
|
+
getComponentStyles,
|
|
91
|
+
getTheme,
|
|
92
|
+
setTheme
|
|
93
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
type FontWeight = 'regular' | 'medium' | 'strong';
|
|
2
|
+
type Space = 'none' | 'gutter' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
3
|
+
type Transition = 'slow' | 'normal' | 'fast';
|
|
4
|
+
type BorderRadius = 'small' | 'medium' | 'large' | 'xlarge';
|
|
5
|
+
type BorderWidth = 'small' | 'medium' | 'large';
|
|
6
|
+
type BoxShadow = 'small' | 'medium' | 'large';
|
|
7
|
+
type FontSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
8
|
+
type LineHeight = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
9
|
+
type Color = 'white' | 'black' | 'body' | 'primaryLight' | 'primary' | 'primaryDark' | 'secondaryLight' | 'secondary' | 'secondaryDark' | 'text' | 'textLight' | 'textDark' | 'danger' | 'link';
|
|
10
|
+
export type ThemeTokens = {
|
|
11
|
+
typography: {
|
|
12
|
+
fontFamily: {
|
|
13
|
+
body?: string;
|
|
14
|
+
primary?: string;
|
|
15
|
+
secondary?: string;
|
|
16
|
+
};
|
|
17
|
+
fontSize: Record<FontSize, number | string>;
|
|
18
|
+
fontWeight: Record<FontWeight, 400 | 500 | 600 | 700 | 800>;
|
|
19
|
+
lineHeight: Record<LineHeight, number | string>;
|
|
20
|
+
};
|
|
21
|
+
spacing: Record<Space, number | string>;
|
|
22
|
+
transition: Record<Transition, string>;
|
|
23
|
+
border: {
|
|
24
|
+
radius: Record<BorderRadius, number | string>;
|
|
25
|
+
width: Record<BorderWidth, number | string>;
|
|
26
|
+
};
|
|
27
|
+
shadow: Record<BoxShadow, string>;
|
|
28
|
+
focus: {
|
|
29
|
+
boxShadow: string;
|
|
30
|
+
};
|
|
31
|
+
color: Record<Color, string>;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
+
const css = require("@vanilla-extract/css");
|
|
5
|
+
const makeVanillaTheme = require("./makeVanillaTheme.cjs");
|
|
6
|
+
const tokens = require("./tokens.cjs");
|
|
7
|
+
fileScope.setFileScope("src/lib/theme/vars.css.ts", "@blockle/blocks");
|
|
8
|
+
const vars = css.createThemeContract(makeVanillaTheme.makeVanillaTheme(tokens.tokens));
|
|
9
|
+
fileScope.endFileScope();
|
|
10
|
+
exports.vars = vars;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const vars: {
|
|
2
|
+
space: {
|
|
3
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
4
|
+
none: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
5
|
+
gutter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
6
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
7
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
8
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
9
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
10
|
+
};
|
|
11
|
+
borderRadius: {
|
|
12
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
13
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
14
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
15
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
16
|
+
};
|
|
17
|
+
color: {
|
|
18
|
+
white: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
19
|
+
black: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
20
|
+
body: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
21
|
+
primaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
22
|
+
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
23
|
+
primaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
24
|
+
secondaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
25
|
+
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
26
|
+
secondaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
27
|
+
text: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
28
|
+
textLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
29
|
+
textDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
30
|
+
danger: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
31
|
+
link: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
32
|
+
};
|
|
33
|
+
borderWidth: {
|
|
34
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
35
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
36
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
37
|
+
};
|
|
38
|
+
fontFamily: {
|
|
39
|
+
body: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
40
|
+
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
41
|
+
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
42
|
+
};
|
|
43
|
+
fontSize: {
|
|
44
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
45
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
46
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
47
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
48
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
49
|
+
};
|
|
50
|
+
fontWeight: {
|
|
51
|
+
regular: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
52
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
53
|
+
strong: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
54
|
+
};
|
|
55
|
+
lineHeight: {
|
|
56
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
57
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
58
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
59
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
60
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
61
|
+
};
|
|
62
|
+
transition: {
|
|
63
|
+
slow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
64
|
+
normal: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
65
|
+
fast: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
66
|
+
};
|
|
67
|
+
shadow: {
|
|
68
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
69
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
70
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
71
|
+
};
|
|
72
|
+
focus: {
|
|
73
|
+
boxShadow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { createThemeContract } from "@vanilla-extract/css";
|
|
3
|
-
import { makeVanillaTheme } from "./makeVanillaTheme.
|
|
4
|
-
import { tokens } from "./tokens.
|
|
3
|
+
import { makeVanillaTheme } from "./makeVanillaTheme.js";
|
|
4
|
+
import { tokens } from "./tokens.js";
|
|
5
5
|
setFileScope("src/lib/theme/vars.css.ts", "@blockle/blocks");
|
|
6
6
|
const vars = createThemeContract(makeVanillaTheme(tokens));
|
|
7
7
|
endFileScope();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sprinkles_css = require("../css/atoms/sprinkles.css.cjs");
|
|
3
4
|
function getAtomsAndProps(props) {
|
|
4
5
|
const atomProps = {};
|
|
5
6
|
const otherProps = {};
|
|
6
7
|
for (const [name, value] of Object.entries(props)) {
|
|
7
|
-
if (
|
|
8
|
+
if (sprinkles_css.atoms.properties.has(name)) {
|
|
8
9
|
atomProps[name] = value;
|
|
9
10
|
} else {
|
|
10
11
|
otherProps[name] = value;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const classnames = (...args) => {
|
|
4
|
+
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
5
|
+
return className || void 0;
|
|
6
|
+
};
|
|
7
|
+
exports.classnames = classnames;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function hasAnimationDuration(element) {
|
|
4
|
+
if (!element) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const style = window.getComputedStyle(element);
|
|
8
|
+
return hasDuration(style.transitionDuration) || hasDuration(style.animationDuration);
|
|
9
|
+
}
|
|
10
|
+
function hasDuration(duration) {
|
|
11
|
+
return duration.split(",").map((part) => Number.parseFloat(part.trim())).some((part) => part > 0);
|
|
12
|
+
}
|
|
13
|
+
exports.hasAnimationDuration = hasAnimationDuration;
|