@kalink-ui/seedly 0.34.3 → 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 +18 -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 +12 -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
@@ -6,18 +6,23 @@ import { ComponentPropsWithoutRef } from 'react';
6
6
  import { Box, BoxProps } from '../box';
7
7
  import { ScrollArea, ScrollAreaProps } from '../scroll-area';
8
8
 
9
- import { alertDialogContent } from './alert-dialog-content.css';
9
+ import { alertDialogContentRecipe } from './alert-dialog-content.css';
10
10
  import { AlertDialogOverlay } from './alert-dialog-overlay';
11
11
 
12
12
  export type AlertDialogContentVariants = NonNullable<
13
- RecipeVariants<typeof alertDialogContent>
13
+ RecipeVariants<typeof alertDialogContentRecipe>
14
14
  >;
15
15
 
16
- export type AlertDialogContentProps = ComponentPropsWithoutRef<typeof Content> &
17
- AlertDialogContentVariants &
16
+ type BoxStyleProps = Pick<
17
+ BoxProps<'div'>,
18
+ 'spacing' | 'radius' | 'elevation' | 'use'
19
+ >;
20
+
21
+ export type AlertDialogContentProps = AlertDialogContentVariants &
18
22
  Pick<ScrollAreaProps, 'maxHeight'> &
19
23
  ComponentPropsWithoutRef<typeof AlertDialogPortal> &
20
- BoxProps<'div'>;
24
+ BoxStyleProps &
25
+ Omit<ComponentPropsWithoutRef<typeof Content>, keyof BoxStyleProps>;
21
26
 
