@blockle/blocks 0.18.4 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -9
- package/dist/index.mjs +25 -9
- package/dist/momotaro.chunk.d.ts +52 -314
- package/dist/styles/components/display/Divider/Divider.cjs +48 -35
- package/dist/styles/components/display/Divider/Divider.mjs +49 -36
- package/dist/styles/components/form/Button/Button.cjs +9 -9
- package/dist/styles/components/form/Button/Button.mjs +9 -9
- package/dist/styles/components/form/Checkbox/Checkbox.cjs +10 -2
- package/dist/styles/components/form/Checkbox/Checkbox.mjs +12 -4
- package/dist/styles/components/form/Input/Input.cjs +11 -2
- package/dist/styles/components/form/Input/Input.mjs +12 -3
- package/dist/styles/components/form/Radio/Radio.cjs +2 -3
- package/dist/styles/components/form/Radio/Radio.mjs +3 -4
- package/dist/styles/components/form/Select/Select.cjs +9 -3
- package/dist/styles/components/form/Select/Select.mjs +10 -4
- package/dist/styles/components/form/Slider/Slider.cjs +5 -1
- package/dist/styles/components/form/Slider/Slider.mjs +6 -2
- package/dist/styles/components/form/Switch/Switch.cjs +9 -2
- package/dist/styles/components/form/Switch/Switch.mjs +11 -4
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +2 -12
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.mjs +3 -13
- package/dist/styles/components/typography/Text/Text.cjs +14 -4
- package/dist/styles/components/typography/Text/Text.mjs +14 -4
- package/dist/styles/lib/css/atoms/sprinkles.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/button.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/helpers.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/progress.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/spinner.css.mjs +1 -1
- package/package.json +34 -34
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
3
3
|
import { divider } from "./divider.css.mjs";
|
|
4
|
-
import { createContext, useContext,
|
|
4
|
+
import { createContext, useContext, Children, isValidElement, cloneElement } from "react";
|
|
5
5
|
import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
|
|
6
6
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
7
7
|
const BlocksProviderContext = createContext(null);
|
|
@@ -84,6 +84,20 @@ const useComponentStyleDefaultProps = (name) => {
|
|
|
84
84
|
}
|
|
85
85
|
return component.defaultVariants ?? {};
|
|
86
86
|
};
|
|
87
|
+
function setRef(ref, value) {
|
|
88
|
+
if (typeof ref === "function") {
|
|
89
|
+
ref(value);
|
|
90
|
+
} else if (ref !== null && ref !== void 0) {
|
|
91
|
+
ref.current = value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function composeRefs(...refs) {
|
|
95
|
+
return (node) => {
|
|
96
|
+
for (const ref of refs) {
|
|
97
|
+
setRef(ref, node);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
87
101
|
function mergeProps(slotProps, childProps) {
|
|
88
102
|
const overrideProps = {};
|
|
89
103
|
for (const propName in childProps) {
|
|
@@ -101,33 +115,35 @@ function mergeProps(slotProps, childProps) {
|
|
|
101
115
|
childPropValue(...args);
|
|
102
116
|
slotPropValue(...args);
|
|
103
117
|
};
|
|
104
|
-
} else
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
} else
|
|
119
|
+
switch (propName) {
|
|
120
|
+
case "style": {
|
|
121
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "className": {
|
|
125
|
+
overrideProps[propName] = classnames(slotPropValue, childPropValue);
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
case "ref": {
|
|
129
|
+
overrideProps[propName] = composeRefs(slotPropValue, childPropValue);
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
default: {
|
|
133
|
+
overrideProps[propName] = childPropValue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
111
136
|
}
|
|
112
137
|
return { ...slotProps, ...overrideProps };
|
|
113
138
|
}
|
|
114
|
-
function setRef(ref, value) {
|
|
115
|
-
if (typeof ref === "function") {
|
|
116
|
-
ref(value);
|
|
117
|
-
} else if (ref !== null && ref !== void 0) {
|
|
118
|
-
ref.current = value;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function composeRefs(...refs) {
|
|
122
|
-
return (node) => {
|
|
123
|
-
for (const ref of refs) {
|
|
124
|
-
setRef(ref, node);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
139
|
function createAsChildTemplate(defaultElement) {
|
|
129
140
|
const Tag = defaultElement;
|
|
130
|
-
const Template2 =
|
|
141
|
+
const Template2 = ({
|
|
142
|
+
asChild,
|
|
143
|
+
children,
|
|
144
|
+
ref,
|
|
145
|
+
...rootProps
|
|
146
|
+
}) => {
|
|
131
147
|
if (!asChild) {
|
|
132
148
|
const tagProps = { ref, ...rootProps };
|
|
133
149
|
return /* @__PURE__ */ jsx(Tag, { ...tagProps, children });
|
|
@@ -146,7 +162,7 @@ function createAsChildTemplate(defaultElement) {
|
|
|
146
162
|
}
|
|
147
163
|
return null;
|
|
148
164
|
}
|
|
149
|
-
if (!
|
|
165
|
+
if (!isValidElementWithChildren(slot)) {
|
|
150
166
|
return null;
|
|
151
167
|
}
|
|
152
168
|
if (!isValidElement(slot.props.children)) {
|
|
@@ -159,36 +175,33 @@ function createAsChildTemplate(defaultElement) {
|
|
|
159
175
|
}
|
|
160
176
|
return null;
|
|
161
177
|
}
|
|
162
|
-
if (!
|
|
178
|
+
if (!isValidElementWithChildren(slot.props.children)) {
|
|
163
179
|
return null;
|
|
164
180
|
}
|
|
165
181
|
const nextChildren = [...childrenArray];
|
|
166
182
|
if (nextChildren.length === 1 && !slot.props.children.props.children) {
|
|
167
|
-
return cloneElement(slot.props.children,
|
|
168
|
-
...mergeProps(rootProps, slot.props.children.props),
|
|
169
|
-
ref: composeRefs(ref, slot.props.children.ref)
|
|
170
|
-
});
|
|
183
|
+
return cloneElement(slot.props.children, mergeProps(rootProps, slot.props.children.props));
|
|
171
184
|
}
|
|
172
185
|
nextChildren[slotIndex] = slot.props.children.props.children;
|
|
173
186
|
return cloneElement(
|
|
174
187
|
slot.props.children,
|
|
175
|
-
|
|
176
|
-
...mergeProps(rootProps, slot.props.children.props),
|
|
177
|
-
ref: composeRefs(ref, slot.props.children.ref)
|
|
178
|
-
},
|
|
188
|
+
mergeProps(rootProps, slot.props.children.props),
|
|
179
189
|
nextChildren
|
|
180
190
|
);
|
|
181
|
-
}
|
|
191
|
+
};
|
|
182
192
|
return {
|
|
183
193
|
Template: Template2,
|
|
184
194
|
Slot: Slot$1
|
|
185
195
|
};
|
|
186
196
|
}
|
|
197
|
+
function isValidElementWithChildren(child) {
|
|
198
|
+
return isValidElement(child) && !!child.props;
|
|
199
|
+
}
|
|
187
200
|
const Slot$1 = ({ children }) => {
|
|
188
201
|
return children;
|
|
189
202
|
};
|
|
190
203
|
const { Template, Slot } = createAsChildTemplate("div");
|
|
191
|
-
const Box =
|
|
204
|
+
const Box = ({ asChild, className, children, ref, ...restProps }) => {
|
|
192
205
|
const [atomsProps, otherProps] = getAtomsAndProps(restProps);
|
|
193
206
|
return /* @__PURE__ */ jsx(
|
|
194
207
|
Template,
|
|
@@ -200,7 +213,7 @@ const Box = forwardRef(function Box2({ asChild, className, children, ...restProp
|
|
|
200
213
|
children: /* @__PURE__ */ jsx(Slot, { children })
|
|
201
214
|
}
|
|
202
215
|
);
|
|
203
|
-
}
|
|
216
|
+
};
|
|
204
217
|
const Divider = ({ className, color, ...restProps }) => {
|
|
205
218
|
const dividerClass = useComponentStyles("divider", { base: true });
|
|
206
219
|
const dividerDefaults = useComponentStyleDefaultProps("divider");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
3
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
4
|
const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
|
|
6
5
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
@@ -11,19 +10,20 @@ const Spinner = ({ className, size, color, ...restProps }) => {
|
|
|
11
10
|
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { color, className: styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs.classnames(spinnerClassName, className), ...restProps });
|
|
12
11
|
};
|
|
13
12
|
const { Template, Slot } = styles_components_display_Divider_Divider_cjs.createAsChildTemplate("button");
|
|
14
|
-
const Button =
|
|
13
|
+
const Button = ({
|
|
14
|
+
asChild,
|
|
15
15
|
children,
|
|
16
16
|
className,
|
|
17
|
-
|
|
17
|
+
disabled,
|
|
18
|
+
endSlot,
|
|
18
19
|
intent,
|
|
20
|
+
loading,
|
|
21
|
+
ref,
|
|
19
22
|
size,
|
|
20
23
|
startSlot,
|
|
21
|
-
|
|
22
|
-
loading,
|
|
23
|
-
disabled,
|
|
24
|
-
asChild,
|
|
24
|
+
variant,
|
|
25
25
|
...restProps
|
|
26
|
-
}
|
|
26
|
+
}) => {
|
|
27
27
|
const buttonClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("button", {
|
|
28
28
|
base: true,
|
|
29
29
|
variants: {
|
|
@@ -51,6 +51,6 @@ const Button = react.forwardRef(function Button2({
|
|
|
51
51
|
]
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
exports.Button = Button;
|
|
56
56
|
exports.Spinner = Spinner;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { useComponentStyles, Box, createAsChildTemplate } from "../../display/Divider/Divider.mjs";
|
|
4
3
|
import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
|
|
5
4
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
@@ -10,19 +9,20 @@ const Spinner = ({ className, size, color, ...restProps }) => {
|
|
|
10
9
|
return /* @__PURE__ */ jsx(Box, { color, className: classnames(spinnerClassName, className), ...restProps });
|
|
11
10
|
};
|
|
12
11
|
const { Template, Slot } = createAsChildTemplate("button");
|
|
13
|
-
const Button =
|
|
12
|
+
const Button = ({
|
|
13
|
+
asChild,
|
|
14
14
|
children,
|
|
15
15
|
className,
|
|
16
|
-
|
|
16
|
+
disabled,
|
|
17
|
+
endSlot,
|
|
17
18
|
intent,
|
|
19
|
+
loading,
|
|
20
|
+
ref,
|
|
18
21
|
size,
|
|
19
22
|
startSlot,
|
|
20
|
-
|
|
21
|
-
loading,
|
|
22
|
-
disabled,
|
|
23
|
-
asChild,
|
|
23
|
+
variant,
|
|
24
24
|
...restProps
|
|
25
|
-
}
|
|
25
|
+
}) => {
|
|
26
26
|
const buttonClassName = useComponentStyles("button", {
|
|
27
27
|
base: true,
|
|
28
28
|
variants: {
|
|
@@ -50,7 +50,7 @@ const Button = forwardRef(function Button2({
|
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
export {
|
|
55
55
|
Button,
|
|
56
56
|
Spinner
|
|
@@ -28,7 +28,15 @@ const Label = ({
|
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
|
-
const Checkbox =
|
|
31
|
+
const Checkbox = ({
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
id,
|
|
35
|
+
name,
|
|
36
|
+
ref,
|
|
37
|
+
required,
|
|
38
|
+
...restProps
|
|
39
|
+
}) => {
|
|
32
40
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { base: true }, false);
|
|
33
41
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { icon: true }, false);
|
|
34
42
|
const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -55,7 +63,7 @@ const Checkbox = react.forwardRef(function Checkbox2({ name, id, children, requi
|
|
|
55
63
|
input,
|
|
56
64
|
children && /* @__PURE__ */ jsxRuntime.jsx(Label, { required, htmlFor: inputId, children })
|
|
57
65
|
] });
|
|
58
|
-
}
|
|
66
|
+
};
|
|
59
67
|
const DefaultIcon = () => {
|
|
60
68
|
return (
|
|
61
69
|
// TOOD - replace with actual icon component renderer
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useId } from "react";
|
|
3
3
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
4
|
import { useComponentStyles } from "../../display/Divider/Divider.mjs";
|
|
5
5
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { input, icon, container } from "./checkbox.css.mjs";
|
|
7
7
|
const Label = ({
|
|
8
8
|
asSpan,
|
|
9
9
|
children,
|
|
@@ -27,7 +27,15 @@ const Label = ({
|
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
|
-
const Checkbox =
|
|
30
|
+
const Checkbox = ({
|
|
31
|
+
children,
|
|
32
|
+
className,
|
|
33
|
+
id,
|
|
34
|
+
name,
|
|
35
|
+
ref,
|
|
36
|
+
required,
|
|
37
|
+
...restProps
|
|
38
|
+
}) => {
|
|
31
39
|
const containerClassName = useComponentStyles("checkbox", { base: true }, false);
|
|
32
40
|
const iconClassName = useComponentStyles("checkbox", { icon: true }, false);
|
|
33
41
|
const labelClassName = useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -54,7 +62,7 @@ const Checkbox = forwardRef(function Checkbox2({ name, id, children, required, c
|
|
|
54
62
|
input$1,
|
|
55
63
|
children && /* @__PURE__ */ jsx(Label, { required, htmlFor: inputId, children })
|
|
56
64
|
] });
|
|
57
|
-
}
|
|
65
|
+
};
|
|
58
66
|
const DefaultIcon = () => {
|
|
59
67
|
return (
|
|
60
68
|
// TOOD - replace with actual icon component renderer
|
|
@@ -4,7 +4,16 @@ const react = require("react");
|
|
|
4
4
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
5
5
|
const styles_components_form_Input_input_css_cjs = require("./input.css.cjs");
|
|
6
6
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
7
|
-
const Input =
|
|
7
|
+
const Input = ({
|
|
8
|
+
className,
|
|
9
|
+
endSlot,
|
|
10
|
+
name,
|
|
11
|
+
placeholder,
|
|
12
|
+
ref,
|
|
13
|
+
startSlot,
|
|
14
|
+
type = "text",
|
|
15
|
+
...restProps
|
|
16
|
+
}) => {
|
|
8
17
|
const id = react.useId();
|
|
9
18
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("input", { container: true }, false);
|
|
10
19
|
const inputClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("input", { input: true });
|
|
@@ -24,5 +33,5 @@ const Input = react.forwardRef(function Input2({ className, name, type = "text",
|
|
|
24
33
|
),
|
|
25
34
|
endSlot
|
|
26
35
|
] }) });
|
|
27
|
-
}
|
|
36
|
+
};
|
|
28
37
|
exports.Input = Input;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useId } from "react";
|
|
3
3
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
4
|
import { input } from "./input.css.mjs";
|
|
5
5
|
import { useComponentStyles, Box } from "../../display/Divider/Divider.mjs";
|
|
6
|
-
const Input =
|
|
6
|
+
const Input = ({
|
|
7
|
+
className,
|
|
8
|
+
endSlot,
|
|
9
|
+
name,
|
|
10
|
+
placeholder,
|
|
11
|
+
ref,
|
|
12
|
+
startSlot,
|
|
13
|
+
type = "text",
|
|
14
|
+
...restProps
|
|
15
|
+
}) => {
|
|
7
16
|
const id = useId();
|
|
8
17
|
const containerClassName = useComponentStyles("input", { container: true }, false);
|
|
9
18
|
const inputClassName = useComponentStyles("input", { input: true });
|
|
@@ -23,7 +32,7 @@ const Input = forwardRef(function Input2({ className, name, type = "text", start
|
|
|
23
32
|
),
|
|
24
33
|
endSlot
|
|
25
34
|
] }) });
|
|
26
|
-
}
|
|
35
|
+
};
|
|
27
36
|
export {
|
|
28
37
|
Input
|
|
29
38
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
3
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
5
4
|
const styles_components_form_Radio_radio_css_cjs = require("./radio.css.cjs");
|
|
6
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
7
6
|
const styles_components_form_Checkbox_Checkbox_cjs = require("../Checkbox/Checkbox.cjs");
|
|
8
|
-
const Radio =
|
|
7
|
+
const Radio = ({ name, children, className, ref, ...restProps }) => {
|
|
9
8
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("radio", { base: true }, false);
|
|
10
9
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("radio", { icon: true }, false);
|
|
11
10
|
const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -20,5 +19,5 @@ const Radio = react.forwardRef(function Checkbox({ name, children, className, ..
|
|
|
20
19
|
input,
|
|
21
20
|
/* @__PURE__ */ jsxRuntime.jsx(styles_components_form_Checkbox_Checkbox_cjs.Label, { asSpan: true, children })
|
|
22
21
|
] });
|
|
23
|
-
}
|
|
22
|
+
};
|
|
24
23
|
exports.Radio = Radio;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { input, icon, container } from "./radio.css.mjs";
|
|
5
4
|
import { useComponentStyles } from "../../display/Divider/Divider.mjs";
|
|
6
5
|
import { Label } from "../Checkbox/Checkbox.mjs";
|
|
7
|
-
const Radio =
|
|
6
|
+
const Radio = ({ name, children, className, ref, ...restProps }) => {
|
|
8
7
|
const containerClassName = useComponentStyles("radio", { base: true }, false);
|
|
9
8
|
const iconClassName = useComponentStyles("radio", { icon: true }, false);
|
|
10
9
|
const labelClassName = useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -19,7 +18,7 @@ const Radio = forwardRef(function Checkbox({ name, children, className, ...restP
|
|
|
19
18
|
input$1,
|
|
20
19
|
/* @__PURE__ */ jsx(Label, { asSpan: true, children })
|
|
21
20
|
] });
|
|
22
|
-
}
|
|
21
|
+
};
|
|
23
22
|
export {
|
|
24
23
|
Radio
|
|
25
24
|
};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
3
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
5
4
|
const styles_components_form_Select_select_css_cjs = require("./select.css.cjs");
|
|
6
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
7
|
-
const Select =
|
|
6
|
+
const Select = ({
|
|
7
|
+
children,
|
|
8
|
+
placeholder,
|
|
9
|
+
className,
|
|
10
|
+
variant,
|
|
11
|
+
ref,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
8
14
|
const wrapperClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { wrapper: true }, false);
|
|
9
15
|
const selectClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { select: true, variants: { variant } });
|
|
10
16
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { icon: true }, false);
|
|
@@ -23,7 +29,7 @@ const Select = react.forwardRef(function Select2({ children, placeholder, classN
|
|
|
23
29
|
),
|
|
24
30
|
/* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { className: styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs.classnames(styles_components_form_Select_select_css_cjs.icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {}) })
|
|
25
31
|
] });
|
|
26
|
-
}
|
|
32
|
+
};
|
|
27
33
|
const DefaultIcon = () => {
|
|
28
34
|
return (
|
|
29
35
|
// TOOD - replace with actual icon component renderer
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { select, icon, wrapper } from "./select.css.mjs";
|
|
5
4
|
import { useComponentStyles, Box } from "../../display/Divider/Divider.mjs";
|
|
6
|
-
const Select =
|
|
5
|
+
const Select = ({
|
|
6
|
+
children,
|
|
7
|
+
placeholder,
|
|
8
|
+
className,
|
|
9
|
+
variant,
|
|
10
|
+
ref,
|
|
11
|
+
...restProps
|
|
12
|
+
}) => {
|
|
7
13
|
const wrapperClassName = useComponentStyles("select", { wrapper: true }, false);
|
|
8
14
|
const selectClassName = useComponentStyles("select", { select: true, variants: { variant } });
|
|
9
15
|
const iconClassName = useComponentStyles("select", { icon: true }, false);
|
|
@@ -22,7 +28,7 @@ const Select = forwardRef(function Select2({ children, placeholder, className, v
|
|
|
22
28
|
),
|
|
23
29
|
/* @__PURE__ */ jsx(Box, { className: classnames(icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsx(DefaultIcon, {}) })
|
|
24
30
|
] });
|
|
25
|
-
}
|
|
31
|
+
};
|
|
26
32
|
const DefaultIcon = () => {
|
|
27
33
|
return (
|
|
28
34
|
// TOOD - replace with actual icon component renderer
|
|
@@ -48,7 +48,11 @@ function getProgress(event, rect) {
|
|
|
48
48
|
const y = (clientY - top) / height;
|
|
49
49
|
return [x, y];
|
|
50
50
|
}
|
|
51
|
-
function usePointerProgress({
|
|
51
|
+
function usePointerProgress({
|
|
52
|
+
container,
|
|
53
|
+
orientation,
|
|
54
|
+
onChange
|
|
55
|
+
}) {
|
|
52
56
|
react.useEffect(() => {
|
|
53
57
|
const element = container.current;
|
|
54
58
|
function pointerdown(event) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback, useEffect, useRef } from "react";
|
|
3
3
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { filledTrack, track, thumb, containerVertical, container } from "./slider.css.mjs";
|
|
5
5
|
import { useComponentStyles } from "../../display/Divider/Divider.mjs";
|
|
6
6
|
function useControlledValue({
|
|
7
7
|
defaultValue,
|
|
@@ -47,7 +47,11 @@ function getProgress(event, rect) {
|
|
|
47
47
|
const y = (clientY - top) / height;
|
|
48
48
|
return [x, y];
|
|
49
49
|
}
|
|
50
|
-
function usePointerProgress({
|
|
50
|
+
function usePointerProgress({
|
|
51
|
+
container: container2,
|
|
52
|
+
orientation,
|
|
53
|
+
onChange
|
|
54
|
+
}) {
|
|
51
55
|
useEffect(() => {
|
|
52
56
|
const element = container2.current;
|
|
53
57
|
function pointerdown(event) {
|
|
@@ -4,7 +4,14 @@ const react = require("react");
|
|
|
4
4
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
5
5
|
const styles_components_form_Switch_switch_css_cjs = require("./switch.css.cjs");
|
|
6
6
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
7
|
-
const Switch =
|
|
7
|
+
const Switch = ({
|
|
8
|
+
checked,
|
|
9
|
+
className,
|
|
10
|
+
defaultChecked,
|
|
11
|
+
onChange,
|
|
12
|
+
ref,
|
|
13
|
+
...restProps
|
|
14
|
+
}) => {
|
|
8
15
|
const [isChecked, setIsChecked] = react.useState(defaultChecked || checked || false);
|
|
9
16
|
const baseClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("switch", { base: true });
|
|
10
17
|
const sliderClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("switch", { slider: true }, false);
|
|
@@ -58,5 +65,5 @@ const Switch = react.forwardRef(function Switch2({ className, checked, onChange,
|
|
|
58
65
|
]
|
|
59
66
|
}
|
|
60
67
|
) });
|
|
61
|
-
}
|
|
68
|
+
};
|
|
62
69
|
exports.Switch = Switch;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
3
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { input, container } from "./switch.css.mjs";
|
|
5
5
|
import { useComponentStyles } from "../../display/Divider/Divider.mjs";
|
|
6
|
-
const Switch =
|
|
6
|
+
const Switch = ({
|
|
7
|
+
checked,
|
|
8
|
+
className,
|
|
9
|
+
defaultChecked,
|
|
10
|
+
onChange,
|
|
11
|
+
ref,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
7
14
|
const [isChecked, setIsChecked] = useState(defaultChecked || checked || false);
|
|
8
15
|
const baseClassName = useComponentStyles("switch", { base: true });
|
|
9
16
|
const sliderClassName = useComponentStyles("switch", { slider: true }, false);
|
|
@@ -57,7 +64,7 @@ const Switch = forwardRef(function Switch2({ className, checked, onChange, defau
|
|
|
57
64
|
]
|
|
58
65
|
}
|
|
59
66
|
) });
|
|
60
|
-
}
|
|
67
|
+
};
|
|
61
68
|
export {
|
|
62
69
|
Switch
|
|
63
70
|
};
|
|
@@ -10,7 +10,6 @@ const BlocksProvider = ({
|
|
|
10
10
|
className,
|
|
11
11
|
...restProps
|
|
12
12
|
}) => {
|
|
13
|
-
const ref = react.useRef(null);
|
|
14
13
|
const [ariaHidden, setAriaHidden] = react.useState(false);
|
|
15
14
|
const contextValue = react.useMemo(
|
|
16
15
|
() => ({
|
|
@@ -19,20 +18,11 @@ const BlocksProvider = ({
|
|
|
19
18
|
}),
|
|
20
19
|
[theme, setAriaHidden]
|
|
21
20
|
);
|
|
22
|
-
|
|
23
|
-
var _a, _b;
|
|
24
|
-
if (ariaHidden) {
|
|
25
|
-
(_a = ref.current) == null ? void 0 : _a.setAttribute("inert", "");
|
|
26
|
-
} else {
|
|
27
|
-
(_b = ref.current) == null ? void 0 : _b.removeAttribute("inert");
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.BlocksProviderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.BlocksProviderContext, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31
22
|
"div",
|
|
32
23
|
{
|
|
33
|
-
ref,
|
|
34
24
|
className: styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs.classnames(theme.vars, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ fontFamily: "primary" }), className),
|
|
35
|
-
|
|
25
|
+
inert: ariaHidden ? true : void 0,
|
|
36
26
|
...restProps,
|
|
37
27
|
children
|
|
38
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
3
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
4
4
|
import { classnames } from "../../Accessibility/VisuallyHidden/VisuallyHidden.mjs";
|
|
5
5
|
import { BlocksProviderContext } from "../../display/Divider/Divider.mjs";
|
|
@@ -9,7 +9,6 @@ const BlocksProvider = ({
|
|
|
9
9
|
className,
|
|
10
10
|
...restProps
|
|
11
11
|
}) => {
|
|
12
|
-
const ref = useRef(null);
|
|
13
12
|
const [ariaHidden, setAriaHidden] = useState(false);
|
|
14
13
|
const contextValue = useMemo(
|
|
15
14
|
() => ({
|
|
@@ -18,20 +17,11 @@ const BlocksProvider = ({
|
|
|
18
17
|
}),
|
|
19
18
|
[theme, setAriaHidden]
|
|
20
19
|
);
|
|
21
|
-
|
|
22
|
-
var _a, _b;
|
|
23
|
-
if (ariaHidden) {
|
|
24
|
-
(_a = ref.current) == null ? void 0 : _a.setAttribute("inert", "");
|
|
25
|
-
} else {
|
|
26
|
-
(_b = ref.current) == null ? void 0 : _b.removeAttribute("inert");
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
return /* @__PURE__ */ jsx(BlocksProviderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
20
|
+
return /* @__PURE__ */ jsx(BlocksProviderContext, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
30
21
|
"div",
|
|
31
22
|
{
|
|
32
|
-
ref,
|
|
33
23
|
className: classnames(theme.vars, atoms({ fontFamily: "primary" }), className),
|
|
34
|
-
|
|
24
|
+
inert: ariaHidden ? true : void 0,
|
|
35
25
|
...restProps,
|
|
36
26
|
children
|
|
37
27
|
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const react = require("react");
|
|
4
3
|
const styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs = require("../../Accessibility/VisuallyHidden/VisuallyHidden.cjs");
|
|
5
4
|
const styles_components_typography_Text_text_css_cjs = require("./text.css.cjs");
|
|
6
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
7
|
-
const Text =
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const Text = ({
|
|
7
|
+
asChild,
|
|
8
|
+
children,
|
|
9
|
+
className,
|
|
10
|
+
ref,
|
|
11
|
+
tag,
|
|
12
|
+
...restProps
|
|
13
|
+
}) => {
|
|
14
|
+
const Component = tag ?? "span";
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { asChild: true, className: styles_components_Accessibility_VisuallyHidden_VisuallyHidden_cjs.classnames(styles_components_typography_Text_text_css_cjs.text, className), ...restProps, children: asChild ? children : (
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
/* @__PURE__ */ jsxRuntime.jsx(Component, { ref, children })
|
|
18
|
+
) });
|
|
19
|
+
};
|
|
10
20
|
exports.Text = Text;
|