@blockle/blocks 0.19.1 → 0.20.0-alpha1
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 +19 -0
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.mjs +20 -0
- package/dist/components/accessibility/VisuallyHidden/index.cjs +1 -0
- package/dist/components/accessibility/VisuallyHidden/index.mjs +1 -0
- package/dist/{styles/components/Accessibility → components/accessibility}/VisuallyHidden/visually-hidden.css.cjs +1 -1
- package/dist/{styles/components/Accessibility → components/accessibility}/VisuallyHidden/visually-hidden.css.mjs +1 -1
- package/dist/components/display/Divider/Divider.cjs +25 -0
- package/dist/components/display/Divider/Divider.mjs +26 -0
- package/dist/{styles/components → components}/display/Divider/divider.css.cjs +2 -2
- package/dist/components/display/Divider/index.cjs +1 -0
- package/dist/components/display/Divider/index.mjs +1 -0
- package/dist/components/feedback/Progress/Progress.cjs +53 -0
- package/dist/components/feedback/Progress/Progress.mjs +54 -0
- package/dist/components/feedback/Progress/index.cjs +1 -0
- package/dist/components/feedback/Progress/index.mjs +1 -0
- package/dist/components/feedback/Spinner/Spinner.cjs +25 -0
- package/dist/components/feedback/Spinner/Spinner.mjs +26 -0
- package/dist/components/feedback/Spinner/index.cjs +1 -0
- package/dist/components/feedback/Spinner/index.mjs +1 -0
- package/dist/components/form/Button/Button.cjs +58 -0
- package/dist/{styles/components → components}/form/Button/Button.css.cjs +2 -2
- package/dist/{styles/components → components}/form/Button/Button.mjs +13 -11
- package/dist/components/form/Button/index.cjs +1 -0
- package/dist/components/form/Button/index.mjs +1 -0
- package/dist/components/form/Checkbox/Checkbox.cjs +78 -0
- package/dist/components/form/Checkbox/Checkbox.mjs +79 -0
- package/dist/{styles/components → components}/form/Checkbox/checkbox.css.cjs +3 -3
- package/dist/components/form/Checkbox/index.cjs +1 -0
- package/dist/components/form/Checkbox/index.mjs +1 -0
- package/dist/components/form/Input/Input.cjs +50 -0
- package/dist/components/form/Input/Input.mjs +51 -0
- package/dist/components/form/Input/index.cjs +1 -0
- package/dist/components/form/Input/index.mjs +1 -0
- package/dist/{styles/components → components}/form/Input/input.css.cjs +2 -2
- package/dist/components/form/Label/Label.cjs +29 -0
- package/dist/components/form/Label/Label.mjs +30 -0
- package/dist/components/form/Label/index.cjs +1 -0
- package/dist/components/form/Label/index.mjs +1 -0
- package/dist/components/form/Radio/Radio.cjs +47 -0
- package/dist/components/form/Radio/Radio.mjs +48 -0
- package/dist/components/form/Radio/RadioGroup.cjs +1 -0
- package/dist/components/form/Radio/RadioGroup.mjs +1 -0
- package/dist/components/form/Radio/index.cjs +1 -0
- package/dist/components/form/Radio/index.mjs +1 -0
- package/dist/{styles/components → components}/form/Radio/radio.css.cjs +3 -3
- package/dist/components/form/Select/Select.cjs +64 -0
- package/dist/{styles/components → components}/form/Select/Select.mjs +23 -6
- package/dist/components/form/Select/index.cjs +1 -0
- package/dist/components/form/Select/index.mjs +1 -0
- package/dist/{styles/components → components}/form/Select/select.css.cjs +4 -4
- package/dist/components/form/Slider/Slider.cjs +139 -0
- package/dist/components/form/Slider/Slider.mjs +142 -0
- package/dist/components/form/Slider/index.cjs +1 -0
- package/dist/components/form/Slider/index.mjs +1 -0
- package/dist/{styles/components → components}/form/Slider/slider.css.cjs +6 -6
- package/dist/components/form/Slider/usePointerProgress.cjs +44 -0
- package/dist/components/form/Slider/usePointerProgress.mjs +45 -0
- package/dist/{styles/components → components}/form/Switch/Switch.cjs +10 -8
- package/dist/{styles/components → components}/form/Switch/Switch.mjs +9 -5
- package/dist/components/form/Switch/index.cjs +1 -0
- package/dist/components/form/Switch/index.mjs +1 -0
- package/dist/{styles/components → components}/form/Switch/switch.css.cjs +3 -3
- package/dist/components/layout/Box/Box.cjs +27 -0
- package/dist/components/layout/Box/Box.mjs +28 -0
- package/dist/components/layout/Box/index.cjs +1 -0
- package/dist/components/layout/Box/index.mjs +1 -0
- package/dist/components/layout/Inline/Inline.cjs +29 -0
- package/dist/components/layout/Inline/Inline.mjs +30 -0
- package/dist/components/layout/Inline/index.cjs +1 -0
- package/dist/components/layout/Inline/index.mjs +1 -0
- package/dist/components/layout/Stack/Stack.cjs +29 -0
- package/dist/components/layout/Stack/Stack.mjs +30 -0
- package/dist/components/layout/Stack/index.cjs +1 -0
- package/dist/components/layout/Stack/index.mjs +1 -0
- package/dist/components/navigation/Link/Link.cjs +31 -0
- package/dist/components/navigation/Link/Link.mjs +32 -0
- package/dist/components/navigation/Link/index.cjs +1 -0
- package/dist/components/navigation/Link/index.mjs +1 -0
- package/dist/components/other/BlocksProvider/BlocksProvider.cjs +36 -0
- package/dist/{styles/components → components}/other/BlocksProvider/BlocksProvider.mjs +12 -5
- package/dist/components/other/BlocksProvider/context.cjs +4 -0
- package/dist/components/other/BlocksProvider/context.mjs +7 -0
- package/dist/components/other/BlocksProvider/index.cjs +1 -0
- package/dist/components/other/BlocksProvider/index.mjs +1 -0
- package/dist/components/other/Portal/Portal.cjs +7 -0
- package/dist/components/other/Portal/Portal.mjs +8 -0
- package/dist/components/other/Portal/index.cjs +1 -0
- package/dist/components/other/Portal/index.mjs +1 -0
- package/dist/components/overlay/Dialog/Dialog.cjs +77 -0
- package/dist/components/overlay/Dialog/Dialog.mjs +80 -0
- package/dist/{styles/components → components}/overlay/Dialog/dialog.css.cjs +2 -2
- package/dist/components/overlay/Dialog/dialogHelper.cjs +20 -0
- package/dist/components/overlay/Dialog/dialogHelper.mjs +21 -0
- package/dist/components/overlay/Dialog/index.cjs +1 -0
- package/dist/components/overlay/Dialog/index.mjs +1 -0
- package/dist/components/overlay/Popover/Popover.cjs +111 -0
- package/dist/components/overlay/Popover/Popover.mjs +112 -0
- package/dist/components/overlay/Popover/popover-utils.cjs +61 -0
- package/dist/components/overlay/Popover/popover-utils.mjs +62 -0
- package/dist/components/overlay/Tooltip/Tooltip.cjs +71 -0
- package/dist/components/overlay/Tooltip/Tooltip.mjs +74 -0
- package/dist/components/overlay/Tooltip/index.cjs +1 -0
- package/dist/components/overlay/Tooltip/index.mjs +1 -0
- package/dist/components/typography/Heading/Heading.cjs +23 -0
- package/dist/components/typography/Heading/Heading.mjs +24 -0
- package/dist/{styles/components → components}/typography/Heading/heading.css.cjs +2 -2
- package/dist/components/typography/Heading/index.cjs +1 -0
- package/dist/components/typography/Heading/index.mjs +1 -0
- package/dist/components/typography/Text/Text.cjs +20 -0
- package/dist/{styles/components → components}/typography/Text/Text.mjs +2 -2
- package/dist/components/typography/Text/index.cjs +1 -0
- package/dist/components/typography/Text/index.mjs +1 -0
- package/dist/{styles/components → components}/typography/Text/text.css.cjs +2 -2
- package/dist/hooks/useClickOutside/useClickOutside.cjs +22 -0
- package/dist/hooks/useClickOutside/useClickOutside.mjs +23 -0
- package/dist/hooks/useControlledValue/useControlledValue.cjs +31 -0
- package/dist/hooks/useControlledValue/useControlledValue.mjs +32 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.cjs +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect/index.mjs +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +4 -0
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs +7 -0
- package/dist/hooks/useKeyboard/index.cjs +1 -0
- package/dist/hooks/useKeyboard/index.mjs +1 -0
- package/dist/hooks/useKeyboard/useKeyboard.cjs +19 -0
- package/dist/hooks/useKeyboard/useKeyboard.mjs +22 -0
- package/dist/hooks/useLayer/index.cjs +1 -0
- package/dist/hooks/useLayer/index.mjs +1 -0
- package/dist/hooks/useLayer/useLayer.cjs +25 -0
- package/dist/hooks/useLayer/useLayer.mjs +26 -0
- package/dist/hooks/usePreventBodyScroll/index.cjs +1 -0
- package/dist/hooks/usePreventBodyScroll/index.mjs +1 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.cjs +29 -0
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.mjs +30 -0
- package/dist/hooks/useRestoreFocus/index.cjs +1 -0
- package/dist/hooks/useRestoreFocus/index.mjs +1 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.cjs +17 -0
- package/dist/hooks/useRestoreFocus/useRestoreFocus.mjs +18 -0
- package/dist/hooks/useRootAriaHidden/index.cjs +1 -0
- package/dist/hooks/useRootAriaHidden/index.mjs +1 -0
- package/dist/hooks/useRootAriaHidden/useRootAriaHidden.cjs +11 -0
- package/dist/hooks/useRootAriaHidden/useRootAriaHidden.mjs +12 -0
- package/dist/hooks/useVisibilityState/index.cjs +1 -0
- package/dist/hooks/useVisibilityState/index.mjs +1 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.cjs +15 -0
- package/dist/hooks/useVisibilityState/useVisibilityState.mjs +16 -0
- package/dist/index.cjs +71 -444
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +37 -415
- package/dist/lib/asChildRenderer/createAsChildTemplate.cjs +72 -0
- package/dist/lib/asChildRenderer/createAsChildTemplate.mjs +73 -0
- package/dist/{styles/lib → lib}/css/atoms/atomicProperties.cjs +28 -22
- package/dist/{styles/lib → lib}/css/atoms/atomicProperties.mjs +7 -1
- package/dist/{styles/lib → lib}/css/atoms/sprinkles.css.cjs +8 -8
- package/dist/lib/css/flexbox/flexbox.cjs +16 -0
- package/dist/lib/css/flexbox/flexbox.mjs +17 -0
- package/dist/{styles/lib → lib}/css/style/style.cjs +3 -3
- package/dist/lib/react/mergeProps.cjs +42 -0
- package/dist/lib/react/mergeProps.mjs +43 -0
- package/dist/lib/react/refs.cjs +16 -0
- package/dist/lib/react/refs.mjs +17 -0
- package/dist/lib/theme/makeTheme.cjs +12 -0
- package/dist/lib/theme/store/theme.cjs +92 -0
- package/dist/lib/theme/store/theme.mjs +93 -0
- package/dist/lib/theme/vars.css.cjs +9 -0
- package/dist/{styles/lib → lib}/utils/atom-props.cjs +2 -2
- package/dist/lib/utils/classnames.cjs +6 -0
- package/dist/lib/utils/classnames.mjs +7 -0
- package/dist/lib/utils/dom.cjs +12 -0
- package/dist/lib/utils/dom.mjs +13 -0
- package/dist/lib/utils/math.cjs +12 -0
- package/dist/lib/utils/math.mjs +13 -0
- package/dist/momotaro.chunk.d.ts +40 -56
- package/dist/reset.cjs +2 -2
- package/dist/reset.mjs +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/button.css.cjs +23 -23
- package/dist/themes/momotaro/components/checkbox.css.cjs +59 -0
- package/dist/{styles/themes → themes}/momotaro/components/dialog.css.cjs +4 -4
- package/dist/{styles/themes → themes}/momotaro/components/divider.css.cjs +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/helpers.css.cjs +3 -3
- package/dist/themes/momotaro/components/index.cjs +34 -0
- package/dist/{styles/themes → themes}/momotaro/components/input.css.cjs +9 -9
- package/dist/{styles/themes → themes}/momotaro/components/label.css.cjs +7 -7
- package/dist/{styles/themes → themes}/momotaro/components/link.css.cjs +7 -7
- package/dist/{styles/themes → themes}/momotaro/components/popover.css.cjs +4 -4
- package/dist/{styles/themes → themes}/momotaro/components/progress.css.cjs +7 -7
- package/dist/themes/momotaro/components/radio.css.cjs +60 -0
- package/dist/themes/momotaro/components/select.css.cjs +44 -0
- package/dist/themes/momotaro/components/slider.css.cjs +89 -0
- package/dist/{styles/themes → themes}/momotaro/components/spinner.css.cjs +2 -2
- package/dist/{styles/themes → themes}/momotaro/components/switch.css.cjs +10 -10
- package/dist/{styles/themes → themes}/momotaro/components/tooltip.css.cjs +6 -6
- package/dist/themes/momotaro/momotaro.css.cjs +13 -0
- package/dist/{styles/themes → themes}/momotaro/tokens.css.cjs +11 -11
- package/dist/themes/momotaro.cjs +2 -2
- package/dist/themes/momotaro.mjs +1 -1
- package/package.json +5 -15
- 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/theme/makeTheme.cjs +0 -12
- package/dist/styles/lib/theme/vars.css.cjs +0 -9
- package/dist/styles/themes/momotaro/components/checkbox.css.cjs +0 -59
- package/dist/styles/themes/momotaro/components/index.cjs +0 -34
- 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/slider.css.cjs +0 -89
- package/dist/styles/themes/momotaro/momotaro.css.cjs +0 -13
- /package/dist/{styles/components → components}/display/Divider/divider.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Button/Button.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Checkbox/checkbox.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Input/input.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Radio/radio.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Select/select.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Slider/slider.css.mjs +0 -0
- /package/dist/{styles/components → components}/form/Switch/switch.css.mjs +0 -0
- /package/dist/{styles/components → components}/overlay/Dialog/dialog.css.mjs +0 -0
- /package/dist/{styles/components → components}/typography/Heading/heading.css.mjs +0 -0
- /package/dist/{styles/components → components}/typography/Text/text.css.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/atoms.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/atoms.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/breakpoints.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/breakpoints.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/index.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/index.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/atoms/sprinkles.css.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/layers/layers.css.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/layers/layers.css.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/reset/reset.css.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/reset/reset.css.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/style/style.mjs +0 -0
- /package/dist/{styles/lib → lib}/css/utils/cssUtils.cjs +0 -0
- /package/dist/{styles/lib → lib}/css/utils/cssUtils.mjs +0 -0
- /package/dist/{styles/lib → lib}/theme/makeComponentTheme.cjs +0 -0
- /package/dist/{styles/lib → lib}/theme/makeComponentTheme.mjs +0 -0
- /package/dist/{styles/lib → lib}/theme/makeTheme.mjs +0 -0
- /package/dist/{styles/lib → lib}/theme/makeVanillaTheme.cjs +0 -0
- /package/dist/{styles/lib → lib}/theme/makeVanillaTheme.mjs +0 -0
- /package/dist/{styles/lib → lib}/theme/tokens.cjs +0 -0
- /package/dist/{styles/lib → lib}/theme/tokens.mjs +0 -0
- /package/dist/{styles/lib → lib}/theme/vars.css.mjs +0 -0
- /package/dist/{styles/lib → lib}/utils/atom-props.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/button.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/checkbox.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/dialog.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/divider.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/helpers.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/index.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/input.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/label.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/link.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/popover.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/progress.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/radio.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/select.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/slider.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/spinner.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/switch.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/tooltip.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/transitions.cjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/components/transitions.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/index.cjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/index.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/momotaro.css.mjs +0 -0
- /package/dist/{styles/themes → themes}/momotaro/tokens.css.mjs +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useRef, useCallback } from "react";
|
|
5
|
+
import { useControlledValue } from "../../../hooks/useControlledValue/useControlledValue.mjs";
|
|
6
|
+
import { getComponentStyles } from "../../../lib/theme/store/theme.mjs";
|
|
7
|
+
import { classnames } from "../../../lib/utils/classnames.mjs";
|
|
8
|
+
import { roundToPrecision, getBoundValue } from "../../../lib/utils/math.mjs";
|
|
9
|
+
import { filledTrack, track, thumb, containerVertical, container } from "./slider.css.mjs";
|
|
10
|
+
import { usePointerProgress } from "./usePointerProgress.mjs";
|
|
11
|
+
const usableKeys = /* @__PURE__ */ new Set([
|
|
12
|
+
"ArrowLeft",
|
|
13
|
+
"ArrowRight",
|
|
14
|
+
"ArrowUp",
|
|
15
|
+
"ArrowDown",
|
|
16
|
+
"Home",
|
|
17
|
+
"End",
|
|
18
|
+
"PageUp",
|
|
19
|
+
"PageDown",
|
|
20
|
+
"Home",
|
|
21
|
+
"End"
|
|
22
|
+
]);
|
|
23
|
+
const Slider = ({
|
|
24
|
+
min = 0,
|
|
25
|
+
max = 100,
|
|
26
|
+
step = 1,
|
|
27
|
+
orientation = "horizontal",
|
|
28
|
+
defaultValue = 0,
|
|
29
|
+
onChange,
|
|
30
|
+
value,
|
|
31
|
+
name,
|
|
32
|
+
size,
|
|
33
|
+
colorScheme,
|
|
34
|
+
disabled,
|
|
35
|
+
precision = 2,
|
|
36
|
+
...restProps
|
|
37
|
+
}) => {
|
|
38
|
+
const baseClass = getComponentStyles("slider", {
|
|
39
|
+
base: true,
|
|
40
|
+
variants: { size, colorScheme, disabled }
|
|
41
|
+
});
|
|
42
|
+
const trackClass = getComponentStyles("slider", { track: true }, false);
|
|
43
|
+
const filledTrackClass = getComponentStyles(
|
|
44
|
+
"slider",
|
|
45
|
+
{ filledTrack: true },
|
|
46
|
+
false
|
|
47
|
+
);
|
|
48
|
+
const thumbClass = getComponentStyles("slider", { thumb: true }, false);
|
|
49
|
+
const containerRef = useRef(null);
|
|
50
|
+
const [currentValue, setValue] = useControlledValue({
|
|
51
|
+
defaultValue,
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
transformValue: (value2) => roundToPrecision(getBoundValue(value2, min, max, step), precision)
|
|
55
|
+
});
|
|
56
|
+
usePointerProgress({
|
|
57
|
+
container: containerRef,
|
|
58
|
+
orientation,
|
|
59
|
+
onChange(progress) {
|
|
60
|
+
if (orientation === "vertical") {
|
|
61
|
+
setValue(max * (1 - progress));
|
|
62
|
+
} else {
|
|
63
|
+
setValue(max * progress);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
const onKeyDown = useCallback(
|
|
68
|
+
(event) => {
|
|
69
|
+
if (!usableKeys.has(event.key)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
const specialKey = ["PageUp", "PageDown"];
|
|
75
|
+
const stepModifier = event.shiftKey || specialKey.includes(event.key) ? (max - min) / 10 : step;
|
|
76
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowDown" || event.key === "PageDown") {
|
|
77
|
+
return setValue(currentValue - stepModifier);
|
|
78
|
+
}
|
|
79
|
+
if (event.key === "ArrowRight" || event.key === "ArrowUp" || event.key === "PageUp") {
|
|
80
|
+
return setValue(currentValue + stepModifier);
|
|
81
|
+
}
|
|
82
|
+
if (event.key === "Home") {
|
|
83
|
+
return setValue(min);
|
|
84
|
+
}
|
|
85
|
+
if (event.key === "End") {
|
|
86
|
+
return setValue(max);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
[max, min, step, setValue, currentValue]
|
|
90
|
+
);
|
|
91
|
+
return /* @__PURE__ */ jsxs(
|
|
92
|
+
"div",
|
|
93
|
+
{
|
|
94
|
+
ref: containerRef,
|
|
95
|
+
className: classnames(
|
|
96
|
+
container,
|
|
97
|
+
orientation === "vertical" ? containerVertical : "",
|
|
98
|
+
baseClass
|
|
99
|
+
),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx("div", { className: classnames(track, trackClass), children: /* @__PURE__ */ jsx(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
className: classnames(filledTrack, filledTrackClass),
|
|
105
|
+
style: {
|
|
106
|
+
inlineSize: `${currentValue / max * 100}%`
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
) }),
|
|
110
|
+
/* @__PURE__ */ jsx(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
className: classnames(thumb, thumbClass),
|
|
115
|
+
role: "slider",
|
|
116
|
+
"aria-valuemin": min,
|
|
117
|
+
"aria-valuemax": max,
|
|
118
|
+
"aria-valuenow": currentValue,
|
|
119
|
+
"aria-orientation": orientation,
|
|
120
|
+
style: {
|
|
121
|
+
[orientation === "horizontal" ? "insetInlineStart" : "insetInlineEnd"]: `${currentValue / max * 100}%`
|
|
122
|
+
},
|
|
123
|
+
onKeyDown,
|
|
124
|
+
...restProps
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx(
|
|
128
|
+
"input",
|
|
129
|
+
{
|
|
130
|
+
type: "hidden",
|
|
131
|
+
disabled,
|
|
132
|
+
name,
|
|
133
|
+
value: currentValue
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
Slider
|
|
142
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
|
-
const
|
|
4
|
+
const lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
5
|
fileScope.setFileScope("src/components/form/Slider/slider.css.ts", "@blockle/blocks");
|
|
6
6
|
const container = css.style({
|
|
7
7
|
"@layer": {
|
|
8
|
-
[
|
|
8
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
9
|
position: "relative",
|
|
10
10
|
writingMode: "horizontal-tb"
|
|
11
11
|
}
|
|
@@ -13,14 +13,14 @@ const container = css.style({
|
|
|
13
13
|
}, "container");
|
|
14
14
|
const containerVertical = css.style({
|
|
15
15
|
"@layer": {
|
|
16
|
-
[
|
|
16
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
17
17
|
writingMode: "vertical-lr"
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}, "containerVertical");
|
|
21
21
|
const track = css.style({
|
|
22
22
|
"@layer": {
|
|
23
|
-
[
|
|
23
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
24
24
|
cursor: "pointer",
|
|
25
25
|
position: "absolute",
|
|
26
26
|
inlineSize: "100%",
|
|
@@ -36,7 +36,7 @@ const track = css.style({
|
|
|
36
36
|
}, "track");
|
|
37
37
|
const filledTrack = css.style({
|
|
38
38
|
"@layer": {
|
|
39
|
-
[
|
|
39
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
40
40
|
position: "absolute",
|
|
41
41
|
blockSize: "100%",
|
|
42
42
|
borderRadius: "inherit",
|
|
@@ -50,7 +50,7 @@ const filledTrack = css.style({
|
|
|
50
50
|
}, "filledTrack");
|
|
51
51
|
const thumb = css.style({
|
|
52
52
|
"@layer": {
|
|
53
|
-
[
|
|
53
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
54
54
|
cursor: "pointer",
|
|
55
55
|
position: "absolute",
|
|
56
56
|
blockSize: "100%",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
function getProgress(event, rect) {
|
|
4
|
+
const { clientX, clientY } = event;
|
|
5
|
+
const { width, height, left, top } = rect;
|
|
6
|
+
const x = (clientX - left) / width;
|
|
7
|
+
const y = (clientY - top) / height;
|
|
8
|
+
return [x, y];
|
|
9
|
+
}
|
|
10
|
+
function usePointerProgress({ container, orientation, onChange }) {
|
|
11
|
+
react.useEffect(() => {
|
|
12
|
+
const element = container.current;
|
|
13
|
+
function pointerdown(event) {
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
if (!element) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const containerRect = element.getBoundingClientRect();
|
|
20
|
+
const axisIndex = orientation === "horizontal" ? 0 : 1;
|
|
21
|
+
const progress = getProgress(event, containerRect);
|
|
22
|
+
onChange(progress[axisIndex]);
|
|
23
|
+
const pointermove = (event2) => {
|
|
24
|
+
event2.preventDefault();
|
|
25
|
+
const progress2 = getProgress(event2, containerRect);
|
|
26
|
+
onChange(progress2[axisIndex]);
|
|
27
|
+
};
|
|
28
|
+
const pointerup = () => {
|
|
29
|
+
document.removeEventListener("pointermove", pointermove);
|
|
30
|
+
document.removeEventListener("pointerup", pointerup);
|
|
31
|
+
};
|
|
32
|
+
document.addEventListener("pointermove", pointermove);
|
|
33
|
+
document.addEventListener("pointerup", pointerup);
|
|
34
|
+
}
|
|
35
|
+
if (!element) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
element.addEventListener("pointerdown", pointerdown);
|
|
39
|
+
return () => {
|
|
40
|
+
element.removeEventListener("pointerdown", pointerdown);
|
|
41
|
+
};
|
|
42
|
+
}, [container, onChange, orientation]);
|
|
43
|
+
}
|
|
44
|
+
exports.usePointerProgress = usePointerProgress;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
function getProgress(event, rect) {
|
|
3
|
+
const { clientX, clientY } = event;
|
|
4
|
+
const { width, height, left, top } = rect;
|
|
5
|
+
const x = (clientX - left) / width;
|
|
6
|
+
const y = (clientY - top) / height;
|
|
7
|
+
return [x, y];
|
|
8
|
+
}
|
|
9
|
+
function usePointerProgress({ container, orientation, onChange }) {
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const element = container.current;
|
|
12
|
+
function pointerdown(event) {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
event.stopPropagation();
|
|
15
|
+
if (!element) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const containerRect = element.getBoundingClientRect();
|
|
19
|
+
const axisIndex = orientation === "horizontal" ? 0 : 1;
|
|
20
|
+
const progress = getProgress(event, containerRect);
|
|
21
|
+
onChange(progress[axisIndex]);
|
|
22
|
+
const pointermove = (event2) => {
|
|
23
|
+
event2.preventDefault();
|
|
24
|
+
const progress2 = getProgress(event2, containerRect);
|
|
25
|
+
onChange(progress2[axisIndex]);
|
|
26
|
+
};
|
|
27
|
+
const pointerup = () => {
|
|
28
|
+
document.removeEventListener("pointermove", pointermove);
|
|
29
|
+
document.removeEventListener("pointerup", pointerup);
|
|
30
|
+
};
|
|
31
|
+
document.addEventListener("pointermove", pointermove);
|
|
32
|
+
document.addEventListener("pointerup", pointerup);
|
|
33
|
+
}
|
|
34
|
+
if (!element) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
element.addEventListener("pointerdown", pointerdown);
|
|
38
|
+
return () => {
|
|
39
|
+
element.removeEventListener("pointerdown", pointerdown);
|
|
40
|
+
};
|
|
41
|
+
}, [container, onChange, orientation]);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
usePointerProgress
|
|
45
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const react = require("react");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const lib_theme_store_theme_cjs = require("../../../lib/theme/store/theme.cjs");
|
|
5
|
+
const lib_utils_classnames_cjs = require("../../../lib/utils/classnames.cjs");
|
|
6
|
+
const components_form_Switch_switch_css_cjs = require("./switch.css.cjs");
|
|
7
7
|
const Switch = ({
|
|
8
8
|
checked,
|
|
9
9
|
className,
|
|
@@ -12,9 +12,11 @@ const Switch = ({
|
|
|
12
12
|
ref,
|
|
13
13
|
...restProps
|
|
14
14
|
}) => {
|
|
15
|
-
const [isChecked, setIsChecked] = react.useState(
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const [isChecked, setIsChecked] = react.useState(
|
|
16
|
+
defaultChecked || checked || false
|
|
17
|
+
);
|
|
18
|
+
const baseClassName = lib_theme_store_theme_cjs.getComponentStyles("switch", { base: true });
|
|
19
|
+
const sliderClassName = lib_theme_store_theme_cjs.getComponentStyles("switch", { slider: true }, false);
|
|
18
20
|
react.useEffect(() => {
|
|
19
21
|
if (checked !== void 0) {
|
|
20
22
|
setIsChecked(checked);
|
|
@@ -41,7 +43,7 @@ const Switch = ({
|
|
|
41
43
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42
44
|
"div",
|
|
43
45
|
{
|
|
44
|
-
className:
|
|
46
|
+
className: lib_utils_classnames_cjs.classnames(className, components_form_Switch_switch_css_cjs.container, baseClassName),
|
|
45
47
|
"data-checked": isChecked,
|
|
46
48
|
onClick: (event) => {
|
|
47
49
|
if (event.target.tagName === "INPUT") {
|
|
@@ -55,7 +57,7 @@ const Switch = ({
|
|
|
55
57
|
{
|
|
56
58
|
ref,
|
|
57
59
|
type: "checkbox",
|
|
58
|
-
className:
|
|
60
|
+
className: components_form_Switch_switch_css_cjs.input,
|
|
59
61
|
checked: isChecked,
|
|
60
62
|
onChange: onChangeHandler,
|
|
61
63
|
...restProps
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
4
|
import { useState, useEffect, useCallback } from "react";
|
|
3
|
-
import {
|
|
5
|
+
import { getComponentStyles } from "../../../lib/theme/store/theme.mjs";
|
|
6
|
+
import { classnames } from "../../../lib/utils/classnames.mjs";
|
|
4
7
|
import { input, container } from "./switch.css.mjs";
|
|
5
|
-
import { useComponentStyles } from "../../display/Divider/Divider.mjs";
|
|
6
8
|
const Switch = ({
|
|
7
9
|
checked,
|
|
8
10
|
className,
|
|
@@ -11,9 +13,11 @@ const Switch = ({
|
|
|
11
13
|
ref,
|
|
12
14
|
...restProps
|
|
13
15
|
}) => {
|
|
14
|
-
const [isChecked, setIsChecked] = useState(
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const [isChecked, setIsChecked] = useState(
|
|
17
|
+
defaultChecked || checked || false
|
|
18
|
+
);
|
|
19
|
+
const baseClassName = getComponentStyles("switch", { base: true });
|
|
20
|
+
const sliderClassName = getComponentStyles("switch", { slider: true }, false);
|
|
17
21
|
useEffect(() => {
|
|
18
22
|
if (checked !== void 0) {
|
|
19
23
|
setIsChecked(checked);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
|
-
const
|
|
4
|
+
const lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
5
|
fileScope.setFileScope("src/components/form/Switch/switch.css.ts", "@blockle/blocks");
|
|
6
6
|
const container = css.style({
|
|
7
7
|
"@layer": {
|
|
8
|
-
[
|
|
8
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
9
|
cursor: "pointer",
|
|
10
10
|
userSelect: "none",
|
|
11
11
|
position: "relative"
|
|
@@ -14,7 +14,7 @@ const container = css.style({
|
|
|
14
14
|
}, "container");
|
|
15
15
|
const input = css.style({
|
|
16
16
|
"@layer": {
|
|
17
|
-
[
|
|
17
|
+
[lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
18
18
|
opacity: 0,
|
|
19
19
|
maxBlockSize: 0,
|
|
20
20
|
maxInlineSize: 0
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const lib_asChildRenderer_createAsChildTemplate_cjs = require("../../../lib/asChildRenderer/createAsChildTemplate.cjs");
|
|
4
|
+
const lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
|
|
5
|
+
const lib_utils_classnames_cjs = require("../../../lib/utils/classnames.cjs");
|
|
6
|
+
const lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
7
|
+
const { Template, Slot } = lib_asChildRenderer_createAsChildTemplate_cjs.createAsChildTemplate("div");
|
|
8
|
+
const Box = ({
|
|
9
|
+
asChild,
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
ref,
|
|
13
|
+
...restProps
|
|
14
|
+
}) => {
|
|
15
|
+
const [atomsProps, otherProps] = lib_utils_atomProps_cjs.getAtomsAndProps(restProps);
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
+
Template,
|
|
18
|
+
{
|
|
19
|
+
ref,
|
|
20
|
+
asChild,
|
|
21
|
+
className: lib_utils_classnames_cjs.classnames(className, lib_css_atoms_sprinkles_css_cjs.atoms(atomsProps)),
|
|
22
|
+
...otherProps,
|
|
23
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Slot, { children })
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
exports.Box = Box;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createAsChildTemplate } from "../../../lib/asChildRenderer/createAsChildTemplate.mjs";
|
|
3
|
+
import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
|
|
4
|
+
import { classnames } from "../../../lib/utils/classnames.mjs";
|
|
5
|
+
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
6
|
+
const { Template, Slot } = createAsChildTemplate("div");
|
|
7
|
+
const Box = ({
|
|
8
|
+
asChild,
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
ref,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
14
|
+
const [atomsProps, otherProps] = getAtomsAndProps(restProps);
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Template,
|
|
17
|
+
{
|
|
18
|
+
ref,
|
|
19
|
+
asChild,
|
|
20
|
+
className: classnames(className, atoms(atomsProps)),
|
|
21
|
+
...otherProps,
|
|
22
|
+
children: /* @__PURE__ */ jsx(Slot, { children })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
Box
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const lib_css_flexbox_flexbox_cjs = require("../../../lib/css/flexbox/flexbox.cjs");
|
|
4
|
+
const components_layout_Box_Box_cjs = require("../Box/Box.cjs");
|
|
5
|
+
const Inline = ({
|
|
6
|
+
alignX,
|
|
7
|
+
alignY,
|
|
8
|
+
tag: Tag = "div",
|
|
9
|
+
children,
|
|
10
|
+
display = "flex",
|
|
11
|
+
spacing,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
|
+
components_layout_Box_Box_cjs.Box,
|
|
16
|
+
{
|
|
17
|
+
asChild: true,
|
|
18
|
+
display,
|
|
19
|
+
gap: spacing,
|
|
20
|
+
flexDirection: "row",
|
|
21
|
+
justifyContent: alignX ? lib_css_flexbox_flexbox_cjs.justifyContentMap[alignX] : void 0,
|
|
22
|
+
alignItems: alignY ? lib_css_flexbox_flexbox_cjs.alignItemsMap[alignY] : void 0,
|
|
23
|
+
flexWrap: "wrap",
|
|
24
|
+
...props,
|
|
25
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tag, { children })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
exports.Inline = Inline;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { alignItemsMap, justifyContentMap } from "../../../lib/css/flexbox/flexbox.mjs";
|
|
3
|
+
import { Box } from "../Box/Box.mjs";
|
|
4
|
+
const Inline = ({
|
|
5
|
+
alignX,
|
|
6
|
+
alignY,
|
|
7
|
+
tag: Tag = "div",
|
|
8
|
+
children,
|
|
9
|
+
display = "flex",
|
|
10
|
+
spacing,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Box,
|
|
15
|
+
{
|
|
16
|
+
asChild: true,
|
|
17
|
+
display,
|
|
18
|
+
gap: spacing,
|
|
19
|
+
flexDirection: "row",
|
|
20
|
+
justifyContent: alignX ? justifyContentMap[alignX] : void 0,
|
|
21
|
+
alignItems: alignY ? alignItemsMap[alignY] : void 0,
|
|
22
|
+
flexWrap: "wrap",
|
|
23
|
+
...props,
|
|
24
|
+
children: /* @__PURE__ */ jsx(Tag, { children })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
Inline
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const lib_css_flexbox_flexbox_cjs = require("../../../lib/css/flexbox/flexbox.cjs");
|
|
4
|
+
const components_layout_Box_Box_cjs = require("../Box/Box.cjs");
|
|
5
|
+
const Stack = ({
|
|
6
|
+
tag: Tag = "div",
|
|
7
|
+
display = "flex",
|
|
8
|
+
children,
|
|
9
|
+
spacing,
|
|
10
|
+
alignX,
|
|
11
|
+
...restProps
|
|
12
|
+
}) => {
|
|
13
|
+
if (process.env.NODE_ENV === "development" && restProps.start !== void 0 && Tag !== "ol") {
|
|
14
|
+
console.warn('Stack: "start" prop is only valid with tag="ol"');
|
|
15
|
+
}
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17
|
+
components_layout_Box_Box_cjs.Box,
|
|
18
|
+
{
|
|
19
|
+
asChild: true,
|
|
20
|
+
display,
|
|
21
|
+
gap: spacing,
|
|
22
|
+
flexDirection: "column",
|
|
23
|
+
alignItems: alignX ? lib_css_flexbox_flexbox_cjs.alignItemsMap[alignX] : void 0,
|
|
24
|
+
...restProps,
|
|
25
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tag, { children })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
exports.Stack = Stack;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { alignItemsMap } from "../../../lib/css/flexbox/flexbox.mjs";
|
|
3
|
+
import { Box } from "../Box/Box.mjs";
|
|
4
|
+
const Stack = ({
|
|
5
|
+
tag: Tag = "div",
|
|
6
|
+
display = "flex",
|
|
7
|
+
children,
|
|
8
|
+
spacing,
|
|
9
|
+
alignX,
|
|
10
|
+
...restProps
|
|
11
|
+
}) => {
|
|
12
|
+
if (process.env.NODE_ENV === "development" && restProps.start !== void 0 && Tag !== "ol") {
|
|
13
|
+
console.warn('Stack: "start" prop is only valid with tag="ol"');
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Box,
|
|
17
|
+
{
|
|
18
|
+
asChild: true,
|
|
19
|
+
display,
|
|
20
|
+
gap: spacing,
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
alignItems: alignX ? alignItemsMap[alignX] : void 0,
|
|
23
|
+
...restProps,
|
|
24
|
+
children: /* @__PURE__ */ jsx(Tag, { children })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
Stack
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const lib_asChildRenderer_createAsChildTemplate_cjs = require("../../../lib/asChildRenderer/createAsChildTemplate.cjs");
|
|
4
|
+
const lib_theme_store_theme_cjs = require("../../../lib/theme/store/theme.cjs");
|
|
5
|
+
const lib_utils_classnames_cjs = require("../../../lib/utils/classnames.cjs");
|
|
6
|
+
const { Template, Slot } = lib_asChildRenderer_createAsChildTemplate_cjs.createAsChildTemplate("a");
|
|
7
|
+
const Link = ({
|
|
8
|
+
asChild,
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
ref,
|
|
12
|
+
underline,
|
|
13
|
+
variant,
|
|
14
|
+
...restProps
|
|
15
|
+
}) => {
|
|
16
|
+
const linkClassName = lib_theme_store_theme_cjs.getComponentStyles("link", {
|
|
17
|
+
base: true,
|
|
18
|
+
variants: { variant, underline }
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
Template,
|
|
22
|
+
{
|
|
23
|
+
asChild,
|
|
24
|
+
ref,
|
|
25
|
+
className: lib_utils_classnames_cjs.classnames(className, linkClassName),
|
|
26
|
+
...restProps,
|
|
27
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Slot, { children })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
exports.Link = Link;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createAsChildTemplate } from "../../../lib/asChildRenderer/createAsChildTemplate.mjs";
|
|
3
|
+
import { getComponentStyles } from "../../../lib/theme/store/theme.mjs";
|
|
4
|
+
import { classnames } from "../../../lib/utils/classnames.mjs";
|
|
5
|
+
const { Template, Slot } = createAsChildTemplate("a");
|
|
6
|
+
const Link = ({
|
|
7
|
+
asChild,
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
ref,
|
|
11
|
+
underline,
|
|
12
|
+
variant,
|
|
13
|
+
...restProps
|
|
14
|
+
}) => {
|
|
15
|
+
const linkClassName = getComponentStyles("link", {
|
|
16
|
+
base: true,
|
|
17
|
+
variants: { variant, underline }
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Template,
|
|
21
|
+
{
|
|
22
|
+
asChild,
|
|
23
|
+
ref,
|
|
24
|
+
className: classnames(className, linkClassName),
|
|
25
|
+
...restProps,
|
|
26
|
+
children: /* @__PURE__ */ jsx(Slot, { children })
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
Link
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|