@blockle/blocks 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +105 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +107 -30
- package/dist/momotaro.chunk.d.ts +38 -4
- package/dist/styles/components/Dialog/dialog.css.cjs +3 -64
- package/dist/styles/components/Dialog/dialog.css.mjs +5 -66
- package/dist/styles/components/Input/input.css.cjs +6 -1
- package/dist/styles/components/Input/input.css.mjs +6 -1
- package/dist/styles/themes/momotaro/components/dialog.css.cjs +28 -4
- package/dist/styles/themes/momotaro/components/dialog.css.mjs +28 -4
- package/dist/styles/themes/momotaro/components/index.cjs +7 -5
- package/dist/styles/themes/momotaro/components/index.mjs +7 -5
- package/dist/styles/themes/momotaro/components/input.css.cjs +1 -2
- package/dist/styles/themes/momotaro/components/input.css.mjs +1 -2
- package/dist/styles/themes/momotaro/components/progress.css.cjs +45 -0
- package/dist/styles/themes/momotaro/components/progress.css.mjs +46 -0
- package/package.json +19 -19
package/dist/index.cjs
CHANGED
|
@@ -352,6 +352,23 @@ const useFocusLock = ({ ref, active }) => {
|
|
|
352
352
|
};
|
|
353
353
|
}, [active]);
|
|
354
354
|
};
|
|
355
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
356
|
+
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
357
|
+
react.useEffect(() => {
|
|
358
|
+
if (!enabled) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
function handleKeyDown(event) {
|
|
362
|
+
if (event.key === key) {
|
|
363
|
+
callback();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
document.addEventListener(type, handleKeyDown);
|
|
367
|
+
return () => {
|
|
368
|
+
document.removeEventListener(type, handleKeyDown);
|
|
369
|
+
};
|
|
370
|
+
}, [callback, enabled, key, type]);
|
|
371
|
+
};
|
|
355
372
|
const useLayer = () => {
|
|
356
373
|
const layerRef = react.useRef();
|
|
357
374
|
react.useEffect(
|
|
@@ -372,7 +389,6 @@ const useLayer = () => {
|
|
|
372
389
|
return layerRef.current;
|
|
373
390
|
};
|
|
374
391
|
};
|
|
375
|
-
const useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
376
392
|
const usePreventBodyScroll = (enabled = true) => {
|
|
377
393
|
useIsomorphicLayoutEffect(() => {
|
|
378
394
|
if (!enabled) {
|
|
@@ -394,6 +410,7 @@ const usePreventBodyScroll = (enabled = true) => {
|
|
|
394
410
|
document.body.style.overflow = prevOverflow;
|
|
395
411
|
document.body.style.overflowY = "";
|
|
396
412
|
document.body.style.width = "";
|
|
413
|
+
document.body.style.top = "";
|
|
397
414
|
document.documentElement.scrollTop = prevScrollTop;
|
|
398
415
|
};
|
|
399
416
|
}, [enabled]);
|
|
@@ -423,6 +440,13 @@ const useVisibilityState = (open) => {
|
|
|
423
440
|
}, [open]);
|
|
424
441
|
return [visible, hide];
|
|
425
442
|
};
|
|
443
|
+
function hasAnimationDuration(element) {
|
|
444
|
+
if (!element) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
const style = window.getComputedStyle(element);
|
|
448
|
+
return style.transitionDuration !== "0s" || style.animationDuration !== "0s";
|
|
449
|
+
}
|
|
426
450
|
const Portal = ({ children, container }) => {
|
|
427
451
|
const context = useTheme();
|
|
428
452
|
return reactDom.createPortal(
|
|
@@ -452,6 +476,9 @@ const Dialog = ({
|
|
|
452
476
|
size,
|
|
453
477
|
...restProps
|
|
454
478
|
}) => {
|
|
479
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
480
|
+
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
481
|
+
const backdropRef = react.useRef(null);
|
|
455
482
|
const dialogRef = react.useRef(null);
|
|
456
483
|
const layer = useLayer();
|
|
457
484
|
const [visible, hide] = useVisibilityState(open);
|
|
@@ -464,55 +491,63 @@ const Dialog = ({
|
|
|
464
491
|
},
|
|
465
492
|
[onRequestClose]
|
|
466
493
|
);
|
|
467
|
-
const onAnimationEnd = react.useCallback((event) => {
|
|
468
|
-
if (event.animationName === styles_components_Dialog_dialog_css_cjs.backdropLeaveAnimation) {
|
|
469
|
-
event.stopPropagation();
|
|
470
|
-
hide();
|
|
471
|
-
}
|
|
472
|
-
}, []);
|
|
473
494
|
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
474
495
|
useRestoreFocus(open);
|
|
475
496
|
const isNested = useNestedDialog(visible);
|
|
476
497
|
usePreventBodyScroll(visible && !isNested);
|
|
477
|
-
|
|
478
|
-
|
|
498
|
+
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
499
|
+
useIsomorphicLayoutEffect(() => {
|
|
500
|
+
var _a, _b;
|
|
501
|
+
if (!open) {
|
|
502
|
+
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
503
|
+
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
479
504
|
return;
|
|
480
505
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
506
|
+
let timer = requestAnimationFrame(() => {
|
|
507
|
+
timer = requestAnimationFrame(() => {
|
|
508
|
+
var _a2, _b2;
|
|
509
|
+
(_a2 = backdropRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
|
|
510
|
+
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
511
|
+
});
|
|
512
|
+
});
|
|
487
513
|
return () => {
|
|
488
|
-
|
|
514
|
+
cancelAnimationFrame(timer);
|
|
489
515
|
};
|
|
490
|
-
}, [open,
|
|
491
|
-
const
|
|
492
|
-
|
|
516
|
+
}, [open, visible]);
|
|
517
|
+
const onAnimationEnd = react.useCallback(() => {
|
|
518
|
+
if (!open) {
|
|
519
|
+
hide();
|
|
520
|
+
}
|
|
521
|
+
}, [hide, open]);
|
|
522
|
+
react.useEffect(() => {
|
|
523
|
+
if (open) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
if (!hasAnimationDuration(dialogRef.current)) {
|
|
527
|
+
hide();
|
|
528
|
+
}
|
|
529
|
+
}, [open]);
|
|
493
530
|
if (!visible) {
|
|
494
531
|
return null;
|
|
495
532
|
}
|
|
533
|
+
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
496
534
|
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
497
535
|
Box,
|
|
498
536
|
{
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
537
|
+
ref: backdropRef,
|
|
538
|
+
className: classnames(styles_components_Dialog_dialog_css_cjs.backdrop, backdropClassName),
|
|
539
|
+
"data-open": dataOpen,
|
|
502
540
|
onClick: onBackdropClick,
|
|
503
541
|
onAnimationEnd,
|
|
542
|
+
onTransitionEnd: onAnimationEnd,
|
|
504
543
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
505
544
|
"dialog",
|
|
506
545
|
{
|
|
507
546
|
ref: dialogRef,
|
|
508
547
|
"aria-modal": "true",
|
|
509
548
|
open: true,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
!open && styles_components_Dialog_dialog_css_cjs.dialogLeave,
|
|
513
|
-
dialogClassName,
|
|
514
|
-
className
|
|
515
|
-
),
|
|
549
|
+
"data-open": dataOpen,
|
|
550
|
+
className: classnames(dialogClassName, className),
|
|
516
551
|
...restProps,
|
|
517
552
|
children
|
|
518
553
|
}
|
|
@@ -618,6 +653,44 @@ const Link = react.forwardRef(function Link2({ asChild, className, children, var
|
|
|
618
653
|
}
|
|
619
654
|
);
|
|
620
655
|
});
|
|
656
|
+
const Progress = react.forwardRef(function Progress2({ value, max = 100, className, ...restProps }, ref) {
|
|
657
|
+
const containerClassName = useComponentStyles(
|
|
658
|
+
"progress",
|
|
659
|
+
{
|
|
660
|
+
container: true
|
|
661
|
+
},
|
|
662
|
+
false
|
|
663
|
+
);
|
|
664
|
+
const barClassName = useComponentStyles(
|
|
665
|
+
"progress",
|
|
666
|
+
{ bar: true, variants: { indeterminate: value === void 0 } },
|
|
667
|
+
false
|
|
668
|
+
);
|
|
669
|
+
const progress = value === void 0 ? 0 : value / max * 100;
|
|
670
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
671
|
+
Box,
|
|
672
|
+
{
|
|
673
|
+
ref,
|
|
674
|
+
className: classnames(containerClassName, className),
|
|
675
|
+
overflow: "hidden",
|
|
676
|
+
role: "progressbar",
|
|
677
|
+
"aria-valuenow": value,
|
|
678
|
+
"aria-valuemin": 0,
|
|
679
|
+
"aria-valuemax": max,
|
|
680
|
+
...restProps,
|
|
681
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
682
|
+
Box,
|
|
683
|
+
{
|
|
684
|
+
className: classnames(barClassName),
|
|
685
|
+
backgroundColor: "currentColor",
|
|
686
|
+
width: "full",
|
|
687
|
+
height: "full",
|
|
688
|
+
style: { transform: value === void 0 ? void 0 : `translateX(-${100 - progress}%)` }
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
});
|
|
621
694
|
const Radio = react.forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
|
|
622
695
|
const containerClassName = useComponentStyles("radio", { base: true }, false);
|
|
623
696
|
const iconClassName = useComponentStyles("radio", { icon: true }, false);
|
|
@@ -678,6 +751,7 @@ exports.Input = Input;
|
|
|
678
751
|
exports.Label = Label;
|
|
679
752
|
exports.Link = Link;
|
|
680
753
|
exports.Portal = Portal;
|
|
754
|
+
exports.Progress = Progress;
|
|
681
755
|
exports.Radio = Radio;
|
|
682
756
|
exports.Slot = Slot;
|
|
683
757
|
exports.Spinner = Spinner;
|
|
@@ -687,3 +761,6 @@ exports.classnames = classnames;
|
|
|
687
761
|
exports.createSlottable = createSlottable;
|
|
688
762
|
exports.useComponentStyleDefaultProps = useComponentStyleDefaultProps;
|
|
689
763
|
exports.useComponentStyles = useComponentStyles;
|
|
764
|
+
exports.useIsomorphicLayoutEffect = useIsomorphicLayoutEffect;
|
|
765
|
+
exports.useKeyboard = useKeyboard;
|
|
766
|
+
exports.usePreventBodyScroll = usePreventBodyScroll;
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Radio, RadioProps, Slot, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, vars } from './momotaro.chunk.js';
|
|
1
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Slot, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars } from './momotaro.chunk.js';
|
package/dist/index.mjs
CHANGED
|
@@ -6,10 +6,10 @@ import { makeTheme } from "./styles/lib/theme/makeTheme.mjs";
|
|
|
6
6
|
import { vars } from "./styles/lib/theme/vars.css.mjs";
|
|
7
7
|
import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { createContext, forwardRef, Children, isValidElement, cloneElement, useContext, useEffect,
|
|
9
|
+
import { createContext, forwardRef, Children, isValidElement, cloneElement, useContext, useEffect, useLayoutEffect, useRef, useState, useCallback, useId } from "react";
|
|
10
10
|
import { buttonReset } from "./styles/components/Button/Button.css.mjs";
|
|
11
11
|
import { container, input, icon } from "./styles/components/Checkbox/checkbox.css.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import { backdrop } from "./styles/components/Dialog/dialog.css.mjs";
|
|
13
13
|
import { createPortal } from "react-dom";
|
|
14
14
|
import { divider } from "./styles/components/Divider/divider.css.mjs";
|
|
15
15
|
import { heading } from "./styles/components/Heading/heading.css.mjs";
|
|
@@ -352,6 +352,23 @@ const useFocusLock = ({ ref, active }) => {
|
|
|
352
352
|
};
|
|
353
353
|
}, [active]);
|
|
354
354
|
};
|
|
355
|
+
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
356
|
+
const useKeyboard = (key, callback, { enabled = true, type = "keydown" } = {}) => {
|
|
357
|
+
useEffect(() => {
|
|
358
|
+
if (!enabled) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
function handleKeyDown(event) {
|
|
362
|
+
if (event.key === key) {
|
|
363
|
+
callback();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
document.addEventListener(type, handleKeyDown);
|
|
367
|
+
return () => {
|
|
368
|
+
document.removeEventListener(type, handleKeyDown);
|
|
369
|
+
};
|
|
370
|
+
}, [callback, enabled, key, type]);
|
|
371
|
+
};
|
|
355
372
|
const useLayer = () => {
|
|
356
373
|
const layerRef = useRef();
|
|
357
374
|
useEffect(
|
|
@@ -372,7 +389,6 @@ const useLayer = () => {
|
|
|
372
389
|
return layerRef.current;
|
|
373
390
|
};
|
|
374
391
|
};
|
|
375
|
-
const useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
376
392
|
const usePreventBodyScroll = (enabled = true) => {
|
|
377
393
|
useIsomorphicLayoutEffect(() => {
|
|
378
394
|
if (!enabled) {
|
|
@@ -394,6 +410,7 @@ const usePreventBodyScroll = (enabled = true) => {
|
|
|
394
410
|
document.body.style.overflow = prevOverflow;
|
|
395
411
|
document.body.style.overflowY = "";
|
|
396
412
|
document.body.style.width = "";
|
|
413
|
+
document.body.style.top = "";
|
|
397
414
|
document.documentElement.scrollTop = prevScrollTop;
|
|
398
415
|
};
|
|
399
416
|
}, [enabled]);
|
|
@@ -423,6 +440,13 @@ const useVisibilityState = (open) => {
|
|
|
423
440
|
}, [open]);
|
|
424
441
|
return [visible, hide];
|
|
425
442
|
};
|
|
443
|
+
function hasAnimationDuration(element) {
|
|
444
|
+
if (!element) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
const style = window.getComputedStyle(element);
|
|
448
|
+
return style.transitionDuration !== "0s" || style.animationDuration !== "0s";
|
|
449
|
+
}
|
|
426
450
|
const Portal = ({ children, container: container2 }) => {
|
|
427
451
|
const context = useTheme();
|
|
428
452
|
return createPortal(
|
|
@@ -452,6 +476,9 @@ const Dialog = ({
|
|
|
452
476
|
size,
|
|
453
477
|
...restProps
|
|
454
478
|
}) => {
|
|
479
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
480
|
+
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
481
|
+
const backdropRef = useRef(null);
|
|
455
482
|
const dialogRef = useRef(null);
|
|
456
483
|
const layer = useLayer();
|
|
457
484
|
const [visible, hide] = useVisibilityState(open);
|
|
@@ -464,55 +491,63 @@ const Dialog = ({
|
|
|
464
491
|
},
|
|
465
492
|
[onRequestClose]
|
|
466
493
|
);
|
|
467
|
-
const onAnimationEnd = useCallback((event) => {
|
|
468
|
-
if (event.animationName === backdropLeaveAnimation) {
|
|
469
|
-
event.stopPropagation();
|
|
470
|
-
hide();
|
|
471
|
-
}
|
|
472
|
-
}, []);
|
|
473
494
|
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
474
495
|
useRestoreFocus(open);
|
|
475
496
|
const isNested = useNestedDialog(visible);
|
|
476
497
|
usePreventBodyScroll(visible && !isNested);
|
|
477
|
-
|
|
478
|
-
|
|
498
|
+
useKeyboard("Escape", onRequestClose, { enabled: open && enabled });
|
|
499
|
+
useIsomorphicLayoutEffect(() => {
|
|
500
|
+
var _a, _b;
|
|
501
|
+
if (!open) {
|
|
502
|
+
(_a = backdropRef.current) == null ? void 0 : _a.removeAttribute("data-open");
|
|
503
|
+
(_b = dialogRef.current) == null ? void 0 : _b.removeAttribute("data-open");
|
|
479
504
|
return;
|
|
480
505
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
506
|
+
let timer = requestAnimationFrame(() => {
|
|
507
|
+
timer = requestAnimationFrame(() => {
|
|
508
|
+
var _a2, _b2;
|
|
509
|
+
(_a2 = backdropRef.current) == null ? void 0 : _a2.setAttribute("data-open", "");
|
|
510
|
+
(_b2 = dialogRef.current) == null ? void 0 : _b2.setAttribute("data-open", "");
|
|
511
|
+
});
|
|
512
|
+
});
|
|
487
513
|
return () => {
|
|
488
|
-
|
|
514
|
+
cancelAnimationFrame(timer);
|
|
489
515
|
};
|
|
490
|
-
}, [open,
|
|
491
|
-
const
|
|
492
|
-
|
|
516
|
+
}, [open, visible]);
|
|
517
|
+
const onAnimationEnd = useCallback(() => {
|
|
518
|
+
if (!open) {
|
|
519
|
+
hide();
|
|
520
|
+
}
|
|
521
|
+
}, [hide, open]);
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
if (open) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
if (!hasAnimationDuration(dialogRef.current)) {
|
|
527
|
+
hide();
|
|
528
|
+
}
|
|
529
|
+
}, [open]);
|
|
493
530
|
if (!visible) {
|
|
494
531
|
return null;
|
|
495
532
|
}
|
|
533
|
+
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
496
534
|
return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsx(
|
|
497
535
|
Box,
|
|
498
536
|
{
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
537
|
+
ref: backdropRef,
|
|
538
|
+
className: classnames(backdrop, backdropClassName),
|
|
539
|
+
"data-open": dataOpen,
|
|
502
540
|
onClick: onBackdropClick,
|
|
503
541
|
onAnimationEnd,
|
|
542
|
+
onTransitionEnd: onAnimationEnd,
|
|
504
543
|
children: /* @__PURE__ */ jsx(
|
|
505
544
|
"dialog",
|
|
506
545
|
{
|
|
507
546
|
ref: dialogRef,
|
|
508
547
|
"aria-modal": "true",
|
|
509
548
|
open: true,
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
!open && dialogLeave,
|
|
513
|
-
dialogClassName,
|
|
514
|
-
className
|
|
515
|
-
),
|
|
549
|
+
"data-open": dataOpen,
|
|
550
|
+
className: classnames(dialogClassName, className),
|
|
516
551
|
...restProps,
|
|
517
552
|
children
|
|
518
553
|
}
|
|
@@ -618,6 +653,44 @@ const Link = forwardRef(function Link2({ asChild, className, children, variant,
|
|
|
618
653
|
}
|
|
619
654
|
);
|
|
620
655
|
});
|
|
656
|
+
const Progress = forwardRef(function Progress2({ value, max = 100, className, ...restProps }, ref) {
|
|
657
|
+
const containerClassName = useComponentStyles(
|
|
658
|
+
"progress",
|
|
659
|
+
{
|
|
660
|
+
container: true
|
|
661
|
+
},
|
|
662
|
+
false
|
|
663
|
+
);
|
|
664
|
+
const barClassName = useComponentStyles(
|
|
665
|
+
"progress",
|
|
666
|
+
{ bar: true, variants: { indeterminate: value === void 0 } },
|
|
667
|
+
false
|
|
668
|
+
);
|
|
669
|
+
const progress = value === void 0 ? 0 : value / max * 100;
|
|
670
|
+
return /* @__PURE__ */ jsx(
|
|
671
|
+
Box,
|
|
672
|
+
{
|
|
673
|
+
ref,
|
|
674
|
+
className: classnames(containerClassName, className),
|
|
675
|
+
overflow: "hidden",
|
|
676
|
+
role: "progressbar",
|
|
677
|
+
"aria-valuenow": value,
|
|
678
|
+
"aria-valuemin": 0,
|
|
679
|
+
"aria-valuemax": max,
|
|
680
|
+
...restProps,
|
|
681
|
+
children: /* @__PURE__ */ jsx(
|
|
682
|
+
Box,
|
|
683
|
+
{
|
|
684
|
+
className: classnames(barClassName),
|
|
685
|
+
backgroundColor: "currentColor",
|
|
686
|
+
width: "full",
|
|
687
|
+
height: "full",
|
|
688
|
+
style: { transform: value === void 0 ? void 0 : `translateX(-${100 - progress}%)` }
|
|
689
|
+
}
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
});
|
|
621
694
|
const Radio = forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
|
|
622
695
|
const containerClassName = useComponentStyles("radio", { base: true }, false);
|
|
623
696
|
const iconClassName = useComponentStyles("radio", { icon: true }, false);
|
|
@@ -674,6 +747,7 @@ export {
|
|
|
674
747
|
Label,
|
|
675
748
|
Link,
|
|
676
749
|
Portal,
|
|
750
|
+
Progress,
|
|
677
751
|
Radio,
|
|
678
752
|
Slot,
|
|
679
753
|
Spinner,
|
|
@@ -687,5 +761,8 @@ export {
|
|
|
687
761
|
makeTheme,
|
|
688
762
|
useComponentStyleDefaultProps,
|
|
689
763
|
useComponentStyles,
|
|
764
|
+
useIsomorphicLayoutEffect,
|
|
765
|
+
useKeyboard,
|
|
766
|
+
usePreventBodyScroll,
|
|
690
767
|
vars
|
|
691
768
|
};
|
package/dist/momotaro.chunk.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
3
|
+
import react__default, { useEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
declare const atoms: ((props: {
|
|
6
6
|
readonly backgroundColor?: "link" | "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "currentColor" | undefined;
|
|
@@ -316,8 +316,8 @@ type DividerTheme = {
|
|
|
316
316
|
};
|
|
317
317
|
};
|
|
318
318
|
type DialogTheme = {
|
|
319
|
-
base: string;
|
|
320
319
|
backdrop: string;
|
|
320
|
+
dialog: string;
|
|
321
321
|
variants: {
|
|
322
322
|
size: 'small' | 'medium' | 'large';
|
|
323
323
|
};
|
|
@@ -351,6 +351,13 @@ type LabelTheme = {
|
|
|
351
351
|
required: boolean;
|
|
352
352
|
};
|
|
353
353
|
};
|
|
354
|
+
type ProgressTheme = {
|
|
355
|
+
container: string;
|
|
356
|
+
bar: string;
|
|
357
|
+
variants: {
|
|
358
|
+
indeterminate: boolean;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
354
361
|
type ComponentThemes = {
|
|
355
362
|
button: ButtonTheme;
|
|
356
363
|
link: LinkTheme;
|
|
@@ -361,6 +368,7 @@ type ComponentThemes = {
|
|
|
361
368
|
checkbox: CheckboxTheme;
|
|
362
369
|
radio: RadioTheme;
|
|
363
370
|
label: LabelTheme;
|
|
371
|
+
progress: ProgressTheme;
|
|
364
372
|
};
|
|
365
373
|
/**
|
|
366
374
|
* ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
|
|
@@ -931,6 +939,19 @@ type PortalProps = {
|
|
|
931
939
|
};
|
|
932
940
|
declare const Portal: React.FC<PortalProps>;
|
|
933
941
|
|
|
942
|
+
type ProgressProps = {
|
|
943
|
+
/**
|
|
944
|
+
* The value of the progress bar, between 0 and 100.
|
|
945
|
+
* If undefined, the progress bar will be indeterminate.
|
|
946
|
+
*/
|
|
947
|
+
value?: number;
|
|
948
|
+
max?: number;
|
|
949
|
+
className?: string;
|
|
950
|
+
style?: React.CSSProperties;
|
|
951
|
+
'aria-labelledby'?: string;
|
|
952
|
+
};
|
|
953
|
+
declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLProgressElement>>;
|
|
954
|
+
|
|
934
955
|
type RadioProps = {
|
|
935
956
|
name: string;
|
|
936
957
|
value: string;
|
|
@@ -968,7 +989,7 @@ declare const Stack: React.FC<StackProps>;
|
|
|
968
989
|
|
|
969
990
|
type TextProps = {
|
|
970
991
|
children: React.ReactNode;
|
|
971
|
-
tag?: 'span' | 'p' | 'strong' | 'em' | 'small' | 's' | 'del' | 'ins' | 'sub' | 'sup';
|
|
992
|
+
tag?: 'span' | 'p' | 'strong' | 'em' | 'small' | 's' | 'del' | 'ins' | 'sub' | 'sup' | 'label';
|
|
972
993
|
asChild?: boolean;
|
|
973
994
|
} & TextAtoms & MarginAtoms & PaddingAtoms & HTMLElementProps<HTMLSpanElement>;
|
|
974
995
|
declare const Text: React.FC<TextProps>;
|
|
@@ -996,9 +1017,22 @@ type Components = {
|
|
|
996
1017
|
};
|
|
997
1018
|
declare const useComponentStyleDefaultProps: <T extends keyof ComponentThemes>(name: T) => Components[T];
|
|
998
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* useLayoutEffect is not avaible on server side use useEffect instead.
|
|
1022
|
+
*/
|
|
1023
|
+
declare const useIsomorphicLayoutEffect: typeof useEffect;
|
|
1024
|
+
|
|
1025
|
+
type UseKeyboardOptions = {
|
|
1026
|
+
enabled?: boolean;
|
|
1027
|
+
type?: 'keydown' | 'keyup';
|
|
1028
|
+
};
|
|
1029
|
+
declare const useKeyboard: (key: string, callback: () => void, { enabled, type }?: UseKeyboardOptions) => void;
|
|
1030
|
+
|
|
1031
|
+
declare const usePreventBodyScroll: (enabled?: boolean) => void;
|
|
1032
|
+
|
|
999
1033
|
type Args = null | undefined | boolean | string;
|
|
1000
1034
|
declare const classnames: (...args: Args[]) => string | undefined;
|
|
1001
1035
|
|
|
1002
1036
|
declare const momotaro: Theme;
|
|
1003
1037
|
|
|
1004
|
-
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Radio, RadioProps, Slot, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
|
|
1038
|
+
export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Label, LabelProps, Link, LinkProps, Portal, PortalProps, Progress, ProgressProps, Radio, RadioProps, Slot, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars };
|
|
@@ -3,81 +3,20 @@ 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/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
6
|
const backdrop = css.style({
|
|
39
7
|
"@layer": {
|
|
40
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
41
9
|
contain: "layout",
|
|
10
|
+
display: "flex",
|
|
11
|
+
placeItems: "center",
|
|
42
12
|
position: "fixed",
|
|
43
13
|
width: "100%",
|
|
44
14
|
height: "100%",
|
|
45
15
|
left: 0,
|
|
46
16
|
top: 0,
|
|
47
|
-
overflow: "hidden"
|
|
48
|
-
opacity: "0",
|
|
49
|
-
animationName: backdropEnterAnimation,
|
|
50
|
-
animationDuration: "100ms",
|
|
51
|
-
animationFillMode: "both"
|
|
17
|
+
overflow: "hidden"
|
|
52
18
|
}
|
|
53
19
|
}
|
|
54
20
|
}, "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
21
|
fileScope.endFileScope();
|
|
79
22
|
exports.backdrop = backdrop;
|
|
80
|
-
exports.backdropLeave = backdropLeave;
|
|
81
|
-
exports.backdropLeaveAnimation = backdropLeaveAnimation;
|
|
82
|
-
exports.dialog = dialog;
|
|
83
|
-
exports.dialogLeave = dialogLeave;
|
|
@@ -1,84 +1,23 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
-
import {
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
3
3
|
import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
|
|
4
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
5
|
const backdrop = style({
|
|
38
6
|
"@layer": {
|
|
39
7
|
[blocksLayer]: {
|
|
40
8
|
contain: "layout",
|
|
9
|
+
display: "flex",
|
|
10
|
+
placeItems: "center",
|
|
41
11
|
position: "fixed",
|
|
42
12
|
width: "100%",
|
|
43
13
|
height: "100%",
|
|
44
14
|
left: 0,
|
|
45
15
|
top: 0,
|
|
46
|
-
overflow: "hidden"
|
|
47
|
-
opacity: "0",
|
|
48
|
-
animationName: backdropEnterAnimation,
|
|
49
|
-
animationDuration: "100ms",
|
|
50
|
-
animationFillMode: "both"
|
|
16
|
+
overflow: "hidden"
|
|
51
17
|
}
|
|
52
18
|
}
|
|
53
19
|
}, "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
20
|
endFileScope();
|
|
78
21
|
export {
|
|
79
|
-
backdrop
|
|
80
|
-
backdropLeave,
|
|
81
|
-
backdropLeaveAnimation,
|
|
82
|
-
dialog,
|
|
83
|
-
dialogLeave
|
|
22
|
+
backdrop
|
|
84
23
|
};
|
|
@@ -6,7 +6,12 @@ fileScope.setFileScope("src/components/Input/input.css.ts?used", "blocks");
|
|
|
6
6
|
const input = css.style({
|
|
7
7
|
"@layer": {
|
|
8
8
|
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
|
-
appearance: "none"
|
|
9
|
+
appearance: "none",
|
|
10
|
+
selectors: {
|
|
11
|
+
"&:-webkit-autofill": {
|
|
12
|
+
transitionDelay: "9999s"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
}
|
|
12
17
|
}, "input");
|
|
@@ -5,7 +5,12 @@ setFileScope("src/components/Input/input.css.ts?used", "blocks");
|
|
|
5
5
|
const input = style({
|
|
6
6
|
"@layer": {
|
|
7
7
|
[blocksLayer]: {
|
|
8
|
-
appearance: "none"
|
|
8
|
+
appearance: "none",
|
|
9
|
+
selectors: {
|
|
10
|
+
"&:-webkit-autofill": {
|
|
11
|
+
transitionDelay: "9999s"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
9
14
|
}
|
|
10
15
|
}
|
|
11
16
|
}, "input");
|
|
@@ -5,7 +5,7 @@ const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/make
|
|
|
5
5
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
6
6
|
fileScope.setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
|
|
7
7
|
const dialog = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dialog", {
|
|
8
|
-
|
|
8
|
+
dialog: css.style([styles_lib_css_atoms_sprinkles_css_cjs.atoms({
|
|
9
9
|
display: "flex",
|
|
10
10
|
flexDirection: "column",
|
|
11
11
|
padding: "gutter",
|
|
@@ -14,10 +14,34 @@ const dialog = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("dialo
|
|
|
14
14
|
borderRadius: "medium",
|
|
15
15
|
boxShadow: "large"
|
|
16
16
|
}), {
|
|
17
|
-
minWidth: "300px"
|
|
18
|
-
|
|
17
|
+
minWidth: "300px",
|
|
18
|
+
selectors: {
|
|
19
|
+
"&[data-open]": {
|
|
20
|
+
transform: "scale(1)"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
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"),
|
|
19
31
|
backdrop: css.style({
|
|
20
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
32
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
33
|
+
selectors: {
|
|
34
|
+
"&[data-open]": {
|
|
35
|
+
opacity: 1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
// Apply the animation only if the user has not requested reduced motion
|
|
39
|
+
"@media": {
|
|
40
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
41
|
+
opacity: 0,
|
|
42
|
+
transition: "opacity 160ms"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
21
45
|
}, "dialog_backdrop"),
|
|
22
46
|
variants: {
|
|
23
47
|
size: {
|
|
@@ -4,7 +4,7 @@ import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
|
4
4
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
5
5
|
setFileScope("src/themes/momotaro/components/dialog.css.ts?used", "blocks");
|
|
6
6
|
const dialog = makeComponentTheme("dialog", {
|
|
7
|
-
|
|
7
|
+
dialog: style([atoms({
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: "column",
|
|
10
10
|
padding: "gutter",
|
|
@@ -13,10 +13,34 @@ const dialog = makeComponentTheme("dialog", {
|
|
|
13
13
|
borderRadius: "medium",
|
|
14
14
|
boxShadow: "large"
|
|
15
15
|
}), {
|
|
16
|
-
minWidth: "300px"
|
|
17
|
-
|
|
16
|
+
minWidth: "300px",
|
|
17
|
+
selectors: {
|
|
18
|
+
"&[data-open]": {
|
|
19
|
+
transform: "scale(1)"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
// Apply the animation only if the user has not requested reduced motion
|
|
23
|
+
"@media": {
|
|
24
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
25
|
+
transform: "scale(0.9)",
|
|
26
|
+
transition: "transform 160ms"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}], "dialog_dialog"),
|
|
18
30
|
backdrop: style({
|
|
19
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
31
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
32
|
+
selectors: {
|
|
33
|
+
"&[data-open]": {
|
|
34
|
+
opacity: 1
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// Apply the animation only if the user has not requested reduced motion
|
|
38
|
+
"@media": {
|
|
39
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
40
|
+
opacity: 0,
|
|
41
|
+
transition: "opacity 160ms"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
20
44
|
}, "dialog_backdrop"),
|
|
21
45
|
variants: {
|
|
22
46
|
size: {
|
|
@@ -6,17 +6,19 @@ const styles_themes_momotaro_components_divider_css_cjs = require("./divider.css
|
|
|
6
6
|
const styles_themes_momotaro_components_input_css_cjs = require("./input.css.cjs");
|
|
7
7
|
const styles_themes_momotaro_components_label_css_cjs = require("./label.css.cjs");
|
|
8
8
|
const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs");
|
|
9
|
+
const styles_themes_momotaro_components_progress_css_cjs = require("./progress.css.cjs");
|
|
9
10
|
const styles_themes_momotaro_components_radio_css_cjs = require("./radio.css.cjs");
|
|
10
11
|
const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
|
|
11
12
|
const components = {
|
|
12
13
|
button: styles_themes_momotaro_components_button_css_cjs.button,
|
|
13
|
-
|
|
14
|
-
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
|
|
15
|
-
divider: styles_themes_momotaro_components_divider_css_cjs.divider,
|
|
14
|
+
checkbox: styles_themes_momotaro_components_checkbox_css_cjs.checkbox,
|
|
16
15
|
dialog: styles_themes_momotaro_components_dialog_css_cjs.dialog,
|
|
16
|
+
divider: styles_themes_momotaro_components_divider_css_cjs.divider,
|
|
17
17
|
input: styles_themes_momotaro_components_input_css_cjs.input,
|
|
18
|
-
|
|
18
|
+
label: styles_themes_momotaro_components_label_css_cjs.label,
|
|
19
|
+
link: styles_themes_momotaro_components_link_css_cjs.link,
|
|
20
|
+
progress: styles_themes_momotaro_components_progress_css_cjs.progress,
|
|
19
21
|
radio: styles_themes_momotaro_components_radio_css_cjs.radio,
|
|
20
|
-
|
|
22
|
+
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner
|
|
21
23
|
};
|
|
22
24
|
exports.components = components;
|
|
@@ -5,18 +5,20 @@ import { divider } from "./divider.css.mjs";
|
|
|
5
5
|
import { input } from "./input.css.mjs";
|
|
6
6
|
import { label } from "./label.css.mjs";
|
|
7
7
|
import { link } from "./link.css.mjs";
|
|
8
|
+
import { progress } from "./progress.css.mjs";
|
|
8
9
|
import { radio } from "./radio.css.mjs";
|
|
9
10
|
import { spinner } from "./spinner.css.mjs";
|
|
10
11
|
const components = {
|
|
11
12
|
button,
|
|
12
|
-
|
|
13
|
-
spinner,
|
|
14
|
-
divider,
|
|
13
|
+
checkbox,
|
|
15
14
|
dialog,
|
|
15
|
+
divider,
|
|
16
16
|
input,
|
|
17
|
-
|
|
17
|
+
label,
|
|
18
|
+
link,
|
|
19
|
+
progress,
|
|
18
20
|
radio,
|
|
19
|
-
|
|
21
|
+
spinner
|
|
20
22
|
};
|
|
21
23
|
export {
|
|
22
24
|
components
|
|
@@ -32,8 +32,7 @@ const input = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("input"
|
|
|
32
32
|
}, styles_lib_css_atoms_sprinkles_css_cjs.atoms({
|
|
33
33
|
backgroundColor: "white",
|
|
34
34
|
borderRadius: "medium",
|
|
35
|
-
boxShadow: "medium"
|
|
36
|
-
gap: "large"
|
|
35
|
+
boxShadow: "medium"
|
|
37
36
|
})], "input_container")
|
|
38
37
|
});
|
|
39
38
|
fileScope.endFileScope();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/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/progress.css.ts?used", "blocks");
|
|
7
|
+
const indeterminateAnimation = css.keyframes({
|
|
8
|
+
"0%": {
|
|
9
|
+
transform: "translateX(-100%)"
|
|
10
|
+
},
|
|
11
|
+
"100%": {
|
|
12
|
+
transform: "translateX(100%)"
|
|
13
|
+
}
|
|
14
|
+
}, "indeterminateAnimation");
|
|
15
|
+
const progress = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("progress", {
|
|
16
|
+
container: css.style([{
|
|
17
|
+
height: 6
|
|
18
|
+
}, styles_lib_css_atoms_sprinkles_css_cjs.atoms({
|
|
19
|
+
width: "full",
|
|
20
|
+
borderRadius: "small",
|
|
21
|
+
backgroundColor: "textLight",
|
|
22
|
+
color: "primary",
|
|
23
|
+
overflow: "hidden"
|
|
24
|
+
})], "progress_container"),
|
|
25
|
+
bar: css.style({
|
|
26
|
+
borderRadius: "inherit",
|
|
27
|
+
"@media": {
|
|
28
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
29
|
+
transition: "transform 180ms ease-out"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, "progress_bar"),
|
|
33
|
+
variants: {
|
|
34
|
+
indeterminate: css.style({
|
|
35
|
+
animation: `${indeterminateAnimation} 10s ease-in-out infinite`,
|
|
36
|
+
"@media": {
|
|
37
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
38
|
+
animationDuration: "3s"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, "progress_variants_indeterminate")
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
fileScope.endFileScope();
|
|
45
|
+
exports.progress = progress;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { keyframes, style } from "@vanilla-extract/css";
|
|
3
|
+
import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
4
|
+
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
5
|
+
setFileScope("src/themes/momotaro/components/progress.css.ts?used", "blocks");
|
|
6
|
+
const indeterminateAnimation = keyframes({
|
|
7
|
+
"0%": {
|
|
8
|
+
transform: "translateX(-100%)"
|
|
9
|
+
},
|
|
10
|
+
"100%": {
|
|
11
|
+
transform: "translateX(100%)"
|
|
12
|
+
}
|
|
13
|
+
}, "indeterminateAnimation");
|
|
14
|
+
const progress = makeComponentTheme("progress", {
|
|
15
|
+
container: style([{
|
|
16
|
+
height: 6
|
|
17
|
+
}, atoms({
|
|
18
|
+
width: "full",
|
|
19
|
+
borderRadius: "small",
|
|
20
|
+
backgroundColor: "textLight",
|
|
21
|
+
color: "primary",
|
|
22
|
+
overflow: "hidden"
|
|
23
|
+
})], "progress_container"),
|
|
24
|
+
bar: style({
|
|
25
|
+
borderRadius: "inherit",
|
|
26
|
+
"@media": {
|
|
27
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
28
|
+
transition: "transform 180ms ease-out"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}, "progress_bar"),
|
|
32
|
+
variants: {
|
|
33
|
+
indeterminate: style({
|
|
34
|
+
animation: `${indeterminateAnimation} 10s ease-in-out infinite`,
|
|
35
|
+
"@media": {
|
|
36
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
37
|
+
animationDuration: "3s"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, "progress_variants_indeterminate")
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
endFileScope();
|
|
44
|
+
export {
|
|
45
|
+
progress
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockle/blocks",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "Blocks design system",
|
|
5
5
|
"repository": "git@github.com:Blockle/blocks.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,6 @@
|
|
|
50
50
|
"string-width": "^4.2.2"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@changesets/cli": "^2.26.2",
|
|
54
53
|
"@vanilla-extract/css": "^1.13.0",
|
|
55
54
|
"@vanilla-extract/css-utils": "^0.1.3",
|
|
56
55
|
"@vanilla-extract/sprinkles": "^1.6.1",
|
|
@@ -58,39 +57,40 @@
|
|
|
58
57
|
"react-dom": "^18.2.0"
|
|
59
58
|
},
|
|
60
59
|
"devDependencies": {
|
|
60
|
+
"@changesets/cli": "^2.26.2",
|
|
61
61
|
"@crackle/cli": "^0.12.4",
|
|
62
62
|
"@crackle/core": "^0.28.0",
|
|
63
|
-
"@storybook/addon-a11y": "^7.
|
|
63
|
+
"@storybook/addon-a11y": "^7.5.2",
|
|
64
64
|
"@storybook/addon-coverage": "^0.0.9",
|
|
65
|
-
"@storybook/addon-essentials": "^7.
|
|
66
|
-
"@storybook/addon-interactions": "^7.
|
|
67
|
-
"@storybook/addon-links": "^7.
|
|
68
|
-
"@storybook/blocks": "^7.
|
|
69
|
-
"@storybook/jest": "^0.2.
|
|
70
|
-
"@storybook/react": "^7.
|
|
71
|
-
"@storybook/react-vite": "^7.
|
|
72
|
-
"@storybook/testing-library": "^0.2.
|
|
65
|
+
"@storybook/addon-essentials": "^7.5.2",
|
|
66
|
+
"@storybook/addon-interactions": "^7.5.2",
|
|
67
|
+
"@storybook/addon-links": "^7.5.2",
|
|
68
|
+
"@storybook/blocks": "^7.5.2",
|
|
69
|
+
"@storybook/jest": "^0.2.3",
|
|
70
|
+
"@storybook/react": "^7.5.2",
|
|
71
|
+
"@storybook/react-vite": "^7.5.2",
|
|
72
|
+
"@storybook/testing-library": "^0.2.2",
|
|
73
73
|
"@testing-library/jest-dom": "^6.1.4",
|
|
74
74
|
"@testing-library/react": "^14.0.0",
|
|
75
|
-
"@types/react": "^18.2.
|
|
76
|
-
"@types/react-dom": "^18.2.
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
78
|
-
"@typescript-eslint/parser": "^6.
|
|
75
|
+
"@types/react": "^18.2.34",
|
|
76
|
+
"@types/react-dom": "^18.2.14",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
78
|
+
"@typescript-eslint/parser": "^6.9.1",
|
|
79
79
|
"@vanilla-extract/vite-plugin": "^3.8.2",
|
|
80
80
|
"@vitest/coverage-v8": "^0.34.6",
|
|
81
81
|
"cross-env": "^7.0.3",
|
|
82
|
-
"eslint": "^8.
|
|
82
|
+
"eslint": "^8.52.0",
|
|
83
83
|
"eslint-config-prettier": "^9.0.0",
|
|
84
|
-
"eslint-plugin-jest": "^27.
|
|
84
|
+
"eslint-plugin-jest": "^27.6.0",
|
|
85
85
|
"eslint-plugin-prettier": "^5.0.1",
|
|
86
86
|
"eslint-plugin-react": "^7.33.2",
|
|
87
87
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
88
88
|
"eslint-plugin-storybook": "^0.6.15",
|
|
89
|
-
"eslint-plugin-unicorn": "^
|
|
89
|
+
"eslint-plugin-unicorn": "^49.0.0",
|
|
90
90
|
"jsdom": "^22.1.0",
|
|
91
91
|
"prettier": "^3.0.3",
|
|
92
92
|
"prop-types": "^15.8.1",
|
|
93
|
-
"storybook": "^7.
|
|
93
|
+
"storybook": "^7.5.2",
|
|
94
94
|
"typescript": "^5.2.2",
|
|
95
95
|
"vitest": "^0.34.6"
|
|
96
96
|
},
|