@blockle/blocks 0.8.2 → 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 +104 -28
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +106 -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 +18 -18
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) {
|
|
@@ -424,6 +440,13 @@ const useVisibilityState = (open) => {
|
|
|
424
440
|
}, [open]);
|
|
425
441
|
return [visible, hide];
|
|
426
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
|
+
}
|
|
427
450
|
const Portal = ({ children, container }) => {
|
|
428
451
|
const context = useTheme();
|
|
429
452
|
return reactDom.createPortal(
|
|
@@ -453,6 +476,9 @@ const Dialog = ({
|
|
|
453
476
|
size,
|
|
454
477
|
...restProps
|
|
455
478
|
}) => {
|
|
479
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
480
|
+
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
481
|
+
const backdropRef = react.useRef(null);
|
|
456
482
|
const dialogRef = react.useRef(null);
|
|
457
483
|
const layer = useLayer();
|
|
458
484
|
const [visible, hide] = useVisibilityState(open);
|
|
@@ -465,55 +491,63 @@ const Dialog = ({
|
|
|
465
491
|
},
|
|
466
492
|
[onRequestClose]
|
|
467
493
|
);
|
|
468
|
-
const onAnimationEnd = react.useCallback((event) => {
|
|
469
|
-
if (event.animationName === styles_components_Dialog_dialog_css_cjs.backdropLeaveAnimation) {
|
|
470
|
-
event.stopPropagation();
|
|
471
|
-
hide();
|
|
472
|
-
}
|
|
473
|
-
}, []);
|
|
474
494
|
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
475
495
|
useRestoreFocus(open);
|
|
476
496
|
const isNested = useNestedDialog(visible);
|
|
477
497
|
usePreventBodyScroll(visible && !isNested);
|
|
478
|
-
|
|
479
|
-
|
|
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");
|
|
480
504
|
return;
|
|
481
505
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
+
});
|
|
488
513
|
return () => {
|
|
489
|
-
|
|
514
|
+
cancelAnimationFrame(timer);
|
|
490
515
|
};
|
|
491
|
-
}, [open,
|
|
492
|
-
const
|
|
493
|
-
|
|
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]);
|
|
494
530
|
if (!visible) {
|
|
495
531
|
return null;
|
|
496
532
|
}
|
|
533
|
+
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
497
534
|
return /* @__PURE__ */ jsxRuntime.jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
498
535
|
Box,
|
|
499
536
|
{
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
537
|
+
ref: backdropRef,
|
|
538
|
+
className: classnames(styles_components_Dialog_dialog_css_cjs.backdrop, backdropClassName),
|
|
539
|
+
"data-open": dataOpen,
|
|
503
540
|
onClick: onBackdropClick,
|
|
504
541
|
onAnimationEnd,
|
|
542
|
+
onTransitionEnd: onAnimationEnd,
|
|
505
543
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
506
544
|
"dialog",
|
|
507
545
|
{
|
|
508
546
|
ref: dialogRef,
|
|
509
547
|
"aria-modal": "true",
|
|
510
548
|
open: true,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
!open && styles_components_Dialog_dialog_css_cjs.dialogLeave,
|
|
514
|
-
dialogClassName,
|
|
515
|
-
className
|
|
516
|
-
),
|
|
549
|
+
"data-open": dataOpen,
|
|
550
|
+
className: classnames(dialogClassName, className),
|
|
517
551
|
...restProps,
|
|
518
552
|
children
|
|
519
553
|
}
|
|
@@ -619,6 +653,44 @@ const Link = react.forwardRef(function Link2({ asChild, className, children, var
|
|
|
619
653
|
}
|
|
620
654
|
);
|
|
621
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
|
+
});
|
|
622
694
|
const Radio = react.forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
|
|
623
695
|
const containerClassName = useComponentStyles("radio", { base: true }, false);
|
|
624
696
|
const iconClassName = useComponentStyles("radio", { icon: true }, false);
|
|
@@ -679,6 +751,7 @@ exports.Input = Input;
|
|
|
679
751
|
exports.Label = Label;
|
|
680
752
|
exports.Link = Link;
|
|
681
753
|
exports.Portal = Portal;
|
|
754
|
+
exports.Progress = Progress;
|
|
682
755
|
exports.Radio = Radio;
|
|
683
756
|
exports.Slot = Slot;
|
|
684
757
|
exports.Spinner = Spinner;
|
|
@@ -688,3 +761,6 @@ exports.classnames = classnames;
|
|
|
688
761
|
exports.createSlottable = createSlottable;
|
|
689
762
|
exports.useComponentStyleDefaultProps = useComponentStyleDefaultProps;
|
|
690
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) {
|
|
@@ -424,6 +440,13 @@ const useVisibilityState = (open) => {
|
|
|
424
440
|
}, [open]);
|
|
425
441
|
return [visible, hide];
|
|
426
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
|
+
}
|
|
427
450
|
const Portal = ({ children, container: container2 }) => {
|
|
428
451
|
const context = useTheme();
|
|
429
452
|
return createPortal(
|
|
@@ -453,6 +476,9 @@ const Dialog = ({
|
|
|
453
476
|
size,
|
|
454
477
|
...restProps
|
|
455
478
|
}) => {
|
|
479
|
+
const backdropClassName = useComponentStyles("dialog", { backdrop: true }, false);
|
|
480
|
+
const dialogClassName = useComponentStyles("dialog", { dialog: true, variants: { size } });
|
|
481
|
+
const backdropRef = useRef(null);
|
|
456
482
|
const dialogRef = useRef(null);
|
|
457
483
|
const layer = useLayer();
|
|
458
484
|
const [visible, hide] = useVisibilityState(open);
|
|
@@ -465,55 +491,63 @@ const Dialog = ({
|
|
|
465
491
|
},
|
|
466
492
|
[onRequestClose]
|
|
467
493
|
);
|
|
468
|
-
const onAnimationEnd = useCallback((event) => {
|
|
469
|
-
if (event.animationName === backdropLeaveAnimation) {
|
|
470
|
-
event.stopPropagation();
|
|
471
|
-
hide();
|
|
472
|
-
}
|
|
473
|
-
}, []);
|
|
474
494
|
useFocusLock({ ref: dialogRef, active: open && enabled });
|
|
475
495
|
useRestoreFocus(open);
|
|
476
496
|
const isNested = useNestedDialog(visible);
|
|
477
497
|
usePreventBodyScroll(visible && !isNested);
|
|
478
|
-
|
|
479
|
-
|
|
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");
|
|
480
504
|
return;
|
|
481
505
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
+
});
|
|
488
513
|
return () => {
|
|
489
|
-
|
|
514
|
+
cancelAnimationFrame(timer);
|
|
490
515
|
};
|
|
491
|
-
}, [open,
|
|
492
|
-
const
|
|
493
|
-
|
|
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]);
|
|
494
530
|
if (!visible) {
|
|
495
531
|
return null;
|
|
496
532
|
}
|
|
533
|
+
const dataOpen = typeof window === "undefined" && open ? "" : void 0;
|
|
497
534
|
return /* @__PURE__ */ jsx(Portal, { container: layer(), children: /* @__PURE__ */ jsx(DialogContext.Provider, { value: { setEnabled }, children: /* @__PURE__ */ jsx(
|
|
498
535
|
Box,
|
|
499
536
|
{
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
537
|
+
ref: backdropRef,
|
|
538
|
+
className: classnames(backdrop, backdropClassName),
|
|
539
|
+
"data-open": dataOpen,
|
|
503
540
|
onClick: onBackdropClick,
|
|
504
541
|
onAnimationEnd,
|
|
542
|
+
onTransitionEnd: onAnimationEnd,
|
|
505
543
|
children: /* @__PURE__ */ jsx(
|
|
506
544
|
"dialog",
|
|
507
545
|
{
|
|
508
546
|
ref: dialogRef,
|
|
509
547
|
"aria-modal": "true",
|
|
510
548
|
open: true,
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
!open && dialogLeave,
|
|
514
|
-
dialogClassName,
|
|
515
|
-
className
|
|
516
|
-
),
|
|
549
|
+
"data-open": dataOpen,
|
|
550
|
+
className: classnames(dialogClassName, className),
|
|
517
551
|
...restProps,
|
|
518
552
|
children
|
|
519
553
|
}
|
|
@@ -619,6 +653,44 @@ const Link = forwardRef(function Link2({ asChild, className, children, variant,
|
|
|
619
653
|
}
|
|
620
654
|
);
|
|
621
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
|
+
});
|
|
622
694
|
const Radio = forwardRef(function Checkbox3({ name, label, className, ...restProps }, ref) {
|
|
623
695
|
const containerClassName = useComponentStyles("radio", { base: true }, false);
|
|
624
696
|
const iconClassName = useComponentStyles("radio", { icon: true }, false);
|
|
@@ -675,6 +747,7 @@ export {
|
|
|
675
747
|
Label,
|
|
676
748
|
Link,
|
|
677
749
|
Portal,
|
|
750
|
+
Progress,
|
|
678
751
|
Radio,
|
|
679
752
|
Slot,
|
|
680
753
|
Spinner,
|
|
@@ -688,5 +761,8 @@ export {
|
|
|
688
761
|
makeTheme,
|
|
689
762
|
useComponentStyleDefaultProps,
|
|
690
763
|
useComponentStyles,
|
|
764
|
+
useIsomorphicLayoutEffect,
|
|
765
|
+
useKeyboard,
|
|
766
|
+
usePreventBodyScroll,
|
|
691
767
|
vars
|
|
692
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",
|
|
@@ -60,37 +60,37 @@
|
|
|
60
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
|
},
|