@blockle/blocks 0.8.8 → 0.8.10

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 (90) hide show
  1. package/dist/index.cjs +79 -738
  2. package/dist/index.d.mts +1 -0
  3. package/dist/index.mjs +58 -716
  4. package/dist/momotaro.chunk.d.ts +159 -146
  5. package/dist/reset.css.d.mts +2 -0
  6. package/dist/reset.css.d.ts +1 -1
  7. package/dist/styles/components/display/Divider/Divider.cjs +226 -0
  8. package/dist/styles/components/display/Divider/Divider.mjs +227 -0
  9. package/dist/styles/components/{Divider → display/Divider}/divider.css.cjs +2 -2
  10. package/dist/styles/components/{Divider → display/Divider}/divider.css.mjs +2 -2
  11. package/dist/styles/components/form/Button/Button.cjs +55 -0
  12. package/dist/styles/components/{Button → form/Button}/Button.css.cjs +2 -2
  13. package/dist/styles/components/{Button → form/Button}/Button.css.mjs +2 -2
  14. package/dist/styles/components/form/Button/Button.mjs +56 -0
  15. package/dist/styles/components/form/Checkbox/Checkbox.cjs +47 -0
  16. package/dist/styles/components/form/Checkbox/Checkbox.mjs +48 -0
  17. package/dist/styles/components/{Checkbox → form/Checkbox}/checkbox.css.cjs +2 -2
  18. package/dist/styles/components/{Checkbox → form/Checkbox}/checkbox.css.mjs +2 -2
  19. package/dist/styles/components/form/Input/Input.cjs +27 -0
  20. package/dist/styles/components/form/Input/Input.mjs +28 -0
  21. package/dist/styles/components/{Input → form/Input}/input.css.cjs +2 -2
  22. package/dist/styles/components/{Input → form/Input}/input.css.mjs +2 -2
  23. package/dist/styles/components/form/Radio/Radio.cjs +23 -0
  24. package/dist/styles/components/form/Radio/Radio.mjs +24 -0
  25. package/dist/styles/components/{Radio → form/Radio}/radio.css.cjs +2 -2
  26. package/dist/styles/components/{Radio → form/Radio}/radio.css.mjs +2 -2
  27. package/dist/styles/components/form/Switch/Switch.cjs +61 -0
  28. package/dist/styles/components/form/Switch/Switch.mjs +62 -0
  29. package/dist/styles/components/{Switch → form/Switch}/switch.css.cjs +2 -2
  30. package/dist/styles/components/{Switch → form/Switch}/switch.css.mjs +2 -2
  31. package/dist/styles/components/other/BlocksProvider/BlocksProvider.cjs +20 -0
  32. package/dist/styles/components/other/BlocksProvider/BlocksProvider.mjs +21 -0
  33. package/dist/styles/components/overlay/Dialog/Dialog.cjs +245 -0
  34. package/dist/styles/components/overlay/Dialog/Dialog.mjs +246 -0
  35. package/dist/styles/components/{Dialog → overlay/Dialog}/dialog.css.cjs +2 -2
  36. package/dist/styles/components/{Dialog → overlay/Dialog}/dialog.css.mjs +2 -2
  37. package/dist/styles/components/typography/Heading/Heading.cjs +14 -0
  38. package/dist/styles/components/typography/Heading/Heading.mjs +15 -0
  39. package/dist/styles/components/{Heading → typography/Heading}/heading.css.cjs +2 -2
  40. package/dist/styles/components/{Heading → typography/Heading}/heading.css.mjs +2 -2
  41. package/dist/styles/components/typography/Text/Text.cjs +9 -0
  42. package/dist/styles/components/typography/Text/Text.mjs +10 -0
  43. package/dist/styles/components/{Text → typography/Text}/text.css.cjs +2 -2
  44. package/dist/styles/components/{Text → typography/Text}/text.css.mjs +2 -2
  45. package/dist/styles/lib/css/atoms/atoms.cjs +1 -0
  46. package/dist/styles/lib/css/atoms/atoms.mjs +1 -0
  47. package/dist/styles/lib/css/atoms/sprinkles.css.cjs +2 -6
  48. package/dist/styles/lib/css/atoms/sprinkles.css.mjs +2 -6
  49. package/dist/styles/lib/css/layers/layers.css.cjs +1 -1
  50. package/dist/styles/lib/css/layers/layers.css.mjs +1 -1
  51. package/dist/styles/lib/theme/vars.css.cjs +1 -1
  52. package/dist/styles/lib/theme/vars.css.mjs +1 -1
  53. package/dist/styles/lib/utils/atom-props.cjs +15 -0
  54. package/dist/styles/lib/utils/atom-props.mjs +16 -0
  55. package/dist/styles/themes/momotaro/components/button.css.cjs +1 -1
  56. package/dist/styles/themes/momotaro/components/button.css.mjs +1 -1
  57. package/dist/styles/themes/momotaro/components/checkbox.css.cjs +1 -1
  58. package/dist/styles/themes/momotaro/components/checkbox.css.mjs +1 -1
  59. package/dist/styles/themes/momotaro/components/dialog.css.cjs +1 -1
  60. package/dist/styles/themes/momotaro/components/dialog.css.mjs +1 -1
  61. package/dist/styles/themes/momotaro/components/divider.css.cjs +1 -1
  62. package/dist/styles/themes/momotaro/components/divider.css.mjs +1 -1
  63. package/dist/styles/themes/momotaro/components/dropdown.css.cjs +54 -0
  64. package/dist/styles/themes/momotaro/components/dropdown.css.mjs +55 -0
  65. package/dist/styles/themes/momotaro/components/helpers.css.cjs +1 -1
  66. package/dist/styles/themes/momotaro/components/helpers.css.mjs +1 -1
  67. package/dist/styles/themes/momotaro/components/index.cjs +2 -0
  68. package/dist/styles/themes/momotaro/components/index.mjs +2 -0
  69. package/dist/styles/themes/momotaro/components/input.css.cjs +1 -1
  70. package/dist/styles/themes/momotaro/components/input.css.mjs +1 -1
  71. package/dist/styles/themes/momotaro/components/label.css.cjs +1 -1
  72. package/dist/styles/themes/momotaro/components/label.css.mjs +1 -1
  73. package/dist/styles/themes/momotaro/components/link.css.cjs +1 -1
  74. package/dist/styles/themes/momotaro/components/link.css.mjs +1 -1
  75. package/dist/styles/themes/momotaro/components/progress.css.cjs +1 -1
  76. package/dist/styles/themes/momotaro/components/progress.css.mjs +1 -1
  77. package/dist/styles/themes/momotaro/components/radio.css.cjs +1 -1
  78. package/dist/styles/themes/momotaro/components/radio.css.mjs +1 -1
  79. package/dist/styles/themes/momotaro/components/spinner.css.cjs +1 -1
  80. package/dist/styles/themes/momotaro/components/spinner.css.mjs +1 -1
  81. package/dist/styles/themes/momotaro/components/switch.css.cjs +1 -1
  82. package/dist/styles/themes/momotaro/components/switch.css.mjs +1 -1
  83. package/dist/styles/themes/momotaro/index.cjs +1 -0
  84. package/dist/styles/themes/momotaro/index.mjs +1 -0
  85. package/dist/styles/themes/momotaro/momotaro.css.cjs +1 -1
  86. package/dist/styles/themes/momotaro/momotaro.css.mjs +1 -1
  87. package/dist/styles/themes/momotaro/tokens.css.cjs +1 -1
  88. package/dist/styles/themes/momotaro/tokens.css.mjs +1 -1
  89. package/dist/themes/momotaro.d.mts +1 -0
  90. package/package.json +47 -37
