@blockle/blocks 0.11.3 → 0.12.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 +52 -44
- package/dist/index.mjs +54 -46
- package/dist/momotaro.chunk.d.ts +15 -12
- package/dist/styles/components/overlay/Dialog/Dialog.cjs +41 -69
- package/dist/styles/components/overlay/Dialog/Dialog.mjs +44 -72
- 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/index.cjs +5 -3
- package/dist/styles/themes/momotaro/components/index.mjs +5 -3
- package/dist/styles/themes/momotaro/components/{dropdown.css.cjs → popover.css.cjs} +6 -28
- package/dist/styles/themes/momotaro/components/{dropdown.css.mjs → popover.css.mjs} +6 -28
- package/dist/styles/themes/momotaro/components/progress.css.cjs +6 -6
- package/dist/styles/themes/momotaro/components/progress.css.mjs +6 -6
- package/dist/styles/themes/momotaro/components/tooltip.css.cjs +30 -0
- package/dist/styles/themes/momotaro/components/tooltip.css.mjs +31 -0
- package/package.json +38 -37
|
@@ -12,33 +12,6 @@ const Portal = ({ children, container }) => {
|
|
|
12
12
|
container || document.body
|
|
13
13
|
);
|
|
14
14
|
};
|
|
15
|
-
const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
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 }) => {
|
|
27
|
-
react.useEffect(() => {
|
|
28
|
-
if (!active) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const handleFocus = (event) => {
|
|
32
|
-
if (ref.current && event.target instanceof HTMLElement && !ref.current.contains(event.target)) {
|
|
33
|
-
focusFirstElement(ref.current);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
document.addEventListener("focusin", handleFocus);
|
|
37
|
-
return () => {
|
|
38
|
-
document.removeEventListener("focusin", handleFocus);
|
|
39
|
-
};
|
|
40
|
-
}, [active, ref]);
|
|
41
|
-
};
|
|
42
15
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
43
16
|
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
44
17
|
react.useEffect(() => {
|
|
@@ -47,7 +20,7 @@ const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) =
|
|
|
47
20
|
}
|
|
48
21
|
function handleKeyDown(event) {
|
|
49
22
|
if (event.key === key) {
|
|
50
|
-
callback();
|
|
23
|
+
callback(event);
|
|
51
24
|
}
|
|
52
25
|
}
|
|
53
26
|
document.addEventListener(type, handleKeyDown);
|
|
@@ -110,21 +83,13 @@ const useRestoreFocus = (active) => {
|
|
|
110
83
|
target.current = document.activeElement;
|
|
111
84
|
}
|
|
112
85
|
react.useEffect(() => {
|
|
86
|
+
var _a;
|
|
113
87
|
if (target.current && !active && target.current instanceof HTMLElement) {
|
|
114
|
-
target.current.focus();
|
|
115
|
-
}
|
|
116
|
-
if (!active) {
|
|
88
|
+
(_a = target.current) == null ? void 0 : _a.focus();
|
|
117
89
|
target.current = null;
|
|
118
90
|
}
|
|
119
91
|
}, [active]);
|
|
120
92
|
};
|
|
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
93
|
const useVisibilityState = (open) => {
|
|
129
94
|
const [visible, setVisible] = react.useState(open);
|
|
130
95
|
const hide = react.useCallback(() => {
|
|
@@ -166,38 +131,56 @@ const Dialog = ({
|
|
|
166
131
|
size,
|
|
167
132
|
...restProps
|
|
168
133
|
}) => {
|
|
169
|
-
const backdropClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("dialog", { backdrop: true }, false);
|
|
170
134
|
const dialogClassName = styles_components_display_Divider_Divider_cjs.useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
171
|
-
const backdropRef = react.useRef(null);
|
|
172
135
|
const dialogRef = react.useRef(null);
|
|
173
136
|
const layer = useLayer();
|
|
174
137
|
const [visible, hide] = useVisibilityState(open);
|
|
175
138
|
const [enabled, setEnabled] = react.useState(true);
|
|
176
|
-
const
|
|
139
|
+
const lastAction = react.useRef(0);
|
|
140
|
+
useRestoreFocus(open);
|
|
141
|
+
const isNested = useNestedDialog(visible);
|
|
142
|
+
usePreventBodyScroll(visible && !isNested);
|
|
143
|
+
const onEscape = react.useCallback(
|
|
177
144
|
(event) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
onRequestClose();
|
|
181
147
|
},
|
|
182
148
|
[onRequestClose]
|
|
183
149
|
);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
150
|
+
useKeyboard("Escape", onEscape, { enabled: open && enabled });
|
|
151
|
+
react.useEffect(() => {
|
|
152
|
+
if (!open || !enabled) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
lastAction.current = Date.now();
|
|
156
|
+
const listener = (event) => {
|
|
157
|
+
var _a;
|
|
158
|
+
if (lastAction.current + 30 > Date.now()) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if ((_a = dialogRef.current) == null ? void 0 : _a.contains(event.target)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
onRequestClose();
|
|
165
|
+
};
|
|
166
|
+
document.addEventListener("click", listener);
|
|
167
|
+
return () => {
|
|
168
|
+
document.removeEventListener("click", listener);
|
|
169
|
+
};
|
|
170
|
+
}, [enabled, onRequestClose, open]);
|
|
190
171
|
useIsomorphicLayoutEffect(() => {
|
|
191
172
|
var _a, _b;
|
|
173
|
+
if (!visible) {
|
|
174
|
+
(_a = dialogRef.current) == null ? void 0 : _a.close();
|
|
175
|
+
}
|
|
192
176
|
if (!open) {
|
|
193
|
-
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
194
177
|
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
195
178
|
return;
|
|
196
179
|
}
|
|
197
180
|
let timer = requestAnimationFrame(() => {
|
|
198
181
|
timer = requestAnimationFrame(() => {
|
|
199
182
|
var _a2, _b2;
|
|
200
|
-
(_a2 =
|
|
183
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.showModal();
|
|
201
184
|
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
202
185
|
});
|
|
203
186
|
});
|
|
@@ -223,26 +206,16 @@ const Dialog = ({
|
|
|
223
206
|
}
|
|
224
207
|
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
225
208
|
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
226
|
-
|
|
209
|
+
"dialog",
|
|
227
210
|
{
|
|
228
|
-
ref:
|
|
229
|
-
|
|
211
|
+
ref: dialogRef,
|
|
212
|
+
"aria-modal": "true",
|
|
230
213
|
"data-open": dataOpen,
|
|
231
|
-
|
|
214
|
+
className: styles_components_display_Divider_Divider_cjs.classnames(styles_components_overlay_Dialog_dialog_css_cjs.dialog, dialogClassName, className),
|
|
232
215
|
onAnimationEnd,
|
|
233
216
|
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
|
-
)
|
|
217
|
+
...restProps,
|
|
218
|
+
children
|
|
246
219
|
}
|
|
247
220
|
) }) });
|
|
248
221
|
};
|
|
@@ -253,5 +226,4 @@ exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
|
253
226
|
exports.useKeyboard = useKeyboard;
|
|
254
227
|
exports.useLayer = useLayer;
|
|
255
228
|
exports.usePreventBodyScroll = usePreventBodyScroll;
|
|
256
|
-
exports.useRootAriaHidden = useRootAriaHidden;
|
|
257
229
|
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,33 +11,6 @@ const Portal = ({ children, container }) => {
|
|
|
11
11
|
container || document.body
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
-
const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
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 }) => {
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!active) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const handleFocus = (event) => {
|
|
31
|
-
if (ref.current && event.target instanceof HTMLElement && !ref.current.contains(event.target)) {
|
|
32
|
-
focusFirstElement(ref.current);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
document.addEventListener("focusin", handleFocus);
|
|
36
|
-
return () => {
|
|
37
|
-
document.removeEventListener("focusin", handleFocus);
|
|
38
|
-
};
|
|
39
|
-
}, [active, ref]);
|
|
40
|
-
};
|
|
41
14
|
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
42
15
|
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
43
16
|
useEffect(() => {
|
|
@@ -46,7 +19,7 @@ const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) =
|
|
|
46
19
|
}
|
|
47
20
|
function handleKeyDown(event) {
|
|
48
21
|
if (event.key === key) {
|
|
49
|
-
callback();
|
|
22
|
+
callback(event);
|
|
50
23
|
}
|
|
51
24
|
}
|
|
52
25
|
document.addEventListener(type, handleKeyDown);
|
|
@@ -109,21 +82,13 @@ const useRestoreFocus = (active) => {
|
|
|
109
82
|
target.current = document.activeElement;
|
|
110
83
|
}
|
|
111
84
|
useEffect(() => {
|
|
85
|
+
var _a;
|
|
112
86
|
if (target.current && !active && target.current instanceof HTMLElement) {
|
|
113
|
-
target.current.focus();
|
|
114
|
-
}
|
|
115
|
-
if (!active) {
|
|
87
|
+
(_a = target.current) == null ? void 0 : _a.focus();
|
|
116
88
|
target.current = null;
|
|
117
89
|
}
|
|
118
90
|
}, [active]);
|
|
119
91
|
};
|
|
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
92
|
const useVisibilityState = (open) => {
|
|
128
93
|
const [visible, setVisible] = useState(open);
|
|
129
94
|
const hide = useCallback(() => {
|
|
@@ -165,38 +130,56 @@ const Dialog = ({
|
|
|
165
130
|
size,
|
|
166
131
|
...restProps
|
|
167
132
|
}) => {
|
|
168
|
-
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
169
133
|
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
170
|
-
const backdropRef = useRef(null);
|
|
171
134
|
const dialogRef = useRef(null);
|
|
172
135
|
const layer = useLayer();
|
|
173
136
|
const [visible, hide] = useVisibilityState(open);
|
|
174
137
|
const [enabled, setEnabled] = useState(true);
|
|
175
|
-
const
|
|
138
|
+
const lastAction = useRef(0);
|
|
139
|
+
useRestoreFocus(open);
|
|
140
|
+
const isNested = useNestedDialog(visible);
|
|
141
|
+
usePreventBodyScroll(visible && !isNested);
|
|
142
|
+
const onEscape = useCallback(
|
|
176
143
|
(event) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
onRequestClose();
|
|
180
146
|
},
|
|
181
147
|
[onRequestClose]
|
|
182
148
|
);
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
149
|
+
useKeyboard("Escape", onEscape, { enabled: open && enabled });
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
if (!open || !enabled) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
lastAction.current = Date.now();
|
|
155
|
+
const listener = (event) => {
|
|
156
|
+
var _a;
|
|
157
|
+
if (lastAction.current + 30 > Date.now()) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if ((_a = dialogRef.current) == null ? void 0 : _a.contains(event.target)) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
onRequestClose();
|
|
164
|
+
};
|
|
165
|
+
document.addEventListener("click", listener);
|
|
166
|
+
return () => {
|
|
167
|
+
document.removeEventListener("click", listener);
|
|
168
|
+
};
|
|
169
|
+
}, [enabled, onRequestClose, open]);
|
|
189
170
|
useIsomorphicLayoutEffect(() => {
|
|
190
171
|
var _a, _b;
|
|
172
|
+
if (!visible) {
|
|
173
|
+
(_a = dialogRef.current) == null ? void 0 : _a.close();
|
|
174
|
+
}
|
|
191
175
|
if (!open) {
|
|
192
|
-
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
193
176
|
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
194
177
|
return;
|
|
195
178
|
}
|
|
196
179
|
let timer = requestAnimationFrame(() => {
|
|
197
180
|
timer = requestAnimationFrame(() => {
|
|
198
181
|
var _a2, _b2;
|
|
199
|
-
(_a2 =
|
|
182
|
+
(_a2 = dialogRef.current) == null ? void 0 : _a2.showModal();
|
|
200
183
|
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
201
184
|
});
|
|
202
185
|
});
|
|
@@ -222,26 +205,16 @@ const Dialog = ({
|
|
|
222
205
|
}
|
|
223
206
|
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
224
207
|
return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsx(
|
|
225
|
-
|
|
208
|
+
"dialog",
|
|
226
209
|
{
|
|
227
|
-
ref:
|
|
228
|
-
|
|
210
|
+
ref: dialogRef,
|
|
211
|
+
"aria-modal": "true",
|
|
229
212
|
"data-open": dataOpen,
|
|
230
|
-
|
|
213
|
+
className: classnames(dialog, dialogClassName, className),
|
|
231
214
|
onAnimationEnd,
|
|
232
215
|
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
|
-
)
|
|
216
|
+
...restProps,
|
|
217
|
+
children
|
|
245
218
|
}
|
|
246
219
|
) }) });
|
|
247
220
|
};
|
|
@@ -253,6 +226,5 @@ export {
|
|
|
253
226
|
useKeyboard,
|
|
254
227
|
useLayer,
|
|
255
228
|
usePreventBodyScroll,
|
|
256
|
-
useRootAriaHidden,
|
|
257
229
|
useVisibilityState
|
|
258
230
|
};
|
|
@@ -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({
|
|
@@ -3,30 +3,32 @@ const styles_themes_momotaro_components_button_css_cjs = require("./button.css.c
|
|
|
3
3
|
const styles_themes_momotaro_components_checkbox_css_cjs = require("./checkbox.css.cjs");
|
|
4
4
|
const styles_themes_momotaro_components_dialog_css_cjs = require("./dialog.css.cjs");
|
|
5
5
|
const styles_themes_momotaro_components_divider_css_cjs = require("./divider.css.cjs");
|
|
6
|
-
const styles_themes_momotaro_components_dropdown_css_cjs = require("./dropdown.css.cjs");
|
|
7
6
|
const styles_themes_momotaro_components_input_css_cjs = require("./input.css.cjs");
|
|
8
7
|
const styles_themes_momotaro_components_label_css_cjs = require("./label.css.cjs");
|
|
9
8
|
const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs");
|
|
9
|
+
const styles_themes_momotaro_components_popover_css_cjs = require("./popover.css.cjs");
|
|
10
10
|
const styles_themes_momotaro_components_progress_css_cjs = require("./progress.css.cjs");
|
|
11
11
|
const styles_themes_momotaro_components_radio_css_cjs = require("./radio.css.cjs");
|
|
12
12
|
const styles_themes_momotaro_components_select_css_cjs = require("./select.css.cjs");
|
|
13
13
|
const styles_themes_momotaro_components_slider_css_cjs = require("./slider.css.cjs");
|
|
14
14
|
const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
|
|
15
15
|
const styles_themes_momotaro_components_switch_css_cjs = require("./switch.css.cjs");
|
|
16
|
+
const styles_themes_momotaro_components_tooltip_css_cjs = require("./tooltip.css.cjs");
|
|
16
17
|
const components = {
|
|
17
18
|
button: styles_themes_momotaro_components_button_css_cjs.button,
|
|
18
19
|
checkbox: styles_themes_momotaro_components_checkbox_css_cjs.checkbox,
|
|
19
20
|
dialog: styles_themes_momotaro_components_dialog_css_cjs.dialog,
|
|
20
21
|
divider: styles_themes_momotaro_components_divider_css_cjs.divider,
|
|
21
|
-
dropdown: styles_themes_momotaro_components_dropdown_css_cjs.dropdown,
|
|
22
22
|
input: styles_themes_momotaro_components_input_css_cjs.input,
|
|
23
23
|
label: styles_themes_momotaro_components_label_css_cjs.label,
|
|
24
24
|
link: styles_themes_momotaro_components_link_css_cjs.link,
|
|
25
|
+
popover: styles_themes_momotaro_components_popover_css_cjs.popover,
|
|
25
26
|
progress: styles_themes_momotaro_components_progress_css_cjs.progress,
|
|
26
27
|
radio: styles_themes_momotaro_components_radio_css_cjs.radio,
|
|
27
28
|
select: styles_themes_momotaro_components_select_css_cjs.select,
|
|
29
|
+
slider: styles_themes_momotaro_components_slider_css_cjs.slider,
|
|
28
30
|
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
|
|
29
31
|
switch: styles_themes_momotaro_components_switch_css_cjs.switchTheme,
|
|
30
|
-
|
|
32
|
+
tooltip: styles_themes_momotaro_components_tooltip_css_cjs.tooltip
|
|
31
33
|
};
|
|
32
34
|
exports.components = components;
|
|
@@ -2,31 +2,33 @@ import { button } from "./button.css.mjs";
|
|
|
2
2
|
import { checkbox } from "./checkbox.css.mjs";
|
|
3
3
|
import { dialog } from "./dialog.css.mjs";
|
|
4
4
|
import { divider } from "./divider.css.mjs";
|
|
5
|
-
import { dropdown } from "./dropdown.css.mjs";
|
|
6
5
|
import { input } from "./input.css.mjs";
|
|
7
6
|
import { label } from "./label.css.mjs";
|
|
8
7
|
import { link } from "./link.css.mjs";
|
|
8
|
+
import { popover } from "./popover.css.mjs";
|
|
9
9
|
import { progress } from "./progress.css.mjs";
|
|
10
10
|
import { radio } from "./radio.css.mjs";
|
|
11
11
|
import { select } from "./select.css.mjs";
|
|
12
12
|
import { slider } from "./slider.css.mjs";
|
|
13
13
|
import { spinner } from "./spinner.css.mjs";
|
|
14
14
|
import { switchTheme } from "./switch.css.mjs";
|
|
15
|
+
import { tooltip } from "./tooltip.css.mjs";
|
|
15
16
|
const components = {
|
|
16
17
|
button,
|
|
17
18
|
checkbox,
|
|
18
19
|
dialog,
|
|
19
20
|
divider,
|
|
20
|
-
dropdown,
|
|
21
21
|
input,
|
|
22
22
|
label,
|
|
23
23
|
link,
|
|
24
|
+
popover,
|
|
24
25
|
progress,
|
|
25
26
|
radio,
|
|
26
27
|
select,
|
|
28
|
+
slider,
|
|
27
29
|
spinner,
|
|
28
30
|
switch: switchTheme,
|
|
29
|
-
|
|
31
|
+
tooltip
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
34
|
components
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const styles_lib_css_style_style_cjs = require("../../../lib/css/style/style.cjs");
|
|
4
4
|
const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
|
|
5
|
-
fileScope.setFileScope("src/themes/momotaro/components/
|
|
6
|
-
const
|
|
5
|
+
fileScope.setFileScope("src/themes/momotaro/components/popover.css.ts", "@blockle/blocks");
|
|
6
|
+
const popover = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("popover", {
|
|
7
7
|
base: styles_lib_css_style_style_cjs.style({
|
|
8
8
|
backgroundColor: "white",
|
|
9
9
|
borderRadius: "small",
|
|
10
10
|
boxShadow: "medium",
|
|
11
11
|
padding: "medium",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
12
|
+
margin: "small",
|
|
13
|
+
// Space between the popover and the anchor element
|
|
15
14
|
selectors: {
|
|
16
15
|
"&[data-open]": {
|
|
17
16
|
transform: "scale(1)",
|
|
@@ -26,28 +25,7 @@ const dropdown = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dro
|
|
|
26
25
|
opacity: 0
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
})
|
|
30
|
-
variants: {
|
|
31
|
-
variant: {
|
|
32
|
-
solid: styles_lib_css_style_style_cjs.style({
|
|
33
|
-
backgroundColor: "white",
|
|
34
|
-
border: "none",
|
|
35
|
-
boxShadow: "medium",
|
|
36
|
-
color: "black",
|
|
37
|
-
padding: "medium"
|
|
38
|
-
}),
|
|
39
|
-
outline: styles_lib_css_style_style_cjs.style({
|
|
40
|
-
backgroundColor: "transparent",
|
|
41
|
-
border: "1px solid black",
|
|
42
|
-
boxShadow: "none",
|
|
43
|
-
color: "black",
|
|
44
|
-
padding: "medium"
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
defaultVariants: {
|
|
49
|
-
variant: "solid"
|
|
50
|
-
}
|
|
28
|
+
})
|
|
51
29
|
});
|
|
52
30
|
fileScope.endFileScope();
|
|
53
|
-
exports.
|
|
31
|
+
exports.popover = popover;
|