@kalink-ui/seedly 0.34.4 → 0.35.0

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 (144) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +34 -0
  3. package/docs/component-theming.md +295 -0
  4. package/docs/theming-strategy.md +69 -0
  5. package/docs/tone-system.md +139 -0
  6. package/docs/value-and-scope.md +65 -0
  7. package/package.json +4 -3
  8. package/src/components/alert-dialog/alert-dialog-action.tsx +0 -2
  9. package/src/components/alert-dialog/alert-dialog-cancel.tsx +0 -1
  10. package/src/components/alert-dialog/alert-dialog-content.css.ts +1 -1
  11. package/src/components/alert-dialog/alert-dialog-content.tsx +13 -6
  12. package/src/components/alert-dialog/alert-dialog-footer.css.ts +3 -3
  13. package/src/components/alert-dialog/alert-dialog-footer.tsx +2 -2
  14. package/src/components/alert-dialog/alert-dialog-header.tsx +4 -4
  15. package/src/components/alert-dialog/index.ts +9 -0
  16. package/src/components/box/box.css.ts +137 -39
  17. package/src/components/box/box.responsive.ts +2 -2
  18. package/src/components/box/box.tsx +2 -3
  19. package/src/components/box/index.ts +1 -1
  20. package/src/components/button/button.css.ts +142 -149
  21. package/src/components/button/button.responsive.ts +2 -2
  22. package/src/components/button/button.tsx +44 -31
  23. package/src/components/button/index.ts +2 -2
  24. package/src/components/button-icon/button-icon.css.ts +26 -62
  25. package/src/components/button-icon/button-icon.responsive.ts +2 -2
  26. package/src/components/button-icon/button-icon.tsx +5 -7
  27. package/src/components/card/card.css.ts +1 -5
  28. package/src/components/card/card.tsx +11 -11
  29. package/src/components/center/center.css.ts +61 -21
  30. package/src/components/center/center.responsive.ts +2 -2
  31. package/src/components/center/center.tsx +4 -6
  32. package/src/components/center/index.ts +1 -1
  33. package/src/components/cluster/cluster.css.ts +37 -99
  34. package/src/components/cluster/cluster.responsive.ts +13 -2
  35. package/src/components/cluster/cluster.tsx +6 -5
  36. package/src/components/cluster/index.ts +5 -1
  37. package/src/components/command/command-empty.tsx +36 -4
  38. package/src/components/command/command-group.css.ts +23 -7
  39. package/src/components/command/command-group.tsx +30 -6
  40. package/src/components/command/command-input.css.ts +2 -2
  41. package/src/components/command/command-item.tsx +26 -2
  42. package/src/components/command/command-list.css.ts +2 -2
  43. package/src/components/command/command-list.responsive.ts +2 -2
  44. package/src/components/command/command-list.tsx +1 -2
  45. package/src/components/command/command-separator.tsx +7 -5
  46. package/src/components/cover/cover.css.ts +29 -8
  47. package/src/components/cover/cover.tsx +13 -13
  48. package/src/components/cover/index.ts +2 -2
  49. package/src/components/divider/divider.css.ts +9 -4
  50. package/src/components/form-field/form-field-context.ts +3 -0
  51. package/src/components/form-field/form-field-item.tsx +3 -3
  52. package/src/components/form-field/form-field-message.tsx +34 -3
  53. package/src/components/form-field/form-field.css.ts +78 -16
  54. package/src/components/form-field/form-field.tsx +5 -0
  55. package/src/components/form-field/index.ts +1 -1
  56. package/src/components/frame/frame.css.ts +96 -59
  57. package/src/components/frame/frame.responsive.ts +9 -0
  58. package/src/components/frame/frame.tsx +11 -5
  59. package/src/components/frame/index.ts +1 -1
  60. package/src/components/grid/grid-child.tsx +14 -10
  61. package/src/components/grid/grid.css.ts +56 -148
  62. package/src/components/grid/grid.tsx +40 -18
  63. package/src/components/grid/index.ts +4 -3
  64. package/src/components/heading/heading.css.ts +4 -4
  65. package/src/components/heading/heading.responsive.ts +6 -6
  66. package/src/components/heading/heading.tsx +3 -4
  67. package/src/components/heading/index.ts +1 -1
  68. package/src/components/input/index.ts +4 -1
  69. package/src/components/input/input-wrapper.tsx +20 -8
  70. package/src/components/input/input.css.ts +121 -93
  71. package/src/components/input/input.responsive.ts +9 -0
  72. package/src/components/input/input.tsx +7 -1
  73. package/src/components/label/label.css.ts +2 -2
  74. package/src/components/label/label.tsx +23 -3
  75. package/src/components/layout-maps.ts +120 -0
  76. package/src/components/loader/index.ts +2 -1
  77. package/src/components/loader/loader.css.ts +91 -54
  78. package/src/components/loader/moon-loader.responsive.ts +2 -2
  79. package/src/components/loader/moon-loader.tsx +4 -5
  80. package/src/components/loader-overlay/loader-overlay.css.ts +3 -3
  81. package/src/components/loader-overlay/loader-overlay.tsx +5 -2
  82. package/src/components/menu/index.ts +2 -2
  83. package/src/components/menu/menu-item.css.ts +102 -46
  84. package/src/components/menu/menu-separator.css.ts +27 -15
  85. package/src/components/menu/menu-separator.responsive.ts +2 -2
  86. package/src/components/overlay/overlay.css.ts +1 -1
  87. package/src/components/popover/index.ts +1 -1
  88. package/src/components/popover/popover-content.css.ts +69 -52
  89. package/src/components/popover/popover-content.tsx +22 -6
  90. package/src/components/scroll-area/scroll-area.css.ts +3 -3
  91. package/src/components/scroll-area/scroll-bar.tsx +2 -2
  92. package/src/components/select/index.ts +4 -5
  93. package/src/components/select/select-content.css.ts +1 -1
  94. package/src/components/select/select-content.tsx +2 -2
  95. package/src/components/select/select-item.tsx +11 -3
  96. package/src/components/select/select-trigger.css.ts +14 -18
  97. package/src/components/select/select-trigger.tsx +18 -8
  98. package/src/components/select/select.tsx +10 -6
  99. package/src/components/sheet/index.ts +9 -0
  100. package/src/components/sheet/sheet-content.css.ts +2 -2
  101. package/src/components/sheet/sheet-content.tsx +25 -7
  102. package/src/components/sheet/sheet-description.tsx +5 -7
  103. package/src/components/sheet/sheet-footer.tsx +3 -1
  104. package/src/components/sheet/sheet-header.css.ts +1 -1
  105. package/src/components/sheet/sheet-header.tsx +3 -3
  106. package/src/components/sheet/sheet-overlay.tsx +3 -4
  107. package/src/components/sheet/sheet-title.tsx +1 -1
  108. package/src/components/sidebar/index.ts +5 -1
  109. package/src/components/sidebar/sidebar.css.ts +35 -9
  110. package/src/components/sidebar/sidebar.tsx +7 -10
  111. package/src/components/skeleton/skeleton.css.ts +23 -14
  112. package/src/components/skeleton/skeleton.tsx +26 -7
  113. package/src/components/stack/index.ts +1 -1
  114. package/src/components/stack/stack.css.ts +18 -46
  115. package/src/components/stack/stack.tsx +1 -2
  116. package/src/components/switcher/index.ts +5 -1
  117. package/src/components/switcher/switcher.css.ts +105 -72
  118. package/src/components/switcher/switcher.responsive.ts +2 -2
  119. package/src/components/switcher/switcher.tsx +5 -5
  120. package/src/components/text/text.css.ts +93 -105
  121. package/src/components/text/text.responsive.ts +3 -63
  122. package/src/components/text/text.tsx +16 -28
  123. package/src/components/text-field/index.ts +1 -2
  124. package/src/components/text-field/text-field.tsx +5 -7
  125. package/src/components/textarea/textarea-input.tsx +30 -3
  126. package/src/components/textarea/textarea.css.ts +12 -7
  127. package/src/components/textarea/textarea.tsx +9 -3
  128. package/src/components/visually-hidden/visually-hidden.css.ts +16 -10
  129. package/src/styles/define-responsive-properties.ts +5 -1
  130. package/src/styles/index.ts +12 -0
  131. package/src/styles/responsive.ts +72 -43
  132. package/src/styles/system-contract.css.ts +22 -3
  133. package/src/styles/theme/sprout-ref.css.ts +107 -0
  134. package/src/styles/theme/sprout.css.ts +259 -0
  135. package/src/styles/tone.ts +69 -0
  136. package/src/styles/typography.responsive.css.ts +35 -0
  137. package/src/styles/typography.responsive.ts +104 -0
  138. package/src/utils/arg-types/index.ts +1 -0
  139. package/src/utils/arg-types/responsive-arg.ts +28 -0
  140. package/src/utils/index.ts +1 -0
  141. package/src/components/command/command-item.css.ts +0 -32
  142. package/src/components/select/select.css.ts +0 -3
  143. package/src/components/sheet/sheet-body.css.ts +0 -68
  144. package/src/components/text-field/text-field.css.ts +0 -3
