@blockle/blocks 0.8.6 → 0.8.8
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/README.md +19 -18
- package/dist/index.cjs +59 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +60 -3
- package/dist/momotaro.chunk.d.ts +22 -8
- package/dist/styles/components/Dialog/dialog.css.cjs +2 -1
- package/dist/styles/components/Dialog/dialog.css.mjs +2 -1
- package/dist/styles/components/Switch/switch.css.cjs +26 -0
- package/dist/styles/components/Switch/switch.css.mjs +27 -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/button.css.cjs +42 -50
- package/dist/styles/themes/momotaro/components/button.css.mjs +43 -51
- package/dist/styles/themes/momotaro/components/helpers.css.cjs +4 -2
- package/dist/styles/themes/momotaro/components/helpers.css.mjs +5 -3
- package/dist/styles/themes/momotaro/components/index.cjs +3 -1
- package/dist/styles/themes/momotaro/components/index.mjs +3 -1
- package/dist/styles/themes/momotaro/components/progress.css.cjs +15 -5
- package/dist/styles/themes/momotaro/components/progress.css.mjs +15 -5
- package/dist/styles/themes/momotaro/components/switch.css.cjs +58 -0
- package/dist/styles/themes/momotaro/components/switch.css.mjs +59 -0
- package/package.json +14 -13
package/README.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
# @blockle/blocks
|
|
1
|
+
# @blockle/blocks design system
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Blocks design system
|
|
3
|
+
Design system for react with vanilla-extract.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
7
|
```bash
|
|
10
|
-
|
|
8
|
+
yarn add @blockle/blocks
|
|
11
9
|
```
|
|
12
10
|
|
|
13
11
|
## Setup
|
|
@@ -16,15 +14,13 @@ npm install @blockle/blocks
|
|
|
16
14
|
import React from 'react';
|
|
17
15
|
|
|
18
16
|
import '@blockle/blocks/reset.css';
|
|
19
|
-
import {
|
|
17
|
+
import { BlocksProvider } from '@blockle/blocks';
|
|
20
18
|
import { momotaro } from '@blockle/blocks/themes/momotaro';
|
|
21
19
|
|
|
22
|
-
// const Link = makeLinkComponent(...)
|
|
23
|
-
|
|
24
20
|
const App = () => (
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
</
|
|
21
|
+
<BlocksProvider theme={momotaro}>
|
|
22
|
+
<div>Your app here</div>
|
|
23
|
+
</BlocksProvider>
|
|
28
24
|
);
|
|
29
25
|
```
|
|
30
26
|
|
|
@@ -34,7 +30,7 @@ const App = () => (
|
|
|
34
30
|
import React from 'react';
|
|
35
31
|
import { Button } from '@blockle/blocks';
|
|
36
32
|
|
|
37
|
-
const App = () => <Button>Click me</Button>;
|
|
33
|
+
const App = () => <Button variant="ghost">Click me</Button>;
|
|
38
34
|
```
|
|
39
35
|
|
|
40
36
|
## Theming
|
|
@@ -42,9 +38,11 @@ const App = () => <Button>Click me</Button>;
|
|
|
42
38
|
yourTheme.css.ts
|
|
43
39
|
|
|
44
40
|
```jsx
|
|
45
|
-
import {
|
|
41
|
+
import { ThemeTokens, makeComponentTheme, makeTheme, style } from "@blockle/blocks";
|
|
46
42
|
|
|
47
|
-
const tokens =
|
|
43
|
+
const tokens: ThemeTokens = {
|
|
44
|
+
// ...
|
|
45
|
+
};
|
|
48
46
|
|
|
49
47
|
const button = makeComponentTheme('button', {
|
|
50
48
|
base: style({
|
|
@@ -58,12 +56,15 @@ const button = makeComponentTheme('button', {
|
|
|
58
56
|
...
|
|
59
57
|
})
|
|
60
58
|
},
|
|
59
|
+
compoundVariants: [],
|
|
60
|
+
defaultVariants: {
|
|
61
|
+
variant: 'primary',
|
|
62
|
+
},
|
|
61
63
|
});
|
|
62
64
|
|
|
63
|
-
const theme = makeTheme({
|
|
65
|
+
export const theme = makeTheme({
|
|
66
|
+
name: 'Theme name',
|
|
64
67
|
tokens,
|
|
65
|
-
components
|
|
66
|
-
button
|
|
67
|
-
}
|
|
68
|
+
components,
|
|
68
69
|
});
|
|
69
70
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const styles_components_Divider_divider_css_cjs = require("./styles/components/D
|
|
|
16
16
|
const styles_components_Heading_heading_css_cjs = require("./styles/components/Heading/heading.css.cjs");
|
|
17
17
|
const styles_components_Input_input_css_cjs = require("./styles/components/Input/input.css.cjs");
|
|
18
18
|
const styles_components_Radio_radio_css_cjs = require("./styles/components/Radio/radio.css.cjs");
|
|
19
|
+
const styles_components_Switch_switch_css_cjs = require("./styles/components/Switch/switch.css.cjs");
|
|
19
20
|
const styles_components_Text_text_css_cjs = require("./styles/components/Text/text.css.cjs");
|
|
20
21
|
const classnames = (...args) => {
|
|
21
22
|
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
@@ -529,7 +530,7 @@ const Dialog = ({
|
|
|
529
530
|
if (!hasAnimationDuration(dialogRef.current)) {
|
|
530
531
|
hide();
|
|
531
532
|
}
|
|
532
|
-
}, [open]);
|
|
533
|
+
}, [hide, open]);
|
|
533
534
|
if (!visible) {
|
|
534
535
|
return null;
|
|
535
536
|
}
|
|
@@ -660,7 +661,7 @@ const Progress = react.forwardRef(function Progress2({ value, max = 100, classNa
|
|
|
660
661
|
const containerClassName = useComponentStyles(
|
|
661
662
|
"progress",
|
|
662
663
|
{
|
|
663
|
-
|
|
664
|
+
base: true
|
|
664
665
|
},
|
|
665
666
|
false
|
|
666
667
|
);
|
|
@@ -734,6 +735,61 @@ const Stack = ({
|
|
|
734
735
|
}
|
|
735
736
|
);
|
|
736
737
|
};
|
|
738
|
+
const Switch = react.forwardRef(function Switch2({ className, checked, onChange, defaultChecked, ...restProps }, ref) {
|
|
739
|
+
const [isChecked, setIsChecked] = react.useState(defaultChecked || checked || false);
|
|
740
|
+
const baseClassName = useComponentStyles("switch", { base: true });
|
|
741
|
+
const sliderClassName = useComponentStyles("switch", { slider: true });
|
|
742
|
+
react.useEffect(() => {
|
|
743
|
+
if (checked !== void 0) {
|
|
744
|
+
setIsChecked(checked);
|
|
745
|
+
}
|
|
746
|
+
}, [checked]);
|
|
747
|
+
const toggle = react.useCallback(() => {
|
|
748
|
+
setIsChecked((checked2) => {
|
|
749
|
+
const newValue = !checked2;
|
|
750
|
+
if (onChange) {
|
|
751
|
+
onChange(newValue);
|
|
752
|
+
}
|
|
753
|
+
return newValue;
|
|
754
|
+
});
|
|
755
|
+
}, [onChange]);
|
|
756
|
+
const onChangeHandler = react.useCallback(
|
|
757
|
+
(event) => {
|
|
758
|
+
setIsChecked(event.target.checked);
|
|
759
|
+
if (onChange) {
|
|
760
|
+
onChange(event.target.checked);
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
[onChange]
|
|
764
|
+
);
|
|
765
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
766
|
+
"div",
|
|
767
|
+
{
|
|
768
|
+
className: classnames(className, styles_components_Switch_switch_css_cjs.container, baseClassName),
|
|
769
|
+
"data-checked": isChecked,
|
|
770
|
+
onClick: (event) => {
|
|
771
|
+
if (event.target.tagName === "INPUT") {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
toggle();
|
|
775
|
+
},
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
778
|
+
"input",
|
|
779
|
+
{
|
|
780
|
+
ref,
|
|
781
|
+
type: "checkbox",
|
|
782
|
+
className: styles_components_Switch_switch_css_cjs.input,
|
|
783
|
+
checked: isChecked,
|
|
784
|
+
onChange: onChangeHandler,
|
|
785
|
+
...restProps
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: sliderClassName, "data-checked": isChecked })
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
) });
|
|
792
|
+
});
|
|
737
793
|
const Text = react.forwardRef(function Text2({ tag: Tag = "span", asChild, children, className, ...restProps }, ref) {
|
|
738
794
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ref, asChild: true, className: classnames(styles_components_Text_text_css_cjs.text, className), ...restProps, children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsx(Tag, { children }) });
|
|
739
795
|
});
|
|
@@ -760,6 +816,7 @@ exports.Radio = Radio;
|
|
|
760
816
|
exports.Slot = Slot;
|
|
761
817
|
exports.Spinner = Spinner;
|
|
762
818
|
exports.Stack = Stack;
|
|
819
|
+
exports.Switch = Switch;
|
|
763
820
|
exports.Text = Text;
|
|
764
821
|
exports.classnames = classnames;
|
|
765
822
|
exports.createSlottable = createSlottable;
|
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, Progress, ProgressProps, Radio, RadioProps, Slot, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, 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, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars } from './momotaro.chunk.js';
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { makeComponentTheme } from "./styles/lib/theme/makeComponentTheme.mjs";
|
|
|
6
6
|
import { makeTheme } from "./styles/lib/theme/makeTheme.mjs";
|
|
7
7
|
import { vars } from "./styles/lib/theme/vars.css.mjs";
|
|
8
8
|
import { atoms } from "./styles/lib/css/atoms/sprinkles.css.mjs";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
10
10
|
import { createContext, forwardRef, Children, isValidElement, cloneElement, useContext, useEffect, useLayoutEffect, useRef, useState, useCallback, useId } from "react";
|
|
11
11
|
import { buttonReset } from "./styles/components/Button/Button.css.mjs";
|
|
12
12
|
import { container, input, icon } from "./styles/components/Checkbox/checkbox.css.mjs";
|
|
@@ -16,6 +16,7 @@ import { divider } from "./styles/components/Divider/divider.css.mjs";
|
|
|
16
16
|
import { heading } from "./styles/components/Heading/heading.css.mjs";
|
|
17
17
|
import { input as input$1 } from "./styles/components/Input/input.css.mjs";
|
|
18
18
|
import { container as container$1, input as input$2, icon as icon$1 } from "./styles/components/Radio/radio.css.mjs";
|
|
19
|
+
import { container as container$2, input as input$3 } from "./styles/components/Switch/switch.css.mjs";
|
|
19
20
|
import { text } from "./styles/components/Text/text.css.mjs";
|
|
20
21
|
const classnames = (...args) => {
|
|
21
22
|
const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
|
|
@@ -529,7 +530,7 @@ const Dialog = ({
|
|
|
529
530
|
if (!hasAnimationDuration(dialogRef.current)) {
|
|
530
531
|
hide();
|
|
531
532
|
}
|
|
532
|
-
}, [open]);
|
|
533
|
+
}, [hide, open]);
|
|
533
534
|
if (!visible) {
|
|
534
535
|
return null;
|
|
535
536
|
}
|
|
@@ -660,7 +661,7 @@ const Progress = forwardRef(function Progress2({ value, max = 100, className, ..
|
|
|
660
661
|
const containerClassName = useComponentStyles(
|
|
661
662
|
"progress",
|
|
662
663
|
{
|
|
663
|
-
|
|
664
|
+
base: true
|
|
664
665
|
},
|
|
665
666
|
false
|
|
666
667
|
);
|
|
@@ -734,6 +735,61 @@ const Stack = ({
|
|
|
734
735
|
}
|
|
735
736
|
);
|
|
736
737
|
};
|
|
738
|
+
const Switch = forwardRef(function Switch2({ className, checked, onChange, defaultChecked, ...restProps }, ref) {
|
|
739
|
+
const [isChecked, setIsChecked] = useState(defaultChecked || checked || false);
|
|
740
|
+
const baseClassName = useComponentStyles("switch", { base: true });
|
|
741
|
+
const sliderClassName = useComponentStyles("switch", { slider: true });
|
|
742
|
+
useEffect(() => {
|
|
743
|
+
if (checked !== void 0) {
|
|
744
|
+
setIsChecked(checked);
|
|
745
|
+
}
|
|
746
|
+
}, [checked]);
|
|
747
|
+
const toggle = useCallback(() => {
|
|
748
|
+
setIsChecked((checked2) => {
|
|
749
|
+
const newValue = !checked2;
|
|
750
|
+
if (onChange) {
|
|
751
|
+
onChange(newValue);
|
|
752
|
+
}
|
|
753
|
+
return newValue;
|
|
754
|
+
});
|
|
755
|
+
}, [onChange]);
|
|
756
|
+
const onChangeHandler = useCallback(
|
|
757
|
+
(event) => {
|
|
758
|
+
setIsChecked(event.target.checked);
|
|
759
|
+
if (onChange) {
|
|
760
|
+
onChange(event.target.checked);
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
[onChange]
|
|
764
|
+
);
|
|
765
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
766
|
+
"div",
|
|
767
|
+
{
|
|
768
|
+
className: classnames(className, container$2, baseClassName),
|
|
769
|
+
"data-checked": isChecked,
|
|
770
|
+
onClick: (event) => {
|
|
771
|
+
if (event.target.tagName === "INPUT") {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
toggle();
|
|
775
|
+
},
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ jsx(
|
|
778
|
+
"input",
|
|
779
|
+
{
|
|
780
|
+
ref,
|
|
781
|
+
type: "checkbox",
|
|
782
|
+
className: input$3,
|
|
783
|
+
checked: isChecked,
|
|
784
|
+
onChange: onChangeHandler,
|
|
785
|
+
...restProps
|
|
786
|
+
}
|
|
787
|
+
),
|
|
788
|
+
/* @__PURE__ */ jsx("div", { className: sliderClassName, "data-checked": isChecked })
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
) });
|
|
792
|
+
});
|
|
737
793
|
const Text = forwardRef(function Text2({ tag: Tag = "span", asChild, children, className, ...restProps }, ref) {
|
|
738
794
|
return /* @__PURE__ */ jsx(Box, { ref, asChild: true, className: classnames(text, className), ...restProps, children: asChild ? children : /* @__PURE__ */ jsx(Tag, { children }) });
|
|
739
795
|
});
|
|
@@ -755,6 +811,7 @@ export {
|
|
|
755
811
|
Slot,
|
|
756
812
|
Spinner,
|
|
757
813
|
Stack,
|
|
814
|
+
Switch,
|
|
758
815
|
Text,
|
|
759
816
|
atoms,
|
|
760
817
|
breakpointQuery,
|
package/dist/momotaro.chunk.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const atoms: ((props: {
|
|
|
7
7
|
readonly backgroundColor?: "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "link" | "currentColor" | undefined;
|
|
8
8
|
readonly borderColor?: "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "link" | "currentColor" | undefined;
|
|
9
9
|
readonly borderRadius?: ("small" | "medium" | "large" | "xlarge") | undefined;
|
|
10
|
+
readonly borderWidth?: ("small" | "medium" | "large") | undefined;
|
|
10
11
|
readonly border?: "none" | undefined;
|
|
11
12
|
readonly bottom?: 0 | undefined;
|
|
12
13
|
readonly boxShadow?: ("small" | "medium" | "large") | undefined;
|
|
@@ -231,7 +232,7 @@ declare const atoms: ((props: {
|
|
|
231
232
|
wide?: "center" | "flex-start" | "flex-end" | undefined;
|
|
232
233
|
} | undefined) | _vanilla_extract_sprinkles.ResponsiveArray<4 | 1 | 2 | 3, "center" | "flex-start" | "flex-end" | null>;
|
|
233
234
|
}) => string) & {
|
|
234
|
-
properties: Set<"borderRadius" | "color" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "transition" | "boxShadow" | "alignContent" | "alignItems" | "alignSelf" | "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" | "outline" | "overflow" | "padding" | "placeItems" | "textDecoration" | "textWrap" | "marginX" | "marginY" | "paddingX" | "paddingY">;
|
|
235
|
+
properties: Set<"borderRadius" | "color" | "borderWidth" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "transition" | "boxShadow" | "alignContent" | "alignItems" | "alignSelf" | "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" | "outline" | "overflow" | "padding" | "placeItems" | "textDecoration" | "textWrap" | "marginX" | "marginY" | "paddingX" | "paddingY">;
|
|
235
236
|
};
|
|
236
237
|
|
|
237
238
|
declare const breakpoints: {
|
|
@@ -363,23 +364,28 @@ type LabelTheme = {
|
|
|
363
364
|
};
|
|
364
365
|
};
|
|
365
366
|
type ProgressTheme = {
|
|
366
|
-
|
|
367
|
+
base: string;
|
|
367
368
|
bar: string;
|
|
368
369
|
variants: {
|
|
369
370
|
indeterminate: boolean;
|
|
370
371
|
};
|
|
371
372
|
};
|
|
373
|
+
type SwitchTheme = {
|
|
374
|
+
base: string;
|
|
375
|
+
slider: string;
|
|
376
|
+
};
|
|
372
377
|
type ComponentThemes = {
|
|
373
378
|
button: ButtonTheme;
|
|
374
|
-
|
|
375
|
-
spinner: SpinnerTheme;
|
|
376
|
-
divider: DividerTheme;
|
|
379
|
+
checkbox: CheckboxTheme;
|
|
377
380
|
dialog: DialogTheme;
|
|
381
|
+
divider: DividerTheme;
|
|
378
382
|
input: InputTheme;
|
|
379
|
-
checkbox: CheckboxTheme;
|
|
380
|
-
radio: RadioTheme;
|
|
381
383
|
label: LabelTheme;
|
|
384
|
+
link: LinkTheme;
|
|
382
385
|
progress: ProgressTheme;
|
|
386
|
+
radio: RadioTheme;
|
|
387
|
+
spinner: SpinnerTheme;
|
|
388
|
+
switch: SwitchTheme;
|
|
383
389
|
};
|
|
384
390
|
/**
|
|
385
391
|
* ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
|
|
@@ -586,6 +592,7 @@ declare const Box: react.ForwardRefExoticComponent<{
|
|
|
586
592
|
readonly backgroundColor?: "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "link" | "currentColor" | undefined;
|
|
587
593
|
readonly borderColor?: "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "link" | "currentColor" | undefined;
|
|
588
594
|
readonly borderRadius?: ("small" | "medium" | "large" | "xlarge") | undefined;
|
|
595
|
+
readonly borderWidth?: ("small" | "medium" | "large") | undefined;
|
|
589
596
|
readonly border?: "none" | undefined;
|
|
590
597
|
readonly bottom?: 0 | undefined;
|
|
591
598
|
readonly boxShadow?: ("small" | "medium" | "large") | undefined;
|
|
@@ -997,6 +1004,13 @@ type StackProps = {
|
|
|
997
1004
|
} & MarginAtoms & PaddingAtoms;
|
|
998
1005
|
declare const Stack: React.FC<StackProps>;
|
|
999
1006
|
|
|
1007
|
+
type SwitchProps = {
|
|
1008
|
+
onChange?: (value: boolean) => void;
|
|
1009
|
+
} & Omit<HTMLElementProps<HTMLInputElement>, 'onChange'>;
|
|
1010
|
+
declare const Switch: react.ForwardRefExoticComponent<{
|
|
1011
|
+
onChange?: ((value: boolean) => void) | undefined;
|
|
1012
|
+
} & Omit<HTMLElementProps<HTMLInputElement>, "onChange"> & react.RefAttributes<HTMLInputElement>>;
|
|
1013
|
+
|
|
1000
1014
|
type TextProps = {
|
|
1001
1015
|
children: React.ReactNode;
|
|
1002
1016
|
tag?: 'span' | 'p' | 'strong' | 'em' | 'small' | 's' | 'del' | 'ins' | 'sub' | 'sup' | 'label';
|
|
@@ -1045,4 +1059,4 @@ declare const classnames: (...args: Args[]) => string | undefined;
|
|
|
1045
1059
|
|
|
1046
1060
|
declare const momotaro: Theme;
|
|
1047
1061
|
|
|
1048
|
-
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, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars };
|
|
1062
|
+
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, Switch, SwitchProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars };
|
|
@@ -0,0 +1,26 @@
|
|
|
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/Switch/switch.css.ts?used", "blocks");
|
|
6
|
+
const container = css.style({
|
|
7
|
+
"@layer": {
|
|
8
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
9
|
+
cursor: "pointer",
|
|
10
|
+
userSelect: "none",
|
|
11
|
+
position: "relative"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}, "container");
|
|
15
|
+
const input = css.style({
|
|
16
|
+
"@layer": {
|
|
17
|
+
[styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
maxHeight: 0,
|
|
20
|
+
maxWidth: 0
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, "input");
|
|
24
|
+
fileScope.endFileScope();
|
|
25
|
+
exports.container = container;
|
|
26
|
+
exports.input = input;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { style } from "@vanilla-extract/css";
|
|
3
|
+
import { blocksLayer } from "../../lib/css/layers/layers.css.mjs";
|
|
4
|
+
setFileScope("src/components/Switch/switch.css.ts?used", "blocks");
|
|
5
|
+
const container = style({
|
|
6
|
+
"@layer": {
|
|
7
|
+
[blocksLayer]: {
|
|
8
|
+
cursor: "pointer",
|
|
9
|
+
userSelect: "none",
|
|
10
|
+
position: "relative"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}, "container");
|
|
14
|
+
const input = style({
|
|
15
|
+
"@layer": {
|
|
16
|
+
[blocksLayer]: {
|
|
17
|
+
opacity: 0,
|
|
18
|
+
maxHeight: 0,
|
|
19
|
+
maxWidth: 0
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, "input");
|
|
23
|
+
endFileScope();
|
|
24
|
+
export {
|
|
25
|
+
container,
|
|
26
|
+
input
|
|
27
|
+
};
|
|
@@ -5,6 +5,7 @@ const unresponsiveProperties = {
|
|
|
5
5
|
backgroundColor: colorWithCurrentColor,
|
|
6
6
|
borderColor: colorWithCurrentColor,
|
|
7
7
|
borderRadius: styles_lib_theme_vars_css_cjs.vars.borderRadius,
|
|
8
|
+
borderWidth: styles_lib_theme_vars_css_cjs.vars.borderWidth,
|
|
8
9
|
border: ["none"],
|
|
9
10
|
bottom: [0],
|
|
10
11
|
boxShadow: styles_lib_theme_vars_css_cjs.vars.shadow,
|
|
@@ -6,7 +6,8 @@ const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/make
|
|
|
6
6
|
const styles_lib_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
|
|
7
7
|
const styles_themes_momotaro_components_helpers_css_cjs = require("./helpers.css.cjs");
|
|
8
8
|
fileScope.setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
|
|
9
|
-
const
|
|
9
|
+
const intentColor = css.createVar("intentColor");
|
|
10
|
+
const hoverBackgroundColor = css.createVar("hoverBackgroundColor");
|
|
10
11
|
const button = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("button", {
|
|
11
12
|
base: styles_lib_css_style_style_cjs.style([{
|
|
12
13
|
display: "inline-flex",
|
|
@@ -15,40 +16,30 @@ const button = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("butto
|
|
|
15
16
|
borderRadius: "medium",
|
|
16
17
|
fontWeight: "medium",
|
|
17
18
|
// Space between `startSlot | children | endSlot`
|
|
18
|
-
gap: "small"
|
|
19
|
+
gap: "small",
|
|
20
|
+
selectors: {
|
|
21
|
+
"&:hover:not(:disabled)": {
|
|
22
|
+
backgroundColor: hoverBackgroundColor
|
|
23
|
+
}
|
|
24
|
+
}
|
|
19
25
|
}, styles_themes_momotaro_components_helpers_css_cjs.clickable]),
|
|
20
26
|
variants: {
|
|
21
27
|
variant: {
|
|
22
28
|
solid: styles_lib_css_style_style_cjs.style({
|
|
23
29
|
color: styles_lib_theme_vars_css_cjs.vars.color.white,
|
|
24
|
-
backgroundColor:
|
|
25
|
-
border: "none"
|
|
26
|
-
selectors: {
|
|
27
|
-
"&:hover:not(:disabled)": {
|
|
28
|
-
backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.primaryDark
|
|
29
|
-
}
|
|
30
|
-
}
|
|
30
|
+
backgroundColor: intentColor,
|
|
31
|
+
border: "none"
|
|
31
32
|
}),
|
|
32
33
|
outline: styles_lib_css_style_style_cjs.style({
|
|
33
|
-
color:
|
|
34
|
-
borderWidth:
|
|
34
|
+
color: intentColor,
|
|
35
|
+
borderWidth: "small",
|
|
35
36
|
borderStyle: "solid",
|
|
36
|
-
borderColor:
|
|
37
|
-
background: "transparent"
|
|
38
|
-
selectors: {
|
|
39
|
-
"&:hover:not(:disabled)": {
|
|
40
|
-
backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.primaryLight
|
|
41
|
-
}
|
|
42
|
-
}
|
|
37
|
+
borderColor: intentColor,
|
|
38
|
+
background: "transparent"
|
|
43
39
|
}),
|
|
44
40
|
ghost: styles_lib_css_style_style_cjs.style({
|
|
45
|
-
color:
|
|
46
|
-
background: "transparent"
|
|
47
|
-
selectors: {
|
|
48
|
-
"&:hover:not(:disabled)": {
|
|
49
|
-
backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.primaryLight
|
|
50
|
-
}
|
|
51
|
-
}
|
|
41
|
+
color: intentColor,
|
|
42
|
+
background: "transparent"
|
|
52
43
|
})
|
|
53
44
|
},
|
|
54
45
|
size: {
|
|
@@ -68,39 +59,40 @@ const button = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("butto
|
|
|
68
59
|
intent: {
|
|
69
60
|
neutral: styles_lib_css_style_style_cjs.style({
|
|
70
61
|
vars: {
|
|
71
|
-
[
|
|
62
|
+
[intentColor]: styles_lib_theme_vars_css_cjs.vars.color.primary,
|
|
63
|
+
[hoverBackgroundColor]: styles_lib_theme_vars_css_cjs.vars.color.primaryLight
|
|
72
64
|
}
|
|
73
65
|
}),
|
|
74
66
|
danger: styles_lib_css_style_style_cjs.style({
|
|
75
67
|
vars: {
|
|
76
|
-
[
|
|
68
|
+
[intentColor]: styles_lib_theme_vars_css_cjs.vars.color.danger,
|
|
69
|
+
[hoverBackgroundColor]: "#fff8f7",
|
|
70
|
+
[styles_themes_momotaro_components_helpers_css_cjs.focusRingColor]: styles_lib_theme_vars_css_cjs.vars.color.danger
|
|
77
71
|
}
|
|
78
72
|
})
|
|
79
73
|
}
|
|
80
74
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// },
|
|
103
|
-
// ],
|
|
75
|
+
compoundVariants: [{
|
|
76
|
+
variants: {
|
|
77
|
+
variant: "solid",
|
|
78
|
+
intent: "neutral"
|
|
79
|
+
},
|
|
80
|
+
style: styles_lib_css_style_style_cjs.style({
|
|
81
|
+
vars: {
|
|
82
|
+
[hoverBackgroundColor]: styles_lib_theme_vars_css_cjs.vars.color.primaryDark
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
}, {
|
|
86
|
+
variants: {
|
|
87
|
+
variant: "solid",
|
|
88
|
+
intent: "danger"
|
|
89
|
+
},
|
|
90
|
+
style: styles_lib_css_style_style_cjs.style({
|
|
91
|
+
vars: {
|
|
92
|
+
[hoverBackgroundColor]: "#f9b1a9"
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}],
|
|
104
96
|
defaultVariants: {
|
|
105
97
|
size: "small",
|
|
106
98
|
variant: "solid",
|
|
@@ -3,9 +3,10 @@ import { createVar } from "@vanilla-extract/css";
|
|
|
3
3
|
import { style } from "../../../lib/css/style/style.mjs";
|
|
4
4
|
import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
5
5
|
import { vars } from "../../../lib/theme/vars.css.mjs";
|
|
6
|
-
import { clickable } from "./helpers.css.mjs";
|
|
6
|
+
import { clickable, focusRingColor } from "./helpers.css.mjs";
|
|
7
7
|
setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
|
|
8
|
-
const
|
|
8
|
+
const intentColor = createVar("intentColor");
|
|
9
|
+
const hoverBackgroundColor = createVar("hoverBackgroundColor");
|
|
9
10
|
const button = makeComponentTheme("button", {
|
|
10
11
|
base: style([{
|
|
11
12
|
display: "inline-flex",
|
|
@@ -14,40 +15,30 @@ const button = makeComponentTheme("button", {
|
|
|
14
15
|
borderRadius: "medium",
|
|
15
16
|
fontWeight: "medium",
|
|
16
17
|
// Space between `startSlot | children | endSlot`
|
|
17
|
-
gap: "small"
|
|
18
|
+
gap: "small",
|
|
19
|
+
selectors: {
|
|
20
|
+
"&:hover:not(:disabled)": {
|
|
21
|
+
backgroundColor: hoverBackgroundColor
|
|
22
|
+
}
|
|
23
|
+
}
|
|
18
24
|
}, clickable]),
|
|
19
25
|
variants: {
|
|
20
26
|
variant: {
|
|
21
27
|
solid: style({
|
|
22
28
|
color: vars.color.white,
|
|
23
|
-
backgroundColor:
|
|
24
|
-
border: "none"
|
|
25
|
-
selectors: {
|
|
26
|
-
"&:hover:not(:disabled)": {
|
|
27
|
-
backgroundColor: vars.color.primaryDark
|
|
28
|
-
}
|
|
29
|
-
}
|
|
29
|
+
backgroundColor: intentColor,
|
|
30
|
+
border: "none"
|
|
30
31
|
}),
|
|
31
32
|
outline: style({
|
|
32
|
-
color:
|
|
33
|
-
borderWidth:
|
|
33
|
+
color: intentColor,
|
|
34
|
+
borderWidth: "small",
|
|
34
35
|
borderStyle: "solid",
|
|
35
|
-
borderColor:
|
|
36
|
-
background: "transparent"
|
|
37
|
-
selectors: {
|
|
38
|
-
"&:hover:not(:disabled)": {
|
|
39
|
-
backgroundColor: vars.color.primaryLight
|
|
40
|
-
}
|
|
41
|
-
}
|
|
36
|
+
borderColor: intentColor,
|
|
37
|
+
background: "transparent"
|
|
42
38
|
}),
|
|
43
39
|
ghost: style({
|
|
44
|
-
color:
|
|
45
|
-
background: "transparent"
|
|
46
|
-
selectors: {
|
|
47
|
-
"&:hover:not(:disabled)": {
|
|
48
|
-
backgroundColor: vars.color.primaryLight
|
|
49
|
-
}
|
|
50
|
-
}
|
|
40
|
+
color: intentColor,
|
|
41
|
+
background: "transparent"
|
|
51
42
|
})
|
|
52
43
|
},
|
|
53
44
|
size: {
|
|
@@ -67,39 +58,40 @@ const button = makeComponentTheme("button", {
|
|
|
67
58
|
intent: {
|
|
68
59
|
neutral: style({
|
|
69
60
|
vars: {
|
|
70
|
-
[
|
|
61
|
+
[intentColor]: vars.color.primary,
|
|
62
|
+
[hoverBackgroundColor]: vars.color.primaryLight
|
|
71
63
|
}
|
|
72
64
|
}),
|
|
73
65
|
danger: style({
|
|
74
66
|
vars: {
|
|
75
|
-
[
|
|
67
|
+
[intentColor]: vars.color.danger,
|
|
68
|
+
[hoverBackgroundColor]: "#fff8f7",
|
|
69
|
+
[focusRingColor]: vars.color.danger
|
|
76
70
|
}
|
|
77
71
|
})
|
|
78
72
|
}
|
|
79
73
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
// },
|
|
102
|
-
// ],
|
|
74
|
+
compoundVariants: [{
|
|
75
|
+
variants: {
|
|
76
|
+
variant: "solid",
|
|
77
|
+
intent: "neutral"
|
|
78
|
+
},
|
|
79
|
+
style: style({
|
|
80
|
+
vars: {
|
|
81
|
+
[hoverBackgroundColor]: vars.color.primaryDark
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
}, {
|
|
85
|
+
variants: {
|
|
86
|
+
variant: "solid",
|
|
87
|
+
intent: "danger"
|
|
88
|
+
},
|
|
89
|
+
style: style({
|
|
90
|
+
vars: {
|
|
91
|
+
[hoverBackgroundColor]: "#f9b1a9"
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}],
|
|
103
95
|
defaultVariants: {
|
|
104
96
|
size: "small",
|
|
105
97
|
variant: "solid",
|
|
@@ -3,11 +3,12 @@ const fileScope = require("@vanilla-extract/css/fileScope");
|
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
|
|
5
5
|
fileScope.setFileScope("src/themes/momotaro/components/helpers.css.ts?used", "blocks");
|
|
6
|
+
const focusRingColor = css.createVar("focusRingColor");
|
|
6
7
|
const focusable = css.style({
|
|
7
8
|
":focus-visible": {
|
|
8
9
|
outline: "2px solid transparent",
|
|
9
10
|
outlineOffset: "2px",
|
|
10
|
-
boxShadow:
|
|
11
|
+
boxShadow: `0 0 1px 2px ${css.fallbackVar(focusRingColor, "#AF8EFF")}`,
|
|
11
12
|
transitionDuration: styles_lib_theme_vars_css_cjs.vars.transition.fast,
|
|
12
13
|
transitionProperty: "box-shadow"
|
|
13
14
|
},
|
|
@@ -32,9 +33,10 @@ const focusable = css.style({
|
|
|
32
33
|
}, "focusable");
|
|
33
34
|
const clickable = css.style([focusable, {
|
|
34
35
|
":active": {
|
|
35
|
-
transform: "scale(0.
|
|
36
|
+
transform: "scale(0.975)"
|
|
36
37
|
}
|
|
37
38
|
}], "clickable");
|
|
38
39
|
fileScope.endFileScope();
|
|
39
40
|
exports.clickable = clickable;
|
|
41
|
+
exports.focusRingColor = focusRingColor;
|
|
40
42
|
exports.focusable = focusable;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
-
import { style } from "@vanilla-extract/css";
|
|
2
|
+
import { createVar, style, fallbackVar } from "@vanilla-extract/css";
|
|
3
3
|
import { vars } from "../../../lib/theme/vars.css.mjs";
|
|
4
4
|
setFileScope("src/themes/momotaro/components/helpers.css.ts?used", "blocks");
|
|
5
|
+
const focusRingColor = createVar("focusRingColor");
|
|
5
6
|
const focusable = style({
|
|
6
7
|
":focus-visible": {
|
|
7
8
|
outline: "2px solid transparent",
|
|
8
9
|
outlineOffset: "2px",
|
|
9
|
-
boxShadow:
|
|
10
|
+
boxShadow: `0 0 1px 2px ${fallbackVar(focusRingColor, "#AF8EFF")}`,
|
|
10
11
|
transitionDuration: vars.transition.fast,
|
|
11
12
|
transitionProperty: "box-shadow"
|
|
12
13
|
},
|
|
@@ -31,11 +32,12 @@ const focusable = style({
|
|
|
31
32
|
}, "focusable");
|
|
32
33
|
const clickable = style([focusable, {
|
|
33
34
|
":active": {
|
|
34
|
-
transform: "scale(0.
|
|
35
|
+
transform: "scale(0.975)"
|
|
35
36
|
}
|
|
36
37
|
}], "clickable");
|
|
37
38
|
endFileScope();
|
|
38
39
|
export {
|
|
39
40
|
clickable,
|
|
41
|
+
focusRingColor,
|
|
40
42
|
focusable
|
|
41
43
|
};
|
|
@@ -9,6 +9,7 @@ const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs")
|
|
|
9
9
|
const styles_themes_momotaro_components_progress_css_cjs = require("./progress.css.cjs");
|
|
10
10
|
const styles_themes_momotaro_components_radio_css_cjs = require("./radio.css.cjs");
|
|
11
11
|
const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
|
|
12
|
+
const styles_themes_momotaro_components_switch_css_cjs = require("./switch.css.cjs");
|
|
12
13
|
const components = {
|
|
13
14
|
button: styles_themes_momotaro_components_button_css_cjs.button,
|
|
14
15
|
checkbox: styles_themes_momotaro_components_checkbox_css_cjs.checkbox,
|
|
@@ -19,6 +20,7 @@ const components = {
|
|
|
19
20
|
link: styles_themes_momotaro_components_link_css_cjs.link,
|
|
20
21
|
progress: styles_themes_momotaro_components_progress_css_cjs.progress,
|
|
21
22
|
radio: styles_themes_momotaro_components_radio_css_cjs.radio,
|
|
22
|
-
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner
|
|
23
|
+
spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
|
|
24
|
+
switch: styles_themes_momotaro_components_switch_css_cjs.switchTheme
|
|
23
25
|
};
|
|
24
26
|
exports.components = components;
|
|
@@ -8,6 +8,7 @@ import { link } from "./link.css.mjs";
|
|
|
8
8
|
import { progress } from "./progress.css.mjs";
|
|
9
9
|
import { radio } from "./radio.css.mjs";
|
|
10
10
|
import { spinner } from "./spinner.css.mjs";
|
|
11
|
+
import { switchTheme } from "./switch.css.mjs";
|
|
11
12
|
const components = {
|
|
12
13
|
button,
|
|
13
14
|
checkbox,
|
|
@@ -18,7 +19,8 @@ const components = {
|
|
|
18
19
|
link,
|
|
19
20
|
progress,
|
|
20
21
|
radio,
|
|
21
|
-
spinner
|
|
22
|
+
spinner,
|
|
23
|
+
switch: switchTheme
|
|
22
24
|
};
|
|
23
25
|
export {
|
|
24
26
|
components
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
3
|
const css = require("@vanilla-extract/css");
|
|
4
4
|
const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
|
|
5
|
+
const styles_lib_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
|
|
5
6
|
const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
|
|
6
7
|
fileScope.setFileScope("src/themes/momotaro/components/progress.css.ts?used", "blocks");
|
|
7
8
|
const indeterminateAnimation = css.keyframes({
|
|
@@ -13,15 +14,15 @@ const indeterminateAnimation = css.keyframes({
|
|
|
13
14
|
}
|
|
14
15
|
}, "indeterminateAnimation");
|
|
15
16
|
const progress = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("progress", {
|
|
16
|
-
|
|
17
|
-
height:
|
|
17
|
+
base: css.style([{
|
|
18
|
+
height: 8
|
|
18
19
|
}, styles_lib_css_atoms_sprinkles_css_cjs.atoms({
|
|
19
20
|
width: "full",
|
|
20
21
|
borderRadius: "small",
|
|
21
22
|
backgroundColor: "textLight",
|
|
22
23
|
color: "primary",
|
|
23
24
|
overflow: "hidden"
|
|
24
|
-
})], "
|
|
25
|
+
})], "progress_base"),
|
|
25
26
|
bar: css.style({
|
|
26
27
|
borderRadius: "inherit",
|
|
27
28
|
"@media": {
|
|
@@ -32,10 +33,19 @@ const progress = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("pro
|
|
|
32
33
|
}, "progress_bar"),
|
|
33
34
|
variants: {
|
|
34
35
|
indeterminate: css.style({
|
|
35
|
-
animation: `${indeterminateAnimation} 10s ease-in-out infinite`,
|
|
36
36
|
"@media": {
|
|
37
|
+
// For reduce motion we show a striped pattern instead of animating
|
|
38
|
+
"(prefers-reduced-motion: reduce)": {
|
|
39
|
+
backgroundImage: `repeating-linear-gradient(
|
|
40
|
+
45deg,
|
|
41
|
+
transparent,
|
|
42
|
+
transparent 20px,
|
|
43
|
+
${styles_lib_theme_vars_css_cjs.vars.color.primaryDark} 20px,
|
|
44
|
+
${styles_lib_theme_vars_css_cjs.vars.color.primaryDark} 40px
|
|
45
|
+
)`
|
|
46
|
+
},
|
|
37
47
|
"(prefers-reduced-motion: no-preference)": {
|
|
38
|
-
|
|
48
|
+
animation: `${indeterminateAnimation} 3s ease-in-out infinite`
|
|
39
49
|
}
|
|
40
50
|
}
|
|
41
51
|
}, "progress_variants_indeterminate")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
2
|
import { keyframes, style } from "@vanilla-extract/css";
|
|
3
3
|
import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
4
|
+
import { vars } from "../../../lib/theme/vars.css.mjs";
|
|
4
5
|
import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
|
|
5
6
|
setFileScope("src/themes/momotaro/components/progress.css.ts?used", "blocks");
|
|
6
7
|
const indeterminateAnimation = keyframes({
|
|
@@ -12,15 +13,15 @@ const indeterminateAnimation = keyframes({
|
|
|
12
13
|
}
|
|
13
14
|
}, "indeterminateAnimation");
|
|
14
15
|
const progress = makeComponentTheme("progress", {
|
|
15
|
-
|
|
16
|
-
height:
|
|
16
|
+
base: style([{
|
|
17
|
+
height: 8
|
|
17
18
|
}, atoms({
|
|
18
19
|
width: "full",
|
|
19
20
|
borderRadius: "small",
|
|
20
21
|
backgroundColor: "textLight",
|
|
21
22
|
color: "primary",
|
|
22
23
|
overflow: "hidden"
|
|
23
|
-
})], "
|
|
24
|
+
})], "progress_base"),
|
|
24
25
|
bar: style({
|
|
25
26
|
borderRadius: "inherit",
|
|
26
27
|
"@media": {
|
|
@@ -31,10 +32,19 @@ const progress = makeComponentTheme("progress", {
|
|
|
31
32
|
}, "progress_bar"),
|
|
32
33
|
variants: {
|
|
33
34
|
indeterminate: style({
|
|
34
|
-
animation: `${indeterminateAnimation} 10s ease-in-out infinite`,
|
|
35
35
|
"@media": {
|
|
36
|
+
// For reduce motion we show a striped pattern instead of animating
|
|
37
|
+
"(prefers-reduced-motion: reduce)": {
|
|
38
|
+
backgroundImage: `repeating-linear-gradient(
|
|
39
|
+
45deg,
|
|
40
|
+
transparent,
|
|
41
|
+
transparent 20px,
|
|
42
|
+
${vars.color.primaryDark} 20px,
|
|
43
|
+
${vars.color.primaryDark} 40px
|
|
44
|
+
)`
|
|
45
|
+
},
|
|
36
46
|
"(prefers-reduced-motion: no-preference)": {
|
|
37
|
-
|
|
47
|
+
animation: `${indeterminateAnimation} 3s ease-in-out infinite`
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
50
|
}, "progress_variants_indeterminate")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const fileScope = require("@vanilla-extract/css/fileScope");
|
|
3
|
+
const css = require("@vanilla-extract/css");
|
|
4
|
+
const styles_lib_css_style_style_cjs = require("../../../lib/css/style/style.cjs");
|
|
5
|
+
const styles_lib_theme_makeComponentTheme_cjs = require("../../../lib/theme/makeComponentTheme.cjs");
|
|
6
|
+
const styles_lib_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
|
|
7
|
+
const styles_themes_momotaro_components_helpers_css_cjs = require("./helpers.css.cjs");
|
|
8
|
+
fileScope.setFileScope("src/themes/momotaro/components/switch.css.ts?used", "blocks");
|
|
9
|
+
const activeScaleFactor = css.createVar("activeScaleFactor");
|
|
10
|
+
const switchTheme = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("switch", {
|
|
11
|
+
base: styles_lib_css_style_style_cjs.style([{
|
|
12
|
+
width: 52,
|
|
13
|
+
height: 32,
|
|
14
|
+
borderRadius: "xlarge",
|
|
15
|
+
backgroundColor: "textLight",
|
|
16
|
+
"@media": {
|
|
17
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
18
|
+
transition: "background-color 120ms linear"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
selectors: {
|
|
22
|
+
'&[data-checked="true"]': {
|
|
23
|
+
backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.secondary
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
// Scale the switch when it's `:active`
|
|
27
|
+
vars: {
|
|
28
|
+
[activeScaleFactor]: "1"
|
|
29
|
+
},
|
|
30
|
+
":active": {
|
|
31
|
+
vars: {
|
|
32
|
+
[activeScaleFactor]: "0.96"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, styles_themes_momotaro_components_helpers_css_cjs.focusable]),
|
|
36
|
+
slider: styles_lib_css_style_style_cjs.style({
|
|
37
|
+
width: 24,
|
|
38
|
+
height: 24,
|
|
39
|
+
top: 4,
|
|
40
|
+
left: 4,
|
|
41
|
+
transform: `translateX(0) scale(calc(0.9 * ${activeScaleFactor}))`,
|
|
42
|
+
position: "absolute",
|
|
43
|
+
backgroundColor: "white",
|
|
44
|
+
borderRadius: "xlarge",
|
|
45
|
+
selectors: {
|
|
46
|
+
'&[data-checked="true"]': {
|
|
47
|
+
transform: `translateX(20px) scale(${activeScaleFactor})`
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"@media": {
|
|
51
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
52
|
+
transition: "transform 120ms ease-out"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
fileScope.endFileScope();
|
|
58
|
+
exports.switchTheme = switchTheme;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
+
import { createVar } from "@vanilla-extract/css";
|
|
3
|
+
import { style } from "../../../lib/css/style/style.mjs";
|
|
4
|
+
import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
|
|
5
|
+
import { vars } from "../../../lib/theme/vars.css.mjs";
|
|
6
|
+
import { focusable } from "./helpers.css.mjs";
|
|
7
|
+
setFileScope("src/themes/momotaro/components/switch.css.ts?used", "blocks");
|
|
8
|
+
const activeScaleFactor = createVar("activeScaleFactor");
|
|
9
|
+
const switchTheme = makeComponentTheme("switch", {
|
|
10
|
+
base: style([{
|
|
11
|
+
width: 52,
|
|
12
|
+
height: 32,
|
|
13
|
+
borderRadius: "xlarge",
|
|
14
|
+
backgroundColor: "textLight",
|
|
15
|
+
"@media": {
|
|
16
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
17
|
+
transition: "background-color 120ms linear"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
selectors: {
|
|
21
|
+
'&[data-checked="true"]': {
|
|
22
|
+
backgroundColor: vars.color.secondary
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
// Scale the switch when it's `:active`
|
|
26
|
+
vars: {
|
|
27
|
+
[activeScaleFactor]: "1"
|
|
28
|
+
},
|
|
29
|
+
":active": {
|
|
30
|
+
vars: {
|
|
31
|
+
[activeScaleFactor]: "0.96"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, focusable]),
|
|
35
|
+
slider: style({
|
|
36
|
+
width: 24,
|
|
37
|
+
height: 24,
|
|
38
|
+
top: 4,
|
|
39
|
+
left: 4,
|
|
40
|
+
transform: `translateX(0) scale(calc(0.9 * ${activeScaleFactor}))`,
|
|
41
|
+
position: "absolute",
|
|
42
|
+
backgroundColor: "white",
|
|
43
|
+
borderRadius: "xlarge",
|
|
44
|
+
selectors: {
|
|
45
|
+
'&[data-checked="true"]': {
|
|
46
|
+
transform: `translateX(20px) scale(${activeScaleFactor})`
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"@media": {
|
|
50
|
+
"(prefers-reduced-motion: no-preference)": {
|
|
51
|
+
transition: "transform 120ms ease-out"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
endFileScope();
|
|
57
|
+
export {
|
|
58
|
+
switchTheme
|
|
59
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockle/blocks",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "Blocks design system",
|
|
5
5
|
"repository": "git@github.com:Blockle/blocks.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,26 +60,27 @@
|
|
|
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.5.
|
|
63
|
+
"@storybook/addon-a11y": "^7.5.3",
|
|
64
64
|
"@storybook/addon-coverage": "^0.0.9",
|
|
65
|
-
"@storybook/addon-essentials": "^7.5.
|
|
66
|
-
"@storybook/addon-interactions": "^7.5.
|
|
67
|
-
"@storybook/addon-links": "^7.5.
|
|
68
|
-
"@storybook/blocks": "^7.5.
|
|
65
|
+
"@storybook/addon-essentials": "^7.5.3",
|
|
66
|
+
"@storybook/addon-interactions": "^7.5.3",
|
|
67
|
+
"@storybook/addon-links": "^7.5.3",
|
|
68
|
+
"@storybook/blocks": "^7.5.3",
|
|
69
69
|
"@storybook/jest": "^0.2.3",
|
|
70
|
-
"@storybook/react": "^7.5.
|
|
71
|
-
"@storybook/react-vite": "^7.5.
|
|
70
|
+
"@storybook/react": "^7.5.3",
|
|
71
|
+
"@storybook/react-vite": "^7.5.3",
|
|
72
72
|
"@storybook/testing-library": "^0.2.2",
|
|
73
73
|
"@testing-library/jest-dom": "^6.1.4",
|
|
74
|
-
"@testing-library/react": "^14.
|
|
74
|
+
"@testing-library/react": "^14.1.0",
|
|
75
75
|
"@types/react": "^18.2.34",
|
|
76
76
|
"@types/react-dom": "^18.2.14",
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
78
|
-
"@typescript-eslint/parser": "^6.
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
|
78
|
+
"@typescript-eslint/parser": "^6.10.0",
|
|
79
79
|
"@vanilla-extract/vite-plugin": "^3.8.2",
|
|
80
80
|
"@vitest/coverage-v8": "^0.34.6",
|
|
81
|
+
"autoprefixer": "^10.4.16",
|
|
81
82
|
"cross-env": "^7.0.3",
|
|
82
|
-
"eslint": "^8.
|
|
83
|
+
"eslint": "^8.53.0",
|
|
83
84
|
"eslint-config-prettier": "^9.0.0",
|
|
84
85
|
"eslint-plugin-jest": "^27.6.0",
|
|
85
86
|
"eslint-plugin-prettier": "^5.0.1",
|
|
@@ -90,7 +91,7 @@
|
|
|
90
91
|
"jsdom": "^22.1.0",
|
|
91
92
|
"prettier": "^3.0.3",
|
|
92
93
|
"prop-types": "^15.8.1",
|
|
93
|
-
"storybook": "^7.5.
|
|
94
|
+
"storybook": "^7.5.3",
|
|
94
95
|
"typescript": "^5.2.2",
|
|
95
96
|
"vitest": "^0.34.6"
|
|
96
97
|
},
|