22
27
  export function AlertDialogContent({
23
28
  className,
@@ -29,17 +34,19 @@ export function AlertDialogContent({
29
34
  elevation = 'high',
30
35
  radius,
31
36
  spacing = 2,
37
+ use,
32
38
  ...props
33
39
  }: AlertDialogContentProps) {
34
40
  return (
35
41
  <AlertDialogPortal container={container} forceMount={forceMount}>
36
42
  <AlertDialogOverlay />
37
43
  <Content
38
- className={clsx(alertDialogContent({ variant }), className)}
44
+ className={clsx(alertDialogContentRecipe({ variant }), className)}
39
45
  asChild
40
46
  {...props}
41
47
  >
42
48
  <Box
49
+ use={use}
43
50
  variant="solid"
44
51
  spacing={spacing}
45
52
  elevation={elevation}
@@ -4,7 +4,7 @@ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
4
4
  import { sys } from '../../styles';
5
5
  import { components } from '../../styles/layers.css';
6
6
 
7
- export const alertDialogFooter = recipe({
7
+ export const alertDialogFooterRecipe = recipe({
8
8
  variants: {
9
9
  position: {
10
10
  sticky: {
@@ -20,7 +20,7 @@ export const alertDialogFooter = recipe({
20
20
  position: 'absolute',
21
21
  insetBlockStart: calc.negate(sys.spacing[2]),
22
22
 
23
- backgroundImage: `linear-gradient(to bottom, transparent, ${sys.color.background})`,
23
+ backgroundImage: `linear-gradient(to bottom, transparent, ${sys.surface.background})`,
24
24
  },
25
25
  },
26
26
  },
@@ -30,5 +30,5 @@ export const alertDialogFooter = recipe({
30
30
  });
31
31
 
32
32
  export type AlertDialogFooterVariants = NonNullable<
33
- RecipeVariants<typeof alertDialogFooter>
33
+ RecipeVariants<typeof alertDialogFooterRecipe>
34
34
  >;
@@ -3,7 +3,7 @@ import { clsx } from 'clsx';
3
3
  import { Cluster, ClusterProps } from '../cluster';
4
4
 
5
5
  import {
6
- alertDialogFooter,
6
+ alertDialogFooterRecipe,
7
7
  AlertDialogFooterVariants,
8
8
  } from './alert-dialog-footer.css';
9
9
 
@@ -19,7 +19,7 @@ export function AlertDialogFooter({
19
19
  return (
20
20
  <Cluster
21
21
  justify={justify}
22
- className={clsx(alertDialogFooter({ position }), className)}
22
+ className={clsx(alertDialogFooterRecipe({ position }), className)}
23
23
  {...props}
24
24
  />
25
25
  );
@@ -2,10 +2,10 @@ import { Stack, StackProps } from '../stack';
2
2
 
3
3
  export type AlertDialogHeaderProps = StackProps<'div'>;
4
4
 
5
- export const AlertDialogHeader = ({
5
+ export function AlertDialogHeader({
6
6
  className,
7
7
  spacing = 2,
8
8
  ...props
9
- }: AlertDialogHeaderProps) => {
10
- return <Stack spacing={spacing} {...props} />;
11
- };
9
+ }: AlertDialogHeaderProps) {
10
+ return <Stack spacing={spacing} className={className} {...props} />;
11
+ }
@@ -9,3 +9,12 @@ export { AlertDialogOverlay } from './alert-dialog-overlay';
9
9
  export { AlertDialogFooter } from './alert-dialog-footer';
10
10
  export { AlertDialogPortal } from './alert-dialog-portal';
11
11
  export { AlertDialogTrigger } from './alert-dialog-trigger';
12
+
13
+ export type { AlertDialogActionProps } from './alert-dialog-action';
14
+ export type { AlertDialogCancelProps } from './alert-dialog-cancel';
15
+ export type { AlertDialogContentProps } from './alert-dialog-content';
16
+ export type { AlertDialogDescriptionProps } from './alert-dialog-description';
17
+ export type { AlertDialogFooterProps } from './alert-dialog-footer';
18
+ export type { AlertDialogHeaderProps } from './alert-dialog-header';
19
+ export type { AlertDialogOverlayProps } from './alert-dialog-overlay';
20
+ export type { AlertDialogTitleProps } from './alert-dialog-title';
@@ -1,3 +1,4 @@
1
+ import { assignVars, createThemeContract } from '@vanilla-extract/css';
1
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
3
 
3
4
  import {
@@ -5,46 +6,145 @@ import {
5
6
  defaultMedia,
6
7
  mapContractVars,
7
8
  sys,
8
- } from '@kalink-ui/seedly/styles';
9
- import { components } from '@kalink-ui/seedly/styles/layers';
9
+ } from '../../styles';
10
+ import { components } from '../../styles/layers.css';
11
+
12
+ export const boxVars = createThemeContract({
13
+ color: {
14
+ container: null,
15
+ content: null,
16
+ outline: null,
17
+ },
18
+ spacing: {
19
+ block: null,
20
+ inline: null,
21
+ },
22
+ shape: {
23
+ corner: null,
24
+ },
25
+ elevation: {
26
+ level: null,
27
+ },
28
+ });
29
+
30
+ const boxColorDefaults = assignVars(boxVars.color, {
31
+ container: 'transparent',
32
+ content: sys.surface.foreground,
33
+ outline: 'transparent',
34
+ });
35
+
36
+ const boxSpacingDefaults = assignVars(boxVars.spacing, {
37
+ block: sys.spacing[0],
38
+ inline: sys.spacing[0],
39
+ });
40
+
41
+ const boxShapeDefaults = assignVars(boxVars.shape, {
42
+ corner: sys.shape.corner.none,
43
+ });
44
+
45
+ const boxElevationDefaults = assignVars(boxVars.elevation, {
46
+ level: sys.elevation.none,
47
+ });
48
+
49
+ export const boxVariantStyles = {
50
+ solid: {
51
+ '@layer': {
52
+ [components]: {
53
+ vars: {
54
+ ...assignVars(boxVars.color, {
55
+ container: sys.surface.background,
56
+ content: sys.surface.foreground,
57
+ outline: 'transparent',
58
+ }),
59
+ },
60
+ },
61
+ },
62
+ },
63
+ outline: {
64
+ '@layer': {
65
+ [components]: {
66
+ borderColor: boxVars.color.outline,
67
+ borderStyle: 'solid',
68
+ borderWidth: '1px',
69
+
70
+ vars: {
71
+ ...assignVars(boxVars.color, {
72
+ container: 'transparent',
73
+ content: sys.surface.foreground,
74
+ outline: sys.surface.foreground,
75
+ }),
76
+ },
77
+ },
78
+ },
79
+ },
80
+ } as const;
10
81
 
11
82
  // Shared variant styles to support responsive overrides
12
83
  export const boxSpacingStyles = mapContractVars(sys.spacing, (key) => ({
13
84
  '@layer': {
14
85
  [components]: {
15
- padding: sys.spacing[key],
86
+ vars: {
87
+ ...assignVars(boxVars.spacing, {
88
+ block: sys.spacing[key],
89
+ inline: sys.spacing[key],
90
+ }),
91
+ },
16
92
  },
17
93
  },
18
94
  }));
19
95
 
20
- export const boxRecipe = recipe({
21
- variants: {
22
- /**
23
- * The main variation of the box
24
- */
25
- variant: {
26
- solid: {
27
- '@layer': {
28
- [components]: {
29
- color: sys.color.foreground,
30
- backgroundColor: sys.color.background,
31
- },
32
- },
96
+ export const boxElevationStyles = mapContractVars(sys.elevation, (key) => ({
97
+ '@layer': {
98
+ [components]: {
99
+ vars: {
100
+ ...assignVars(boxVars.elevation, {
101
+ level: sys.elevation[key],
102
+ }),
103
+ },
104
+ },
105
+ },
106
+ }));
107
+
108
+ export const boxRadiusStyles = mapContractVars(sys.shape.corner, (key) => ({
109
+ '@layer': {
110
+ [components]: {
111
+ vars: {
112
+ ...assignVars(boxVars.shape, {
113
+ corner: sys.shape.corner[key],
114
+ }),
33
115
  },
116
+ },
117
+ },
118
+ }));
34
119
 
35
- outline: {
36
- '@layer': {
37
- [components]: {
38
- color: sys.color.foreground,
39
- backgroundColor: 'transparent',
120
+ export const boxRecipe = recipe({
121
+ base: {
122
+ '@layer': {
123
+ [components]: {
124
+ paddingBlock: boxVars.spacing.block,
125
+ paddingInline: boxVars.spacing.inline,
126
+
127
+ color: boxVars.color.content,
40
128
 
41
- borderColor: sys.color.foreground,
42
- borderStyle: 'solid',
43
- borderWidth: '1px',
44
- },
129
+ backgroundColor: boxVars.color.container,
130
+ borderRadius: boxVars.shape.corner,
131
+ boxShadow: boxVars.elevation.level,
132
+
133
+ vars: {
134
+ ...boxColorDefaults,
135
+ ...boxSpacingDefaults,
136
+ ...boxShapeDefaults,
137
+ ...boxElevationDefaults,
45
138
  },
46
139
  },
47
140
  },
141
+ },
142
+
143
+ variants: {
144
+ /**
145
+ * The main variation of the box
146
+ */
147
+ variant: boxVariantStyles,
48
148
 
49
149
  /**
50
150
  * The spacing between the box borders and its contents
@@ -54,24 +154,12 @@ export const boxRecipe = recipe({
54
154
  /**
55
155
  * The elevation of the box
56
156
  */
57
- elevation: mapContractVars(sys.elevation, (key) => ({
58
- '@layer': {
59
- [components]: {
60
- boxShadow: sys.elevation[key],
61
- },
62
- },
63
- })),
157
+ elevation: boxElevationStyles,
64
158
 
65
159
  /**
66
160
  * The radius of the box
67
161
  */
68
- radius: mapContractVars(sys.shape.corner, (key) => ({
69
- '@layer': {
70
- [components]: {
71
- borderRadius: sys.shape.corner[key],
72
- },
73
- },
74
- })),
162
+ radius: boxRadiusStyles,
75
163
  },
76
164
  });
77
165
 
@@ -81,3 +169,13 @@ export const spacingAt = createResponsiveVariants({
81
169
  styles: boxSpacingStyles,
82
170
  media: defaultMedia,
83
171
  });
172
+
173
+ export const radiusAt = createResponsiveVariants({
174
+ styles: boxRadiusStyles,
175
+ media: defaultMedia,
176
+ });
177
+
178
+ export const elevationAt = createResponsiveVariants({
179
+ styles: boxElevationStyles,
180
+ media: defaultMedia,
181
+ });
@@ -1,9 +1,9 @@
1
1
  import { defaultOrder, responsiveRecipe } from '../../styles/responsive';
2
2
 
3
- import { boxRecipe, spacingAt } from './box.css';
3
+ import { boxRecipe, radiusAt, spacingAt } from './box.css';
4
4
 
5
5
  export const boxResponsive = responsiveRecipe({
6
6
  recipe: boxRecipe,
7
- at: { spacing: spacingAt },
7
+ at: { spacing: spacingAt, radius: radiusAt },
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 { BoxVariants } from './box.css';
@@ -31,8 +30,8 @@ export function Box<TUse extends ElementType = 'div'>({
31
30
 
32
31
  return (
33
32
  <Comp
34
- className={clsx(
35
- boxResponsive({ variant, spacing, radius, elevation }),
33
+ className={boxResponsive(
34
+ { variant, spacing, radius, elevation },
36
35
  className,
37
36
  )}
38
37
  {...rest}
@@ -1,2 +1,2 @@
1
1
  export { Box, type BoxProps } from './box';
2
- export { boxRecipe, type BoxVariants } from './box.css';
2
+ export { boxRecipe, boxVars, type BoxVariants } from './box.css';