@@ -9,67 +9,7 @@ import {
9
9
  buttonVariantStyles,
10
10
  } from '../button/button.css';
11
11
 
12
- export const buttonIcon = recipe({
13
- base: [buttonRecipe.classNames.base],
14
-
15
- variants: {
16
- variant: buttonRecipe.classNames.variants.variant,
17
- size: {
18
- sm: [
19
- buttonRecipe.classNames.variants.size.sm,
20
- {
21
- '@layer': {
22
- [overrides]: {
23
- vars: assignVars(buttonVars.spacing, {
24
- block: sys.spacing[2],
25
- inline: sys.spacing[2],
26
- inner: sys.spacing[2],
27
- }),
28
- },
29
- },
30
- },
31
- ],
32
- md: [
33
- buttonRecipe.classNames.variants.size.md,
34
- {
35
- '@layer': {
36
- [overrides]: {
37
- vars: assignVars(buttonVars.spacing, {
38
- block: sys.spacing[2],
39
- inline: sys.spacing[2],
40
- inner: sys.spacing[2],
41
- }),
42
- },
43
- },
44
- },
45
- ],
46
- lg: [
47
- buttonRecipe.classNames.variants.size.lg,
48
- {
49
- '@layer': {
50
- [overrides]: {
51
- vars: assignVars(buttonVars.spacing, {
52
- block: sys.spacing[3],
53
- inline: sys.spacing[3],
54
- inner: sys.spacing[3],
55
- }),
56
- },
57
- },
58
- },
59
- ],
60
- },
61
- },
62
-
63
- defaultVariants: {
64
- variant: 'ghost',
65
- size: 'md',
66
- },
67
- });
68
-
69
- export type ButtonIconVariants = NonNullable<RecipeVariants<typeof buttonIcon>>;
70
-
71
- // Responsive variants
72
- const buttonIconSizeStyles = {
12
+ const buttonIconSizeOverrides = {
73
13
  sm: {
74
14
  '@layer': {
75
15
  [overrides]: {
@@ -105,8 +45,32 @@ const buttonIconSizeStyles = {
105
45
  },
106
46
  } as const;
107
47
 
48
+ const buttonIconSizeStyles = {
49
+ sm: [buttonRecipe.classNames.variants.size.sm, buttonIconSizeOverrides.sm],
50
+ md: [buttonRecipe.classNames.variants.size.md, buttonIconSizeOverrides.md],
51
+ lg: [buttonRecipe.classNames.variants.size.lg, buttonIconSizeOverrides.lg],
52
+ };
53
+
54
+ export const buttonIconRecipe = recipe({
55
+ base: [buttonRecipe.classNames.base],
56
+
57
+ variants: {
58
+ variant: buttonRecipe.classNames.variants.variant,
59
+ size: buttonIconSizeStyles,
60
+ },
61
+
62
+ defaultVariants: {
63
+ variant: 'ghost',
64
+ size: 'md',
65
+ },
66
+ });
67
+
68
+ export type ButtonIconVariants = NonNullable<
69
+ RecipeVariants<typeof buttonIconRecipe>
70
+ >;
71
+
108
72
  export const sizeAt = createResponsiveVariants({
109
- styles: buttonIconSizeStyles,
73
+ styles: buttonIconSizeOverrides,
110
74
  media: defaultMedia,
111
75
  });
112
76
 
@@ -1,9 +1,9 @@
1
1
  import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
2
2
 
3
- import { buttonIcon, sizeAt, variantAt } from './button-icon.css';
3
+ import { buttonIconRecipe, sizeAt, variantAt } from './button-icon.css';
4
4
 
5
5
  export const buttonIconResponsive = responsiveRecipe({
6
- recipe: buttonIcon,
6
+ recipe: buttonIconRecipe,
7
7
  at: { size: sizeAt, variant: variantAt },
8
8
  order: defaultOrder,
9
9
  });
@@ -1,5 +1,4 @@
1
1
  import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
2
- import { clsx } from 'clsx';
3
2
 
4
3
  import { AccessibleIcon } from '../accessible-icon';
5
4
  import { ButtonTypes } from '../button/button';
@@ -9,11 +8,10 @@ import { buttonIconResponsive } from './button-icon.responsive';
9
8
 
10
9
  import type { Responsive } from '../../styles/responsive';
11
10
 
12
- type ButtonIconVariantResponsive = {
13
- [K in keyof ButtonIconVariants]?: Responsive<
14
- NonNullable<ButtonIconVariants[K]>
15
- >;
16
- };
11
+ export interface ButtonIconVariantResponsive {
12
+ size?: Responsive<NonNullable<ButtonIconVariants['size']>>;
13
+ variant?: Responsive<NonNullable<ButtonIconVariants['variant']>>;
14
+ }
17
15
 
18
16
  export type ButtonIconProps<TUse extends ButtonTypes> =
19
17
  PolymorphicComponentProps<TUse> &
@@ -36,7 +34,7 @@ export function ButtonIcon<TUse extends ButtonTypes>(
36
34
 
37
35
  return (
38
36
  <Comp
39
- className={clsx(buttonIconResponsive({ variant, size }), className)}
37
+ className={buttonIconResponsive({ variant, size }, className)}
40
38
  {...(rest as Record<string, unknown>)}
41
39
  >
42
40
  <AccessibleIcon label={label}>{children}</AccessibleIcon>
@@ -1,12 +1,8 @@
1
- import { style } from '@vanilla-extract/css';
2
1
  import { recipe } from '@vanilla-extract/recipes';
3
2
 
4
3
  import { components } from '../../styles/layers.css';
5
4
 
6
- export const card = style({});
7
- export const cardHeader = style({});
8
- export const cardBody = style({});
9
- export const cardFooter = recipe({
5
+ export const cardFooterRecipe = recipe({
10
6
  base: {
11
7
  '@layer': {
12
8
  [components]: {
@@ -2,14 +2,13 @@ import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
2
2
  import { clsx } from 'clsx';
3
3
  import { ElementType } from 'react';
4
4
 
5
- import { Box, Cluster, Stack } from '@kalink-ui/seedly';
6
- import { Spacing } from '@kalink-ui/seedly/styles';
5
+ import { Box, type BoxProps } from '../box';
6
+ import { Cluster, type ClusterProps } from '../cluster';
7
+ import { Stack } from '../stack';
7
8
 
8
- import { BoxProps } from '../box';
9
- import { ClusterProps } from '../cluster';
10
-
11
- import { card, cardBody, cardFooter, cardHeader } from './card.css';
9
+ import { cardFooterRecipe } from './card.css';
12
10
 
11
+ import type { Spacing } from '../../styles';
13
12
  import type { Responsive } from '../../styles/responsive';
14
13
 
15
14
  export type CardRootElement = 'article' | 'div';
@@ -37,7 +36,7 @@ export function Card<TUse extends CardRootElement = 'article'>(
37
36
  use={use as CardProps['use']}
38
37
  variant={variant}
39
38
  spacing={spacing}
40
- className={clsx(card, className)}
39
+ className={className}
41
40
  {...rest}
42
41
  >
43
42
  <Stack align="stretch" spacing={verticalSpacing ?? spacing}>
@@ -52,7 +51,7 @@ Card.Header = function CardHeader<TUse extends ElementType = 'header'>(
52
51
  ) {
53
52
  const { use: Comp = 'header', className, ...rest } = props;
54
53
 
55
- return <Comp className={clsx(cardHeader, className)} {...rest} />;
54
+ return <Comp className={className} {...rest} />;
56
55
  };
57
56
 
58
57
  Card.Body = function CardBody<TUse extends ElementType = 'div'>(
@@ -60,7 +59,7 @@ Card.Body = function CardBody<TUse extends ElementType = 'div'>(
60
59
  ) {
61
60
  const { use: Comp = 'div', className, ...rest } = props;
62
61
 
63
- return <Comp className={clsx(cardBody, className)} {...rest} />;
62
+ return <Comp className={className} {...rest} />;
64
63
  };
65
64
 
66
65
  type CardFooterProps<TUse extends ElementType = 'footer'> = ClusterProps<TUse>;
@@ -68,12 +67,13 @@ type CardFooterProps<TUse extends ElementType = 'footer'> = ClusterProps<TUse>;
68
67
  Card.Footer = function CardFooter<TUse extends ElementType = 'footer'>(
69
68
  props: CardFooterProps<TUse>,
70
69
  ) {
71
- const { use = 'footer', className, ...rest } = props;
70
+ const { use = 'footer', spacing = 2, className, ...rest } = props;
72
71
 
73
72
  return (
74
73
  <Cluster
75
74
  use={use as CardFooterProps['use']}
76
- className={clsx(cardFooter, className)}
75
+ className={clsx(cardFooterRecipe(), className)}
76
+ spacing={spacing}
77
77
  {...rest}
78
78
  />
79
79
  );
@@ -1,4 +1,4 @@
1
- import { createVar } from '@vanilla-extract/css';
1
+ import { assignVars, createThemeContract } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
4
  import {
@@ -9,19 +9,58 @@ import {
9
9
  } from '../../styles';
10
10
  import { components } from '../../styles/layers.css';
11
11
 
12
- export const gutterSize = createVar();
12
+ export const centerVars = createThemeContract({
13
+ spacing: {
14
+ gutters: null,
15
+ },
16
+ layout: {
17
+ measure: null,
18
+ },
19
+ });
20
+
21
+ const centerSpacingDefaults = assignVars(centerVars.spacing, {
22
+ gutters: sys.spacing[0],
23
+ });
24
+
25
+ const centerLayoutDefaults = assignVars(centerVars.layout, {
26
+ measure: sys.layout.measure,
27
+ });
13
28
 
14
29
  // Shared variant style maps to support responsive overrides
15
30
  export const centerGuttersStyles = mapContractVars(sys.spacing, (key) => ({
16
31
  '@layer': {
17
32
  [components]: {
18
33
  vars: {
19
- [gutterSize]: sys.spacing[key],
34
+ ...assignVars(centerVars.spacing, {
35
+ gutters: sys.spacing[key],
36
+ }),
20
37
  },
21
38
  },
22
39
  },
23
40
  }));
24
41
 
42
+ export const centerAndTextStyles = {
43
+ true: {
44
+ '@layer': {
45
+ [components]: {
46
+ textAlign: 'center',
47
+ },
48
+ },
49
+ },
50
+ } as const;
51
+
52
+ export const centerIntrinsicStyles = {
53
+ true: {
54
+ '@layer': {
55
+ [components]: {
56
+ display: 'flex',
57
+ flexDirection: 'column',
58
+ alignItems: 'center',
59
+ },
60
+ },
61
+ },
62
+ } as const;
63
+
25
64
  export const centerRecipe = recipe({
26
65
  base: {
27
66
  '@layer': {
@@ -29,8 +68,13 @@ export const centerRecipe = recipe({
29
68
  display: 'block',
30
69
  boxSizing: 'content-box',
31
70
  marginInline: 'auto',
32
- maxInlineSize: sys.layout.measure,
33
- paddingInline: gutterSize,
71
+ maxInlineSize: centerVars.layout.measure,
72
+ paddingInline: centerVars.spacing.gutters,
73
+
74
+ vars: {
75
+ ...centerSpacingDefaults,
76
+ ...centerLayoutDefaults,
77
+ },
34
78
  },
35
79
  },
36
80
  },
@@ -40,28 +84,14 @@ export const centerRecipe = recipe({
40
84
  * Center align the text too with `text-align: center`
41
85
  */
42
86
  andText: {
43
- true: {
44
- '@layer': {
45
- [components]: {
46
- textAlign: 'center',
47
- },
48
- },
49
- },
87
+ ...centerAndTextStyles,
50
88
  },
51
89
 
52
90
  /**
53
91
  * Center child elements based on their content width
54
92
  */
55
93
  intrinsic: {
56
- true: {
57
- '@layer': {
58
- [components]: {
59
- display: 'flex',
60
- flexDirection: 'column',
61
- alignItems: 'center',
62
- },
63
- },
64
- },
94
+ ...centerIntrinsicStyles,
65
95
  },
66
96
 
67
97
  /**
@@ -77,3 +107,13 @@ export const guttersAt = createResponsiveVariants({
77
107
  styles: centerGuttersStyles,
78
108
  media: defaultMedia,
79
109
  });
110
+
111
+ export const andTextAt = createResponsiveVariants({
112
+ styles: centerAndTextStyles,
113
+ media: defaultMedia,
114
+ });
115
+
116
+ export const intrinsicAt = createResponsiveVariants({
117
+ styles: centerIntrinsicStyles,
118
+ media: defaultMedia,
119
+ });
@@ -1,9 +1,9 @@
1
1
  import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
2
2
 
3
- import { centerRecipe, guttersAt } from './center.css';
3
+ import { andTextAt, centerRecipe, guttersAt, intrinsicAt } from './center.css';
4
4
 
5
5
  export const centerResponsive = responsiveRecipe({
6
6
  recipe: centerRecipe,
7
- at: { gutters: guttersAt },
7
+ at: { gutters: guttersAt, andText: andTextAt, intrinsic: intrinsicAt },
8
8
  order: defaultOrder,
9
9
  });
@@ -1,5 +1,4 @@
1
1
  import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
2
- import { clsx } from 'clsx';
3
2
  import { ElementType } from 'react';
4
3
 
5
4
  import { CenterVariants } from './center.css';
@@ -9,8 +8,10 @@ import type { Responsive } from '../../styles/responsive';
9
8
 
10
9
  export type CenterProps<TUse extends ElementType> =
11
10
  PolymorphicComponentProps<TUse> &
12
- Omit<CenterVariants, 'gutters'> & {
11
+ Omit<CenterVariants, 'gutters' | 'andText' | 'intrinsic'> & {
12
+ andText?: Responsive<NonNullable<CenterVariants['andText']>>;
13
13
  gutters?: Responsive<NonNullable<CenterVariants['gutters']>>;
14
+ intrinsic?: Responsive<NonNullable<CenterVariants['intrinsic']>>;
14
15
  };
15
16
 
16
17
  /**
@@ -30,10 +31,7 @@ export function Center<TUse extends ElementType>({
30
31
 
31
32
  return (
32
33
  <Comp
33
- className={clsx(
34
- centerResponsive({ andText, gutters, intrinsic }),
35
- className,
36
- )}
34
+ className={centerResponsive({ andText, gutters, intrinsic }, className)}
37
35
  {...rest}
38
36
  />
39
37
  );
@@ -1,2 +1,2 @@
1
1
  export { Center, type CenterProps } from './center';
2
- export { centerRecipe, gutterSize, type CenterVariants } from './center.css';
2
+ export { centerRecipe, centerVars, type CenterVariants } from './center.css';
@@ -1,100 +1,43 @@
1
+ import { assignVars, createThemeContract } from '@vanilla-extract/css';
1
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
3
 
3
- import {
4
- createResponsiveVariants,
5
- defaultMedia,
6
- mapContractVars,
7
- sys,
8
- } from '../../styles';
4
+ import { createResponsiveVariants, defaultMedia, sys } from '../../styles';
9
5
  import { components } from '../../styles/layers.css';
6
+ import {
7
+ createSpacingVarStyles,
8
+ flexAlignItemsWithBaselineStyles,
9
+ flexJustifyContentStyles,
10
+ } from '../layout-maps';
10
11
 
11
- // Shared variant style maps so we can reuse them for responsive overrides
12
- export const clusterSpacingStyles = mapContractVars(sys.spacing, (key) => ({
13
- '@layer': {
14
- [components]: {
15
- gap: sys.spacing[key],
16
- },
12
+ export const clusterVars = createThemeContract({
13
+ spacing: {
14
+ gap: null,
17
15
  },
18
- }));
16
+ });
19
17
 
20
- export const clusterJustifyStyles = {
21
- start: {
22
- '@layer': {
23
- [components]: {
24
- justifyContent: 'flex-start',
25
- },
26
- },
27
- },
28
- end: {
29
- '@layer': {
30
- [components]: {
31
- justifyContent: 'flex-end',
32
- },
33
- },
34
- },
35
- center: {
36
- '@layer': {
37
- [components]: {
38
- justifyContent: 'center',
39
- },
40
- },
41
- },
42
- spaceBetween: {
43
- '@layer': {
44
- [components]: {
45
- justifyContent: 'space-between',
46
- },
47
- },
48
- },
49
- spaceAround: {
50
- '@layer': {
51
- [components]: {
52
- justifyContent: 'space-around',
53
- },
54
- },
55
- },
56
- spaceEvenly: {
57
- '@layer': {
58
- [components]: {
59
- justifyContent: 'space-evenly',
60
- },
61
- },
62
- },
63
- } as const;
18
+ const clusterSpacingDefaults = assignVars(clusterVars.spacing, {
19
+ gap: sys.spacing[0],
20
+ });
64
21
 
65
- export const clusterAlignStyles = {
66
- start: {
67
- '@layer': {
68
- [components]: {
69
- alignItems: 'flex-start',
70
- },
71
- },
72
- },
73
- end: {
74
- '@layer': {
75
- [components]: {
76
- alignItems: 'flex-end',
77
- },
78
- },
79
- },
80
- center: {
81
- '@layer': {
82
- [components]: {
83
- alignItems: 'center',
84
- },
85
- },
86
- },
87
- stretch: {
22
+ // Shared variant style maps so we can reuse them for responsive overrides
23
+ export const clusterSpacingStyles = createSpacingVarStyles(clusterVars.spacing);
24
+
25
+ export const clusterJustifyStyles = flexJustifyContentStyles;
26
+
27
+ export const clusterAlignStyles = flexAlignItemsWithBaselineStyles;
28
+
29
+ export const clusterDirectionStyles = {
30
+ row: {
88
31
  '@layer': {
89
32
  [components]: {
90
- alignItems: 'stretch',
33
+ flexDirection: 'row',
91
34
  },
92
35
  },
93
36
  },
94
- baseline: {
37
+ rowReverse: {
95
38
  '@layer': {
96
39
  [components]: {
97
- alignItems: 'baseline',
40
+ flexDirection: 'row-reverse',
98
41
  },
99
42
  },
100
43
  },
@@ -108,6 +51,11 @@ export const clusterRecipe = recipe({
108
51
  flexWrap: 'wrap',
109
52
  justifyContent: 'flex-start',
110
53
  alignItems: 'flex-start',
54
+ gap: clusterVars.spacing.gap,
55
+
56
+ vars: {
57
+ ...clusterSpacingDefaults,
58
+ },
111
59
  },
112
60
  },
113
61
  },
@@ -128,22 +76,7 @@ export const clusterRecipe = recipe({
128
76
  */
129
77
  align: clusterAlignStyles,
130
78
 
131
- direction: {
132
- row: {
133
- '@layer': {
134
- [components]: {
135
- flexDirection: 'row',
136
- },
137
- },
138
- },
139
- rowReverse: {
140
- '@layer': {
141
- [components]: {
142
- flexDirection: 'row-reverse',
143
- },
144
- },
145
- },
146
- },
79
+ direction: clusterDirectionStyles,
147
80
  },
148
81
  });
149
82
 
@@ -163,3 +96,8 @@ export const alignAt = createResponsiveVariants({
163
96
  styles: clusterAlignStyles,
164
97
  media: defaultMedia,
165
98
  });
99
+
100
+ export const directionAt = createResponsiveVariants({
101
+ styles: clusterDirectionStyles,
102
+ media: defaultMedia,
103
+ });
@@ -1,9 +1,20 @@
1
1
  import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
2
2
 
3
- import { alignAt, clusterRecipe, justifyAt, spacingAt } from './cluster.css';
3
+ import {
4
+ alignAt,
5
+ clusterRecipe,
6
+ directionAt,
7
+ justifyAt,
8
+ spacingAt,
9
+ } from './cluster.css';
4
10
 
5
11
  export const clusterResponsive = responsiveRecipe({
6
12
  recipe: clusterRecipe,
7
- at: { spacing: spacingAt, justify: justifyAt, align: alignAt },
13
+ at: {
14
+ spacing: spacingAt,
15
+ justify: justifyAt,
16
+ align: alignAt,
17
+ direction: directionAt,
18
+ },
8
19
  order: defaultOrder,
9
20
  });
@@ -1,5 +1,4 @@
1
1
  import { PolymorphicComponentProps } from '@kalink-ui/dibbly';
2
- import { clsx } from 'clsx';
3
2
  import { ElementType } from 'react';
4
3
 
5
4
  import { ClusterVariants } from './cluster.css';
@@ -9,10 +8,11 @@ import type { Responsive } from '../../styles/responsive';
9
8
 
10
9
  export type ClusterProps<TUse extends ElementType> =
11
10
  PolymorphicComponentProps<TUse> &
12
- Omit<ClusterVariants, 'spacing' | 'justify' | 'align'> & {
11
+ Omit<ClusterVariants, 'spacing' | 'justify' | 'align' | 'direction'> & {
13
12
  spacing?: Responsive<NonNullable<ClusterVariants['spacing']>>;
14
13
  justify?: Responsive<NonNullable<ClusterVariants['justify']>>;
15
14
  align?: Responsive<NonNullable<ClusterVariants['align']>>;
15
+ direction?: Responsive<NonNullable<ClusterVariants['direction']>>;
16
16
  };
17
17
 
18
18
  /**
@@ -20,10 +20,11 @@ export type ClusterProps<TUse extends ElementType> =
20
20
  *
21
21
  * https://every-layout.dev/layouts/cluster
22
22
  */
23
- export function Cluster<TUse extends ElementType>({
23
+ export function Cluster<TUse extends ElementType = 'div'>({
24
24
  spacing,
25
25
  justify,
26
26
  align,
27
+ direction,
27
28
  className,
28
29
  ...props
29
30
  }: ClusterProps<TUse>) {
@@ -31,8 +32,8 @@ export function Cluster<TUse extends ElementType>({
31
32
 
32
33
  return (
33
34
  <Comp
34
- className={clsx(
35
- clusterResponsive({ spacing, align, justify }),
35
+ className={clusterResponsive(
36
+ { spacing, align, justify, direction },
36
37
  className,
37
38
  )}
38
39
  {...rest}
@@ -1,2 +1,6 @@
1
1
  export { Cluster, type ClusterProps } from './cluster';
2
- export { clusterRecipe, type ClusterVariants } from './cluster.css';
2
+ export {
3
+ clusterRecipe,
4
+ clusterVars,
5
+ type ClusterVariants,
6
+ } from './cluster.css';
@@ -1,14 +1,46 @@
1
1
  'use client';
2
2
 
3
+ import { clsx } from 'clsx';
3
4
  import { Command as CommandPrimitive } from 'cmdk';
4
5
  import { ComponentPropsWithoutRef } from 'react';
5
6
 
6
- import { menuItem } from '../menu/menu-item.css';
7
+ import {
8
+ buildTypographyOverrides,
9
+ getResponsiveBase,
10
+ mapResponsiveSizeToTypography,
11
+ type Responsive,
12
+ type Tone,
13
+ } from '../../styles';
14
+ import { menuItemRecipe, type MenuItemVariants } from '../menu/menu-item.css';
7
15
 
8
16
  export type CommandEmptyProps = ComponentPropsWithoutRef<
9
17
  typeof CommandPrimitive.Empty
10
- >;
18
+ > & {
19
+ tone?: Tone;
20
+ size?: Responsive<NonNullable<MenuItemVariants['size']>>;
21
+ };
11
22
 
12
- export function CommandEmpty(props: CommandEmptyProps) {
13
- return <CommandPrimitive.Empty className={menuItem()} {...props} />;
23
+ export function CommandEmpty({
24
+ tone,
25
+ size,
26
+ className,
27
+ ...props
28
+ }: CommandEmptyProps) {
29
+ const baseSize = getResponsiveBase(size) ?? 'md';
30
+ const typographySize = mapResponsiveSizeToTypography(size);
31
+ const typographyOverrides = buildTypographyOverrides({
32
+ variant: 'body',
33
+ size: typographySize,
34
+ });
35
+
36
+ return (
37
+ <CommandPrimitive.Empty
38
+ className={clsx(
39
+ menuItemRecipe({ tone, size: baseSize }),
40
+ typographyOverrides,
41
+ className,
42
+ )}
43
+ {...props}
44
+ />
45
+ );
14
46
  }