@blockle/blocks 0.12.0 → 0.12.2
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 +9 -18
- package/dist/index.mjs +11 -20
- package/dist/momotaro.chunk.d.ts +267 -268
- package/dist/styles/components/display/Divider/Divider.cjs +1 -1
- package/dist/styles/components/display/Divider/Divider.mjs +1 -1
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +30 -61
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +33 -64
- package/dist/styles/components/overlay/Dialog/dialog.css.cjs +10 -12
- package/dist/styles/components/overlay/Dialog/dialog.css.mjs +10 -12
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +13 -16
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +13 -16
- package/dist/styles/themes/momotaro/components/divider.css.cjs +4 -0
- package/dist/styles/themes/momotaro/components/divider.css.mjs +4 -0
- package/dist/styles/themes/momotaro/components/progress.css.cjs +6 -6
- package/dist/styles/themes/momotaro/components/progress.css.mjs +6 -6
- package/package.json +38 -38
|
@@ -208,7 +208,7 @@ const Divider = ({ className, color, ...restProps }) => {
|
|
|
208
208
|
Box,
|
|
209
209
|
{
|
|
210
210
|
role: "separator",
|
|
211
|
-
|
|
211
|
+
inlineSize: "full",
|
|
212
212
|
backgroundColor: color ?? dividerDefaults.color,
|
|
213
213
|
className: classnames(className, dividerClass, styles_components_display_Divider_divider_css_cjs.divider),
|
|
214
214
|
...restProps
|
|
@@ -207,7 +207,7 @@ const Divider = ({ className, color, ...restProps }) => {
|
|
|
207
207
|
Box,
|
|
208
208
|
{
|
|
209
209
|
role: "separator",
|
|
210
|
-
|
|
210
|
+
inlineSize: "full",
|
|
211
211
|
backgroundColor: color ?? dividerDefaults.color,
|
|
212
212
|
className: classnames(className, dividerClass, divider),
|
|
213
213
|
...restProps
|
|
@@ -12,32 +12,21 @@ const Portal = ({ children, container }) => {
|
|
|
12
12
|
container || document.body
|
|
13
13
|
);
|
|
14
14
|
};
|
|
15
|
-
const
|
|
16
|
-
const getFirstFocusableElement = (container) => {
|
|
17
|
-
const focusable = container.querySelector(focusableSelectors);
|
|
18
|
-
return focusable || null;
|
|
19
|
-
};
|
|
20
|
-
const focusFirstElement = (container) => {
|
|
21
|
-
const focusable = getFirstFocusableElement(container);
|
|
22
|
-
if (focusable) {
|
|
23
|
-
focusable.focus();
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const useFocusLock = ({ ref, active }) => {
|
|
15
|
+
const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
|
|
27
16
|
react.useEffect(() => {
|
|
28
|
-
if (!
|
|
17
|
+
if (!enabled) {
|
|
29
18
|
return;
|
|
30
19
|
}
|
|
31
|
-
const
|
|
32
|
-
if (ref.current &&
|
|
33
|
-
|
|
20
|
+
const listener = (event) => {
|
|
21
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
22
|
+
onClickOutside();
|
|
34
23
|
}
|
|
35
24
|
};
|
|
36
|
-
document.addEventListener("
|
|
25
|
+
document.addEventListener("click", listener);
|
|
37
26
|
return () => {
|
|
38
|
-
document.removeEventListener("
|
|
27
|
+
document.removeEventListener("click", listener);
|
|
39
28
|
};
|
|
40
|
-
}, [
|
|
29
|
+
}, [ref, onClickOutside, enabled]);
|
|
41
30
|
};
|
|
42
31
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
43
32
|
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
@@ -47,7 +36,7 @@ const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) =
|
|
|
47
36
|
}
|
|
48
37
|
function handleKeyDown(event) {
|
|
49
38
|
if (event.key === key) {
|
|
50
|
-
callback();
|
|
39
|
+
callback(event);
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
42
|
document.addEventListener(type, handleKeyDown);
|
|
@@ -110,21 +99,13 @@ const useRestoreFocus = (active) => {
|
|
|
110
99
|
target.current = document.activeElement;
|
|
111
100
|
}
|
|
112
101
|
react.useEffect(() => {
|
|
102
|
+
var _a;
|
|
113
103
|
if (target.current && !active && target.current instanceof HTMLElement) {
|
|
114
|
-
target.current.focus();
|
|
115
|
-
}
|
|
116
|
-
if (!active) {
|
|
104
|
+
(_a = target.current) == null ? void 0 : _a.focus();
|
|
117
105
|
target.current = null;
|
|
118
106
|
}
|
|
119
107
|
}, [active]);
|
|
120
108
|
};
|
|
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
|
-
};
|
|
128
109
|
const useVisibilityState = (open) => {
|
|
129
110
|
const [visible, setVisible] = react.useState(open);
|
|
130
111
|
const hide = react.useCallback(() => {
|
|
@@ -166,38 +147,36 @@ const Dialog = ({
|
|
|
166
147
|
size,
|
|
167
148
|
...restProps
|
|
168
149
|
}) => {
|
|
169
|
-
const backdropClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("dialog", { backdrop: true }, false);
|
|
170
150
|
const dialogClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
171
|
-
const backdropRef = react.useRef(null);
|
|
172
151
|
const dialogRef = react.useRef(null);
|
|
173
152
|
const layer = useLayer();
|
|
174
153
|
const [visible, hide] = useVisibilityState(open);
|
|
175
154
|
const [enabled, setEnabled] = react.useState(true);
|
|
176
|
-
|
|
155
|
+
useRestoreFocus(open);
|
|
156
|
+
const isNested = useNestedDialog(visible);
|
|
157
|
+
usePreventBodyScroll(visible && !isNested);
|
|
158
|
+
const onEscape = react.useCallback(
|
|
177
159
|
(event) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
onRequestClose();
|
|
181
162
|
},
|
|
182
163
|
[onRequestClose]
|
|
183
164
|
);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
const isNested = useNestedDialog(visible);
|
|
187
|
-
usePreventBodyScroll(visible && !isNested);
|
|
188
|
-
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
189
|
-
useRootAriaHidden(visible);
|
|
165
|
+
useKeyboard("Escape", onEscape, { enabled: open && enabled });
|
|
166
|
+
useClickOutside(dialogRef, onRequestClose, { enabled: open && enabled });
|
|
190
167
|
useIsomorphicLayoutEffect(() => {
|
|
191
168
|
var _a, _b;
|
|
169
|
+
if (!visible) {
|
|
170
|
+
(_a = dialogRef.current) == null ? void 0 : _a.close();
|
|
171
|
+
}
|
|
192
172
|
if (!open) {
|
|
193
|
-
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
194
173
|
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
195
174
|
return;
|
|
196
175
|
}
|
|
197
176
|
let timer = requestAnimationFrame(() => {
|
|
198
177
|
timer = requestAnimationFrame(() => {
|
|
199
178
|
var _a2, _b2;
|
|
200
|
-
(_a2 =
|
|
179
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.showModal();
|
|
201
180
|
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
202
181
|
});
|
|
203
182
|
});
|
|
@@ -223,35 +202,25 @@ const Dialog = ({
|
|
|
223
202
|
}
|
|
224
203
|
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
225
204
|
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
-
|
|
205
|
+
"dialog",
|
|
227
206
|
{
|
|
228
|
-
ref:
|
|
229
|
-
|
|
207
|
+
ref: dialogRef,
|
|
208
|
+
"aria-modal": "true",
|
|
230
209
|
"data-open": dataOpen,
|
|
231
|
-
|
|
210
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_overlay_Dialog_dialog_css_cjs.dialog, dialogClassName, className),
|
|
232
211
|
onAnimationEnd,
|
|
233
212
|
onTransitionEnd: onAnimationEnd,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
{
|
|
237
|
-
ref: dialogRef,
|
|
238
|
-
"aria-modal": "true",
|
|
239
|
-
open: true,
|
|
240
|
-
"data-open": dataOpen,
|
|
241
|
-
className: styles_components_display_Divider_Divider_cjs.classnames(dialogClassName, className),
|
|
242
|
-
...restProps,
|
|
243
|
-
children
|
|
244
|
-
}
|
|
245
|
-
)
|
|
213
|
+
...restProps,
|
|
214
|
+
children
|
|
246
215
|
}
|
|
247
216
|
) }) });
|
|
248
217
|
};
|
|
249
218
|
exports.Dialog = Dialog;
|
|
250
219
|
exports.Portal = Portal;
|
|
251
220
|
exports.hasAnimationDuration = hasAnimationDuration;
|
|
221
|
+
exports.useClickOutside = useClickOutside;
|
|
252
222
|
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
253
223
|
exports.useKeyboard = useKeyboard;
|
|
254
224
|
exports.useLayer = useLayer;
|
|
255
225
|
exports.usePreventBodyScroll = usePreventBodyScroll;
|
|
256
|
-
exports.useRootAriaHidden = useRootAriaHidden;
|
|
257
226
|
exports.useVisibilityState = useVisibilityState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useLayoutEffect, useRef,
|
|
3
|
-
import { useTheme,
|
|
4
|
-
import {
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState, useCallback, createContext, useContext } from "react";
|
|
3
|
+
import { useTheme, useComponentStyles, classnames } from "../../display/Divider/Divider.mjs";
|
|
4
|
+
import { dialog } from "./dialog.css.mjs";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
6
|
import { BlocksProvider } from "../../other/BlocksProvider/BlocksProvider.mjs";
|
|
7
7
|
const Portal = ({ children, container }) => {
|
|
@@ -11,32 +11,21 @@ const Portal = ({ children, container }) => {
|
|
|
11
11
|
container || document.body
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
const getFirstFocusableElement = (container) => {
|
|
16
|
-
const focusable = container.querySelector(focusableSelectors);
|
|
17
|
-
return focusable || null;
|
|
18
|
-
};
|
|
19
|
-
const focusFirstElement = (container) => {
|
|
20
|
-
const focusable = getFirstFocusableElement(container);
|
|
21
|
-
if (focusable) {
|
|
22
|
-
focusable.focus();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const useFocusLock = ({ ref, active }) => {
|
|
14
|
+
const useClickOutside = (ref, onClickOutside, { enabled = true } = {}) => {
|
|
26
15
|
useEffect(() => {
|
|
27
|
-
if (!
|
|
16
|
+
if (!enabled) {
|
|
28
17
|
return;
|
|
29
18
|
}
|
|
30
|
-
const
|
|
31
|
-
if (ref.current &&
|
|
32
|
-
|
|
19
|
+
const listener = (event) => {
|
|
20
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
21
|
+
onClickOutside();
|
|
33
22
|
}
|
|
34
23
|
};
|
|
35
|
-
document.addEventListener("
|
|
24
|
+
document.addEventListener("click", listener);
|
|
36
25
|
return () => {
|
|
37
|
-
document.removeEventListener("
|
|
26
|
+
document.removeEventListener("click", listener);
|
|
38
27
|
};
|
|
39
|
-
}, [
|
|
28
|
+
}, [ref, onClickOutside, enabled]);
|
|
40
29
|
};
|
|
41
30
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
42
31
|
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
@@ -46,7 +35,7 @@ const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) =
|
|
|
46
35
|
}
|
|
47
36
|
function handleKeyDown(event) {
|
|
48
37
|
if (event.key === key) {
|
|
49
|
-
callback();
|
|
38
|
+
callback(event);
|
|
50
39
|
}
|
|
51
40
|
}
|
|
52
41
|
document.addEventListener(type, handleKeyDown);
|
|
@@ -109,21 +98,13 @@ const useRestoreFocus = (active) => {
|
|
|
109
98
|
target.current = document.activeElement;
|
|
110
99
|
}
|
|
111
100
|
useEffect(() => {
|
|
101
|
+
var _a;
|
|
112
102
|
if (target.current && !active && target.current instanceof HTMLElement) {
|
|
113
|
-
target.current.focus();
|
|
114
|
-
}
|
|
115
|
-
if (!active) {
|
|
103
|
+
(_a = target.current) == null ? void 0 : _a.focus();
|
|
116
104
|
target.current = null;
|
|
117
105
|
}
|
|
118
106
|
}, [active]);
|
|
119
107
|
};
|
|
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
|
-
};
|
|
127
108
|
const useVisibilityState = (open) => {
|
|
128
109
|
const [visible, setVisible] = useState(open);
|
|
129
110
|
const hide = useCallback(() => {
|
|
@@ -165,38 +146,36 @@ const Dialog = ({
|
|
|
165
146
|
size,
|
|
166
147
|
...restProps
|
|
167
148
|
}) => {
|
|
168
|
-
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
169
149
|
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
170
|
-
const backdropRef = useRef(null);
|
|
171
150
|
const dialogRef = useRef(null);
|
|
172
151
|
const layer = useLayer();
|
|
173
152
|
const [visible, hide] = useVisibilityState(open);
|
|
174
153
|
const [enabled, setEnabled] = useState(true);
|
|
175
|
-
|
|
154
|
+
useRestoreFocus(open);
|
|
155
|
+
const isNested = useNestedDialog(visible);
|
|
156
|
+
usePreventBodyScroll(visible && !isNested);
|
|
157
|
+
const onEscape = useCallback(
|
|
176
158
|
(event) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
onRequestClose();
|
|
180
161
|
},
|
|
181
162
|
[onRequestClose]
|
|
182
163
|
);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const isNested = useNestedDialog(visible);
|
|
186
|
-
usePreventBodyScroll(visible && !isNested);
|
|
187
|
-
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
188
|
-
useRootAriaHidden(visible);
|
|
164
|
+
useKeyboard("Escape", onEscape, { enabled: open && enabled });
|
|
165
|
+
useClickOutside(dialogRef, onRequestClose, { enabled: open && enabled });
|
|
189
166
|
useIsomorphicLayoutEffect(() => {
|
|
190
167
|
var _a, _b;
|
|
168
|
+
if (!visible) {
|
|
169
|
+
(_a = dialogRef.current) == null ? void 0 : _a.close();
|
|
170
|
+
}
|
|
191
171
|
if (!open) {
|
|
192
|
-
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
193
172
|
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
194
173
|
return;
|
|
195
174
|
}
|
|
196
175
|
let timer = requestAnimationFrame(() => {
|
|
197
176
|
timer = requestAnimationFrame(() => {
|
|
198
177
|
var _a2, _b2;
|
|
199
|
-
(_a2 =
|
|
178
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.showModal();
|
|
200
179
|
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
201
180
|
});
|
|
202
181
|
});
|
|
@@ -222,26 +201,16 @@ const Dialog = ({
|
|
|
222
201
|
}
|
|
223
202
|
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
224
203
|
return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsx(
|
|
225
|
-
|
|
204
|
+
"dialog",
|
|
226
205
|
{
|
|
227
|
-
ref:
|
|
228
|
-
|
|
206
|
+
ref: dialogRef,
|
|
207
|
+
"aria-modal": "true",
|
|
229
208
|
"data-open": dataOpen,
|
|
230
|
-
|
|
209
|
+
className: classnames(dialog, dialogClassName, className),
|
|
231
210
|
onAnimationEnd,
|
|
232
211
|
onTransitionEnd: onAnimationEnd,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
{
|
|
236
|
-
ref: dialogRef,
|
|
237
|
-
"aria-modal": "true",
|
|
238
|
-
open: true,
|
|
239
|
-
"data-open": dataOpen,
|
|
240
|
-
className: classnames(dialogClassName, className),
|
|
241
|
-
...restProps,
|
|
242
|
-
children
|
|
243
|
-
}
|
|
244
|
-
)
|
|
212
|
+
...restProps,
|
|
213
|
+
children
|
|
245
214
|
}
|
|
246
215
|
) }) });
|
|
247
216
|
};
|
|
@@ -249,10 +218,10 @@ export {
|
|
|
249
218
|
Dialog,
|
|
250
219
|
Portal,
|
|
251
220
|
hasAnimationDuration,
|
|
221
|
+
useClickOutside,
|
|
252
222
|
useIsomorphicLayoutEffect,
|
|
253
223
|
useKeyboard,
|
|
254
224
|
useLayer,
|
|
255
225
|
usePreventBodyScroll,
|
|
256
|
-
useRootAriaHidden,
|
|
257
226
|
useVisibilityState
|
|
258
227
|
};
|
|
@@ -3,21 +3,19 @@ const fileScope = require("@vanilla-extract/css/fileScope");
|
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_css_layers_layers_css_cjs = require("../../../lib/css/layers/layers.css.cjs");
|
|
5
5
|
fileScope.setFileScope("src/components/overlay/Dialog/dialog.css.ts", "@blockle/blocks");
|
|
6
|
-
const
|
|
6
|
+
const dialog = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
|
-
contain: "layout",
|
|
10
|
-
display: "flex",
|
|
11
|
-
placeItems: "center",
|
|
12
9
|
position: "fixed",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
inset: 0,
|
|
11
|
+
border: "none",
|
|
12
|
+
"::backdrop": {
|
|
13
|
+
// Remove pointer event to prevent clicks on the backdrop
|
|
14
|
+
// and make it easier to check if the click was outside the dialog
|
|
15
|
+
pointerEvents: "none"
|
|
16
|
+
}
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
|
-
}, "
|
|
19
|
+
}, "dialog");
|
|
22
20
|
fileScope.endFileScope();
|
|
23
|
-
exports.
|
|
21
|
+
exports.dialog = dialog;
|
|
@@ -2,23 +2,21 @@ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
|
2
2
|
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../../lib/css/layers/layers.css.mjs";
|
|
4
4
|
setFileScope("src/components/overlay/Dialog/dialog.css.ts", "@blockle/blocks");
|
|
5
|
-
const
|
|
5
|
+
const dialog = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
8
|
-
contain: "layout",
|
|
9
|
-
display: "flex",
|
|
10
|
-
placeItems: "center",
|
|
11
8
|
position: "fixed",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
inset: 0,
|
|
10
|
+
border: "none",
|
|
11
|
+
"::backdrop": {
|
|
12
|
+
// Remove pointer event to prevent clicks on the backdrop
|
|
13
|
+
// and make it easier to check if the click was outside the dialog
|
|
14
|
+
pointerEvents: "none"
|
|
15
|
+
}
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
|
-
}, "
|
|
18
|
+
}, "dialog");
|
|
21
19
|
endFileScope();
|
|
22
20
|
export {
|
|
23
|
-
|
|
21
|
+
dialog
|
|
24
22
|
};
|
|
@@ -16,34 +16,31 @@ const dialog = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dialo
|
|
|
16
16
|
}), {
|
|
17
17
|
maxHeight: "90%",
|
|
18
18
|
minWidth: "300px",
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
transform: "scale(1)"
|
|
22
|
-
}
|
|
19
|
+
"::backdrop": {
|
|
20
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
23
21
|
},
|
|
24
|
-
// Apply the animation only if the user has not requested reduced motion
|
|
25
|
-
"@media": {
|
|
26
|
-
"(prefers-reduced-motion: no-preference)": {
|
|
27
|
-
transform: "scale(0.9)",
|
|
28
|
-
transition: "transform 160ms"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}], "dialog_dialog"),
|
|
32
|
-
backdrop: css.style({
|
|
33
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
34
22
|
selectors: {
|
|
35
23
|
"&[data-open]": {
|
|
24
|
+
transform: "translate(0, 0)",
|
|
25
|
+
opacity: 1
|
|
26
|
+
},
|
|
27
|
+
"&[data-open]::backdrop": {
|
|
36
28
|
opacity: 1
|
|
37
29
|
}
|
|
38
30
|
},
|
|
39
31
|
// Apply the animation only if the user has not requested reduced motion
|
|
40
32
|
"@media": {
|
|
41
33
|
"(prefers-reduced-motion: no-preference)": {
|
|
34
|
+
transform: "translate(0, -120px)",
|
|
42
35
|
opacity: 0,
|
|
43
|
-
transition: "opacity 160ms"
|
|
36
|
+
transition: "transform 240ms, opacity 160ms",
|
|
37
|
+
"::backdrop": {
|
|
38
|
+
opacity: 0,
|
|
39
|
+
transition: "opacity 160ms"
|
|
40
|
+
}
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
|
-
}, "
|
|
43
|
+
}], "dialog_dialog"),
|
|
47
44
|
variants: {
|
|
48
45
|
size: {
|
|
49
46
|
small: css.style({
|
|
@@ -15,34 +15,31 @@ const dialog = makeComponentTheme("dialog", {
|
|
|
15
15
|
}), {
|
|
16
16
|
maxHeight: "90%",
|
|
17
17
|
minWidth: "300px",
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
transform: "scale(1)"
|
|
21
|
-
}
|
|
18
|
+
"::backdrop": {
|
|
19
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
22
20
|
},
|
|
23
|
-
// Apply the animation only if the user has not requested reduced motion
|
|
24
|
-
"@media": {
|
|
25
|
-
"(prefers-reduced-motion: no-preference)": {
|
|
26
|
-
transform: "scale(0.9)",
|
|
27
|
-
transition: "transform 160ms"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}], "dialog_dialog"),
|
|
31
|
-
backdrop: style({
|
|
32
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
33
21
|
selectors: {
|
|
34
22
|
"&[data-open]": {
|
|
23
|
+
transform: "translate(0, 0)",
|
|
24
|
+
opacity: 1
|
|
25
|
+
},
|
|
26
|
+
"&[data-open]::backdrop": {
|
|
35
27
|
opacity: 1
|
|
36
28
|
}
|
|
37
29
|
},
|
|
38
30
|
// Apply the animation only if the user has not requested reduced motion
|
|
39
31
|
"@media": {
|
|
40
32
|
"(prefers-reduced-motion: no-preference)": {
|
|
33
|
+
transform: "translate(0, -120px)",
|
|
41
34
|
opacity: 0,
|
|
42
|
-
transition: "opacity 160ms"
|
|
35
|
+
transition: "transform 240ms, opacity 160ms",
|
|
36
|
+
"::backdrop": {
|
|
37
|
+
opacity: 0,
|
|
38
|
+
transition: "opacity 160ms"
|
|
39
|
+
}
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
|
-
}, "
|
|
42
|
+
}], "dialog_dialog"),
|
|
46
43
|
variants: {
|
|
47
44
|
size: {
|
|
48
45
|
small: style({
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
3
4
|
const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
|
|
4
5
|
fileScope.setFileScope("src/themes/momotaro/components/divider.css.ts", "@blockle/blocks");
|
|
5
6
|
const divider = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("divider", {
|
|
7
|
+
base: css.style({
|
|
8
|
+
blockSize: 1
|
|
9
|
+
}, "divider_base"),
|
|
6
10
|
defaultVariants: {
|
|
7
11
|
color: "textLight"
|
|
8
12
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
2
3
|
import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
3
4
|
setFileScope("src/themes/momotaro/components/divider.css.ts", "@blockle/blocks");
|
|
4
5
|
const divider = makeComponentTheme("divider", {
|
|
6
|
+
base: style({
|
|
7
|
+
blockSize: 1
|
|
8
|
+
}, "divider_base"),
|
|
5
9
|
defaultVariants: {
|
|
6
10
|
color: "textLight"
|
|
7
11
|
}
|
|
@@ -37,12 +37,12 @@ const progress = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("pro
|
|
|
37
37
|
// For reduce motion we show a striped pattern instead of animating
|
|
38
38
|
"(prefers-reduced-motion: reduce)": {
|
|
39
39
|
backgroundImage: `repeating-linear-gradient(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
45deg,
|
|
41
|
+
transparent,
|
|
42
|
+
transparent 20px,
|
|
43
|
+
${styles_lib_theme_vars_css_cjs.vars.color.primaryDark} 20px,
|
|
44
|
+
${styles_lib_theme_vars_css_cjs.vars.color.primaryDark} 40px
|
|
45
|
+
)`
|
|
46
46
|
},
|
|
47
47
|
"(prefers-reduced-motion: no-preference)": {
|
|
48
48
|
animation: `${indeterminateAnimation} 3s ease-in-out infinite`
|
|
@@ -36,12 +36,12 @@ const progress = makeComponentTheme("progress", {
|
|
|
36
36
|
// For reduce motion we show a striped pattern instead of animating
|
|
37
37
|
"(prefers-reduced-motion: reduce)": {
|
|
38
38
|
backgroundImage: `repeating-linear-gradient(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
45deg,
|
|
40
|
+
transparent,
|
|
41
|
+
transparent 20px,
|
|
42
|
+
${vars.color.primaryDark} 20px,
|
|
43
|
+
${vars.color.primaryDark} 40px
|
|
44
|
+
)`
|
|
45
45
|
},
|
|
46
46
|
"(prefers-reduced-motion: no-preference)": {
|
|
47
47
|
animation: `${indeterminateAnimation} 3s ease-in-out infinite`
|