@blockle/blocks-react 1.1.2 → 1.2.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.stories.d.ts +1 -1
- package/dist/components/display/Divider/Divider.js +2 -2
- package/dist/components/display/Divider/Divider.stories.d.ts +1 -1
- package/dist/components/feedback/Progress/Progress.stories.d.ts +1 -1
- package/dist/components/feedback/Spinner/Spinner.stories.d.ts +1 -1
- package/dist/components/form/Button/Button.js +2 -2
- package/dist/components/form/Button/Button.stories.d.ts +1 -1
- package/dist/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/components/form/Checkbox/Checkbox.stories.d.ts +1 -1
- package/dist/components/form/Input/Input.js +2 -2
- package/dist/components/form/Input/Input.stories.d.ts +1 -1
- package/dist/components/form/Label/Label.stories.d.ts +1 -1
- package/dist/components/form/Radio/Radio.js +1 -1
- package/dist/components/form/Radio/Radio.stories.d.ts +1 -1
- package/dist/components/form/Select/Select.js +1 -1
- package/dist/components/form/Select/Select.stories.d.ts +1 -1
- package/dist/components/form/Slider/Slider.js +1 -1
- package/dist/components/form/Slider/Slider.stories.d.ts +1 -1
- package/dist/components/form/Switch/Switch.js +1 -1
- package/dist/components/form/Switch/Switch.stories.d.ts +1 -1
- package/dist/components/layout/Box/Box.stories.d.ts +1 -1
- package/dist/components/layout/Inline/Inline.stories.d.ts +1 -1
- package/dist/components/layout/Stack/Stack.stories.d.ts +1 -1
- package/dist/components/navigation/Link/Link.stories.d.ts +1 -1
- package/dist/components/overlay/Dialog/Dialog.js +5 -5
- package/dist/components/overlay/Dialog/Dialog.stories.d.ts +1 -1
- package/dist/components/overlay/Popover/Popover.js +2 -2
- package/dist/components/overlay/Popover/Popover.stories.d.ts +1 -1
- package/dist/components/overlay/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/overlay/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/components/typography/Heading/Heading.js +1 -1
- package/dist/components/typography/Heading/heading.stories.d.ts +1 -1
- package/dist/components/typography/Text/Text.js +1 -1
- package/dist/components/typography/Text/Text.stories.d.ts +1 -1
- package/dist/index.d.ts +28 -27
- package/package.json +8 -14
- package/dist/components/accessibility/VisuallyHidden/VisuallyHidden.cjs +0 -20
- package/dist/components/accessibility/VisuallyHidden/index.d.ts +0 -1
- package/dist/components/accessibility/VisuallyHidden/visually-hidden.css.cjs +0 -16
- package/dist/components/display/Divider/Divider.cjs +0 -28
- package/dist/components/display/Divider/divider.css.cjs +0 -16
- package/dist/components/display/Divider/index.d.ts +0 -1
- package/dist/components/feedback/Progress/Progress.cjs +0 -55
- package/dist/components/feedback/Progress/index.d.ts +0 -1
- package/dist/components/feedback/Spinner/Spinner.cjs +0 -27
- package/dist/components/feedback/Spinner/index.d.ts +0 -1
- package/dist/components/form/Button/Button.cjs +0 -58
- package/dist/components/form/Button/Button.css.cjs +0 -16
- package/dist/components/form/Button/index.d.ts +0 -1
- package/dist/components/form/Checkbox/Checkbox.cjs +0 -80
- package/dist/components/form/Checkbox/checkbox.css.cjs +0 -32
- package/dist/components/form/Checkbox/index.d.ts +0 -1
- package/dist/components/form/Input/Input.cjs +0 -52
- package/dist/components/form/Input/index.d.ts +0 -1
- package/dist/components/form/Input/input.css.cjs +0 -21
- package/dist/components/form/Label/Label.cjs +0 -30
- package/dist/components/form/Label/index.d.ts +0 -1
- package/dist/components/form/Radio/Radio.cjs +0 -50
- package/dist/components/form/Radio/index.d.ts +0 -2
- package/dist/components/form/Radio/radio.css.cjs +0 -32
- package/dist/components/form/Select/Select.cjs +0 -73
- package/dist/components/form/Select/index.d.ts +0 -1
- package/dist/components/form/Select/select.css.cjs +0 -38
- package/dist/components/form/Slider/Slider.cjs +0 -139
- package/dist/components/form/Slider/index.d.ts +0 -1
- package/dist/components/form/Slider/slider.css.cjs +0 -75
- package/dist/components/form/Slider/usePointerProgress.cjs +0 -46
- package/dist/components/form/Switch/Switch.cjs +0 -73
- package/dist/components/form/Switch/index.d.ts +0 -1
- package/dist/components/form/Switch/switch.css.cjs +0 -27
- package/dist/components/layout/Box/Box.cjs +0 -26
- package/dist/components/layout/Box/index.d.ts +0 -1
- package/dist/components/layout/Inline/Inline.cjs +0 -30
- package/dist/components/layout/Inline/index.d.ts +0 -1
- package/dist/components/layout/Stack/Stack.cjs +0 -27
- package/dist/components/layout/Stack/index.d.ts +0 -1
- package/dist/components/navigation/Link/Link.cjs +0 -33
- package/dist/components/navigation/Link/index.d.ts +0 -1
- package/dist/components/overlay/Dialog/Dialog.cjs +0 -82
- package/dist/components/overlay/Dialog/dialog.css.cjs +0 -22
- package/dist/components/overlay/Dialog/dialogHelper.cjs +0 -21
- package/dist/components/overlay/Dialog/index.d.ts +0 -1
- package/dist/components/overlay/Popover/Popover.cjs +0 -106
- package/dist/components/overlay/Popover/index.d.ts +0 -1
- package/dist/components/overlay/Popover/popover-utils.cjs +0 -57
- package/dist/components/overlay/Portal/Portal.cjs +0 -15
- package/dist/components/overlay/Portal/index.d.ts +0 -1
- package/dist/components/overlay/Tooltip/Tooltip.cjs +0 -73
- package/dist/components/overlay/Tooltip/index.d.ts +0 -1
- package/dist/components/providers/BlocksProvider/BlocksProvider.cjs +0 -35
- package/dist/components/providers/BlocksProvider/context.cjs +0 -5
- package/dist/components/providers/BlocksProvider/index.d.ts +0 -2
- package/dist/components/typography/Heading/Heading.cjs +0 -24
- package/dist/components/typography/Heading/heading.css.cjs +0 -16
- package/dist/components/typography/Heading/index.d.ts +0 -1
- package/dist/components/typography/Text/Text.cjs +0 -21
- package/dist/components/typography/Text/index.d.ts +0 -1
- package/dist/components/typography/Text/text.css.cjs +0 -16
- package/dist/hooks/useClickOutside/useClickOutside.cjs +0 -23
- package/dist/hooks/useComponentStyles/index.d.ts +0 -2
- package/dist/hooks/useComponentStyles/useComponentStyleDefaultProps.cjs +0 -12
- package/dist/hooks/useComponentStyles/useComponentStyles.cjs +0 -74
- package/dist/hooks/useControlledValue/index.d.ts +0 -1
- package/dist/hooks/useControlledValue/useControlledValue.cjs +0 -33
- package/dist/hooks/useIsomorphicLayoutEffect/index.d.ts +0 -1
- package/dist/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs +0 -6
- package/dist/hooks/useKeyboard/index.d.ts +0 -1
- package/dist/hooks/useKeyboard/useKeyboard.cjs +0 -21
- package/dist/hooks/useLayer/index.d.ts +0 -1
- package/dist/hooks/usePreventBodyScroll/index.d.ts +0 -1
- package/dist/hooks/usePreventBodyScroll/usePreventBodyScroll.cjs +0 -31
- package/dist/hooks/useRestoreFocus/index.d.ts +0 -1
- package/dist/hooks/useRestoreFocus/useRestoreFocus.cjs +0 -19
- package/dist/hooks/useTheme/index.d.ts +0 -1
- package/dist/hooks/useTheme/useTheme.cjs +0 -13
- package/dist/hooks/useVisibilityState/index.d.ts +0 -1
- package/dist/index.cjs +0 -58
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const blocksReactSlot = require("@blockle/blocks-react-slot");
|
|
7
|
-
const Button_css = require("./Button.css.cjs");
|
|
8
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
9
|
-
const Spinner = require("../../feedback/Spinner/Spinner.cjs");
|
|
10
|
-
const [Template, Slot] = blocksReactSlot.createSlottable("button");
|
|
11
|
-
const Button = ({
|
|
12
|
-
asChild,
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
disabled,
|
|
16
|
-
endSlot,
|
|
17
|
-
intent,
|
|
18
|
-
loading,
|
|
19
|
-
ref,
|
|
20
|
-
size,
|
|
21
|
-
startSlot,
|
|
22
|
-
variant,
|
|
23
|
-
...restProps
|
|
24
|
-
}) => {
|
|
25
|
-
const buttonClassName = useComponentStyles.useComponentStyles("button", {
|
|
26
|
-
base: true,
|
|
27
|
-
variants: {
|
|
28
|
-
variant,
|
|
29
|
-
intent,
|
|
30
|
-
size,
|
|
31
|
-
disabled,
|
|
32
|
-
loading
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const [atomsProps, otherProps] = blocksCore.getAtomsAndProps(restProps);
|
|
36
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37
|
-
Template,
|
|
38
|
-
{
|
|
39
|
-
ref,
|
|
40
|
-
asChild,
|
|
41
|
-
disabled: disabled || loading,
|
|
42
|
-
className: blocksCore.classnames(
|
|
43
|
-
Button_css.buttonReset,
|
|
44
|
-
buttonClassName,
|
|
45
|
-
blocksCore.atoms(atomsProps),
|
|
46
|
-
className
|
|
47
|
-
),
|
|
48
|
-
...otherProps,
|
|
49
|
-
children: [
|
|
50
|
-
startSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { children: startSlot }),
|
|
51
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx(Spinner.Spinner, { size }),
|
|
52
|
-
/* @__PURE__ */ jsxRuntime.jsx(Slot, { children }),
|
|
53
|
-
endSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { children: endSlot })
|
|
54
|
-
]
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
exports.Button = Button;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
5
|
-
const css = require("@vanilla-extract/css");
|
|
6
|
-
fileScope.setFileScope("src/components/form/Button/Button.css.ts", "@blockle/blocks-react");
|
|
7
|
-
const buttonReset = css.style({
|
|
8
|
-
"@layer": {
|
|
9
|
-
[blocksCore.blocksLayerComponent]: {
|
|
10
|
-
all: "unset",
|
|
11
|
-
cursor: "pointer"
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
fileScope.endFileScope();
|
|
16
|
-
exports.buttonReset = buttonReset;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Button, type ButtonProps } from './Button';
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const Label = require("../Label/Label.cjs");
|
|
8
|
-
const checkbox_css = require("./checkbox.css.cjs");
|
|
9
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
10
|
-
const Checkbox = ({
|
|
11
|
-
children,
|
|
12
|
-
className,
|
|
13
|
-
id,
|
|
14
|
-
name,
|
|
15
|
-
ref,
|
|
16
|
-
required,
|
|
17
|
-
...restProps
|
|
18
|
-
}) => {
|
|
19
|
-
const containerClassName = useComponentStyles.useComponentStyles(
|
|
20
|
-
"checkbox",
|
|
21
|
-
{ base: true },
|
|
22
|
-
false
|
|
23
|
-
);
|
|
24
|
-
const iconClassName = useComponentStyles.useComponentStyles("checkbox", { icon: true }, false);
|
|
25
|
-
const labelClassName = useComponentStyles.useComponentStyles("checkbox", { label: true }, false);
|
|
26
|
-
const reactId = react.useId();
|
|
27
|
-
const inputId = id || reactId;
|
|
28
|
-
const input = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
-
"div",
|
|
30
|
-
{
|
|
31
|
-
className: blocksCore.classnames(checkbox_css.container, containerClassName, className),
|
|
32
|
-
children: [
|
|
33
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
-
"input",
|
|
35
|
-
{
|
|
36
|
-
ref,
|
|
37
|
-
type: "checkbox",
|
|
38
|
-
name,
|
|
39
|
-
id: inputId,
|
|
40
|
-
className: checkbox_css.input,
|
|
41
|
-
...restProps
|
|
42
|
-
}
|
|
43
|
-
),
|
|
44
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: blocksCore.classnames(checkbox_css.icon, iconClassName), "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {}) })
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
if (!children) {
|
|
49
|
-
return input;
|
|
50
|
-
}
|
|
51
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: labelClassName, children: [
|
|
52
|
-
input,
|
|
53
|
-
children && /* @__PURE__ */ jsxRuntime.jsx(Label.Label, { required, htmlFor: inputId, children })
|
|
54
|
-
] });
|
|
55
|
-
};
|
|
56
|
-
const DefaultIcon = () => {
|
|
57
|
-
return (
|
|
58
|
-
// TOOD - replace with actual icon component renderer
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
-
"svg",
|
|
61
|
-
{
|
|
62
|
-
viewBox: "0 0 24 24",
|
|
63
|
-
fill: "none",
|
|
64
|
-
strokeWidth: "1.5",
|
|
65
|
-
stroke: "currentColor",
|
|
66
|
-
style: { width: "1rem", height: "1rem", display: "block" },
|
|
67
|
-
role: "presentation",
|
|
68
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
|
-
"path",
|
|
70
|
-
{
|
|
71
|
-
strokeLinecap: "round",
|
|
72
|
-
strokeLinejoin: "round",
|
|
73
|
-
d: "m4.5 12.75 6 6 9-13.5"
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
)
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
exports.Checkbox = Checkbox;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
5
|
-
const css = require("@vanilla-extract/css");
|
|
6
|
-
fileScope.setFileScope("src/components/form/Checkbox/checkbox.css.ts", "@blockle/blocks-react");
|
|
7
|
-
const container = css.style({
|
|
8
|
-
"@layer": {
|
|
9
|
-
[blocksCore.blocksLayerComponent]: {
|
|
10
|
-
position: "relative",
|
|
11
|
-
cursor: "pointer",
|
|
12
|
-
overflow: "hidden"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const input = css.style({
|
|
17
|
-
position: "absolute",
|
|
18
|
-
inset: 0,
|
|
19
|
-
opacity: 0,
|
|
20
|
-
"@layer": {
|
|
21
|
-
[blocksCore.blocksLayerComponent]: {
|
|
22
|
-
all: "unset"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const icon = css.style({
|
|
27
|
-
pointerEvents: "none"
|
|
28
|
-
});
|
|
29
|
-
fileScope.endFileScope();
|
|
30
|
-
exports.container = container;
|
|
31
|
-
exports.icon = icon;
|
|
32
|
-
exports.input = input;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Checkbox, type CheckboxProps } from './Checkbox';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const react = require("react");
|
|
6
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
7
|
-
const input_css = require("./input.css.cjs");
|
|
8
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
9
|
-
const Box = require("../../layout/Box/Box.cjs");
|
|
10
|
-
const Input = ({
|
|
11
|
-
className,
|
|
12
|
-
endSlot,
|
|
13
|
-
name,
|
|
14
|
-
placeholder,
|
|
15
|
-
ref,
|
|
16
|
-
startSlot,
|
|
17
|
-
type = "text",
|
|
18
|
-
...restProps
|
|
19
|
-
}) => {
|
|
20
|
-
const id = react.useId();
|
|
21
|
-
const containerClassName = useComponentStyles.useComponentStyles(
|
|
22
|
-
"input",
|
|
23
|
-
{ container: true },
|
|
24
|
-
false
|
|
25
|
-
);
|
|
26
|
-
const inputClassName = useComponentStyles.useComponentStyles("input", { input: true });
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
28
|
-
Box.Box,
|
|
29
|
-
{
|
|
30
|
-
display: "flex",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
className: blocksCore.classnames(containerClassName, className),
|
|
33
|
-
children: [
|
|
34
|
-
startSlot,
|
|
35
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
-
"input",
|
|
37
|
-
{
|
|
38
|
-
id,
|
|
39
|
-
ref,
|
|
40
|
-
name,
|
|
41
|
-
type,
|
|
42
|
-
placeholder,
|
|
43
|
-
className: blocksCore.classnames(input_css.input, inputClassName),
|
|
44
|
-
...restProps
|
|
45
|
-
}
|
|
46
|
-
),
|
|
47
|
-
endSlot
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
) });
|
|
51
|
-
};
|
|
52
|
-
exports.Input = Input;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Input, type InputProps } from './Input';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
5
|
-
const css = require("@vanilla-extract/css");
|
|
6
|
-
fileScope.setFileScope("src/components/form/Input/input.css.ts", "@blockle/blocks-react");
|
|
7
|
-
const input = css.style({
|
|
8
|
-
"@layer": {
|
|
9
|
-
[blocksCore.blocksLayerComponent]: {
|
|
10
|
-
appearance: "none",
|
|
11
|
-
width: "100%",
|
|
12
|
-
selectors: {
|
|
13
|
-
"&:-webkit-autofill": {
|
|
14
|
-
transitionDelay: "9999s"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
fileScope.endFileScope();
|
|
21
|
-
exports.input = input;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
7
|
-
const Label = ({
|
|
8
|
-
asSpan,
|
|
9
|
-
children,
|
|
10
|
-
className,
|
|
11
|
-
required,
|
|
12
|
-
size,
|
|
13
|
-
cursor,
|
|
14
|
-
...restProps
|
|
15
|
-
}) => {
|
|
16
|
-
const Component = asSpan ? "span" : "label";
|
|
17
|
-
const containerClassName = useComponentStyles.useComponentStyles("label", {
|
|
18
|
-
base: true,
|
|
19
|
-
variants: { required, size }
|
|
20
|
-
});
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
-
Component,
|
|
23
|
-
{
|
|
24
|
-
className: blocksCore.classnames(containerClassName, className, blocksCore.atoms({ cursor })),
|
|
25
|
-
...restProps,
|
|
26
|
-
children
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
exports.Label = Label;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Label, type LabelProps } from './Label';
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const radio_css = require("./radio.css.cjs");
|
|
8
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
9
|
-
const Label = require("../Label/Label.cjs");
|
|
10
|
-
const Radio = ({
|
|
11
|
-
name,
|
|
12
|
-
children,
|
|
13
|
-
className,
|
|
14
|
-
ref,
|
|
15
|
-
...restProps
|
|
16
|
-
}) => {
|
|
17
|
-
const rid = react.useId();
|
|
18
|
-
const id = restProps.id ?? rid;
|
|
19
|
-
const containerClassName = useComponentStyles.useComponentStyles("radio", { base: true }, false);
|
|
20
|
-
const iconClassName = useComponentStyles.useComponentStyles("radio", { icon: true }, false);
|
|
21
|
-
const labelClassName = useComponentStyles.useComponentStyles("checkbox", { label: true }, false);
|
|
22
|
-
const input = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
23
|
-
"div",
|
|
24
|
-
{
|
|
25
|
-
className: blocksCore.classnames(radio_css.container, containerClassName, className),
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
-
"input",
|
|
29
|
-
{
|
|
30
|
-
ref,
|
|
31
|
-
type: "radio",
|
|
32
|
-
name,
|
|
33
|
-
id,
|
|
34
|
-
className: radio_css.input,
|
|
35
|
-
...restProps
|
|
36
|
-
}
|
|
37
|
-
),
|
|
38
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: blocksCore.classnames(radio_css.icon, iconClassName) })
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
if (!children) {
|
|
43
|
-
return input;
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: labelClassName, children: [
|
|
46
|
-
input,
|
|
47
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label.Label, { asSpan: true, children })
|
|
48
|
-
] });
|
|
49
|
-
};
|
|
50
|
-
exports.Radio = Radio;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
5
|
-
const css = require("@vanilla-extract/css");
|
|
6
|
-
fileScope.setFileScope("src/components/form/Radio/radio.css.ts", "@blockle/blocks-react");
|
|
7
|
-
const container = css.style({
|
|
8
|
-
"@layer": {
|
|
9
|
-
[blocksCore.blocksLayerComponent]: {
|
|
10
|
-
position: "relative",
|
|
11
|
-
cursor: "pointer",
|
|
12
|
-
overflow: "hidden"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
const input = css.style({
|
|
17
|
-
position: "absolute",
|
|
18
|
-
inset: 0,
|
|
19
|
-
opacity: 0,
|
|
20
|
-
"@layer": {
|
|
21
|
-
[blocksCore.blocksLayerComponent]: {
|
|
22
|
-
all: "unset"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
const icon = css.style({
|
|
27
|
-
pointerEvents: "none"
|
|
28
|
-
});
|
|
29
|
-
fileScope.endFileScope();
|
|
30
|
-
exports.container = container;
|
|
31
|
-
exports.icon = icon;
|
|
32
|
-
exports.input = input;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const select_css = require("./select.css.cjs");
|
|
7
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
8
|
-
const Box = require("../../layout/Box/Box.cjs");
|
|
9
|
-
const Select = ({
|
|
10
|
-
children,
|
|
11
|
-
placeholder,
|
|
12
|
-
className,
|
|
13
|
-
variant,
|
|
14
|
-
ref,
|
|
15
|
-
...restProps
|
|
16
|
-
}) => {
|
|
17
|
-
const wrapperClassName = useComponentStyles.useComponentStyles(
|
|
18
|
-
"select",
|
|
19
|
-
{ wrapper: true },
|
|
20
|
-
false
|
|
21
|
-
);
|
|
22
|
-
const selectClassName = useComponentStyles.useComponentStyles("select", {
|
|
23
|
-
select: true,
|
|
24
|
-
variants: { variant }
|
|
25
|
-
});
|
|
26
|
-
const iconClassName = useComponentStyles.useComponentStyles("select", { icon: true }, false);
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(Box.Box, { className: blocksCore.classnames(select_css.wrapper, wrapperClassName), children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
-
"select",
|
|
30
|
-
{
|
|
31
|
-
ref,
|
|
32
|
-
className: blocksCore.classnames(select_css.select, selectClassName, className),
|
|
33
|
-
...restProps,
|
|
34
|
-
children: [
|
|
35
|
-
placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
|
|
36
|
-
children
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
-
Box.Box,
|
|
42
|
-
{
|
|
43
|
-
className: blocksCore.classnames(select_css.icon, iconClassName),
|
|
44
|
-
role: "presentation",
|
|
45
|
-
"aria-hidden": true,
|
|
46
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {})
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
] });
|
|
50
|
-
};
|
|
51
|
-
const DefaultIcon = () => {
|
|
52
|
-
return (
|
|
53
|
-
// TOOD - replace with actual icon component renderer
|
|
54
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
55
|
-
"svg",
|
|
56
|
-
{
|
|
57
|
-
role: "presentation",
|
|
58
|
-
viewBox: "0 0 24 24",
|
|
59
|
-
style: { width: "1rem", height: "1rem" },
|
|
60
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
-
"path",
|
|
62
|
-
{
|
|
63
|
-
fill: "currentColor",
|
|
64
|
-
fillRule: "evenodd",
|
|
65
|
-
d: "m11.625 14.3666 7.9365-7.653c.5241-.5055 1.3133-.4372 1.7625.1525.4493.5897.3886 1.4774-.1355 1.9829l-8.75 8.4375c-.4681.4513-1.1589.4513-1.627 0l-8.75-8.4375c-.5241-.5055-.5848-1.3932-.1356-1.9829.4493-.5897 1.2385-.658 1.7626-.1525l7.9365 7.653Z",
|
|
66
|
-
clipRule: "evenodd"
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
exports.Select = Select;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Select, type SelectProps } from './Select';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
4
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
5
|
-
const css = require("@vanilla-extract/css");
|
|
6
|
-
fileScope.setFileScope("src/components/form/Select/select.css.ts", "@blockle/blocks-react");
|
|
7
|
-
const wrapper = css.style({
|
|
8
|
-
"@layer": {
|
|
9
|
-
[blocksCore.blocksLayerComponent]: {
|
|
10
|
-
position: "relative"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const select = css.style({
|
|
15
|
-
"@layer": {
|
|
16
|
-
[blocksCore.blocksLayerComponent]: {
|
|
17
|
-
appearance: "none",
|
|
18
|
-
inlineSize: "100%"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const icon = css.style({
|
|
23
|
-
"@layer": {
|
|
24
|
-
[blocksCore.blocksLayerComponent]: {
|
|
25
|
-
position: "absolute",
|
|
26
|
-
right: 0,
|
|
27
|
-
top: 0,
|
|
28
|
-
bottom: 0,
|
|
29
|
-
pointerEvents: "none",
|
|
30
|
-
display: "flex",
|
|
31
|
-
alignItems: "center"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
fileScope.endFileScope();
|
|
36
|
-
exports.icon = icon;
|
|
37
|
-
exports.select = select;
|
|
38
|
-
exports.wrapper = wrapper;
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
5
|
-
const blocksCore = require("@blockle/blocks-core");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const useControlledValue = require("../../../hooks/useControlledValue/useControlledValue.cjs");
|
|
8
|
-
const slider_css = require("./slider.css.cjs");
|
|
9
|
-
const usePointerProgress = require("./usePointerProgress.cjs");
|
|
10
|
-
const useComponentStyles = require("../../../hooks/useComponentStyles/useComponentStyles.cjs");
|
|
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 = 0.01,
|
|
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 = useComponentStyles.useComponentStyles("slider", {
|
|
39
|
-
base: true,
|
|
40
|
-
variants: { size, colorScheme, disabled }
|
|
41
|
-
});
|
|
42
|
-
const trackClass = useComponentStyles.useComponentStyles("slider", { track: true }, false);
|
|
43
|
-
const filledTrackClass = useComponentStyles.useComponentStyles(
|
|
44
|
-
"slider",
|
|
45
|
-
{ filledTrack: true },
|
|
46
|
-
false
|
|
47
|
-
);
|
|
48
|
-
const thumbClass = useComponentStyles.useComponentStyles("slider", { thumb: true }, false);
|
|
49
|
-
const containerRef = react.useRef(null);
|
|
50
|
-
const [currentValue, setValue] = useControlledValue.useControlledValue({
|
|
51
|
-
defaultValue,
|
|
52
|
-
value,
|
|
53
|
-
onChange,
|
|
54
|
-
transformValue: (value2) => blocksCore.roundToPrecision(blocksCore.getBoundValue(value2, min, max, step), precision)
|
|
55
|
-
});
|
|
56
|
-
usePointerProgress.usePointerProgress({
|
|
57
|
-
container: containerRef,
|
|
58
|
-
orientation,
|
|
59
|
-
onChange(progress) {
|
|
60
|
-
if (orientation === "vertical") {
|
|
61
|
-
progress = 1 - progress;
|
|
62
|
-
}
|
|
63
|
-
setValue(max * progress);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const onKeyDown = react.useCallback(
|
|
67
|
-
(event) => {
|
|
68
|
-
if (!usableKeys.has(event.key)) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
event.preventDefault();
|
|
72
|
-
event.stopPropagation();
|
|
73
|
-
const specialKey = ["PageUp", "PageDown"];
|
|
74
|
-
const stepModifier = event.shiftKey || specialKey.includes(event.key) ? (max - min) / 10 : step;
|
|
75
|
-
if (event.key === "ArrowLeft" || event.key === "ArrowDown" || event.key === "PageDown") {
|
|
76
|
-
return setValue(currentValue - stepModifier);
|
|
77
|
-
}
|
|
78
|
-
if (event.key === "ArrowRight" || event.key === "ArrowUp" || event.key === "PageUp") {
|
|
79
|
-
return setValue(currentValue + stepModifier);
|
|
80
|
-
}
|
|
81
|
-
if (event.key === "Home") {
|
|
82
|
-
return setValue(min);
|
|
83
|
-
}
|
|
84
|
-
if (event.key === "End") {
|
|
85
|
-
return setValue(max);
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
[max, min, step, setValue, currentValue]
|
|
89
|
-
);
|
|
90
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
91
|
-
"div",
|
|
92
|
-
{
|
|
93
|
-
ref: containerRef,
|
|
94
|
-
className: blocksCore.classnames(
|
|
95
|
-
slider_css.container,
|
|
96
|
-
orientation === "vertical" ? slider_css.containerVertical : "",
|
|
97
|
-
baseClass
|
|
98
|
-
),
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: blocksCore.classnames(slider_css.track, trackClass), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
className: blocksCore.classnames(slider_css.filledTrack, filledTrackClass),
|
|
104
|
-
style: {
|
|
105
|
-
inlineSize: `${currentValue / max * 100}%`
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
) }),
|
|
109
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
110
|
-
"button",
|
|
111
|
-
{
|
|
112
|
-
type: "button",
|
|
113
|
-
className: blocksCore.classnames(slider_css.thumb, thumbClass),
|
|
114
|
-
role: "slider",
|
|
115
|
-
"aria-valuemin": min,
|
|
116
|
-
"aria-valuemax": max,
|
|
117
|
-
"aria-valuenow": currentValue,
|
|
118
|
-
"aria-orientation": orientation,
|
|
119
|
-
style: {
|
|
120
|
-
[orientation === "horizontal" ? "insetInlineStart" : "insetInlineEnd"]: `${currentValue / max * 100}%`
|
|
121
|
-
},
|
|
122
|
-
onKeyDown,
|
|
123
|
-
...restProps
|
|
124
|
-
}
|
|
125
|
-
),
|
|
126
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
-
"input",
|
|
128
|
-
{
|
|
129
|
-
type: "hidden",
|
|
130
|
-
disabled,
|
|
131
|
-
name,
|
|
132
|
-
value: currentValue
|
|
133
|
-
}
|
|
134
|
-
)
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
};
|
|
139
|
-
exports.Slider = Slider;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Slider, type SliderProps } from './Slider';
|