@blockle/blocks 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/index.cjs +215 -149
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.mjs +223 -157
  4. package/dist/momotaro.chunk.d.ts +142 -69
  5. package/dist/styles/components/Checkbox/checkbox.css.cjs +31 -0
  6. package/dist/styles/components/Checkbox/checkbox.css.mjs +32 -0
  7. package/dist/styles/components/Radio/radio.css.cjs +31 -0
  8. package/dist/styles/components/Radio/radio.css.mjs +32 -0
  9. package/dist/styles/themes/momotaro/components/button.css.cjs +1 -1
  10. package/dist/styles/themes/momotaro/components/button.css.mjs +1 -1
  11. package/dist/styles/themes/momotaro/components/checkbox.css.cjs +53 -0
  12. package/dist/styles/themes/momotaro/components/checkbox.css.mjs +54 -0
  13. package/dist/styles/themes/momotaro/components/helpers.css.cjs +13 -0
  14. package/dist/styles/themes/momotaro/components/helpers.css.mjs +13 -0
  15. package/dist/styles/themes/momotaro/components/index.cjs +7 -1
  16. package/dist/styles/themes/momotaro/components/index.mjs +7 -1
  17. package/dist/styles/themes/momotaro/components/input.css.cjs +3 -3
  18. package/dist/styles/themes/momotaro/components/input.css.mjs +3 -3
  19. package/dist/styles/themes/momotaro/components/label.css.cjs +33 -0
  20. package/dist/styles/themes/momotaro/components/label.css.mjs +34 -0
  21. package/dist/styles/themes/momotaro/components/link.css.cjs +1 -0
  22. package/dist/styles/themes/momotaro/components/link.css.mjs +1 -0
  23. package/dist/styles/themes/momotaro/components/radio.css.cjs +53 -0
  24. package/dist/styles/themes/momotaro/components/radio.css.mjs +54 -0
  25. package/dist/styles/themes/momotaro/components/transitions.cjs +3 -0
  26. package/dist/styles/themes/momotaro/components/transitions.mjs +4 -0
  27. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
1
  import { ForwardRefComponent } from '@radix-ui/react-polymorphic';
2
2
  import * as react from 'react';
3
- import { HTMLProps, ReactNode, FC } from 'react';
3
+ import react__default, { HTMLProps, ReactNode, FC } from 'react';
4
4
  import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
5
5
 