@@ -1,7 +1,7 @@
1
1
  import { StyleRule } from '@vanilla-extract/css';
2
- import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
3
2
  import * as react from 'react';
4
3
  import react__default, { useEffect } from 'react';
4
+ import * as _vanilla_extract_sprinkles from '@vanilla-extract/sprinkles';
5
5
 
6
6
  declare const atoms: ((props: {
7
7
  readonly backgroundColor?: "white" | "black" | "body" | "primaryLight" | "primary" | "primaryDark" | "secondaryLight" | "secondary" | "secondaryDark" | "text" | "textLight" | "textDark" | "danger" | "link" | "currentColor" | undefined;
@@ -374,6 +374,12 @@ type SwitchTheme = {
374
374
  base: string;
375
375
  slider: string;
376
376
  };
377
+ type DropdownTheme = {
378
+ base: string;
379
+ variants: {
380
+ variant: 'solid' | 'outline';
381
+ };
382
+ };
377
383
  type ComponentThemes = {
378
384
  button: ButtonTheme;
379
385
  checkbox: CheckboxTheme;
@@ -386,6 +392,7 @@ type ComponentThemes = {
386
392
  radio: RadioTheme;
387
393
  spinner: SpinnerTheme;
388
394
  switch: SwitchTheme;
395
+ dropdown: DropdownTheme;
389
396
  };
390
397
  /**
391
398
  * ComponentThemeProps is a helper type to define the props passed to useComponentStyles.
@@ -567,16 +574,127 @@ declare const vars: {
567
574
  };
568
575
  };
569
576
 
570
- type BlocksProviderProps = {
571
- children: React.ReactNode;
572
- theme: Theme;
577
+ type DividerProps = {
573
578
  className?: string;
579
+ color?: Atoms['backgroundColor'];
574
580
  style?: React.CSSProperties;
575
581
  };
576
- declare const BlocksProvider: React.FC<BlocksProviderProps>;
582
+ declare const Divider: React.FC<DividerProps>;
583
+
584
+ type ProgressProps = {
585
+ /**
586
+ * The value of the progress bar, between 0 and 100.
587
+ * If undefined, the progress bar will be indeterminate.
588
+ */
589
+ value?: number;
590
+ max?: number;
591
+ className?: string;
592
+ style?: React.CSSProperties;
593
+ 'aria-labelledby'?: string;
594
+ };
595
+ declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLProgressElement>>;
596
+
597
+ type SpinnerProps = {
598
+ className?: string;
599
+ color?: SpinnerTheme['variants']['color'];
600
+ size?: SpinnerTheme['variants']['size'];
601
+ style?: React.CSSProperties;
602
+ } & MarginAtoms;
603
+ declare const Spinner: React.FC<SpinnerProps>;
577
604
 
578
605
  type HTMLElementProps<E extends Element> = Omit<React.HTMLProps<E>, keyof Atoms | 'as' | 'ref'>;
579
606
 
607
+ type ButtonProps = {
608
+ children: React.ReactNode;
609
+ type?: 'button' | 'submit' | 'reset';
610
+ variant?: ButtonTheme['variants']['variant'];
611
+ intent?: ButtonTheme['variants']['intent'];
612
+ size?: ButtonTheme['variants']['size'];
613
+ width?: Atoms['width'];
614
+ alignSelf?: Atoms['alignSelf'];
615
+ loading?: boolean;
616
+ startSlot?: React.ReactNode;
617
+ endSlot?: React.ReactNode;
618
+ disabled?: boolean;
619
+ asChild?: boolean;
620
+ } & Omit<HTMLElementProps<HTMLButtonElement>, 'size'> & MarginAtoms;
621
+ declare const Button: react.ForwardRefExoticComponent<{
622
+ children: React.ReactNode;
623
+ type?: "button" | "reset" | "submit" | undefined;
624
+ variant?: "outline" | "solid" | "ghost" | undefined;
625
+ intent?: "danger" | "neutral" | undefined;
626
+ size?: "small" | "medium" | "large" | undefined;
627
+ width?: Atoms['width'];
628
+ alignSelf?: Atoms['alignSelf'];
629
+ loading?: boolean | undefined;
630
+ startSlot?: React.ReactNode;
631
+ endSlot?: React.ReactNode;
632
+ disabled?: boolean | undefined;
633
+ asChild?: boolean | undefined;
634
+ } & Omit<HTMLElementProps<HTMLButtonElement>, "size"> & MarginAtoms & react.RefAttributes<HTMLButtonElement>>;
635
+
636
+ type CheckboxProps = {
637
+ name: string;
638
+ label?: react__default.ReactNode;
639
+ required?: boolean;
640
+ } & HTMLElementProps<HTMLInputElement>;
641
+ declare const Checkbox: react__default.ForwardRefExoticComponent<{
642
+ name: string;
643
+ label?: react__default.ReactNode;
644
+ required?: boolean | undefined;
645
+ } & HTMLElementProps<HTMLInputElement> & react__default.RefAttributes<HTMLInputElement>>;
646
+
647
+ type InputProps = {
648
+ className?: string;
649
+ name: string;
650
+ type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
651
+ startSlot?: React.ReactNode;
652
+ endSlot?: React.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?: React.ReactNode;
660
+ endSlot?: React.ReactNode;
661
+ label: string;
662
+ } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
663
+
664
+ type LabelProps = {
665
+ /**
666
+ * If true, the label will be rendered as a span element
667
+ * but will still have the same styles as a label.
668
+ * Useful for when you want to use a label element but
669
+ * can't because of the parent element's structure.
670
+ */
671
+ asSpan?: boolean;
672
+ htmlFor?: string;
673
+ children?: React.ReactNode;
674
+ required?: boolean;
675
+ size?: LabelTheme['variants']['size'];
676
+ cursor?: Atoms['cursor'];
677
+ } & HTMLElementProps<HTMLLabelElement>;
678
+ declare const Label: React.FC<LabelProps>;
679
+
680
+ type RadioProps = {
681
+ name: string;
682
+ value: string;
683
+ children?: React.ReactNode;
684
+ } & HTMLElementProps<HTMLInputElement>;
685
+ declare const Radio: react.ForwardRefExoticComponent<{
686
+ name: string;
687
+ value: string;
688
+ children?: React.ReactNode;
689
+ } & HTMLElementProps<HTMLInputElement> & react.RefAttributes<HTMLInputElement>>;
690
+
691
+ type SwitchProps = {
692
+ onChange?: (value: boolean) => void;
693
+ } & Omit<HTMLElementProps<HTMLInputElement>, 'onChange'>;
694
+ declare const Switch: react.ForwardRefExoticComponent<{
695
+ onChange?: ((value: boolean) => void) | undefined;
696
+ } & Omit<HTMLElementProps<HTMLInputElement>, "onChange"> & react.RefAttributes<HTMLInputElement>>;
697
+
580
698
  type BoxProps = {
581
699
  children?: React.ReactNode;
582
700
  className?: string;
@@ -818,70 +936,6 @@ declare const Box: react.ForwardRefExoticComponent<{
818
936
  } | undefined) | _vanilla_extract_sprinkles.ResponsiveArray<4 | 1 | 2 | 3, "center" | "flex-start" | "flex-end" | null>;
819
937
  } & HTMLElementProps<HTMLDivElement> & react.RefAttributes<unknown>>;
820
938
 
821
- type ButtonProps = {
822
- children: React.ReactNode;
823
- type?: 'button' | 'submit' | 'reset';
824
- variant?: ButtonTheme['variants']['variant'];
825
- intent?: ButtonTheme['variants']['intent'];
826
- size?: ButtonTheme['variants']['size'];
827
- width?: Atoms['width'];
828
- alignSelf?: Atoms['alignSelf'];
829
- loading?: boolean;
830
- startSlot?: React.ReactNode;
831
- endSlot?: React.ReactNode;
832
- disabled?: boolean;
833
- asChild?: boolean;
834
- } & Omit<HTMLElementProps<HTMLButtonElement>, 'size'> & MarginAtoms;
835
- declare const Button: react.ForwardRefExoticComponent<{
836
- children: React.ReactNode;
837
- type?: "button" | "reset" | "submit" | undefined;
838
- variant?: "outline" | "solid" | "ghost" | undefined;
839
- intent?: "danger" | "neutral" | undefined;
840
- size?: "small" | "medium" | "large" | undefined;
841
- width?: Atoms['width'];
842
- alignSelf?: Atoms['alignSelf'];
843
- loading?: boolean | undefined;
844
- startSlot?: React.ReactNode;
845
- endSlot?: React.ReactNode;
846
- disabled?: boolean | undefined;
847
- asChild?: boolean | undefined;
848
- } & Omit<HTMLElementProps<HTMLButtonElement>, "size"> & MarginAtoms & react.RefAttributes<HTMLButtonElement>>;
849
-
850
- type CheckboxProps = {
851
- name: string;
852
- label?: react__default.ReactNode;
853
- required?: boolean;
854
- } & HTMLElementProps<HTMLInputElement>;
855
- declare const Checkbox: react__default.ForwardRefExoticComponent<{
856
- name: string;
857
- label?: react__default.ReactNode;
858
- required?: boolean | undefined;
859
- } & HTMLElementProps<HTMLInputElement> & react__default.RefAttributes<HTMLInputElement>>;
860
-
861
- type DialogProps = {
862
- children?: React.ReactNode;
863
- open: boolean;
864
- onRequestClose: () => void;
865
- className?: string;
866
- size?: DialogTheme['variants']['size'];
867
- 'aria-label'?: string;
868
- };
869
- declare const Dialog: React.FC<DialogProps>;
870
-
871
- type DividerProps = {
872
- className?: string;
873
- color?: Atoms['backgroundColor'];
874
- style?: React.CSSProperties;
875
- };
876
- declare const Divider: React.FC<DividerProps>;
877
-
878
- type HeadingProps = {
879
- children: React.ReactNode;
880
- className?: string;
881
- level: 1 | 2 | 3 | 4 | 5 | 6;
882
- } & TextAtoms & MarginAtoms & PaddingAtoms & HTMLElementProps<HTMLHeadingElement>;
883
- declare const Heading: React.FC<HeadingProps>;
884
-
885
939
  declare const justifyContentMap: {
886
940
  readonly left: "flex-start";
887
941
  readonly right: "flex-end";
@@ -905,37 +959,26 @@ type InlineProps = {
905
959
  children: React.ReactNode;
906
960
  className?: string;
907
961
  display?: ResponsiveDisplayFlex;
908
- gap: Atoms['gap'];
962
+ spacing: Atoms['gap'];
909
963
  style?: React.CSSProperties;
910
964
  } & MarginAtoms & PaddingAtoms;
911
965
  declare const Inline: React.FC<InlineProps>;
912
966
 
913
- type InputProps = {
967
+ type StackProps = {
968
+ alignX?: keyof AlignItemsMap;
969
+ tag?: 'div' | 'section' | 'ul' | 'ol';
970
+ children: React.ReactNode;
914
971
  className?: string;
915
- name: string;
916
- type?: OptionalLiteral<'email' | 'number' | 'password' | 'tel' | 'text' | 'url'>;
917
- startSlot?: React.ReactNode;
918
- endSlot?: React.ReactNode;
919
- label: string;
920
- } & Omit<HTMLElementProps<HTMLInputElement>, 'type'>;
921
- declare const Input: react.ForwardRefExoticComponent<{
922
- className?: string | undefined;
923
- name: string;
924
- type?: OptionalLiteral<"number" | "text" | "tel" | "url" | "email" | "password"> | undefined;
925
- startSlot?: React.ReactNode;
926
- endSlot?: React.ReactNode;
927
- label: string;
928
- } & Omit<HTMLElementProps<HTMLInputElement>, "type"> & react.RefAttributes<HTMLInputElement>>;
929
-
930
- type LabelProps = {
931
- visualOnly?: boolean;
932
- htmlFor?: string;
933
- children?: React.ReactNode;
934
- required?: boolean;
935
- size?: LabelTheme['variants']['size'];
936
- cursor?: Atoms['cursor'];
937
- } & HTMLElementProps<HTMLLabelElement>;
938
- declare const Label: React.FC<LabelProps>;
972
+ display?: ResponsiveDisplayFlex;
973
+ spacing: Atoms['gap'];
974
+ style?: React.CSSProperties;
975
+ role?: React.AriaRole;
976
+ /**
977
+ * Start prop is only valid when tag="ol"
978
+ */
979
+ start?: number;
980
+ } & MarginAtoms & PaddingAtoms;
981
+ declare const Stack: React.FC<StackProps>;
939
982
 
940
983
  type LinkProps = {
941
984
  asChild?: boolean;
@@ -950,66 +993,36 @@ declare const Link: react.ForwardRefExoticComponent<{
950
993
  variant?: "primary" | "secondary" | "inherit" | undefined;
951
994
  } & MarginAtoms & HTMLElementProps<HTMLAnchorElement> & react.RefAttributes<HTMLAnchorElement>>;
952
995
 
996
+ type BlocksProviderProps = {
997
+ children: React.ReactNode;
998
+ theme: Theme;
999
+ className?: string;
1000
+ style?: React.CSSProperties;
1001
+ };
1002
+ declare const BlocksProvider: React.FC<BlocksProviderProps>;
1003
+
953
1004
  type PortalProps = {
954
1005
  children: React.ReactNode;
955
1006
  container?: HTMLElement;
956
1007
  };
957
1008
  declare const Portal: React.FC<PortalProps>;
958
1009
 
959
- type ProgressProps = {
960
- /**
961
- * The value of the progress bar, between 0 and 100.
962
- * If undefined, the progress bar will be indeterminate.
963
- */
964
- value?: number;
965
- max?: number;
1010
+ type DialogProps = {
1011
+ children?: React.ReactNode;
1012
+ open: boolean;
1013
+ onRequestClose: () => void;
966
1014
  className?: string;
967
- style?: React.CSSProperties;
968
- 'aria-labelledby'?: string;
1015
+ size?: DialogTheme['variants']['size'];
1016
+ 'aria-label'?: string;
969
1017
  };
970
- declare const Progress: react.ForwardRefExoticComponent<ProgressProps & react.RefAttributes<HTMLProgressElement>>;
971
-
972
- type RadioProps = {
973
- name: string;
974
- value: string;
975
- label?: React.ReactNode;
976
- } & HTMLElementProps<HTMLInputElement>;
977
- declare const Radio: react.ForwardRefExoticComponent<{
978
- name: string;
979
- value: string;
980
- label?: React.ReactNode;
981
- } & HTMLElementProps<HTMLInputElement> & react.RefAttributes<HTMLInputElement>>;
982
-
983
- type SpinnerProps = {
984
- className?: string;
985
- color?: SpinnerTheme['variants']['color'];
986
- size?: SpinnerTheme['variants']['size'];
987
- style?: React.CSSProperties;
988
- } & MarginAtoms;
989
- declare const Spinner: React.FC<SpinnerProps>;
1018
+ declare const Dialog: React.FC<DialogProps>;
990
1019
 
991
- type StackProps = {
992
- alignX?: keyof AlignItemsMap;
993
- tag?: 'div' | 'section' | 'ul' | 'ol';
1020
+ type HeadingProps = {
994
1021
  children: React.ReactNode;
995
1022
  className?: string;
996
- display?: ResponsiveDisplayFlex;
997
- gap: Atoms['gap'];
998
- style?: React.CSSProperties;
999
- role?: React.AriaRole;
1000
- /**
1001
- * Start prop is only valid when tag="ol"
1002
- */
1003
- start?: number;
1004
- } & MarginAtoms & PaddingAtoms;
1005
- declare const Stack: React.FC<StackProps>;
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>>;
1023
+ level: 1 | 2 | 3 | 4 | 5 | 6;
1024
+ } & TextAtoms & MarginAtoms & PaddingAtoms & HTMLElementProps<HTMLHeadingElement>;
1025
+ declare const Heading: React.FC<HeadingProps>;
1013
1026
 
1014
1027
  type TextProps = {
1015
1028
  children: React.ReactNode;
@@ -1050,7 +1063,7 @@ type UseKeyboardOptions = {
1050
1063
  enabled?: boolean;
1051
1064
  type?: 'keydown' | 'keyup';
1052
1065
  };
1053
- declare const useKeyboard: (key: string, callback: () => void, { enabled, type }?: UseKeyboardOptions) => void;
1066
+ declare const useKeyboard: (key: KeyboardEvent['key'], callback: () => void, { enabled, type }?: UseKeyboardOptions) => void;
1054
1067
 
1055
1068
  declare const usePreventBodyScroll: (enabled?: boolean) => void;
1056
1069
 
@@ -1059,4 +1072,4 @@ declare const classnames: (...args: Args[]) => string | undefined;
1059
1072
 
1060
1073
  declare const momotaro: Theme;
1061
1074
 
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 };
1075
+ export { BlocksProvider, type BlocksProviderProps, Box, type BoxProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Dialog, type DialogProps, Divider, type DividerProps, Heading, type HeadingProps, Inline, type InlineProps, Input, type InputProps, Label, type LabelProps, Link, type LinkProps, Portal, type PortalProps, Progress, type ProgressProps, Radio, type RadioProps, Slot, Spinner, type SpinnerProps, Stack, type StackProps, Switch, type SwitchProps, Text, type TextProps, type ThemeComponentsStyles, type ThemeTokens, atoms, breakpointQuery, classnames, createSlottable, makeComponentTheme, makeTheme, momotaro, style, useComponentStyleDefaultProps, useComponentStyles, useIsomorphicLayoutEffect, useKeyboard, usePreventBodyScroll, vars };
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -1,2 +1,2 @@
1
1
 
2
- export { }
2
+ export { }
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const styles_components_display_Divider_divider_css_cjs = require("./divider.css.cjs");
4
+ const react = require("react");
5
+ const styles_lib_utils_atomProps_cjs = require("../../../lib/utils/atom-props.cjs");
6
+ const styles_lib_css_atoms_sprinkles_css_cjs = require("../../../lib/css/atoms/sprinkles.css.cjs");
7
+ const BlocksProviderContext = react.createContext(null);
8
+ const useTheme = () => {
9
+ const theme = react.useContext(BlocksProviderContext);
10
+ if (!theme) {
11
+ throw new Error("useTheme must be used within a BlocksProvider");
12
+ }
13
+ return theme;
14
+ };
15
+ function useComponentStyles(name, props, useDefaultVariants = true) {
16
+ const { components } = useTheme();
17
+ const component = components[name];
18
+ if (!component) {
19
+ console.warn(`Component ${name} is not defined in the theme`);
20
+ return "";
21
+ }
22
+ const classNames = [];
23
+ const variants = props.variants ?? {};
24
+ const variantsWithDefaults = { ...variants };
25
+ for (const key in props) {
26
+ const value = props[key];
27
+ if (typeof value === "boolean" && value) {
28
+ classNames.push(component[key]);
29
+ }
30
+ }
31
+ if (!component.variants) {
32
+ return classNames.join(" ");
33
+ }
34
+ const { defaultVariants } = component;
35
+ if (useDefaultVariants && defaultVariants) {
36
+ const keys2 = Object.keys(defaultVariants);
37
+ for (const key of keys2) {
38
+ if (variantsWithDefaults[key] === void 0 && defaultVariants[key]) {
39
+ variantsWithDefaults[key] = defaultVariants[key];
40
+ }
41
+ }
42
+ }
43
+ const keys = Object.keys(variantsWithDefaults);
44
+ const componentVariants = component.variants;
45
+ for (const key of keys) {
46
+ const value = variantsWithDefaults[key];
47
+ if (value === void 0 || componentVariants[key] === void 0) {
48
+ continue;
49
+ }
50
+ if (typeof value === "boolean") {
51
+ if (value && componentVariants[key]) {
52
+ classNames.push(componentVariants[key]);
53
+ }
54
+ continue;
55
+ }
56
+ const variant = componentVariants[key][value];
57
+ if (variant) {
58
+ classNames.push(variant);
59
+ }
60
+ }
61
+ const { compoundVariants } = component;
62
+ if (compoundVariants) {
63
+ for (const compoundVariant of compoundVariants) {
64
+ const keys2 = Object.keys(compoundVariant.variants);
65
+ const matches = keys2.every((key) => {
66
+ const value = variantsWithDefaults[key];
67
+ if (value === void 0) {
68
+ return false;
69
+ }
70
+ return value === compoundVariant.variants[key];
71
+ });
72
+ if (matches) {
73
+ classNames.push(compoundVariant.style);
74
+ }
75
+ }
76
+ }
77
+ return classNames.join(" ");
78
+ }
79
+ const useComponentStyleDefaultProps = (name) => {
80
+ const { components } = useTheme();
81
+ const component = components[name];
82
+ if (!component) {
83
+ return {};
84
+ }
85
+ return component.defaultVariants ?? {};
86
+ };
87
+ const classnames = (...args) => {
88
+ const className = args.filter((arg) => arg && typeof arg === "string").join(" ");
89
+ return className || void 0;
90
+ };
91
+ function setRef(ref, value) {
92
+ if (typeof ref === "function") {
93
+ ref(value);
94
+ } else if (ref !== null && ref !== void 0) {
95
+ ref.current = value;
96
+ }
97
+ }
98
+ function composeRefs(...refs) {
99
+ return (node) => {
100
+ for (const ref of refs) {
101
+ setRef(ref, node);
102
+ }
103
+ };
104
+ }
105
+ function mergeProps(slotProps, childProps) {
106
+ const overrideProps = {};
107
+ for (const propName in childProps) {
108
+ const slotPropValue = slotProps[propName];
109
+ const childPropValue = childProps[propName];
110
+ if (childPropValue === void 0) {
111
+ continue;
112
+ }
113
+ if (slotPropValue === void 0) {
114
+ overrideProps[propName] = childPropValue;
115
+ continue;
116
+ }
117
+ if (typeof slotPropValue === "function" && typeof childPropValue === "function") {
118
+ overrideProps[propName] = (...args) => {
119
+ childPropValue(...args);
120
+ slotPropValue(...args);
121
+ };
122
+ } else if (propName === "style") {
123
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
124
+ } else if (propName === "className") {
125
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
126
+ } else {
127
+ overrideProps[propName] = childPropValue;
128
+ }
129
+ }
130
+ return { ...slotProps, ...overrideProps };
131
+ }
132
+ function createSlottable(defaultElement) {
133
+ function Slottable2(props, ref) {
134
+ const { asChild, children, ...slotProps } = props;
135
+ const Component = defaultElement;
136
+ if (!asChild) {
137
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...slotProps, children });
138
+ }
139
+ const childrenArray = react.Children.toArray(children);
140
+ const slot = childrenArray.find((child) => {
141
+ if (!react.isValidElement(child)) {
142
+ return false;
143
+ }
144
+ return child.type === Slot;
145
+ });
146
+ if (!slot) {
147
+ const Slot2 = childrenArray[0];
148
+ if (!react.isValidElement(childrenArray[0])) {
149
+ if (process.env.NODE_ENV === "development") {
150
+ console.warn("Slottable: First child is not a valid React element");
151
+ }
152
+ return null;
153
+ }
154
+ if (!react.isValidElement(Slot2)) {
155
+ return null;
156
+ }
157
+ return react.cloneElement(
158
+ Slot2,
159
+ {
160
+ ...mergeProps(slotProps, Slot2.props),
161
+ ref: composeRefs(ref, Slot2.ref)
162
+ },
163
+ Slot2.props.children
164
+ );
165
+ }
166
+ if (!react.isValidElement(slot) || !react.isValidElement(slot.props.children)) {
167
+ return null;
168
+ }
169
+ const newChildren = childrenArray.map((child) => {
170
+ if (!react.isValidElement(child)) {
171
+ return child;
172
+ }
173
+ if (child.type === Slot) {
174
+ return slot.props.children.props.children;
175
+ }
176
+ return child;
177
+ });
178
+ return react.cloneElement(
179
+ slot.props.children,
180
+ {
181
+ ...mergeProps(slotProps, slot.props),
182
+ ref: composeRefs(ref, slot.props.children.ref)
183
+ },
184
+ newChildren
185
+ );
186
+ }
187
+ return react.forwardRef(Slottable2);
188
+ }
189
+ const Slot = ({ children }) => children;
190
+ const Slottable = createSlottable("div");
191
+ const Box = react.forwardRef(function Box2({ asChild, className, children, ...restProps }, ref) {
192
+ const [atomsProps, otherProps] = styles_lib_utils_atomProps_cjs.getAtomsAndProps(restProps);
193
+ return /* @__PURE__ */ jsxRuntime.jsx(
194
+ Slottable,
195
+ {
196
+ ref,
197
+ asChild,
198
+ className: classnames(className, styles_lib_css_atoms_sprinkles_css_cjs.atoms(atomsProps)),
199
+ ...otherProps,
200
+ children
201
+ }
202
+ );
203
+ });
204
+ const Divider = ({ className, color, ...restProps }) => {
205
+ const dividerClass = useComponentStyles("divider", { base: true });
206
+ const dividerDefaults = useComponentStyleDefaultProps("divider");
207
+ return /* @__PURE__ */ jsxRuntime.jsx(
208
+ Box,
209
+ {
210
+ role: "separator",
211
+ width: "full",
212
+ backgroundColor: color ?? dividerDefaults.color,
213
+ className: classnames(className, dividerClass, styles_components_display_Divider_divider_css_cjs.divider),
214
+ ...restProps
215
+ }
216
+ );
217
+ };
218
+ exports.BlocksProviderContext = BlocksProviderContext;
219
+ exports.Box = Box;
220
+ exports.Divider = Divider;
221
+ exports.Slot = Slot;
222
+ exports.classnames = classnames;
223
+ exports.createSlottable = createSlottable;
224
+ exports.useComponentStyleDefaultProps = useComponentStyleDefaultProps;
225
+ exports.useComponentStyles = useComponentStyles;
226
+ exports.useTheme = useTheme;