@blockle/blocks 0.11.2 → 0.11.3
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 +18 -18
- package/dist/momotaro.chunk.d.ts +65 -69
- package/dist/styles/components/display/Divider/Divider.cjs +13 -13
- package/dist/styles/components/form/Button/Button.cjs +2 -2
- package/dist/styles/components/form/Checkbox/Checkbox.cjs +2 -2
- package/dist/styles/components/form/Input/Input.cjs +3 -3
- package/dist/styles/components/form/Radio/Radio.cjs +2 -2
- package/dist/styles/components/form/Select/Select.cjs +2 -2
- package/dist/styles/components/form/Slider/Slider.cjs +7 -7
- package/dist/styles/components/form/Switch/Switch.cjs +6 -6
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +5 -5
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +23 -28819
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +3 -28797
- package/dist/styles/components/typography/Text/Text.cjs +2 -2
- package/dist/styles/lib/css/atoms/sprinkles.css.cjs +4 -314
- package/dist/styles/lib/css/atoms/sprinkles.css.mjs +2 -312
- package/package.json +4 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const styles_components_display_Divider_divider_css_cjs = require("./divider.css.cjs");
|
|
4
|
-
const
|
|
4
|
+
const react = require("react");
|
|
5
5
|
const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
|
|
6
6
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
7
|
-
const BlocksProviderContext =
|
|
7
|
+
const BlocksProviderContext = react.createContext(null);
|
|
8
8
|
const useTheme = () => {
|
|
9
|
-
const context =
|
|
9
|
+
const context = react.useContext(BlocksProviderContext);
|
|
10
10
|
if (!context) {
|
|
11
11
|
throw new Error("useTheme must be used within a BlocksProvider");
|
|
12
12
|
}
|
|
@@ -136,25 +136,25 @@ function createSlottable(defaultElement) {
|
|
|
136
136
|
if (!asChild) {
|
|
137
137
|
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...slotProps, children });
|
|
138
138
|
}
|
|
139
|
-
const childrenArray =
|
|
139
|
+
const childrenArray = react.Children.toArray(children);
|
|
140
140
|
const slot = childrenArray.find((child) => {
|
|
141
|
-
if (!
|
|
141
|
+
if (!react.isValidElement(child)) {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
return child.type === Slot;
|
|
145
145
|
});
|
|
146
146
|
if (!slot) {
|
|
147
147
|
const Slot2 = childrenArray[0];
|
|
148
|
-
if (!
|
|
148
|
+
if (!react.isValidElement(childrenArray[0])) {
|
|
149
149
|
if (process.env.NODE_ENV === "development") {
|
|
150
150
|
console.warn("Slottable: First child is not a valid React element");
|
|
151
151
|
}
|
|
152
152
|
return null;
|
|
153
153
|
}
|
|
154
|
-
if (!
|
|
154
|
+
if (!react.isValidElement(Slot2)) {
|
|
155
155
|
return null;
|
|
156
156
|
}
|
|
157
|
-
return
|
|
157
|
+
return react.cloneElement(
|
|
158
158
|
Slot2,
|
|
159
159
|
{
|
|
160
160
|
...mergeProps(slotProps, Slot2.props),
|
|
@@ -163,11 +163,11 @@ function createSlottable(defaultElement) {
|
|
|
163
163
|
Slot2.props.children
|
|
164
164
|
);
|
|
165
165
|
}
|
|
166
|
-
if (!
|
|
166
|
+
if (!react.isValidElement(slot) || !react.isValidElement(slot.props.children)) {
|
|
167
167
|
return null;
|
|
168
168
|
}
|
|
169
169
|
const newChildren = childrenArray.map((child) => {
|
|
170
|
-
if (!
|
|
170
|
+
if (!react.isValidElement(child)) {
|
|
171
171
|
return child;
|
|
172
172
|
}
|
|
173
173
|
if (child.type === Slot) {
|
|
@@ -175,7 +175,7 @@ function createSlottable(defaultElement) {
|
|
|
175
175
|
}
|
|
176
176
|
return child;
|
|
177
177
|
});
|
|
178
|
-
return
|
|
178
|
+
return react.cloneElement(
|
|
179
179
|
slot.props.children,
|
|
180
180
|
{
|
|
181
181
|
...mergeProps(slotProps, slot.props),
|
|
@@ -184,11 +184,11 @@ function createSlottable(defaultElement) {
|
|
|
184
184
|
newChildren
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
return
|
|
187
|
+
return react.forwardRef(Slottable2);
|
|
188
188
|
}
|
|
189
189
|
const Slot = ({ children }) => children;
|
|
190
190
|
const Slottable = createSlottable("div");
|
|
191
|
-
const Box =
|
|
191
|
+
const Box = react.forwardRef(function Box2({ asChild, className, children, ...restProps }, ref) {
|
|
192
192
|
const [atomsProps, otherProps] = styles_lib_utils_atomProps_cjs.getAtomsAndProps(restProps);
|
|
193
193
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
194
|
Slottable,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
|
|
5
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
6
6
|
const styles_components_form_Button_Button_css_cjs = require("./Button.css.cjs");
|
|
@@ -10,7 +10,7 @@ const Spinner = ({ className, size, color, ...restProps }) => {
|
|
|
10
10
|
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { color, className: styles_components_display_Divider_Divider_cjs.classnames(spinnerClassName, className), ...restProps });
|
|
11
11
|
};
|
|
12
12
|
const Slottable = styles_components_display_Divider_Divider_cjs.createSlottable("button");
|
|
13
|
-
const Button =
|
|
13
|
+
const Button = react.forwardRef(function Button2({
|
|
14
14
|
children,
|
|
15
15
|
className,
|
|
16
16
|
variant,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
6
6
|
const styles_components_form_Checkbox_checkbox_css_cjs = require("./checkbox.css.cjs");
|
|
@@ -27,7 +27,7 @@ const Label = ({
|
|
|
27
27
|
}
|
|
28
28
|
);
|
|
29
29
|
};
|
|
30
|
-
const Checkbox =
|
|
30
|
+
const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, className, ...restProps }, ref) {
|
|
31
31
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { base: true }, false);
|
|
32
32
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { icon: true }, false);
|
|
33
33
|
const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_components_form_Input_input_css_cjs = require("./input.css.cjs");
|
|
6
|
-
const Input =
|
|
7
|
-
const id =
|
|
6
|
+
const Input = react.forwardRef(function Input2({ className, name, type = "text", startSlot, endSlot, label, placeholder, ...restProps }, ref) {
|
|
7
|
+
const id = react.useId();
|
|
8
8
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("input", { container: true }, false);
|
|
9
9
|
const inputClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("input", { input: true });
|
|
10
10
|
return /* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(styles_components_display_Divider_Divider_cjs.Box, { display: "flex", alignItems: "center", className: styles_components_display_Divider_Divider_cjs.classnames(containerClassName, className), children: [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_components_form_Radio_radio_css_cjs = require("./radio.css.cjs");
|
|
6
6
|
const styles_components_form_Checkbox_Checkbox_cjs = require("../Checkbox/Checkbox.cjs");
|
|
7
|
-
const Radio =
|
|
7
|
+
const Radio = react.forwardRef(function Checkbox({ name, children, className, ...restProps }, ref) {
|
|
8
8
|
const containerClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("radio", { base: true }, false);
|
|
9
9
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("radio", { icon: true }, false);
|
|
10
10
|
const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_components_form_Select_select_css_cjs = require("./select.css.cjs");
|
|
6
|
-
const Select =
|
|
6
|
+
const Select = react.forwardRef(function Select2({ children, placeholder, className, variant, ...restProps }, ref) {
|
|
7
7
|
const wrapperClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { wrapper: true }, false);
|
|
8
8
|
const selectClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { select: true, variants: { variant } });
|
|
9
9
|
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { icon: true }, false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_components_form_Slider_slider_css_cjs = require("./slider.css.cjs");
|
|
6
6
|
function getProgress(event, rect) {
|
|
@@ -11,7 +11,7 @@ function getProgress(event, rect) {
|
|
|
11
11
|
return [x, y];
|
|
12
12
|
}
|
|
13
13
|
function usePointerProgress({ container, orientation, onChange }) {
|
|
14
|
-
|
|
14
|
+
react.useEffect(() => {
|
|
15
15
|
const element = container.current;
|
|
16
16
|
function pointerdown(event) {
|
|
17
17
|
event.preventDefault();
|
|
@@ -62,20 +62,20 @@ const Slider = ({
|
|
|
62
62
|
colorScheme,
|
|
63
63
|
...restProps
|
|
64
64
|
}) => {
|
|
65
|
-
const [internValue, setInternValue] =
|
|
65
|
+
const [internValue, setInternValue] = react.useState(
|
|
66
66
|
getBoundValue(value ?? defaultValue, min, max, step)
|
|
67
67
|
);
|
|
68
68
|
const baseClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { base: true, variants: { size, colorScheme } });
|
|
69
69
|
const trackClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { track: true }, false);
|
|
70
70
|
const filledTrackClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { filledTrack: true }, false);
|
|
71
71
|
const thumbClass = styles_components_display_Divider_Divider_cjs.useComponentStyles("slider", { thumb: true }, false);
|
|
72
|
-
const containerRef =
|
|
73
|
-
|
|
72
|
+
const containerRef = react.useRef(null);
|
|
73
|
+
react.useEffect(() => {
|
|
74
74
|
if (value !== void 0) {
|
|
75
75
|
setInternValue(getBoundValue(value, min, max, step));
|
|
76
76
|
}
|
|
77
77
|
}, [value, min, max, step]);
|
|
78
|
-
|
|
78
|
+
react.useEffect(() => {
|
|
79
79
|
if (onChange && internValue !== value) {
|
|
80
80
|
onChange(internValue);
|
|
81
81
|
}
|
|
@@ -90,7 +90,7 @@ const Slider = ({
|
|
|
90
90
|
setInternValue(getBoundValue(max * progress, min, max, step));
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
const onKeyDown =
|
|
93
|
+
const onKeyDown = react.useCallback(
|
|
94
94
|
(event) => {
|
|
95
95
|
event.preventDefault();
|
|
96
96
|
event.stopPropagation();
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
5
|
const styles_components_form_Switch_switch_css_cjs = require("./switch.css.cjs");
|
|
6
|
-
const Switch =
|
|
7
|
-
const [isChecked, setIsChecked] =
|
|
6
|
+
const Switch = react.forwardRef(function Switch2({ className, checked, onChange, defaultChecked, ...restProps }, ref) {
|
|
7
|
+
const [isChecked, setIsChecked] = react.useState(defaultChecked || checked || false);
|
|
8
8
|
const baseClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("switch", { base: true });
|
|
9
9
|
const sliderClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("switch", { slider: true }, false);
|
|
10
|
-
|
|
10
|
+
react.useEffect(() => {
|
|
11
11
|
if (checked !== void 0) {
|
|
12
12
|
setIsChecked(checked);
|
|
13
13
|
}
|
|
14
14
|
}, [checked]);
|
|
15
|
-
const toggle =
|
|
15
|
+
const toggle = react.useCallback(() => {
|
|
16
16
|
setIsChecked((checked2) => {
|
|
17
17
|
const newValue = !checked2;
|
|
18
18
|
if (onChange) {
|
|
@@ -21,7 +21,7 @@ const Switch = require$$0.forwardRef(function Switch2({ className, checked, onCh
|
|
|
21
21
|
return newValue;
|
|
22
22
|
});
|
|
23
23
|
}, [onChange]);
|
|
24
|
-
const onChangeHandler =
|
|
24
|
+
const onChangeHandler = react.useCallback(
|
|
25
25
|
(event) => {
|
|
26
26
|
setIsChecked(event.target.checked);
|
|
27
27
|
if (onChange) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
-
const
|
|
3
|
+
const react = require("react");
|
|
4
4
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
5
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
6
6
|
const BlocksProvider = ({
|
|
@@ -9,16 +9,16 @@ const BlocksProvider = ({
|
|
|
9
9
|
className,
|
|
10
10
|
...restProps
|
|
11
11
|
}) => {
|
|
12
|
-
const ref =
|
|
13
|
-
const [ariaHidden, setAriaHidden] =
|
|
14
|
-
const contextValue =
|
|
12
|
+
const ref = react.useRef(null);
|
|
13
|
+
const [ariaHidden, setAriaHidden] = react.useState(false);
|
|
14
|
+
const contextValue = react.useMemo(
|
|
15
15
|
() => ({
|
|
16
16
|
theme,
|
|
17
17
|
setAriaHidden
|
|
18
18
|
}),
|
|
19
19
|
[theme, setAriaHidden]
|
|
20
20
|
);
|
|
21
|
-
|
|
21
|
+
react.useEffect(() => {
|
|
22
22
|
var _a, _b;
|
|
23
23
|
if (ariaHidden) {
|
|
24
24
|
(_a = ref.current) == null ? void 0 : _a.setAttribute("inert", "");
|