6
6
  declare const atoms: ((props: {
@@ -248,9 +248,6 @@ declare const breakpointQuery: (key: Breakpoint) => string;
248
248
  */
249
249
  type OptionalLiteral<T extends string> = T | (string & {});
250
250
  type RecordLike = Record<string | number, unknown>;
251
- type IsStringUnion<T> = T extends string ? (string extends T ? false : true) : false;
252
- type IsNumberUnion<T> = T extends number ? (number extends T ? false : true) : false;
253
- type IsUnion<T> = IsStringUnion<T> extends true ? true : IsNumberUnion<T> extends true ? true : false;
254
251
 
255
252
  type Atoms = Parameters<typeof atoms>[0];
256
253
  type ResponsiveValue<T> = T | [T] | [T, T] | [T, T, T] | [T, T, T, T];
@@ -278,7 +275,7 @@ type MarginAndPaddingAtoms = MarginAtoms & PaddingAtoms;
278
275
  type ButtonTheme = {
279
276
  base: string;
280
277
  variants: {
281
- variant: 'solid' | 'outline' | 'ghost' | 'link';
278
+ variant: 'solid' | 'outline' | 'ghost';
282
279
  intent: 'neutral' | 'danger';
283
280
  size: 'small' | 'medium' | 'large';
284
281
  loading: boolean;
@@ -300,7 +297,7 @@ type SpinnerTheme = {
300
297
  };
301
298
  };
302
299
  type DividerTheme = {
303
- base: string;
300
+ base?: string;
304
301
  variants: {
305
302
  color: Exclude<Atoms['color'], undefined>;
306
303
  };
@@ -316,22 +313,52 @@ type InputTheme = {
316
313
  container: string;
317
314
  input: string;
318
315
  variants: {
316
+ variant: 'solid' | 'outline';
319
317
  disabled: boolean;
318
+ required: boolean;
319
+ };
320
+ };
321
+ type CheckboxTheme = {
322
+ base: string;
323
+ icon: string;
324
+ label: string;
325
+ variants: {
326
+ required: boolean;
327
+ };
328
+ };
329
+ type RadioTheme = {
330
+ base: string;
331
+ icon: string;
332
+ label: string;
333
+ };
334
+ type LabelTheme = {
335
+ base: string;
336
+ variants: {
337
+ size: 'small' | 'medium' | 'large';
338
+ required: boolean;
320
339
  };
321
340
  };
322
- type ThemeComponents = {
341
+ type ComponentThemes = {
323
342
  button: ButtonTheme;
324
343
  link: LinkTheme;
325
344
  spinner: SpinnerTheme;
326
345
  divider: DividerTheme;
327
346
  dialog: DialogTheme;
328
347
  input: InputTheme;
348
+ checkbox: CheckboxTheme;
349
+ radio: RadioTheme;
350
+ label: LabelTheme;
329
351
  };
330
- type ThemeComponentsProps = {
331
- [K in keyof ThemeComponents]: ThemeComponentProps<ThemeComponents[K]>;
352
+ /**
353
+ * ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
354
+ */
355
+ type ComponentThemeProps<T extends RecordLike> = Omit<{
356
+ [K in keyof T]?: Exclude<T[K], undefined> extends string ? boolean : never;
357
+ }, 'variants'> & {
358
+ variants?: T['variants'] extends RecordLike ? Partial<T['variants']> : never;
332
359
  };
333
- type ThemeComponentProps<T extends RecordLike> = {
334
- [K in keyof T]?: T[K] extends RecordLike ? ThemeComponentProps<T[K]> : IsUnion<T[K]> extends true ? T[K] : T[K] extends string ? boolean : T[K];
360
+ type ComponentThemesProps = {
361
+ [K in keyof ComponentThemes]: ComponentThemeProps<ComponentThemes[K]>;
335
362
  };
336
363
 
337
364
  /**
@@ -354,8 +381,14 @@ type ThemeComponentProps<T extends RecordLike> = {
354
381
  * };
355
382
  * };
356
383
  */
357
- type ComponentThemeToStyles<T extends RecordLike> = {
358
- [K in keyof T]?: T[K] extends RecordLike ? ComponentThemeToStyles<T[K]> : IsUnion<Exclude<T[K], undefined>> extends true ? Exclude<T[K], undefined> extends string | number ? ComponentThemeToStyles<Record<Exclude<T[K], undefined>, string>> : never : string;
384
+ type VariantsToStyle<T extends RecordLike> = {
385
+ [K in keyof T]?: T[K] extends string | number ? Partial<Record<T[K], string>> : T[K] extends boolean ? string : never;
386
+ };
387
+ /**
388
+ * ComponentThemeToStyles is a helper type to define the props passed to useComponentStyles.
389
+ */
390
+ type ComponentThemeToStyles<T extends RecordLike> = Omit<T, 'variants'> & {
391
+ variants?: T['variants'] extends RecordLike ? VariantsToStyle<T['variants']> : never;
359
392
  };
360
393
  type ComponentThemeCompoundVariants<T extends RecordLike> = T['variants'] extends RecordLike ? {
361
394
  variants: {
@@ -371,7 +404,7 @@ type ComponentTheme<T extends RecordLike> = ComponentThemeToStyles<T> & {
371
404
  defaultVariants?: ComponentThemeDefaultVariants<T>;
372
405
  };
373
406
  type ThemeComponentsStyles = {
374
- [K in keyof ThemeComponents]?: ComponentTheme<ThemeComponents[K]>;
407
+ [K in keyof ComponentThemes]: ComponentTheme<ComponentThemes[K]>;
375
408
  };
376
409
  declare function makeComponentTheme<T extends keyof ThemeComponentsStyles>(component: T, componentTheme: ThemeComponentsStyles[T]): ThemeComponentsStyles[T];
377
410
 
@@ -411,12 +444,12 @@ type ThemeTokens = {
411
444
  type ThemeInput = {
412
445
  name: string;
413
446
  tokens: ThemeTokens;
414
- components: Partial<ThemeComponentsStyles>;
447
+ components: ThemeComponentsStyles;
415
448
  };
416
449
  type Theme = {
417
450
  name: string;
418
451
  vars: string;
419
- components: Partial<ThemeComponentsStyles>;
452
+ components: ThemeComponentsStyles;
420
453
  };
421
454
  declare function makeTheme(theme: ThemeInput): Theme;
422
455
 
@@ -530,7 +563,7 @@ type ButtonProps = {
530
563
  declare const Button: react.ForwardRefExoticComponent<{
531
564
  children: ReactNode;
532
565
  type?: "button" | "submit" | "reset" | undefined;
533
- variant?: "link" | "outline" | "solid" | "ghost" | undefined;
566
+ variant?: "outline" | "solid" | "ghost" | undefined;
534
567
  intent?: "danger" | "neutral" | undefined;
535
568
  size?: "small" | "medium" | "large" | undefined;
536
569
  width?: Atoms['width'];
@@ -541,6 +574,34 @@ declare const Button: react.ForwardRefExoticComponent<{
541
574
  disabled?: boolean | undefined;
542
575
  } & Omit<HTMLElementProps<HTMLButtonElement>, "size"> & react.RefAttributes<HTMLButtonElement>>;
543
576
 
577
+ type CheckboxProps = {
578
+ name: string;
579
+ label?: react__default.ReactNode;
580
+ required?: boolean;
581
+ } & HTMLElementProps<HTMLInputElement>;
582
+ declare const Checkbox: react__default.ForwardRefExoticComponent<{
583
+ name: string;
584
+ label?: react__default.ReactNode;
585
+ required?: boolean | undefined;
586
+ } & HTMLElementProps<HTMLInputElement> & react__default.RefAttributes<HTMLInputElement>>;
587
+
588
+ type DialogProps = {
589
+ children?: ReactNode;
590
+ open: boolean;
591
+ onRequestClose: () => void;
592
+ className?: string;
593
+ size?: DialogTheme['variants']['size'];
594
+ 'aria-label'?: string;
595
+ };
596
+ declare const Dialog: FC<DialogProps>;
597
+
598
+ type DividerProps = {
599
+ className?: string;
600
+ color?: Atoms['backgroundColor'];
601
+ style?: React.CSSProperties;
602
+ };
603
+ declare const Divider: FC<DividerProps>;
604
+
544
605
  type HeadingProps = {
545
606
  align?: Atoms['textAlign'];
546
607
  children: React.ReactNode;
@@ -580,6 +641,66 @@ type InlineProps = {
580
641
  } & MarginAndPaddingAtoms;
581
642
  declare const Inline: React.FC<InlineProps>;
582
643
 
644
+ type InputProps = {
645
+ className?: string;
646
+ name: string;
647
+ type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
648
+ startSlot?: ReactNode;
649
+ endSlot?: ReactNode;
650
+ label: string;
651
+ } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
652
+ declare const Input: react.ForwardRefExoticComponent<{
653
+ className?: string | undefined;
654
+ name: string;
655
+ type?: OptionalLiteral<"number" | "text" | "tel" | "url" | "email" | "password"> | undefined;
656
+ startSlot?: ReactNode;
657
+ endSlot?: ReactNode;
658
+ label: string;
659
+ } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
660
+
661
+ type LabelProps = {
662
+ visualOnly?: boolean;
663
+ htmlFor?: string;
664
+ children?: React.ReactNode;
665
+ required?: boolean;
666
+ size?: LabelTheme['variants']['size'];
667
+ cursor?: Atoms['cursor'];
668
+ } & HTMLElementProps<HTMLLabelElement>;
669
+ declare const Label: React.FC<LabelProps>;
670
+
671
+ type LinkProps = {
672
+ children?: ReactNode;
673
+ underline?: LinkTheme['variants']['underline'];
674
+ variant?: LinkTheme['variants']['variant'];
675
+ } & Atoms & HTMLElementProps<HTMLAnchorElement>;
676
+ type PolymorphicLink = ForwardRefComponent<'a', LinkProps>;
677
+ declare const Link: PolymorphicLink;
678
+
679
+ type PortalProps = {
680
+ children: ReactNode;
681
+ container?: HTMLElement;
682
+ };
683
+ declare const Portal: FC<PortalProps>;
684
+
685
+ type RadioProps = {
686
+ name: string;
687
+ value: string;
688
+ label?: React.ReactNode;
689
+ } & HTMLElementProps<HTMLInputElement>;
690
+ declare const Radio: react.ForwardRefExoticComponent<{
691
+ name: string;
692
+ value: string;
693
+ label?: React.ReactNode;
694
+ } & HTMLElementProps<HTMLInputElement> & react.RefAttributes<HTMLInputElement>>;
695
+
696
+ type SpinnerProps = {
697
+ className?: string;
698
+ color?: SpinnerTheme['variants']['color'];
699
+ size?: SpinnerTheme['variants']['size'];
700
+ style?: React.CSSProperties;
701
+ } & MarginAtoms;
702
+ declare const Spinner: FC<SpinnerProps>;
703
+
583
704
  type StackProps = {
584
705
  alignX?: keyof AlignItemsMap;
585
706
  as?: 'div' | 'section' | 'ul' | 'ol';
@@ -588,6 +709,7 @@ type StackProps = {
588
709
  display?: ResponsiveDisplayFlex;
589
710
  gap: Atoms['gap'];
590
711
  style?: React.CSSProperties;
712
+ role?: React.AriaRole;
591
713
  /**
592
714
  * Start prop is only valid when as="ol"
593
715
  */
@@ -612,66 +734,17 @@ type TextProps = {
612
734
  } & MarginAndPaddingAtoms & HTMLElementProps<HTMLSpanElement>;
613
735
  declare const Text: React.FC<TextProps>;
614
736
 
615
- type LinkProps = {
616
- children?: ReactNode;
617
- underline?: LinkTheme['variants']['underline'];
618
- variant?: LinkTheme['variants']['variant'];
619
- } & Atoms & HTMLElementProps<HTMLAnchorElement>;
620
- type PolymorphicLink = ForwardRefComponent<'a', LinkProps>;
621
- declare const Link: PolymorphicLink;
622
-
623
- type SpinnerProps = {
624
- className?: string;
625
- color?: SpinnerTheme['variants']['color'];
626
- size?: SpinnerTheme['variants']['size'];
627
- style?: React.CSSProperties;
628
- } & MarginAtoms;
629
- declare const Spinner: FC<SpinnerProps>;
630
-
631
- type DividerProps = {
632
- className?: string;
633
- color?: Atoms['backgroundColor'];
634
- style?: React.CSSProperties;
635
- };
636
- declare const Divider: FC<DividerProps>;
637
-
638
- type DialogProps = {
639
- children?: ReactNode;
640
- open: boolean;
641
- onRequestClose: () => void;
642
- className?: string;
643
- size?: DialogTheme['variants']['size'];
644
- };
645
- declare const Dialog: FC<DialogProps>;
646
-
647
- type InputProps = {
648
- className?: string;
649
- name: string;
650
- type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
651
- startSlot?: ReactNode;
652
- endSlot?: ReactNode;
653
- label: string;
654
- } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
655
- declare const Input: react.ForwardRefExoticComponent<{
656
- className?: string | undefined;
657
- name: string;
658
- type?: OptionalLiteral<"number" | "text" | "tel" | "url" | "email" | "password"> | undefined;
659
- startSlot?: ReactNode;
660
- endSlot?: ReactNode;
661
- label: string;
662
- } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
663
-
664
- declare function useComponentStyles<T extends keyof ThemeComponentsProps>(name: T, props: ThemeComponentsProps[T], useDefaultVariants?: boolean): string;
737
+ declare function useComponentStyles<T extends keyof ComponentThemesProps>(name: T, props: ComponentThemesProps[T], useDefaultVariants?: boolean): string;
665
738
 
666
739
  type ThemeComponentsStylesRequired = Required<ThemeComponentsStyles>;
667
740
  type Components = {
668
741
  [K in keyof ThemeComponentsStylesRequired]: ThemeComponentsStylesRequired[K] extends RecordLike ? Required<ThemeComponentsStylesRequired[K]>['defaultVariants'] extends RecordLike ? ThemeComponentsStylesRequired[K]['defaultVariants'] extends undefined ? never : Exclude<ThemeComponentsStylesRequired[K]['defaultVariants'], undefined> : never : never;
669
742
  };
670
- declare const useComponentStyleDefaultProps: <T extends keyof ThemeComponents>(name: T) => Components[T];
743
+ declare const useComponentStyleDefaultProps: <T extends keyof ComponentThemes>(name: T) => Components[T];
671
744
 
672
745
  type Args = null | undefined | boolean | string;
673
746
  declare const classnames: (...args: Args[]) => string | undefined;
674
747
 
675
748
  declare const momotaro: Theme;
676
749
 
677
- export { BlocksProvider, BlocksProviderProps, Box, BoxProps, Button, ButtonProps, Dialog, DialogProps, Divider, DividerProps, Heading, HeadingProps, Inline, InlineProps, Input, InputProps, Link, LinkProps, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
750
+ 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, Spinner, SpinnerProps, Stack, StackProps, Text, TextProps, ThemeComponentsStyles, ThemeTokens, atoms, breakpointQuery, classnames, makeComponentTheme, makeTheme, momotaro, useComponentStyleDefaultProps, useComponentStyles, vars };
@@ -0,0 +1,31 @@
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/Checkbox/checkbox.css.ts?used", "blocks");
6
+ const container = css.style({
7
+ "@layer": {
8
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
9
+ position: "relative",
10
+ cursor: "pointer",
11
+ overflow: "hidden"
12
+ }
13
+ }
14
+ }, "container");
15
+ const input = css.style({
16
+ position: "absolute",
17
+ inset: 0,
18
+ opacity: 0,
19
+ "@layer": {
20
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
21
+ all: "unset"
22
+ }
23
+ }
24
+ }, "input");
25
+ const icon = css.style({
26
+ pointerEvents: "none"
27
+ }, "icon");
28
+ fileScope.endFileScope();
29
+ exports.container = container;
30
+ exports.icon = icon;
31
+ exports.input = input;
@@ -0,0 +1,32 @@
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/Checkbox/checkbox.css.ts?used", "blocks");
5
+ const container = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ position: "relative",
9
+ cursor: "pointer",
10
+ overflow: "hidden"
11
+ }
12
+ }
13
+ }, "container");
14
+ const input = style({
15
+ position: "absolute",
16
+ inset: 0,
17
+ opacity: 0,
18
+ "@layer": {
19
+ [blocksLayer]: {
20
+ all: "unset"
21
+ }
22
+ }
23
+ }, "input");
24
+ const icon = style({
25
+ pointerEvents: "none"
26
+ }, "icon");
27
+ endFileScope();
28
+ export {
29
+ container,
30
+ icon,
31
+ input
32
+ };
@@ -0,0 +1,31 @@
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/Radio/radio.css.ts?used", "blocks");
6
+ const container = css.style({
7
+ "@layer": {
8
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
9
+ position: "relative",
10
+ cursor: "pointer",
11
+ overflow: "hidden"
12
+ }
13
+ }
14
+ }, "container");
15
+ const input = css.style({
16
+ position: "absolute",
17
+ inset: 0,
18
+ opacity: 0,
19
+ "@layer": {
20
+ [styles_lib_css_layers_layers_css_cjs.blocksLayer]: {
21
+ all: "unset"
22
+ }
23
+ }
24
+ }, "input");
25
+ const icon = css.style({
26
+ pointerEvents: "none"
27
+ }, "icon");
28
+ fileScope.endFileScope();
29
+ exports.container = container;
30
+ exports.icon = icon;
31
+ exports.input = input;
@@ -0,0 +1,32 @@
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/Radio/radio.css.ts?used", "blocks");
5
+ const container = style({
6
+ "@layer": {
7
+ [blocksLayer]: {
8
+ position: "relative",
9
+ cursor: "pointer",
10
+ overflow: "hidden"
11
+ }
12
+ }
13
+ }, "container");
14
+ const input = style({
15
+ position: "absolute",
16
+ inset: 0,
17
+ opacity: 0,
18
+ "@layer": {
19
+ [blocksLayer]: {
20
+ all: "unset"
21
+ }
22
+ }
23
+ }, "input");
24
+ const icon = style({
25
+ pointerEvents: "none"
26
+ }, "icon");
27
+ endFileScope();
28
+ export {
29
+ container,
30
+ icon,
31
+ input
32
+ };
@@ -2,8 +2,8 @@
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_themes_momotaro_components_helpers_css_cjs = require("./helpers.css.cjs");
6
5
  const styles_lib_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
6
+ const styles_themes_momotaro_components_helpers_css_cjs = require("./helpers.css.cjs");
7
7
  const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
8
8
  fileScope.setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
9
9
  const primaryColor = css.createVar("primaryColor");
@@ -1,8 +1,8 @@
1
1
  import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
2
  import { createVar, style } from "@vanilla-extract/css";
3
3
  import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
4
- import { clickable } from "./helpers.css.mjs";
5
4
  import { vars } from "../../../lib/theme/vars.css.mjs";
5
+ import { clickable } from "./helpers.css.mjs";
6
6
  import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
7
7
  setFileScope("src/themes/momotaro/components/button.css.ts?used", "blocks");
8
8
  const primaryColor = createVar("primaryColor");
@@ -0,0 +1,53 @@
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_theme_vars_css_cjs = require("../../../lib/theme/vars.css.cjs");
6
+ const styles_themes_momotaro_components_helpers_css_cjs = require("./helpers.css.cjs");
7
+ const styles_themes_momotaro_components_transitions_cjs = require("./transitions.cjs");
8
+ const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
9
+ fileScope.setFileScope("src/themes/momotaro/components/checkbox.css.ts?used", "blocks");
10
+ const checkbox = styles_lib_theme_makeComponentTheme_cjs.makeComponentTheme("checkbox", {
11
+ base: css.style([{
12
+ display: "flex",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ width: 24,
16
+ height: 24,
17
+ transition: `transform ${styles_lib_theme_vars_css_cjs.vars.transition.fast}`,
18
+ transitionProperty: "background-color",
19
+ ":hover": {
20
+ backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.primaryDark
21
+ },
22
+ selectors: {
23
+ "&:has(input:checked):not(:hover)": {
24
+ backgroundColor: styles_lib_theme_vars_css_cjs.vars.color.primary
25
+ }
26
+ }
27
+ }, styles_lib_css_atoms_sprinkles_css_cjs.atoms({
28
+ backgroundColor: "primaryLight",
29
+ borderRadius: "small"
30
+ }), styles_themes_momotaro_components_helpers_css_cjs.focusable], "checkbox_base"),
31
+ icon: css.style({
32
+ height: 12,
33
+ width: 12,
34
+ backgroundColor: "white",
35
+ borderRadius: "8px",
36
+ transform: "scale(0)",
37
+ transition: `transform ${styles_lib_theme_vars_css_cjs.vars.transition.normal} ${styles_themes_momotaro_components_transitions_cjs.bounceOut}`,
38
+ selectors: {
39
+ "input:checked ~ &": {
40
+ transform: "scale(1)"
41
+ }
42
+ }
43
+ }, "checkbox_icon"),
44
+ label: styles_lib_css_atoms_sprinkles_css_cjs.atoms({
45
+ display: "flex",
46
+ flexDirection: "row",
47
+ padding: "xsmall",
48
+ gap: "medium",
49
+ cursor: "pointer"
50
+ })
51
+ });
52
+ fileScope.endFileScope();
53
+ exports.checkbox = checkbox;
@@ -0,0 +1,54 @@
1
+ import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
2
+ import { style } from "@vanilla-extract/css";
3
+ import { makeComponentTheme } from "../../../lib/theme/makeComponentTheme.mjs";
4
+ import { vars } from "../../../lib/theme/vars.css.mjs";
5
+ import { focusable } from "./helpers.css.mjs";
6
+ import { bounceOut } from "./transitions.mjs";
7
+ import { atoms } from "../../../lib/css/atoms/sprinkles.css.mjs";
8
+ setFileScope("src/themes/momotaro/components/checkbox.css.ts?used", "blocks");
9
+ const checkbox = makeComponentTheme("checkbox", {
10
+ base: style([{
11
+ display: "flex",
12
+ alignItems: "center",
13
+ justifyContent: "center",
14
+ width: 24,
15
+ height: 24,
16
+ transition: `transform ${vars.transition.fast}`,
17
+ transitionProperty: "background-color",
18
+ ":hover": {
19
+ backgroundColor: vars.color.primaryDark
20
+ },
21
+ selectors: {
22
+ "&:has(input:checked):not(:hover)": {
23
+ backgroundColor: vars.color.primary
24
+ }
25
+ }
26
+ }, atoms({
27
+ backgroundColor: "primaryLight",
28
+ borderRadius: "small"
29
+ }), focusable], "checkbox_base"),
30
+ icon: style({
31
+ height: 12,
32
+ width: 12,
33
+ backgroundColor: "white",
34
+ borderRadius: "8px",
35
+ transform: "scale(0)",
36
+ transition: `transform ${vars.transition.normal} ${bounceOut}`,
37
+ selectors: {
38
+ "input:checked ~ &": {
39
+ transform: "scale(1)"
40
+ }
41
+ }
42
+ }, "checkbox_icon"),
43
+ label: atoms({
44
+ display: "flex",
45
+ flexDirection: "row",
46
+ padding: "xsmall",
47
+ gap: "medium",
48
+ cursor: "pointer"
49
+ })
50
+ });
51
+ endFileScope();
52
+ export {
53
+ checkbox
54
+ };
@@ -14,6 +14,19 @@ const focusable = css.style({
14
14
  ":disabled": {
15
15
  opacity: 0.5,
16
16
  cursor: "auto"
17
+ },
18
+ selectors: {
19
+ "&:has(input:focus-visible)": {
20
+ outline: "2px solid transparent",
21
+ outlineOffset: "2px",
22
+ boxShadow: styles_lib_theme_vars_css_cjs.vars.focus.boxShadow,
23
+ transitionDuration: styles_lib_theme_vars_css_cjs.vars.transition.fast,
24
+ transitionProperty: "box-shadow"
25
+ },
26
+ "&:has(input:disabled)": {
27
+ opacity: 0.5,
28
+ cursor: "auto"
29
+ }
17
30
  }
18
31
  }, "focusable");
19
32
  const clickable = css.style([focusable, {
@@ -13,6 +13,19 @@ const focusable = style({
13
13
  ":disabled": {
14
14
  opacity: 0.5,
15
15
  cursor: "auto"
16
+ },
17
+ selectors: {
18
+ "&:has(input:focus-visible)": {
19
+ outline: "2px solid transparent",
20
+ outlineOffset: "2px",
21
+ boxShadow: vars.focus.boxShadow,
22
+ transitionDuration: vars.transition.fast,
23
+ transitionProperty: "box-shadow"
24
+ },
25
+ "&:has(input:disabled)": {
26
+ opacity: 0.5,
27
+ cursor: "auto"
28
+ }
16
29
  }
17
30
  }, "focusable");
18
31
  const clickable = style([focusable, {
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  const styles_themes_momotaro_components_button_css_cjs = require("./button.css.cjs");
3
+ const styles_themes_momotaro_components_checkbox_css_cjs = require("./checkbox.css.cjs");
3
4
  const styles_themes_momotaro_components_dialog_css_cjs = require("./dialog.css.cjs");
4
5
  const styles_themes_momotaro_components_divider_css_cjs = require("./divider.css.cjs");
5
6
  const styles_themes_momotaro_components_input_css_cjs = require("./input.css.cjs");
7
+ const styles_themes_momotaro_components_label_css_cjs = require("./label.css.cjs");
6
8
  const styles_themes_momotaro_components_link_css_cjs = require("./link.css.cjs");
9
+ const styles_themes_momotaro_components_radio_css_cjs = require("./radio.css.cjs");
7
10
  const styles_themes_momotaro_components_spinner_css_cjs = require("./spinner.css.cjs");
8
11
  const components = {
9
12
  button: styles_themes_momotaro_components_button_css_cjs.button,
@@ -11,6 +14,9 @@ const components = {
11
14
  spinner: styles_themes_momotaro_components_spinner_css_cjs.spinner,
12
15
  divider: styles_themes_momotaro_components_divider_css_cjs.divider,
13
16
  dialog: styles_themes_momotaro_components_dialog_css_cjs.dialog,
14
- input: styles_themes_momotaro_components_input_css_cjs.input
17
+ input: styles_themes_momotaro_components_input_css_cjs.input,
18
+ checkbox: styles_themes_momotaro_components_checkbox_css_cjs.checkbox,
19
+ radio: styles_themes_momotaro_components_radio_css_cjs.radio,
20
+ label: styles_themes_momotaro_components_label_css_cjs.label
15
21
  };
16
22
  exports.components = components;
@@ -1,8 +1,11 @@
1
1
  import { button } from "./button.css.mjs";
2
+ import { checkbox } from "./checkbox.css.mjs";
2
3
  import { dialog } from "./dialog.css.mjs";
3
4
  import { divider } from "./divider.css.mjs";
4
5
  import { input } from "./input.css.mjs";
6
+ import { label } from "./label.css.mjs";
5
7
  import { link } from "./link.css.mjs";
8
+ import { radio } from "./radio.css.mjs";
6
9
  import { spinner } from "./spinner.css.mjs";
7
10
  const components = {
8
11
  button,
@@ -10,7 +13,10 @@ const components = {
10
13
  spinner,
11
14
  divider,
12
15
  dialog,
13
- input
16
+ input,
17
+ checkbox,
18
+ radio,
19
+ label
14
20
  };
15
21
  export {
16
22
  components