@blockle/blocks 0.3.8 → 0.4.0
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 +179 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +178 -2
- package/dist/momotaro.chunk.d.ts +157 -125
- package/dist/styles/components/Dialog/dialog.css.cjs +83 -0
- package/dist/styles/components/Dialog/dialog.css.mjs +84 -0
- package/dist/styles/lib/css/atoms/atomicProperties.cjs +1 -0
- package/dist/styles/lib/css/atoms/atomicProperties.mjs +1 -0
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +25 -0
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +26 -0
- package/dist/styles/themes/momotaro/components/index.cjs +3 -1
- package/dist/styles/themes/momotaro/components/index.mjs +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const styles_lib_css_atoms_breakpoints_cjs = require("./styles/lib/css/atoms/breakpoints.cjs");
|
|
4
|
-
const styles_lib_css_theme_makeTheme_cjs = require("./styles/lib/css/theme/makeTheme.cjs");
|
|
5
4
|
const styles_lib_css_theme_makeComponentTheme_cjs = require("./styles/lib/css/theme/makeComponentTheme.cjs");
|
|
5
|
+
const styles_lib_css_theme_makeTheme_cjs = require("./styles/lib/css/theme/makeTheme.cjs");
|
|
6
6
|
const styles_lib_css_theme_vars_css_cjs = require("./styles/lib/css/theme/vars.css.cjs");
|
|
7
7
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("./styles/lib/css/atoms/sprinkles.css.cjs");
|
|
8
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
9
8
|
const react = require("react");
|
|
9
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
const styles_components_Button_Button_css_cjs = require("./styles/components/Button/Button.css.cjs");
|
|
11
11
|
const styles_components_Divider_divider_css_cjs = require("./styles/components/Divider/divider.css.cjs");
|
|
12
|
+
const styles_components_Dialog_dialog_css_cjs = require("./styles/components/Dialog/dialog.css.cjs");
|
|
13
|
+
const reactDom = require("react-dom");
|
|
12
14
|
const classnames = (...args) => {
|
|
13
15
|
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
14
16
|
return className || void 0;
|
|
@@ -286,14 +288,186 @@ const Divider = ({ className, color }) => {
|
|
|
286
288
|
}
|
|
287
289
|
);
|
|
288
290
|
};
|
|
291
|
+
const useLayer = () => {
|
|
292
|
+
const layerRef = react.useRef();
|
|
293
|
+
react.useEffect(
|
|
294
|
+
() => () => {
|
|
295
|
+
if (layerRef.current) {
|
|
296
|
+
layerRef.current.remove();
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
[]
|
|
300
|
+
);
|
|
301
|
+
return () => {
|
|
302
|
+
if (!layerRef.current) {
|
|
303
|
+
layerRef.current = document.createElement("div");
|
|
304
|
+
document.body.append(layerRef.current);
|
|
305
|
+
}
|
|
306
|
+
return layerRef.current;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
const useVisibilityState = (open) => {
|
|
310
|
+
const [visible, setVisible] = react.useState(open);
|
|
311
|
+
const hide = react.useCallback(() => {
|
|
312
|
+
setVisible(false);
|
|
313
|
+
}, []);
|
|
314
|
+
react.useEffect(() => {
|
|
315
|
+
if (open) {
|
|
316
|
+
setVisible(true);
|
|
317
|
+
}
|
|
318
|
+
}, [open]);
|
|
319
|
+
return [visible, hide];
|
|
320
|
+
};
|
|
321
|
+
const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
322
|
+
const getFirstFocusableElement = (container) => {
|
|
323
|
+
const focusable = container.querySelector(focusableSelectors);
|
|
324
|
+
return focusable || null;
|
|
325
|
+
};
|
|
326
|
+
const focusFirstElement = (container) => {
|
|
327
|
+
const focusable = getFirstFocusableElement(container);
|
|
328
|
+
if (focusable) {
|
|
329
|
+
focusable.focus();
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const useFocusLock = ({ ref, active }) => {
|
|
333
|
+
react.useEffect(() => {
|
|
334
|
+
if (!active) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const handleFocus = (event) => {
|
|
338
|
+
if (ref.current && event.target instanceof HTMLElement && !ref.current.contains(event.target)) {
|
|
339
|
+
focusFirstElement(ref.current);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
document.addEventListener("focusin", handleFocus);
|
|
343
|
+
return () => {
|
|
344
|
+
document.removeEventListener("focusin", handleFocus);
|
|
345
|
+
};
|
|
346
|
+
}, [active]);
|
|
347
|
+
};
|
|
348
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? react.useLayoutEffect : react.useEffect;
|
|
349
|
+
const useRestoreFocus = (active) => {
|
|
350
|
+
const [target, setTarget] = react.useState(null);
|
|
351
|
+
useIsomorphicLayoutEffect(() => {
|
|
352
|
+
if (active && !target) {
|
|
353
|
+
setTarget(document.activeElement);
|
|
354
|
+
}
|
|
355
|
+
}, [active]);
|
|
356
|
+
react.useEffect(() => {
|
|
357
|
+
if (!active && target instanceof HTMLElement) {
|
|
358
|
+
target.focus();
|
|
359
|
+
}
|
|
360
|
+
}, [active]);
|
|
361
|
+
};
|
|
362
|
+
const DialogContext = react.createContext(void 0);
|
|
363
|
+
const useNestedDialog = (open) => {
|
|
364
|
+
const parentDialog = react.useContext(DialogContext);
|
|
365
|
+
react.useEffect(() => {
|
|
366
|
+
if (!parentDialog || !open) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
parentDialog.setEnabled(false);
|
|
370
|
+
return () => {
|
|
371
|
+
parentDialog.setEnabled(true);
|
|
372
|
+
};
|
|
373
|
+
}, [parentDialog, open]);
|
|
374
|
+
return !!parentDialog;
|
|
375
|
+
};
|
|
376
|
+
const usePreventBodyScroll = (enabled = true) => {
|
|
377
|
+
useIsomorphicLayoutEffect(() => {
|
|
378
|
+
const prevValue = document.body.style.getPropertyValue("overflow");
|
|
379
|
+
if (enabled) {
|
|
380
|
+
document.body.style.overflow = "hidden";
|
|
381
|
+
}
|
|
382
|
+
return () => {
|
|
383
|
+
document.body.style.overflow = prevValue;
|
|
384
|
+
};
|
|
385
|
+
}, [enabled]);
|
|
386
|
+
};
|
|
387
|
+
const Portal = ({ children, container }) => {
|
|
388
|
+
const context = useTheme();
|
|
389
|
+
return reactDom.createPortal(
|
|
390
|
+
/* @__PURE__ */ jsxRuntime.jsx(BlocksProvider, { theme: context, children }),
|
|
391
|
+
container || document.body
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
const Dialog = ({ children, open, className, onRequestClose }) => {
|
|
395
|
+
const dialogRef = react.useRef(null);
|
|
396
|
+
const layer = useLayer();
|
|
397
|
+
const [visible, hide] = useVisibilityState(open);
|
|
398
|
+
const [enabled, setEnabled] = react.useState(true);
|
|
399
|
+
const onBackdropClick = react.useCallback(
|
|
400
|
+
(event) => {
|
|
401
|
+
if (event.target === event.currentTarget) {
|
|
402
|
+
onRequestClose();
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
[onRequestClose]
|
|
406
|
+
);
|
|
407
|
+
const onAnimationEnd = react.useCallback((event) => {
|
|
408
|
+
if (event.animationName === styles_components_Dialog_dialog_css_cjs.backdropLeaveAnimation) {
|
|
409
|
+
event.stopPropagation();
|
|
410
|
+
hide();
|
|
411
|
+
}
|
|
412
|
+
}, []);
|
|
413
|
+
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
414
|
+
useRestoreFocus(open);
|
|
415
|
+
const isNested = useNestedDialog(visible);
|
|
416
|
+
usePreventBodyScroll(visible && !isNested);
|
|
417
|
+
react.useEffect(() => {
|
|
418
|
+
if (!open || !enabled) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const handleKeyDown = (event) => {
|
|
422
|
+
if (event.key === "Escape") {
|
|
423
|
+
onRequestClose();
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
427
|
+
return () => {
|
|
428
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
429
|
+
};
|
|
430
|
+
}, [open, enabled]);
|
|
431
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true });
|
|
432
|
+
const dialogClassName = useComponentStyles("dialog", { base: true });
|
|
433
|
+
if (!visible) {
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
437
|
+
Box,
|
|
438
|
+
{
|
|
439
|
+
className: classnames(styles_components_Dialog_dialog_css_cjs.backdrop, !open && styles_components_Dialog_dialog_css_cjs.backdropLeave, backdropClassName),
|
|
440
|
+
display: "flex",
|
|
441
|
+
placeItems: "center",
|
|
442
|
+
onClick: onBackdropClick,
|
|
443
|
+
onAnimationEnd,
|
|
444
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
445
|
+
Box,
|
|
446
|
+
{
|
|
447
|
+
ref: dialogRef,
|
|
448
|
+
as: "dialog",
|
|
449
|
+
open: true,
|
|
450
|
+
className: classnames(
|
|
451
|
+
styles_components_Dialog_dialog_css_cjs.dialog,
|
|
452
|
+
!open && styles_components_Dialog_dialog_css_cjs.dialogLeave,
|
|
453
|
+
dialogClassName,
|
|
454
|
+
className
|
|
455
|
+
),
|
|
456
|
+
children
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
) }) });
|
|
461
|
+
};
|
|
289
462
|
exports.breakpointQuery = styles_lib_css_atoms_breakpoints_cjs.breakpointQuery;
|
|
290
|
-
exports.makeTheme = styles_lib_css_theme_makeTheme_cjs.makeTheme;
|
|
291
463
|
exports.makeComponentTheme = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme;
|
|
464
|
+
exports.makeTheme = styles_lib_css_theme_makeTheme_cjs.makeTheme;
|
|
292
465
|
exports.vars = styles_lib_css_theme_vars_css_cjs.vars;
|
|
293
466
|
exports.atoms = styles_lib_css_atoms_sprinkles_css_cjs.atoms;
|
|
294
467
|
exports.BlocksProvider = BlocksProvider;
|
|
295
468
|
exports.Box = Box;
|
|
296
469
|
exports.Button = Button;
|
|
470
|
+
exports.Dialog = Dialog;
|
|
297
471
|
exports.Divider = Divider;
|
|
298
472
|
exports.Heading = Heading;
|
|
299
473
|
exports.Inline = Inline;
|
|
@@ -302,3 +476,5 @@ exports.Spinner = Spinner;
|
|
|
302
476
|
exports.Stack = Stack;
|
|
303
477
|
exports.Text = Text;
|
|
304
478
|
exports.classnames = classnames;
|
|
479
|
+
exports.useComponentStyleDefaultProps = useComponentStyleDefaultProps;
|
|
480
|
+
exports.useComponentStyles = useComponentStyles;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlocksProvider, BlocksProviderProps, BlocksTokens, Box, BoxProps, Button, ButtonProps, ComponentThemesMap, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, vars } from './momotaro.chunk.js';
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, BlocksTokens, Box, BoxProps, Button, ButtonProps, ComponentThemesMap, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, vars } from './momotaro.chunk.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { breakpointQuery } from "./styles/lib/css/atoms/breakpoints.mjs";
|
|
4
|
-
import { makeTheme } from "./styles/lib/css/theme/makeTheme.mjs";
|
|
5
4
|
import { makeComponentTheme } from "./styles/lib/css/theme/makeComponentTheme.mjs";
|
|
5
|
+
import { makeTheme } from "./styles/lib/css/theme/makeTheme.mjs";
|
|
6
6
|
import { vars } from "./styles/lib/css/theme/vars.css.mjs";
|
|
7
7
|
import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
|
|
8
|
+
import { createContext, forwardRef, useContext, useRef, useEffect, useState, useCallback, useLayoutEffect } from "react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { createContext, forwardRef, useContext } from "react";
|
|
10
10
|
import { buttonReset } from "./styles/components/Button/Button.css.mjs";
|
|
11
11
|
import { divider } from "./styles/components/Divider/divider.css.mjs";
|
|
12
|
+
import { backdropLeaveAnimation, backdropLeave, backdrop, dialogLeave, dialog } from "./styles/components/Dialog/dialog.css.mjs";
|
|
13
|
+
import { createPortal } from "react-dom";
|
|
12
14
|
const classnames = (...args) => {
|
|
13
15
|
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
14
16
|
return className || void 0;
|
|
@@ -286,10 +288,182 @@ const Divider = ({ className, color }) => {
|
|
|
286
288
|
}
|
|
287
289
|
);
|
|
288
290
|
};
|
|
291
|
+
const useLayer = () => {
|
|
292
|
+
const layerRef = useRef();
|
|
293
|
+
useEffect(
|
|
294
|
+
() => () => {
|
|
295
|
+
if (layerRef.current) {
|
|
296
|
+
layerRef.current.remove();
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
[]
|
|
300
|
+
);
|
|
301
|
+
return () => {
|
|
302
|
+
if (!layerRef.current) {
|
|
303
|
+
layerRef.current = document.createElement("div");
|
|
304
|
+
document.body.append(layerRef.current);
|
|
305
|
+
}
|
|
306
|
+
return layerRef.current;
|
|
307
|
+
};
|
|
308
|
+
};
|
|
309
|
+
const useVisibilityState = (open) => {
|
|
310
|
+
const [visible, setVisible] = useState(open);
|
|
311
|
+
const hide = useCallback(() => {
|
|
312
|
+
setVisible(false);
|
|
313
|
+
}, []);
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
if (open) {
|
|
316
|
+
setVisible(true);
|
|
317
|
+
}
|
|
318
|
+
}, [open]);
|
|
319
|
+
return [visible, hide];
|
|
320
|
+
};
|
|
321
|
+
const focusableSelectors = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
322
|
+
const getFirstFocusableElement = (container) => {
|
|
323
|
+
const focusable = container.querySelector(focusableSelectors);
|
|
324
|
+
return focusable || null;
|
|
325
|
+
};
|
|
326
|
+
const focusFirstElement = (container) => {
|
|
327
|
+
const focusable = getFirstFocusableElement(container);
|
|
328
|
+
if (focusable) {
|
|
329
|
+
focusable.focus();
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const useFocusLock = ({ ref, active }) => {
|
|
333
|
+
useEffect(() => {
|
|
334
|
+
if (!active) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
const handleFocus = (event) => {
|
|
338
|
+
if (ref.current && event.target instanceof HTMLElement && !ref.current.contains(event.target)) {
|
|
339
|
+
focusFirstElement(ref.current);
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
document.addEventListener("focusin", handleFocus);
|
|
343
|
+
return () => {
|
|
344
|
+
document.removeEventListener("focusin", handleFocus);
|
|
345
|
+
};
|
|
346
|
+
}, [active]);
|
|
347
|
+
};
|
|
348
|
+
const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
|
|
349
|
+
const useRestoreFocus = (active) => {
|
|
350
|
+
const [target, setTarget] = useState(null);
|
|
351
|
+
useIsomorphicLayoutEffect(() => {
|
|
352
|
+
if (active && !target) {
|
|
353
|
+
setTarget(document.activeElement);
|
|
354
|
+
}
|
|
355
|
+
}, [active]);
|
|
356
|
+
useEffect(() => {
|
|
357
|
+
if (!active && target instanceof HTMLElement) {
|
|
358
|
+
target.focus();
|
|
359
|
+
}
|
|
360
|
+
}, [active]);
|
|
361
|
+
};
|
|
362
|
+
const DialogContext = createContext(void 0);
|
|
363
|
+
const useNestedDialog = (open) => {
|
|
364
|
+
const parentDialog = useContext(DialogContext);
|
|
365
|
+
useEffect(() => {
|
|
366
|
+
if (!parentDialog || !open) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
parentDialog.setEnabled(false);
|
|
370
|
+
return () => {
|
|
371
|
+
parentDialog.setEnabled(true);
|
|
372
|
+
};
|
|
373
|
+
}, [parentDialog, open]);
|
|
374
|
+
return !!parentDialog;
|
|
375
|
+
};
|
|
376
|
+
const usePreventBodyScroll = (enabled = true) => {
|
|
377
|
+
useIsomorphicLayoutEffect(() => {
|
|
378
|
+
const prevValue = document.body.style.getPropertyValue("overflow");
|
|
379
|
+
if (enabled) {
|
|
380
|
+
document.body.style.overflow = "hidden";
|
|
381
|
+
}
|
|
382
|
+
return () => {
|
|
383
|
+
document.body.style.overflow = prevValue;
|
|
384
|
+
};
|
|
385
|
+
}, [enabled]);
|
|
386
|
+
};
|
|
387
|
+
const Portal = ({ children, container }) => {
|
|
388
|
+
const context = useTheme();
|
|
389
|
+
return createPortal(
|
|
390
|
+
/* @__PURE__ */ jsx(BlocksProvider, { theme: context, children }),
|
|
391
|
+
container || document.body
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
const Dialog = ({ children, open, className, onRequestClose }) => {
|
|
395
|
+
const dialogRef = useRef(null);
|
|
396
|
+
const layer = useLayer();
|
|
397
|
+
const [visible, hide] = useVisibilityState(open);
|
|
398
|
+
const [enabled, setEnabled] = useState(true);
|
|
399
|
+
const onBackdropClick = useCallback(
|
|
400
|
+
(event) => {
|
|
401
|
+
if (event.target === event.currentTarget) {
|
|
402
|
+
onRequestClose();
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
[onRequestClose]
|
|
406
|
+
);
|
|
407
|
+
const onAnimationEnd = useCallback((event) => {
|
|
408
|
+
if (event.animationName === backdropLeaveAnimation) {
|
|
409
|
+
event.stopPropagation();
|
|
410
|
+
hide();
|
|
411
|
+
}
|
|
412
|
+
}, []);
|
|
413
|
+
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
414
|
+
useRestoreFocus(open);
|
|
415
|
+
const isNested = useNestedDialog(visible);
|
|
416
|
+
usePreventBodyScroll(visible && !isNested);
|
|
417
|
+
useEffect(() => {
|
|
418
|
+
if (!open || !enabled) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const handleKeyDown = (event) => {
|
|
422
|
+
if (event.key === "Escape") {
|
|
423
|
+
onRequestClose();
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
427
|
+
return () => {
|
|
428
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
429
|
+
};
|
|
430
|
+
}, [open, enabled]);
|
|
431
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true });
|
|
432
|
+
const dialogClassName = useComponentStyles("dialog", { base: true });
|
|
433
|
+
if (!visible) {
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsx(
|
|
437
|
+
Box,
|
|
438
|
+
{
|
|
439
|
+
className: classnames(backdrop, !open && backdropLeave, backdropClassName),
|
|
440
|
+
display: "flex",
|
|
441
|
+
placeItems: "center",
|
|
442
|
+
onClick: onBackdropClick,
|
|
443
|
+
onAnimationEnd,
|
|
444
|
+
children: /* @__PURE__ */ jsx(
|
|
445
|
+
Box,
|
|
446
|
+
{
|
|
447
|
+
ref: dialogRef,
|
|
448
|
+
as: "dialog",
|
|
449
|
+
open: true,
|
|
450
|
+
className: classnames(
|
|
451
|
+
dialog,
|
|
452
|
+
!open && dialogLeave,
|
|
453
|
+
dialogClassName,
|
|
454
|
+
className
|
|
455
|
+
),
|
|
456
|
+
children
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
) }) });
|
|
461
|
+
};
|
|
289
462
|
export {
|
|
290
463
|
BlocksProvider,
|
|
291
464
|
Box,
|
|
292
465
|
Button,
|
|
466
|
+
Dialog,
|
|
293
467
|
Divider,
|
|
294
468
|
Heading,
|
|
295
469
|
Inline,
|
|
@@ -302,5 +476,7 @@ export {
|
|
|
302
476
|
classnames,
|
|
303
477
|
makeComponentTheme,
|
|
304
478
|
makeTheme,
|
|
479
|
+
useComponentStyleDefaultProps,
|
|
480
|
+
useComponentStyles,
|
|
305
481
|
vars
|
|
306
482
|
};
|
package/dist/momotaro.chunk.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const atoms: ((props: {
|
|
|
7
7
|
readonly backgroundColor?: "link" | "danger" | "primary" | "secondary" | "white" | "black" | "body" | "primaryLight" | "primaryDark" | "secondaryLight" | "secondaryDark" | "text" | "textLight" | "textDark" | "currentColor" | undefined;
|
|
8
8
|
readonly borderColor?: "link" | "danger" | "primary" | "secondary" | "white" | "black" | "body" | "primaryLight" | "primaryDark" | "secondaryLight" | "secondaryDark" | "text" | "textLight" | "textDark" | "currentColor" | undefined;
|
|
9
9
|
readonly borderRadius?: ("small" | "medium" | "large" | "xlarge") | undefined;
|
|
10
|
+
readonly border?: "none" | undefined;
|
|
10
11
|
readonly bottom?: 0 | undefined;
|
|
11
12
|
readonly boxShadow?: ("small" | "medium" | "large") | undefined;
|
|
12
13
|
readonly color?: "link" | "danger" | "primary" | "secondary" | "white" | "black" | "body" | "primaryLight" | "primaryDark" | "secondaryLight" | "secondaryDark" | "text" | "textLight" | "textDark" | "currentColor" | undefined;
|
|
@@ -218,9 +219,18 @@ declare const atoms: ((props: {
|
|
|
218
219
|
wide?: "center" | "flex-start" | "flex-end" | undefined;
|
|
219
220
|
} | undefined) | _vanilla_extract_sprinkles.ResponsiveArray<4 | 1 | 2 | 3, "center" | "flex-start" | "flex-end" | null>;
|
|
220
221
|
}) => string) & {
|
|
221
|
-
properties: Set<"outline" | "borderRadius" | "color" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "transition" | "boxShadow" | "alignItems" | "backgroundColor" | "bottom" | "columnGap" | "cursor" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "height" | "justifyContent" | "left" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "opacity" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "right" | "rowGap" | "textAlign" | "textTransform" | "top" | "userSelect" | "whiteSpace" | "width" | "wordBreak" | "wordWrap" | "borderColor" | "flex" | "gap" | "inset" | "margin" | "overflow" | "padding" | "placeItems" | "textDecoration" | "textWrap" | "marginX" | "marginY" | "paddingX" | "paddingY">;
|
|
222
|
+
properties: Set<"outline" | "borderRadius" | "color" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "transition" | "boxShadow" | "alignItems" | "backgroundColor" | "bottom" | "columnGap" | "cursor" | "display" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "height" | "justifyContent" | "left" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "opacity" | "overflowX" | "overflowY" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "pointerEvents" | "position" | "right" | "rowGap" | "textAlign" | "textTransform" | "top" | "userSelect" | "whiteSpace" | "width" | "wordBreak" | "wordWrap" | "border" | "borderColor" | "flex" | "gap" | "inset" | "margin" | "overflow" | "padding" | "placeItems" | "textDecoration" | "textWrap" | "marginX" | "marginY" | "paddingX" | "paddingY">;
|
|
222
223
|
};
|
|
223
224
|
|
|
225
|
+
declare const breakpoints: {
|
|
226
|
+
readonly mobile: 0;
|
|
227
|
+
readonly tablet: 740;
|
|
228
|
+
readonly desktop: 992;
|
|
229
|
+
readonly wide: 1200;
|
|
230
|
+
};
|
|
231
|
+
type Breakpoint = keyof typeof breakpoints;
|
|
232
|
+
declare const breakpointQuery: (key: Breakpoint) => string;
|
|
233
|
+
|
|
224
234
|
type Atoms = Parameters<typeof atoms>[0];
|
|
225
235
|
type ResponsiveValue<T> = T | [T] | [T, T] | [T, T, T] | [T, T, T, T];
|
|
226
236
|
type ResponsiveDisplayFlex = ResponsiveValue<'none' | 'flex' | 'inline-flex'>;
|
|
@@ -266,6 +276,12 @@ type CreateComponentTheme<T extends Theme$1> = {
|
|
|
266
276
|
[VariantGroup in keyof T['variants']]?: T['variants'][VariantGroup] extends string ? T['variants'][VariantGroup] : boolean;
|
|
267
277
|
};
|
|
268
278
|
};
|
|
279
|
+
type CreateThemeProps<T extends Theme$1> = {
|
|
280
|
+
[K in keyof T['variants']]?: T['variants'][K] extends string ? T['variants'][K] : boolean;
|
|
281
|
+
} & {
|
|
282
|
+
type: T['type'];
|
|
283
|
+
base?: boolean;
|
|
284
|
+
};
|
|
269
285
|
declare const makeComponentTheme: <T extends ComponentThemes>(options: T) => T;
|
|
270
286
|
|
|
271
287
|
type ButtonTheme = {
|
|
@@ -276,6 +292,7 @@ type ButtonTheme = {
|
|
|
276
292
|
size: 'small' | 'medium' | 'large';
|
|
277
293
|
};
|
|
278
294
|
};
|
|
295
|
+
type ButtonThemeProps = CreateThemeProps<ButtonTheme>;
|
|
279
296
|
type ButtonThemeComponent = CreateComponentTheme<ButtonTheme>;
|
|
280
297
|
type LinkTheme = {
|
|
281
298
|
type: 'link';
|
|
@@ -284,6 +301,7 @@ type LinkTheme = {
|
|
|
284
301
|
underline: boolean;
|
|
285
302
|
};
|
|
286
303
|
};
|
|
304
|
+
type LinkThemeProps = CreateThemeProps<LinkTheme>;
|
|
287
305
|
type LinkThemeComponent = CreateComponentTheme<LinkTheme>;
|
|
288
306
|
type SpinnerTheme = {
|
|
289
307
|
type: 'spinner';
|
|
@@ -292,6 +310,7 @@ type SpinnerTheme = {
|
|
|
292
310
|
color: Exclude<Atoms['color'], undefined>;
|
|
293
311
|
};
|
|
294
312
|
};
|
|
313
|
+
type SpinnerThemeProps = CreateThemeProps<SpinnerTheme>;
|
|
295
314
|
type SpinnerThemeComponent = CreateComponentTheme<SpinnerTheme>;
|
|
296
315
|
type DividerTheme = {
|
|
297
316
|
type: 'divider';
|
|
@@ -299,8 +318,18 @@ type DividerTheme = {
|
|
|
299
318
|
color: Exclude<Atoms['color'], undefined>;
|
|
300
319
|
};
|
|
301
320
|
};
|
|
321
|
+
type DividerThemeProps = CreateThemeProps<DividerTheme>;
|
|
302
322
|
type DividerThemeComponent = CreateComponentTheme<DividerTheme>;
|
|
303
|
-
type
|
|
323
|
+
type DialogTheme = {
|
|
324
|
+
type: 'dialog';
|
|
325
|
+
variants: {
|
|
326
|
+
backdrop: boolean;
|
|
327
|
+
};
|
|
328
|
+
};
|
|
329
|
+
type DialogThemeProps = CreateThemeProps<DialogTheme>;
|
|
330
|
+
type DialogThemeComponent = CreateComponentTheme<DialogTheme>;
|
|
331
|
+
type ComponentThemeProps = UnionThemesToRecord<ButtonThemeProps | LinkThemeProps | SpinnerThemeProps | DividerThemeProps | DialogThemeProps>;
|
|
332
|
+
type ComponentThemes = ButtonThemeComponent | LinkThemeComponent | SpinnerThemeComponent | DividerThemeComponent | DialogThemeComponent;
|
|
304
333
|
type ComponentThemesMap = UnionThemesToRecord<ComponentThemes>;
|
|
305
334
|
type UnionThemesToRecord<T extends {
|
|
306
335
|
type: string;
|
|
@@ -310,6 +339,123 @@ type UnionThemesToRecord<T extends {
|
|
|
310
339
|
}>, 'type'>;
|
|
311
340
|
};
|
|
312
341
|
|
|
342
|
+
type FontWeight = 'regular' | 'medium' | 'strong';
|
|
343
|
+
type Space = 'none' | 'gutter' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
344
|
+
type Transition = 'slow' | 'normal' | 'fast';
|
|
345
|
+
type BorderRadius = 'small' | 'medium' | 'large' | 'xlarge';
|
|
346
|
+
type BorderWidth = 'small' | 'medium' | 'large';
|
|
347
|
+
type BoxShadow = 'small' | 'medium' | 'large';
|
|
348
|
+
type FontSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
349
|
+
type LineHeight = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
350
|
+
type Color = 'white' | 'black' | 'body' | 'primaryLight' | 'primary' | 'primaryDark' | 'secondaryLight' | 'secondary' | 'secondaryDark' | 'text' | 'textLight' | 'textDark' | 'danger' | 'link';
|
|
351
|
+
type BlocksTokens = {
|
|
352
|
+
typography: {
|
|
353
|
+
fontFamily: {
|
|
354
|
+
primary?: string;
|
|
355
|
+
secondary?: string;
|
|
356
|
+
};
|
|
357
|
+
fontSize: Record<FontSize, number | string>;
|
|
358
|
+
fontWeight: Record<FontWeight, 400 | 500 | 600 | 700 | 800>;
|
|
359
|
+
lineHeight: Record<LineHeight, number | string>;
|
|
360
|
+
};
|
|
361
|
+
spacing: Record<Space, number | string>;
|
|
362
|
+
transition: Record<Transition, string>;
|
|
363
|
+
border: {
|
|
364
|
+
radius: Record<BorderRadius, number | string>;
|
|
365
|
+
width: Record<BorderWidth, number | string>;
|
|
366
|
+
};
|
|
367
|
+
shadow: Record<BoxShadow, string>;
|
|
368
|
+
focus: {
|
|
369
|
+
boxShadow: string;
|
|
370
|
+
};
|
|
371
|
+
color: Record<Color, string>;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
type Theme = {
|
|
375
|
+
name: string;
|
|
376
|
+
tokens: BlocksTokens;
|
|
377
|
+
components: ComponentThemesMap;
|
|
378
|
+
};
|
|
379
|
+
declare const makeTheme: (theme: Theme) => {
|
|
380
|
+
vars: string;
|
|
381
|
+
components: ComponentThemesMap;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
declare const vars: {
|
|
385
|
+
space: {
|
|
386
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
387
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
388
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
389
|
+
none: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
390
|
+
gutter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
391
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
392
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
393
|
+
};
|
|
394
|
+
borderRadius: {
|
|
395
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
396
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
397
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
398
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
399
|
+
};
|
|
400
|
+
color: {
|
|
401
|
+
link: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
402
|
+
danger: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
403
|
+
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
404
|
+
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
405
|
+
white: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
406
|
+
black: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
407
|
+
body: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
408
|
+
primaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
409
|
+
primaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
410
|
+
secondaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
411
|
+
secondaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
412
|
+
text: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
413
|
+
textLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
414
|
+
textDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
415
|
+
};
|
|
416
|
+
borderWidth: {
|
|
417
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
418
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
419
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
420
|
+
};
|
|
421
|
+
fontFamily: {
|
|
422
|
+
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
423
|
+
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
424
|
+
};
|
|
425
|
+
fontSize: {
|
|
426
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
427
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
428
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
429
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
430
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
431
|
+
};
|
|
432
|
+
fontWeight: {
|
|
433
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
434
|
+
regular: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
435
|
+
strong: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
436
|
+
};
|
|
437
|
+
lineHeight: {
|
|
438
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
439
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
440
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
441
|
+
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
442
|
+
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
443
|
+
};
|
|
444
|
+
transition: {
|
|
445
|
+
slow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
446
|
+
normal: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
447
|
+
fast: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
448
|
+
};
|
|
449
|
+
shadow: {
|
|
450
|
+
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
451
|
+
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
452
|
+
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
453
|
+
};
|
|
454
|
+
focus: {
|
|
455
|
+
boxShadow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
456
|
+
};
|
|
457
|
+
};
|
|
458
|
+
|
|
313
459
|
type BlocksProviderContextData = {
|
|
314
460
|
vars: string;
|
|
315
461
|
components: ComponentThemesMap;
|
|
@@ -445,131 +591,17 @@ type DividerProps = {
|
|
|
445
591
|
};
|
|
446
592
|
declare const Divider: FC<DividerProps>;
|
|
447
593
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
};
|
|
454
|
-
type Breakpoint = keyof typeof breakpoints;
|
|
455
|
-
declare const breakpointQuery: (key: Breakpoint) => string;
|
|
456
|
-
|
|
457
|
-
type FontWeight = 'regular' | 'medium' | 'strong';
|
|
458
|
-
type Space = 'none' | 'gutter' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
459
|
-
type Transition = 'slow' | 'normal' | 'fast';
|
|
460
|
-
type BorderRadius = 'small' | 'medium' | 'large' | 'xlarge';
|
|
461
|
-
type BorderWidth = 'small' | 'medium' | 'large';
|
|
462
|
-
type BoxShadow = 'small' | 'medium' | 'large';
|
|
463
|
-
type FontSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
464
|
-
type LineHeight = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
465
|
-
type Color = 'white' | 'black' | 'body' | 'primaryLight' | 'primary' | 'primaryDark' | 'secondaryLight' | 'secondary' | 'secondaryDark' | 'text' | 'textLight' | 'textDark' | 'danger' | 'link';
|
|
466
|
-
type BlocksTokens = {
|
|
467
|
-
typography: {
|
|
468
|
-
fontFamily: {
|
|
469
|
-
primary?: string;
|
|
470
|
-
secondary?: string;
|
|
471
|
-
};
|
|
472
|
-
fontSize: Record<FontSize, number | string>;
|
|
473
|
-
fontWeight: Record<FontWeight, 400 | 500 | 600 | 700 | 800>;
|
|
474
|
-
lineHeight: Record<LineHeight, number | string>;
|
|
475
|
-
};
|
|
476
|
-
spacing: Record<Space, number | string>;
|
|
477
|
-
transition: Record<Transition, string>;
|
|
478
|
-
border: {
|
|
479
|
-
radius: Record<BorderRadius, number | string>;
|
|
480
|
-
width: Record<BorderWidth, number | string>;
|
|
481
|
-
};
|
|
482
|
-
shadow: Record<BoxShadow, string>;
|
|
483
|
-
focus: {
|
|
484
|
-
boxShadow: string;
|
|
485
|
-
};
|
|
486
|
-
color: Record<Color, string>;
|
|
594
|
+
type DialogProps = {
|
|
595
|
+
children?: ReactNode;
|
|
596
|
+
open: boolean;
|
|
597
|
+
onRequestClose: () => void;
|
|
598
|
+
className?: string;
|
|
487
599
|
};
|
|
600
|
+
declare const Dialog: FC<DialogProps>;
|
|
488
601
|
|
|
489
|
-
|
|
490
|
-
name: string;
|
|
491
|
-
tokens: BlocksTokens;
|
|
492
|
-
components: ComponentThemesMap;
|
|
493
|
-
};
|
|
494
|
-
declare const makeTheme: (theme: Theme) => {
|
|
495
|
-
vars: string;
|
|
496
|
-
components: ComponentThemesMap;
|
|
497
|
-
};
|
|
602
|
+
declare function useComponentStyles<T extends keyof ComponentThemeProps>(name: T, props: ComponentThemeProps[T]): string;
|
|
498
603
|
|
|
499
|
-
declare const
|
|
500
|
-
space: {
|
|
501
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
502
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
503
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
504
|
-
none: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
505
|
-
gutter: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
506
|
-
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
507
|
-
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
508
|
-
};
|
|
509
|
-
borderRadius: {
|
|
510
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
511
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
512
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
513
|
-
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
514
|
-
};
|
|
515
|
-
color: {
|
|
516
|
-
link: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
517
|
-
danger: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
518
|
-
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
519
|
-
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
520
|
-
white: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
521
|
-
black: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
522
|
-
body: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
523
|
-
primaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
524
|
-
primaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
525
|
-
secondaryLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
526
|
-
secondaryDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
527
|
-
text: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
528
|
-
textLight: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
529
|
-
textDark: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
530
|
-
};
|
|
531
|
-
borderWidth: {
|
|
532
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
533
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
534
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
535
|
-
};
|
|
536
|
-
fontFamily: {
|
|
537
|
-
primary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
538
|
-
secondary: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
539
|
-
};
|
|
540
|
-
fontSize: {
|
|
541
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
542
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
543
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
544
|
-
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
545
|
-
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
546
|
-
};
|
|
547
|
-
fontWeight: {
|
|
548
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
549
|
-
regular: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
550
|
-
strong: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
551
|
-
};
|
|
552
|
-
lineHeight: {
|
|
553
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
554
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
555
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
556
|
-
xsmall: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
557
|
-
xlarge: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
558
|
-
};
|
|
559
|
-
transition: {
|
|
560
|
-
slow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
561
|
-
normal: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
562
|
-
fast: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
563
|
-
};
|
|
564
|
-
shadow: {
|
|
565
|
-
small: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
566
|
-
medium: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
567
|
-
large: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
568
|
-
};
|
|
569
|
-
focus: {
|
|
570
|
-
boxShadow: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
|
|
571
|
-
};
|
|
572
|
-
};
|
|
604
|
+
declare const useComponentStyleDefaultProps: <T extends "button" | "link" | "spinner" | "divider" | "dialog">(name: T) => ComponentThemeProps[T];
|
|
573
605
|
|
|
574
606
|
type Args = null | undefined | boolean | string;
|
|
575
607
|
declare const classnames: (...args: Args[]) => string | undefined;
|
|
@@ -579,4 +611,4 @@ declare const momotaro: {
|
|
|
579
611
|
components: ComponentThemesMap;
|
|
580
612
|
};
|
|
581
613
|
|
|
582
|
-
export { BlocksProvider, BlocksProviderProps, BlocksTokens, Box, BoxProps, Button, ButtonProps, ComponentThemesMap, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, vars };
|
|
614
|
+
export { BlocksProvider, BlocksProviderProps, BlocksTokens, Box, BoxProps, Button, ButtonProps, ComponentThemesMap, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
|
|
@@ -0,0 +1,83 @@
|
|
|
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/Dialog/dialog.css.ts?used", "blocks");
|
|
6
|
+
const backdropEnterAnimation = css.keyframes({
|
|
7
|
+
"0%": {
|
|
8
|
+
opacity: 0
|
|
9
|
+
},
|
|
10
|
+
"100%": {
|
|
11
|
+
opacity: 1
|
|
12
|
+
}
|
|
13
|
+
}, "backdropEnterAnimation");
|
|
14
|
+
const backdropLeaveAnimation = css.keyframes({
|
|
15
|
+
"0%": {
|
|
16
|
+
opacity: 1
|
|
17
|
+
},
|
|
18
|
+
"100%": {
|
|
19
|
+
opacity: 0
|
|
20
|
+
}
|
|
21
|
+
}, "backdropLeaveAnimation");
|
|
22
|
+
const dialogEnterAnimation = css.keyframes({
|
|
23
|
+
"0%": {
|
|
24
|
+
transform: "translateY(-34px)"
|
|
25
|
+
},
|
|
26
|
+
"100%": {
|
|
27
|
+
transform: "translateY(0)"
|
|
28
|
+
}
|
|
29
|
+
}, "dialogEnterAnimation");
|
|
30
|
+
const dialogLeaveAnimation = css.keyframes({
|
|
31
|
+
"0%": {
|
|
32
|
+
transform: "translateY(0)"
|
|
33
|
+
},
|
|
34
|
+
"100%": {
|
|
35
|
+
transform: "translateY(-34px)"
|
|
36
|
+
}
|
|
37
|
+
}, "dialogLeaveAnimation");
|
|
38
|
+
const backdrop = css.style({
|
|
39
|
+
"@layer": {
|
|
40
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
41
|
+
contain: "layout",
|
|
42
|
+
position: "fixed",
|
|
43
|
+
width: "100%",
|
|
44
|
+
height: "100%",
|
|
45
|
+
left: 0,
|
|
46
|
+
top: 0,
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
opacity: "0",
|
|
49
|
+
animationName: backdropEnterAnimation,
|
|
50
|
+
animationDuration: "100ms",
|
|
51
|
+
animationFillMode: "both"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, "backdrop");
|
|
55
|
+
const backdropLeave = css.style({
|
|
56
|
+
"@layer": {
|
|
57
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
58
|
+
animationName: backdropLeaveAnimation
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, "backdropLeave");
|
|
62
|
+
const dialog = css.style({
|
|
63
|
+
"@layer": {
|
|
64
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
65
|
+
animationName: dialogEnterAnimation,
|
|
66
|
+
animationDuration: "160ms",
|
|
67
|
+
animationFillMode: "both"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, "dialog");
|
|
71
|
+
const dialogLeave = css.style({
|
|
72
|
+
"@layer": {
|
|
73
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
74
|
+
animationName: dialogLeaveAnimation
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}, "dialogLeave");
|
|
78
|
+
fileScope.endFileScope();
|
|
79
|
+
exports.backdrop = backdrop;
|
|
80
|
+
exports.backdropLeave = backdropLeave;
|
|
81
|
+
exports.backdropLeaveAnimation = backdropLeaveAnimation;
|
|
82
|
+
exports.dialog = dialog;
|
|
83
|
+
exports.dialogLeave = dialogLeave;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { keyframes, style } from "@vanilla-extract/css";
|
|
3
|
+
import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
|
|
4
|
+
setFileScope("src/components/Dialog/dialog.css.ts?used", "blocks");
|
|
5
|
+
const backdropEnterAnimation = keyframes({
|
|
6
|
+
"0%": {
|
|
7
|
+
opacity: 0
|
|
8
|
+
},
|
|
9
|
+
"100%": {
|
|
10
|
+
opacity: 1
|
|
11
|
+
}
|
|
12
|
+
}, "backdropEnterAnimation");
|
|
13
|
+
const backdropLeaveAnimation = keyframes({
|
|
14
|
+
"0%": {
|
|
15
|
+
opacity: 1
|
|
16
|
+
},
|
|
17
|
+
"100%": {
|
|
18
|
+
opacity: 0
|
|
19
|
+
}
|
|
20
|
+
}, "backdropLeaveAnimation");
|
|
21
|
+
const dialogEnterAnimation = keyframes({
|
|
22
|
+
"0%": {
|
|
23
|
+
transform: "translateY(-34px)"
|
|
24
|
+
},
|
|
25
|
+
"100%": {
|
|
26
|
+
transform: "translateY(0)"
|
|
27
|
+
}
|
|
28
|
+
}, "dialogEnterAnimation");
|
|
29
|
+
const dialogLeaveAnimation = keyframes({
|
|
30
|
+
"0%": {
|
|
31
|
+
transform: "translateY(0)"
|
|
32
|
+
},
|
|
33
|
+
"100%": {
|
|
34
|
+
transform: "translateY(-34px)"
|
|
35
|
+
}
|
|
36
|
+
}, "dialogLeaveAnimation");
|
|
37
|
+
const backdrop = style({
|
|
38
|
+
"@layer": {
|
|
39
|
+
[blocksLayer]: {
|
|
40
|
+
contain: "layout",
|
|
41
|
+
position: "fixed",
|
|
42
|
+
width: "100%",
|
|
43
|
+
height: "100%",
|
|
44
|
+
left: 0,
|
|
45
|
+
top: 0,
|
|
46
|
+
overflow: "hidden",
|
|
47
|
+
opacity: "0",
|
|
48
|
+
animationName: backdropEnterAnimation,
|
|
49
|
+
animationDuration: "100ms",
|
|
50
|
+
animationFillMode: "both"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, "backdrop");
|
|
54
|
+
const backdropLeave = style({
|
|
55
|
+
"@layer": {
|
|
56
|
+
[blocksLayer]: {
|
|
57
|
+
animationName: backdropLeaveAnimation
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, "backdropLeave");
|
|
61
|
+
const dialog = style({
|
|
62
|
+
"@layer": {
|
|
63
|
+
[blocksLayer]: {
|
|
64
|
+
animationName: dialogEnterAnimation,
|
|
65
|
+
animationDuration: "160ms",
|
|
66
|
+
animationFillMode: "both"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, "dialog");
|
|
70
|
+
const dialogLeave = style({
|
|
71
|
+
"@layer": {
|
|
72
|
+
[blocksLayer]: {
|
|
73
|
+
animationName: dialogLeaveAnimation
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, "dialogLeave");
|
|
77
|
+
endFileScope();
|
|
78
|
+
export {
|
|
79
|
+
backdrop,
|
|
80
|
+
backdropLeave,
|
|
81
|
+
backdropLeaveAnimation,
|
|
82
|
+
dialog,
|
|
83
|
+
dialogLeave
|
|
84
|
+
};
|
|
@@ -5,6 +5,7 @@ const unresponsiveProperties = {
|
|
|
5
5
|
backgroundColor: colorWithCurrentColor,
|
|
6
6
|
borderColor: colorWithCurrentColor,
|
|
7
7
|
borderRadius: styles_lib_css_theme_vars_css_cjs.vars.borderRadius,
|
|
8
|
+
border: ["none"],
|
|
8
9
|
bottom: [0],
|
|
9
10
|
boxShadow: styles_lib_css_theme_vars_css_cjs.vars.shadow,
|
|
10
11
|
color: colorWithCurrentColor,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const styles_lib_css_theme_makeComponentTheme_cjs = require("../../../lib/css/theme/makeComponentTheme.cjs");
|
|
5
|
+
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
6
|
+
fileScope.setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
|
|
7
|
+
const dialog = styles_lib_css_theme_makeComponentTheme_cjs.makeComponentTheme({
|
|
8
|
+
type: "dialog",
|
|
9
|
+
base: css.style([styles_lib_css_atoms_sprinkles_css_cjs.atoms({
|
|
10
|
+
display: "flex",
|
|
11
|
+
flexDirection: "column",
|
|
12
|
+
padding: "gutter",
|
|
13
|
+
border: "none",
|
|
14
|
+
overflow: "auto"
|
|
15
|
+
}), {
|
|
16
|
+
minWidth: "300px"
|
|
17
|
+
}], "dialog_base"),
|
|
18
|
+
variants: {
|
|
19
|
+
backdrop: css.style({
|
|
20
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
21
|
+
}, "dialog_variants_backdrop")
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
fileScope.endFileScope();
|
|
25
|
+
exports.dialog = dialog;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
3
|
+
import { makeComponentTheme } from "../../../lib/css/theme/makeComponentTheme.mjs";
|
|
4
|
+
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
5
|
+
setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
|
|
6
|
+
const dialog = makeComponentTheme({
|
|
7
|
+
type: "dialog",
|
|
8
|
+
base: style([atoms({
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
padding: "gutter",
|
|
12
|
+
border: "none",
|
|
13
|
+
overflow: "auto"
|
|
14
|
+
}), {
|
|
15
|
+
minWidth: "300px"
|
|
16
|
+
}], "dialog_base"),
|
|
17
|
+
variants: {
|
|
18
|
+
backdrop: style({
|
|
19
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
20
|
+
}, "dialog_variants_backdrop")
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
endFileScope();
|
|
24
|
+
export {
|
|
25
|
+
dialog
|
|
26
|
+
};
|
|
@@ -3,10 +3,12 @@ const styles_themes_momotaro_components_button_css_cjs = require("./button.css.c
|
|
|
3
3
|
const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs");
|
|
4
4
|
const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
|
|
5
5
|
const styles_themes_momotaro_components_divider_css_cjs = require("./divider.css.cjs");
|
|
6
|
+
const styles_themes_momotaro_components_dialog_css_cjs = require("./dialog.css.cjs");
|
|
6
7
|
const components = {
|
|
7
8
|
button: styles_themes_momotaro_components_button_css_cjs.button,
|
|
8
9
|
link: styles_themes_momotaro_components_link_css_cjs.link,
|
|
9
10
|
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
|
|
10
|
-
divider: styles_themes_momotaro_components_divider_css_cjs.divider
|
|
11
|
+
divider: styles_themes_momotaro_components_divider_css_cjs.divider,
|
|
12
|
+
dialog: styles_themes_momotaro_components_dialog_css_cjs.dialog
|
|
11
13
|
};
|
|
12
14
|
exports.components = components;
|
|
@@ -2,11 +2,13 @@ import { button } from "./button.css.mjs";
|
|
|
2
2
|
import { link } from "./link.css.mjs";
|
|
3
3
|
import { spinner } from "./spinner.css.mjs";
|
|
4
4
|
import { divider } from "./divider.css.mjs";
|
|
5
|
+
import { dialog } from "./dialog.css.mjs";
|
|
5
6
|
const components = {
|
|
6
7
|
button,
|
|
7
8
|
link,
|
|
8
9
|
spinner,
|
|
9
|
-
divider
|
|
10
|
+
divider,
|
|
11
|
+
dialog
|
|
10
12
|
};
|
|
11
13
|
export {
|
|
12
14
|
components
|