@blockle/blocks 0.8.10 → 0.9.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 +5 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +6 -3
- package/dist/momotaro.chunk.d.ts +127 -93
- package/dist/styles/components/display/Divider/Divider.cjs +3 -3
- package/dist/styles/components/display/Divider/Divider.mjs +3 -3
- package/dist/styles/components/display/Divider/divider.css.cjs +1 -1
- package/dist/styles/components/display/Divider/divider.css.mjs +1 -1
- package/dist/styles/components/form/Checkbox/Checkbox.cjs +17 -1
- package/dist/styles/components/form/Checkbox/Checkbox.mjs +17 -1
- package/dist/styles/components/form/Select/Select.cjs +40 -0
- package/dist/styles/components/form/Select/Select.mjs +41 -0
- package/dist/styles/components/form/Select/select.css.cjs +37 -0
- package/dist/styles/components/form/Select/select.css.mjs +38 -0
- package/dist/styles/components/form/Switch/switch.css.cjs +2 -2
- package/dist/styles/components/form/Switch/switch.css.mjs +2 -2
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +21 -1
- package/dist/styles/components/other/BlocksProvider/BlocksProvider.mjs +21 -1
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +9 -0
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +12 -3
- package/dist/styles/components/overlay/Dialog/dialog.css.cjs +4 -4
- package/dist/styles/components/overlay/Dialog/dialog.css.mjs +4 -4
- package/dist/styles/lib/css/atoms/atomicProperties.cjs +28 -22
- package/dist/styles/lib/css/atoms/atomicProperties.mjs +28 -22
- package/dist/styles/lib/css/atoms/sprinkles.css.cjs +4 -7
- package/dist/styles/lib/css/atoms/sprinkles.css.mjs +4 -7
- package/dist/styles/themes/momotaro/components/button.css.cjs +3 -3
- package/dist/styles/themes/momotaro/components/button.css.mjs +3 -3
- package/dist/styles/themes/momotaro/components/checkbox.css.cjs +18 -12
- package/dist/styles/themes/momotaro/components/checkbox.css.mjs +18 -12
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +4 -3
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +4 -3
- package/dist/styles/themes/momotaro/components/helpers.css.cjs +7 -6
- package/dist/styles/themes/momotaro/components/helpers.css.mjs +7 -6
- package/dist/styles/themes/momotaro/components/index.cjs +3 -1
- package/dist/styles/themes/momotaro/components/index.mjs +3 -1
- package/dist/styles/themes/momotaro/components/input.css.cjs +6 -4
- package/dist/styles/themes/momotaro/components/input.css.mjs +6 -4
- package/dist/styles/themes/momotaro/components/progress.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/progress.css.mjs +1 -1
- package/dist/styles/themes/momotaro/components/radio.css.cjs +12 -5
- package/dist/styles/themes/momotaro/components/radio.css.mjs +12 -5
- package/dist/styles/themes/momotaro/components/select.css.cjs +35 -0
- package/dist/styles/themes/momotaro/components/select.css.mjs +36 -0
- package/dist/styles/themes/momotaro/components/switch.css.cjs +1 -1
- package/dist/styles/themes/momotaro/components/switch.css.mjs +1 -1
- package/package.json +9 -9
|
@@ -5,11 +5,11 @@ import { getAtomsAndProps } from "../../../lib/utils/atom-props.mjs";
|
|
|
5
5
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
6
6
|
const BlocksProviderContext = createContext(null);
|
|
7
7
|
const useTheme = () => {
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
8
|
+
const context = useContext(BlocksProviderContext);
|
|
9
|
+
if (!context) {
|
|
10
10
|
throw new Error("useTheme must be used within a BlocksProvider");
|
|
11
11
|
}
|
|
12
|
-
return theme;
|
|
12
|
+
return context.theme;
|
|
13
13
|
};
|
|
14
14
|
function useComponentStyles(name, props, useDefaultVariants = true) {
|
|
15
15
|
const { components } = useTheme();
|
|
@@ -33,7 +33,7 @@ const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, cl
|
|
|
33
33
|
const labelClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("checkbox", { label: true }, false);
|
|
34
34
|
const input = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Checkbox_checkbox_css_cjs.container, containerClassName, className), children: [
|
|
35
35
|
/* @__PURE__ */ jsxRuntime.jsx("input", { ref, type: "checkbox", name, className: styles_components_form_Checkbox_checkbox_css_cjs.input, ...restProps }),
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Checkbox_checkbox_css_cjs.icon, iconClassName) })
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Checkbox_checkbox_css_cjs.icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {}) })
|
|
37
37
|
] });
|
|
38
38
|
if (!label) {
|
|
39
39
|
return input;
|
|
@@ -43,5 +43,21 @@ const Checkbox = react.forwardRef(function Checkbox2({ name, label, required, cl
|
|
|
43
43
|
label && /* @__PURE__ */ jsxRuntime.jsx(Label, { asSpan: true, required, children: label })
|
|
44
44
|
] });
|
|
45
45
|
});
|
|
46
|
+
const DefaultIcon = () => {
|
|
47
|
+
return (
|
|
48
|
+
// TOOD - replace with actual icon component renderer
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
50
|
+
"svg",
|
|
51
|
+
{
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
fill: "none",
|
|
54
|
+
strokeWidth: "1.5",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
style: { width: "1rem", height: "1rem", display: "block" },
|
|
57
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 12.75 6 6 9-13.5" })
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
);
|
|
61
|
+
};
|
|
46
62
|
exports.Checkbox = Checkbox;
|
|
47
63
|
exports.Label = Label;
|
|
@@ -32,7 +32,7 @@ const Checkbox = forwardRef(function Checkbox2({ name, label, required, classNam
|
|
|
32
32
|
const labelClassName = useComponentStyles("checkbox", { label: true }, false);
|
|
33
33
|
const input$1 = /* @__PURE__ */ jsxs("div", { className: classnames(container, containerClassName, className), children: [
|
|
34
34
|
/* @__PURE__ */ jsx("input", { ref, type: "checkbox", name, className: input, ...restProps }),
|
|
35
|
-
/* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName) })
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: classnames(icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsx(DefaultIcon, {}) })
|
|
36
36
|
] });
|
|
37
37
|
if (!label) {
|
|
38
38
|
return input$1;
|
|
@@ -42,6 +42,22 @@ const Checkbox = forwardRef(function Checkbox2({ name, label, required, classNam
|
|
|
42
42
|
label && /* @__PURE__ */ jsx(Label, { asSpan: true, required, children: label })
|
|
43
43
|
] });
|
|
44
44
|
});
|
|
45
|
+
const DefaultIcon = () => {
|
|
46
|
+
return (
|
|
47
|
+
// TOOD - replace with actual icon component renderer
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"svg",
|
|
50
|
+
{
|
|
51
|
+
viewBox: "0 0 24 24",
|
|
52
|
+
fill: "none",
|
|
53
|
+
strokeWidth: "1.5",
|
|
54
|
+
stroke: "currentColor",
|
|
55
|
+
style: { width: "1rem", height: "1rem", display: "block" },
|
|
56
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m4.5 12.75 6 6 9-13.5" })
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
};
|
|
45
61
|
export {
|
|
46
62
|
Checkbox,
|
|
47
63
|
Label
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
|
+
const styles_components_form_Select_select_css_cjs = require("./select.css.cjs");
|
|
6
|
+
const Select = react.forwardRef(function Select2({ children, placeholder, className, ...restProps }, ref) {
|
|
7
|
+
const wrapperClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { wrapper: true }, false);
|
|
8
|
+
const selectClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { select: true });
|
|
9
|
+
const iconClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("select", { icon: true }, false);
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(styles_components_display_Divider_Divider_cjs.Box, { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Select_select_css_cjs.wrapper, wrapperClassName), children: [
|
|
11
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
12
|
+
"select",
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Select_select_css_cjs.select, selectClassName, className),
|
|
16
|
+
...restProps,
|
|
17
|
+
children: [
|
|
18
|
+
placeholder && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
|
|
19
|
+
children
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.Box, { className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_form_Select_select_css_cjs.icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(DefaultIcon, {}) })
|
|
24
|
+
] });
|
|
25
|
+
});
|
|
26
|
+
const DefaultIcon = () => {
|
|
27
|
+
return (
|
|
28
|
+
// TOOD - replace with actual icon component renderer
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", style: { width: "1rem", height: "1rem" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
fill: "currentColor",
|
|
33
|
+
fillRule: "evenodd",
|
|
34
|
+
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",
|
|
35
|
+
clipRule: "evenodd"
|
|
36
|
+
}
|
|
37
|
+
) })
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
exports.Select = Select;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { useComponentStyles, Box, classnames } from "../../display/Divider/Divider.mjs";
|
|
4
|
+
import { wrapper, select, icon } from "./select.css.mjs";
|
|
5
|
+
const Select = forwardRef(function Select2({ children, placeholder, className, ...restProps }, ref) {
|
|
6
|
+
const wrapperClassName = useComponentStyles("select", { wrapper: true }, false);
|
|
7
|
+
const selectClassName = useComponentStyles("select", { select: true });
|
|
8
|
+
const iconClassName = useComponentStyles("select", { icon: true }, false);
|
|
9
|
+
return /* @__PURE__ */ jsxs(Box, { className: classnames(wrapper, wrapperClassName), children: [
|
|
10
|
+
/* @__PURE__ */ jsxs(
|
|
11
|
+
"select",
|
|
12
|
+
{
|
|
13
|
+
ref,
|
|
14
|
+
className: classnames(select, selectClassName, className),
|
|
15
|
+
...restProps,
|
|
16
|
+
children: [
|
|
17
|
+
placeholder && /* @__PURE__ */ jsx("option", { value: "", children: placeholder }),
|
|
18
|
+
children
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
),
|
|
22
|
+
/* @__PURE__ */ jsx(Box, { className: classnames(icon, iconClassName), role: "presentation", "aria-hidden": true, children: /* @__PURE__ */ jsx(DefaultIcon, {}) })
|
|
23
|
+
] });
|
|
24
|
+
});
|
|
25
|
+
const DefaultIcon = () => {
|
|
26
|
+
return (
|
|
27
|
+
// TOOD - replace with actual icon component renderer
|
|
28
|
+
/* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", style: { width: "1rem", height: "1rem" }, children: /* @__PURE__ */ jsx(
|
|
29
|
+
"path",
|
|
30
|
+
{
|
|
31
|
+
fill: "currentColor",
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
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",
|
|
34
|
+
clipRule: "evenodd"
|
|
35
|
+
}
|
|
36
|
+
) })
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
Select
|
|
41
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
|
+
fileScope.setFileScope("src/components/form/Select/select.css.ts", "blocks");
|
|
6
|
+
const wrapper = css.style({
|
|
7
|
+
"@layer": {
|
|
8
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
|
+
position: "relative"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, "wrapper");
|
|
13
|
+
const select = css.style({
|
|
14
|
+
"@layer": {
|
|
15
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
16
|
+
appearance: "none",
|
|
17
|
+
inlineSize: "100%"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}, "select");
|
|
21
|
+
const icon = css.style({
|
|
22
|
+
"@layer": {
|
|
23
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
24
|
+
position: "absolute",
|
|
25
|
+
right: 0,
|
|
26
|
+
top: 0,
|
|
27
|
+
bottom: 0,
|
|
28
|
+
pointerEvents: "none",
|
|
29
|
+
display: "flex",
|
|
30
|
+
alignItems: "center"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, "icon");
|
|
34
|
+
fileScope.endFileScope();
|
|
35
|
+
exports.icon = icon;
|
|
36
|
+
exports.select = select;
|
|
37
|
+
exports.wrapper = wrapper;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
3
|
+
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
|
+
setFileScope("src/components/form/Select/select.css.ts", "blocks");
|
|
5
|
+
const wrapper = style({
|
|
6
|
+
"@layer": {
|
|
7
|
+
[blocksLayer]: {
|
|
8
|
+
position: "relative"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}, "wrapper");
|
|
12
|
+
const select = style({
|
|
13
|
+
"@layer": {
|
|
14
|
+
[blocksLayer]: {
|
|
15
|
+
appearance: "none",
|
|
16
|
+
inlineSize: "100%"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}, "select");
|
|
20
|
+
const icon = style({
|
|
21
|
+
"@layer": {
|
|
22
|
+
[blocksLayer]: {
|
|
23
|
+
position: "absolute",
|
|
24
|
+
right: 0,
|
|
25
|
+
top: 0,
|
|
26
|
+
bottom: 0,
|
|
27
|
+
pointerEvents: "none",
|
|
28
|
+
display: "flex",
|
|
29
|
+
alignItems: "center"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, "icon");
|
|
33
|
+
endFileScope();
|
|
34
|
+
export {
|
|
35
|
+
icon,
|
|
36
|
+
select,
|
|
37
|
+
wrapper
|
|
38
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const react = require("react");
|
|
3
4
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
4
5
|
const styles_components_display_Divider_Divider_cjs = require("../../display/Divider/Divider.cjs");
|
|
5
6
|
const BlocksProvider = ({
|
|
@@ -8,10 +9,29 @@ const BlocksProvider = ({
|
|
|
8
9
|
className,
|
|
9
10
|
...restProps
|
|
10
11
|
}) => {
|
|
11
|
-
|
|
12
|
+
const ref = react.useRef(null);
|
|
13
|
+
const [ariaHidden, setAriaHidden] = react.useState(false);
|
|
14
|
+
const contextValue = react.useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
theme,
|
|
17
|
+
setAriaHidden
|
|
18
|
+
}),
|
|
19
|
+
[theme, setAriaHidden]
|
|
20
|
+
);
|
|
21
|
+
react.useEffect(() => {
|
|
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__ */ jsxRuntime.jsx(styles_components_display_Divider_Divider_cjs.BlocksProviderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12
30
|
"div",
|
|
13
31
|
{
|
|
32
|
+
ref,
|
|
14
33
|
className: styles_components_display_Divider_Divider_cjs.classnames(theme.vars, styles_lib_css_atoms_sprinkles_css_cjs.atoms({ fontFamily: "primary" }), className),
|
|
34
|
+
"aria-hidden": ariaHidden,
|
|
15
35
|
...restProps,
|
|
16
36
|
children
|
|
17
37
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, useMemo, useEffect } from "react";
|
|
2
3
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
3
4
|
import { BlocksProviderContext, classnames } from "../../display/Divider/Divider.mjs";
|
|
4
5
|
const BlocksProvider = ({
|
|
@@ -7,10 +8,29 @@ const BlocksProvider = ({
|
|
|
7
8
|
className,
|
|
8
9
|
...restProps
|
|
9
10
|
}) => {
|
|
10
|
-
|
|
11
|
+
const ref = useRef(null);
|
|
12
|
+
const [ariaHidden, setAriaHidden] = useState(false);
|
|
13
|
+
const contextValue = useMemo(
|
|
14
|
+
() => ({
|
|
15
|
+
theme,
|
|
16
|
+
setAriaHidden
|
|
17
|
+
}),
|
|
18
|
+
[theme, setAriaHidden]
|
|
19
|
+
);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
if (ariaHidden) {
|
|
23
|
+
(_a = ref.current) == null ? void 0 : _a.setAttribute("inert", "");
|
|
24
|
+
} else {
|
|
25
|
+
(_b = ref.current) == null ? void 0 : _b.removeAttribute("inert");
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return /* @__PURE__ */ jsx(BlocksProviderContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
11
29
|
"div",
|
|
12
30
|
{
|
|
31
|
+
ref,
|
|
13
32
|
className: classnames(theme.vars, atoms({ fontFamily: "primary" }), className),
|
|
33
|
+
"aria-hidden": ariaHidden,
|
|
14
34
|
...restProps,
|
|
15
35
|
children
|
|
16
36
|
}
|
|
@@ -118,6 +118,13 @@ const useRestoreFocus = (active) => {
|
|
|
118
118
|
}
|
|
119
119
|
}, [active]);
|
|
120
120
|
};
|
|
121
|
+
const useRootAriaHidden = (hidden) => {
|
|
122
|
+
const context = react.useContext(styles_components_display_Divider_Divider_cjs.BlocksProviderContext);
|
|
123
|
+
if (!context) {
|
|
124
|
+
throw new Error("useRootAriaHidden must be used within a BlocksProvider");
|
|
125
|
+
}
|
|
126
|
+
context.setAriaHidden(hidden);
|
|
127
|
+
};
|
|
121
128
|
const useVisibilityState = (open) => {
|
|
122
129
|
const [visible, setVisible] = react.useState(open);
|
|
123
130
|
const hide = react.useCallback(() => {
|
|
@@ -179,6 +186,7 @@ const Dialog = ({
|
|
|
179
186
|
const isNested = useNestedDialog(visible);
|
|
180
187
|
usePreventBodyScroll(visible && !isNested);
|
|
181
188
|
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
189
|
+
useRootAriaHidden(visible);
|
|
182
190
|
useIsomorphicLayoutEffect(() => {
|
|
183
191
|
var _a, _b;
|
|
184
192
|
if (!open) {
|
|
@@ -243,3 +251,4 @@ exports.Portal = Portal;
|
|
|
243
251
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
244
252
|
exports.useKeyboard = useKeyboard;
|
|
245
253
|
exports.usePreventBodyScroll = usePreventBodyScroll;
|
|
254
|
+
exports.useRootAriaHidden = useRootAriaHidden;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useLayoutEffect, useRef, useState, useCallback, createContext
|
|
3
|
-
import { useTheme, useComponentStyles, Box, classnames } from "../../display/Divider/Divider.mjs";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useContext, useState, useCallback, createContext } from "react";
|
|
3
|
+
import { useTheme, BlocksProviderContext, useComponentStyles, Box, classnames } from "../../display/Divider/Divider.mjs";
|
|
4
4
|
import { backdrop } from "./dialog.css.mjs";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { BlocksProvider } from "../../other/BlocksProvider/BlocksProvider.mjs";
|
|
@@ -117,6 +117,13 @@ const useRestoreFocus = (active) => {
|
|
|
117
117
|
}
|
|
118
118
|
}, [active]);
|
|
119
119
|
};
|
|
120
|
+
const useRootAriaHidden = (hidden) => {
|
|
121
|
+
const context = useContext(BlocksProviderContext);
|
|
122
|
+
if (!context) {
|
|
123
|
+
throw new Error("useRootAriaHidden must be used within a BlocksProvider");
|
|
124
|
+
}
|
|
125
|
+
context.setAriaHidden(hidden);
|
|
126
|
+
};
|
|
120
127
|
const useVisibilityState = (open) => {
|
|
121
128
|
const [visible, setVisible] = useState(open);
|
|
122
129
|
const hide = useCallback(() => {
|
|
@@ -178,6 +185,7 @@ const Dialog = ({
|
|
|
178
185
|
const isNested = useNestedDialog(visible);
|
|
179
186
|
usePreventBodyScroll(visible && !isNested);
|
|
180
187
|
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
188
|
+
useRootAriaHidden(visible);
|
|
181
189
|
useIsomorphicLayoutEffect(() => {
|
|
182
190
|
var _a, _b;
|
|
183
191
|
if (!open) {
|
|
@@ -242,5 +250,6 @@ export {
|
|
|
242
250
|
Portal,
|
|
243
251
|
useIsomorphicLayoutEffect,
|
|
244
252
|
useKeyboard,
|
|
245
|
-
usePreventBodyScroll
|
|
253
|
+
usePreventBodyScroll,
|
|
254
|
+
useRootAriaHidden
|
|
246
255
|
};
|
|
@@ -10,10 +10,10 @@ const backdrop = css.style({
|
|
|
10
10
|
display: "flex",
|
|
11
11
|
placeItems: "center",
|
|
12
12
|
position: "fixed",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
inlineSize: "100%",
|
|
14
|
+
blockSize: "100%",
|
|
15
|
+
insetInlineStart: 0,
|
|
16
|
+
insetBlockStart: 0,
|
|
17
17
|
overflow: "hidden",
|
|
18
18
|
zIndex: 1e3
|
|
19
19
|
}
|
|
@@ -9,10 +9,10 @@ const backdrop = style({
|
|
|
9
9
|
display: "flex",
|
|
10
10
|
placeItems: "center",
|
|
11
11
|
position: "fixed",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
inlineSize: "100%",
|
|
13
|
+
blockSize: "100%",
|
|
14
|
+
insetInlineStart: 0,
|
|
15
|
+
insetBlockStart: 0,
|
|
16
16
|
overflow: "hidden",
|
|
17
17
|
zIndex: 1e3
|
|
18
18
|
}
|
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const styles_lib_theme_vars_css_cjs = require("../../theme/vars.css.cjs");
|
|
3
|
-
const
|
|
3
|
+
const colorsWithCurrentColor = { ...styles_lib_theme_vars_css_cjs.vars.color, currentColor: "currentColor" };
|
|
4
|
+
const size = { auto: "auto", full: "100%", "fit-content": "fit-content" };
|
|
4
5
|
const unresponsiveProperties = {
|
|
5
|
-
backgroundColor:
|
|
6
|
-
borderColor:
|
|
6
|
+
backgroundColor: colorsWithCurrentColor,
|
|
7
|
+
borderColor: colorsWithCurrentColor,
|
|
7
8
|
borderRadius: styles_lib_theme_vars_css_cjs.vars.borderRadius,
|
|
8
9
|
borderWidth: styles_lib_theme_vars_css_cjs.vars.borderWidth,
|
|
9
10
|
border: ["none"],
|
|
10
|
-
|
|
11
|
+
insetBlock: [0],
|
|
12
|
+
insetBlockStart: [0],
|
|
13
|
+
insetBlockEnd: [0],
|
|
14
|
+
insetInline: [0],
|
|
15
|
+
insetInlineStart: [0],
|
|
16
|
+
insetInlineEnd: [0],
|
|
11
17
|
boxShadow: styles_lib_theme_vars_css_cjs.vars.shadow,
|
|
12
|
-
color:
|
|
18
|
+
color: colorsWithCurrentColor,
|
|
13
19
|
cursor: ["auto", "pointer"],
|
|
14
20
|
fontFamily: styles_lib_theme_vars_css_cjs.vars.fontFamily,
|
|
15
21
|
fontStyle: ["normal", "italic", "oblique"],
|
|
16
22
|
fontWeight: styles_lib_theme_vars_css_cjs.vars.fontWeight,
|
|
17
|
-
height: { auto: "auto", full: "100%" },
|
|
18
|
-
left: [0],
|
|
19
23
|
lineHeight: styles_lib_theme_vars_css_cjs.vars.lineHeight,
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
blockSize: size,
|
|
25
|
+
maxBlockSize: size,
|
|
26
|
+
inlineSize: size,
|
|
27
|
+
maxInlineSize: size,
|
|
22
28
|
opacity: [0, 1],
|
|
23
29
|
overflow: ["hidden", "scroll", "visible", "auto"],
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
overflowBlock: ["hidden", "scroll", "visible", "auto"],
|
|
31
|
+
overflowInline: ["hidden", "scroll", "visible", "auto"],
|
|
26
32
|
pointerEvents: ["none"],
|
|
27
|
-
right: [0],
|
|
28
33
|
textDecoration: ["overline", "line-through", "underline", "none"],
|
|
29
34
|
textTransform: ["lowercase", "uppercase", "capitalize"],
|
|
30
35
|
textWrap: ["balance", "wrap"],
|
|
31
|
-
top: [0],
|
|
32
36
|
transition: styles_lib_theme_vars_css_cjs.vars.transition,
|
|
33
37
|
userSelect: ["none"],
|
|
34
38
|
whiteSpace: ["nowrap", "pre", "pre-line", "pre-wrap"],
|
|
35
|
-
width: { auto: "auto", full: "100%", "fit-content": "fit-content" },
|
|
36
39
|
wordBreak: ["break-word"],
|
|
37
40
|
wordWrap: ["break-word"]
|
|
38
41
|
};
|
|
@@ -60,15 +63,18 @@ const responsiveProperties = {
|
|
|
60
63
|
fontSize: styles_lib_theme_vars_css_cjs.vars.fontSize,
|
|
61
64
|
gap: styles_lib_theme_vars_css_cjs.vars.space,
|
|
62
65
|
justifyContent: ["flex-start", "flex-end", "center", "space-between", "space-around"],
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
marginBlockStart: marginSpace,
|
|
67
|
+
marginBlockEnd: marginSpace,
|
|
68
|
+
marginInlineStart: marginSpace,
|
|
69
|
+
marginInlineEnd: marginSpace,
|
|
67
70
|
outline: ["none"],
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
padding: styles_lib_theme_vars_css_cjs.vars.space,
|
|
72
|
+
paddingBlock: styles_lib_theme_vars_css_cjs.vars.space,
|
|
73
|
+
paddingBlockStart: styles_lib_theme_vars_css_cjs.vars.space,
|
|
74
|
+
paddingBlockEnd: styles_lib_theme_vars_css_cjs.vars.space,
|
|
75
|
+
paddingInline: styles_lib_theme_vars_css_cjs.vars.space,
|
|
76
|
+
paddingInlineStart: styles_lib_theme_vars_css_cjs.vars.space,
|
|
77
|
+
paddingInlineEnd: styles_lib_theme_vars_css_cjs.vars.space,
|
|
72
78
|
position: ["relative", "fixed", "absolute", "sticky", "static"],
|
|
73
79
|
rowGap: styles_lib_theme_vars_css_cjs.vars.space,
|
|
74
80
|
textAlign: ["center", "left", "right", "justify"]
|
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
import { vars } from "../../theme/vars.css.mjs";
|
|
2
|
-
const
|
|
2
|
+
const colorsWithCurrentColor = { ...vars.color, currentColor: "currentColor" };
|
|
3
|
+
const size = { auto: "auto", full: "100%", "fit-content": "fit-content" };
|
|
3
4
|
const unresponsiveProperties = {
|
|
4
|
-
backgroundColor:
|
|
5
|
-
borderColor:
|
|
5
|
+
backgroundColor: colorsWithCurrentColor,
|
|
6
|
+
borderColor: colorsWithCurrentColor,
|
|
6
7
|
borderRadius: vars.borderRadius,
|
|
7
8
|
borderWidth: vars.borderWidth,
|
|
8
9
|
border: ["none"],
|
|
9
|
-
|
|
10
|
+
insetBlock: [0],
|
|
11
|
+
insetBlockStart: [0],
|
|
12
|
+
insetBlockEnd: [0],
|
|
13
|
+
insetInline: [0],
|
|
14
|
+
insetInlineStart: [0],
|
|
15
|
+
insetInlineEnd: [0],
|
|
10
16
|
boxShadow: vars.shadow,
|
|
11
|
-
color:
|
|
17
|
+
color: colorsWithCurrentColor,
|
|
12
18
|
cursor: ["auto", "pointer"],
|
|
13
19
|
fontFamily: vars.fontFamily,
|
|
14
20
|
fontStyle: ["normal", "italic", "oblique"],
|
|
15
21
|
fontWeight: vars.fontWeight,
|
|
16
|
-
height: { auto: "auto", full: "100%" },
|
|
17
|
-
left: [0],
|
|
18
22
|
lineHeight: vars.lineHeight,
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
blockSize: size,
|
|
24
|
+
maxBlockSize: size,
|
|
25
|
+
inlineSize: size,
|
|
26
|
+
maxInlineSize: size,
|
|
21
27
|
opacity: [0, 1],
|
|
22
28
|
overflow: ["hidden", "scroll", "visible", "auto"],
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
overflowBlock: ["hidden", "scroll", "visible", "auto"],
|
|
30
|
+
overflowInline: ["hidden", "scroll", "visible", "auto"],
|
|
25
31
|
pointerEvents: ["none"],
|
|
26
|
-
right: [0],
|
|
27
32
|
textDecoration: ["overline", "line-through", "underline", "none"],
|
|
28
33
|
textTransform: ["lowercase", "uppercase", "capitalize"],
|
|
29
34
|
textWrap: ["balance", "wrap"],
|
|
30
|
-
top: [0],
|
|
31
35
|
transition: vars.transition,
|
|
32
36
|
userSelect: ["none"],
|
|
33
37
|
whiteSpace: ["nowrap", "pre", "pre-line", "pre-wrap"],
|
|
34
|
-
width: { auto: "auto", full: "100%", "fit-content": "fit-content" },
|
|
35
38
|
wordBreak: ["break-word"],
|
|
36
39
|
wordWrap: ["break-word"]
|
|
37
40
|
};
|
|
@@ -59,15 +62,18 @@ const responsiveProperties = {
|
|
|
59
62
|
fontSize: vars.fontSize,
|
|
60
63
|
gap: vars.space,
|
|
61
64
|
justifyContent: ["flex-start", "flex-end", "center", "space-between", "space-around"],
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
marginBlockStart: marginSpace,
|
|
66
|
+
marginBlockEnd: marginSpace,
|
|
67
|
+
marginInlineStart: marginSpace,
|
|
68
|
+
marginInlineEnd: marginSpace,
|
|
66
69
|
outline: ["none"],
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
padding: vars.space,
|
|
71
|
+
paddingBlock: vars.space,
|
|
72
|
+
paddingBlockStart: vars.space,
|
|
73
|
+
paddingBlockEnd: vars.space,
|
|
74
|
+
paddingInline: vars.space,
|
|
75
|
+
paddingInlineStart: vars.space,
|
|
76
|
+
paddingInlineEnd: vars.space,
|
|
71
77
|
position: ["relative", "fixed", "absolute", "sticky", "static"],
|
|
72
78
|
rowGap: vars.space,
|
|
73
79
|
textAlign: ["center", "left", "right", "justify"]
|
|
@@ -7,7 +7,7 @@ fileScope.setFileScope("src/lib/css/atoms/sprinkles.css.ts", "blocks");
|
|
|
7
7
|
const unresponsiveAtomicProperties = sprinkles.defineProperties({
|
|
8
8
|
properties: styles_lib_css_atoms_atomicProperties_cjs.unresponsiveProperties,
|
|
9
9
|
shorthands: {
|
|
10
|
-
inset: ["
|
|
10
|
+
inset: ["insetBlockStart", "insetBlockEnd", "insetInlineStart", "insetInlineEnd"]
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
const responsiveAtomicProperties = sprinkles.defineProperties({
|
|
@@ -27,12 +27,9 @@ const responsiveAtomicProperties = sprinkles.defineProperties({
|
|
|
27
27
|
responsiveArray: styles_lib_css_atoms_breakpoints_cjs.breakpointNames,
|
|
28
28
|
properties: styles_lib_css_atoms_atomicProperties_cjs.responsiveProperties,
|
|
29
29
|
shorthands: {
|
|
30
|
-
margin: ["
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
padding: ["paddingTop", "paddingBottom", "paddingLeft", "paddingRight"],
|
|
34
|
-
paddingX: ["paddingLeft", "paddingRight"],
|
|
35
|
-
paddingY: ["paddingTop", "paddingBottom"],
|
|
30
|
+
margin: ["marginBlockStart", "marginBlockEnd", "marginInlineStart", "marginInlineEnd"],
|
|
31
|
+
marginBlock: ["marginBlockStart", "marginBlockEnd"],
|
|
32
|
+
marginInline: ["marginInlineStart", "marginInlineEnd"],
|
|
36
33
|
placeItems: ["justifyContent", "alignItems"]
|
|
37
34
|
}
|
|
38
35
|
});
|