@kalink-ui/seedly 0.4.0 → 0.6.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 (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +25 -14
  3. package/src/components/box/box.css.ts +36 -15
  4. package/src/components/box/box.tsx +2 -2
  5. package/src/components/button/button.css.ts +1 -1
  6. package/src/components/button/button.tsx +6 -8
  7. package/src/components/center/center.css.ts +28 -11
  8. package/src/components/center/center.tsx +1 -2
  9. package/src/components/cluster/cluster.css.ts +71 -18
  10. package/src/components/cluster/cluster.tsx +1 -2
  11. package/src/components/cover/cover.css.ts +44 -15
  12. package/src/components/cover/cover.tsx +1 -2
  13. package/src/components/frame/frame.css.ts +54 -20
  14. package/src/components/frame/frame.tsx +1 -2
  15. package/src/components/grid/grid.css.ts +16 -7
  16. package/src/components/grid/grid.tsx +1 -2
  17. package/src/components/sidebar/sidebar.css.ts +45 -16
  18. package/src/components/sidebar/sidebar.tsx +1 -2
  19. package/src/components/stack/stack.css.ts +21 -8
  20. package/src/components/stack/stack.tsx +1 -2
  21. package/src/components/switcher/switcher.css.ts +47 -14
  22. package/src/components/switcher/switcher.tsx +1 -2
  23. package/src/components/text/index.ts +1 -0
  24. package/src/components/text/text.css.ts +15 -0
  25. package/src/components/text/text.tsx +43 -0
  26. package/src/styles/layers.css.ts +6 -0
  27. package/src/styles/reset.css.ts +116 -0
  28. package/src/styles/seed/seed.tsx +4 -4
  29. package/src/styles/system-contract.css.ts +2 -2
  30. package/src/styles/typography.css.ts +23 -0
  31. package/src/utils/extract-sprinkles-props.ts +1 -0
  32. package/src/utils/index.ts +0 -1
  33. package/src/types/index.ts +0 -5
  34. package/src/types/utils.types.ts +0 -15
  35. package/src/utils/is-object.ts +0 -3
@@ -1,16 +1,22 @@
1
1
  import { createVar, globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
5
+
4
6
  const ratioVar = createVar();
5
7
 
6
8
  const baseFrame = style({
7
- display: 'flex',
8
- justifyContent: 'center',
9
- alignItems: 'center',
9
+ '@layer': {
10
+ [components]: {
11
+ display: 'flex',
12
+ justifyContent: 'center',
13
+ alignItems: 'center',
10
14
 
11
- overflow: 'hidden',
15
+ overflow: 'hidden',
12
16
 
13
- aspectRatio: ratioVar,
17
+ aspectRatio: ratioVar,
18
+ },
19
+ },
14
20
  });
15
21
 
16
22
  export const frameRecipe = recipe({
@@ -19,33 +25,57 @@ export const frameRecipe = recipe({
19
25
  variants: {
20
26
  ratio: {
21
27
  '1:1': {
22
- vars: {
23
- [ratioVar]: '1 / 1',
28
+ '@layer': {
29
+ [components]: {
30
+ vars: {
31
+ [ratioVar]: '1 / 1',
32
+ },
33
+ },
24
34
  },
25
35
  },
26
36
  '3:2': {
27
- vars: {
28
- [ratioVar]: '3 / 2',
37
+ '@layer': {
38
+ [components]: {
39
+ vars: {
40
+ [ratioVar]: '3 / 2',
41
+ },
42
+ },
29
43
  },
30
44
  },
31
45
  '2:3': {
32
- vars: {
33
- [ratioVar]: '2 / 3',
46
+ '@layer': {
47
+ [components]: {
48
+ vars: {
49
+ [ratioVar]: '2 / 3',
50
+ },
51
+ },
34
52
  },
35
53
  },
36
54
  '4:3': {
37
- vars: {
38
- [ratioVar]: '4 / 3',
55
+ '@layer': {
56
+ [components]: {
57
+ vars: {
58
+ [ratioVar]: '4 / 3',
59
+ },
60
+ },
39
61
  },
40
62
  },
41
63
  '16:9': {
42
- vars: {
43
- [ratioVar]: '16 / 9',
64
+ '@layer': {
65
+ [components]: {
66
+ vars: {
67
+ [ratioVar]: '16 / 9',
68
+ },
69
+ },
44
70
  },
45
71
  },
46
72
  '9:16': {
47
- vars: {
48
- [ratioVar]: '9 / 16',
73
+ '@layer': {
74
+ [components]: {
75
+ vars: {
76
+ [ratioVar]: '9 / 16',
77
+ },
78
+ },
49
79
  },
50
80
  },
51
81
  },
@@ -53,9 +83,13 @@ export const frameRecipe = recipe({
53
83
  });
54
84
 
55
85
  globalStyle(`${baseFrame} > img, ${baseFrame} > video`, {
56
- inlineSize: '100%',
57
- blockSize: '100%',
58
- objectFit: 'cover',
86
+ '@layer': {
87
+ [components]: {
88
+ inlineSize: '100%',
89
+ blockSize: '100%',
90
+ objectFit: 'cover',
91
+ },
92
+ },
59
93
  });
60
94
 
61
95
  export type FrameVariants = NonNullable<RecipeVariants<typeof frameRecipe>>;
@@ -1,8 +1,7 @@
1
+ import { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
1
2
  import { clsx } from 'clsx';
2
3
  import { ElementType } from 'react';
3
4
 
4
- import { PolymorphicComponentProps } from '@/types/utils.types';
5
-
6
5
  import { frameRecipe, FrameVariants } from './frame.css';
7
6
 
8
7
  type FrameProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
@@ -1,24 +1,33 @@
1
1
  import { createVar } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
- import { sys } from '@/styles/system-contract.css';
5
- import { mapContractVars } from '@/utils/map-contract-vars';
4
+ import { components } from '../../styles/layers.css';
5
+ import { sys } from '../../styles/system-contract.css';
6
+ import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
7
8
  export const minSizeVar = createVar();
8
9
 
9
10
  export const gridRecipe = recipe({
10
11
  base: {
11
- display: 'grid',
12
- gridTemplateColumns: `repeat(auto-fill, minmax(min(${minSizeVar}, 100%), 1fr))`,
12
+ '@layer': {
13
+ [components]: {
14
+ display: 'grid',
15
+ gridTemplateColumns: `repeat(auto-fill, minmax(min(${minSizeVar}, 100%), 1fr))`,
13
16
 
14
- vars: {
15
- [minSizeVar]: '250px',
17
+ vars: {
18
+ [minSizeVar]: '250px',
19
+ },
20
+ },
16
21
  },
17
22
  },
18
23
 
19
24
  variants: {
20
25
  spacing: mapContractVars(sys.spacing, (key) => ({
21
- gridGap: sys.spacing[key],
26
+ '@layer': {
27
+ [components]: {
28
+ gridGap: sys.spacing[key],
29
+ },
30
+ },
22
31
  })),
23
32
  },
24
33
  });
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
+ import { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
3
4
  import { assignInlineVars } from '@vanilla-extract/dynamic';
4
5
  import { clsx } from 'clsx';
5
6
  import { ElementType } from 'react';
6
7
 
7
- import { PolymorphicComponentProps } from '@/types/utils.types';
8
-
9
8
  import { gridRecipe, GridVariants, minSizeVar } from './grid.css';
10
9
 
11
10
  type GridProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
@@ -1,30 +1,43 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
- import { sys } from '@/styles/system-contract.css';
5
- import { mapContractVars } from '@/utils/map-contract-vars';
4
+ import { components } from '../../styles/layers.css';
5
+ import { sys } from '../../styles/system-contract.css';
6
+ import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
7
8
  export const sideWidthVar = createVar();
8
9
  export const contentMinWidthVar = createVar();
9
10
 
10
11
  export const sidebarRecipe = recipe({
11
12
  base: {
12
- display: 'flex',
13
- flexWrap: 'wrap',
13
+ '@layer': {
14
+ [components]: {
15
+ display: 'flex',
16
+ flexWrap: 'wrap',
14
17
 
15
- vars: {
16
- [contentMinWidthVar]: '50%',
18
+ vars: {
19
+ [contentMinWidthVar]: '50%',
20
+ },
21
+ },
17
22
  },
18
23
  },
19
24
 
20
25
  variants: {
21
26
  spacing: mapContractVars(sys.spacing, (key) => ({
22
- gap: sys.spacing[key],
27
+ '@layer': {
28
+ [components]: {
29
+ gap: sys.spacing[key],
30
+ },
31
+ },
23
32
  })),
24
33
 
25
34
  noStretch: {
26
35
  true: {
27
- alignItems: 'flex-start',
36
+ '@layer': {
37
+ [components]: {
38
+ alignItems: 'flex-start',
39
+ },
40
+ },
28
41
  },
29
42
  },
30
43
 
@@ -46,23 +59,39 @@ export const sidebarRecipe = recipe({
46
59
  });
47
60
 
48
61
  globalStyle(`${sidebarRecipe.classNames.base} > *`, {
49
- flexGrow: 1,
62
+ '@layer': {
63
+ [components]: {
64
+ flexGrow: 1,
65
+ },
66
+ },
50
67
  });
51
68
 
52
69
  globalStyle(`${sidebarRecipe.classNames.variants.sideWidth.true} > *`, {
53
- flexBasis: sideWidthVar,
70
+ '@layer': {
71
+ [components]: {
72
+ flexBasis: sideWidthVar,
73
+ },
74
+ },
54
75
  });
55
76
 
56
77
  globalStyle(`${sidebarRecipe.classNames.variants.side.left} > :last-child`, {
57
- flexBasis: 0,
58
- flexGrow: 999,
59
- minInlineSize: contentMinWidthVar,
78
+ '@layer': {
79
+ [components]: {
80
+ flexBasis: 0,
81
+ flexGrow: 999,
82
+ minInlineSize: contentMinWidthVar,
83
+ },
84
+ },
60
85
  });
61
86
 
62
87
  globalStyle(`${sidebarRecipe.classNames.variants.side.right} > :first-child`, {
63
- flexBasis: 0,
64
- flexGrow: 999,
65
- minInlineSize: contentMinWidthVar,
88
+ '@layer': {
89
+ [components]: {
90
+ flexBasis: 0,
91
+ flexGrow: 999,
92
+ minInlineSize: contentMinWidthVar,
93
+ },
94
+ },
66
95
  });
67
96
 
68
97
  export type SidebarVariants = NonNullable<RecipeVariants<typeof sidebarRecipe>>;
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
+ import { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
3
4
  import { assignInlineVars } from '@vanilla-extract/dynamic';
4
5
  import { clsx } from 'clsx';
5
6
  import { ElementType } from 'react';
6
7
 
7
- import { PolymorphicComponentProps } from '@/types/utils.types';
8
-
9
8
  import {
10
9
  contentMinWidthVar,
11
10
  sidebarRecipe,
@@ -1,16 +1,21 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
- import { sys } from '@/styles/system-contract.css';
5
- import { mapContractVars } from '@/utils/map-contract-vars';
4
+ import { components } from '../../styles/layers.css';
5
+ import { sys } from '../../styles/system-contract.css';
6
+ import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
7
8
  const spacing = createVar();
8
9
 
9
10
  export const stackRecipe = recipe({
10
11
  base: {
11
- display: 'flex',
12
- flexDirection: 'column',
13
- justifyContent: 'flex-start',
12
+ '@layer': {
13
+ [components]: {
14
+ display: 'flex',
15
+ flexDirection: 'column',
16
+ justifyContent: 'flex-start',
17
+ },
18
+ },
14
19
  },
15
20
 
16
21
  variants: {
@@ -19,8 +24,12 @@ export const stackRecipe = recipe({
19
24
  },
20
25
 
21
26
  spacing: mapContractVars(sys.spacing, (key) => ({
22
- vars: {
23
- [spacing]: sys.spacing[key],
27
+ '@layer': {
28
+ [components]: {
29
+ vars: {
30
+ [spacing]: sys.spacing[key],
31
+ },
32
+ },
24
33
  },
25
34
  })),
26
35
  },
@@ -29,7 +38,11 @@ export const stackRecipe = recipe({
29
38
  globalStyle(
30
39
  `${stackRecipe.classNames.base} > * + *, ${stackRecipe.classNames.variants.recursive.true} * + *`,
31
40
  {
32
- marginBlockStart: spacing,
41
+ '@layer': {
42
+ [components]: {
43
+ marginBlockStart: spacing,
44
+ },
45
+ },
33
46
  },
34
47
  );
35
48
 
@@ -1,8 +1,7 @@
1
+ import { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
1
2
  import { clsx } from 'clsx';
2
3
  import { ElementType } from 'react';
3
4
 
4
- import { PolymorphicComponentProps } from '@/types/utils.types';
5
-
6
5
  import { stackRecipe, StackVariants } from './stack.css';
7
6
 
8
7
  type StackProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
@@ -1,19 +1,24 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
- import { sys } from '@/styles/system-contract.css';
5
- import { mapContractVars } from '@/utils/map-contract-vars';
4
+ import { components } from '../../styles/layers.css';
5
+ import { sys } from '../../styles/system-contract.css';
6
+ import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
7
8
  export const thresholdVar = createVar();
8
9
  export const limitVar = createVar();
9
10
 
10
11
  export const switcherRecipe = recipe({
11
12
  base: {
12
- display: 'flex',
13
- flexWrap: 'wrap',
13
+ '@layer': {
14
+ [components]: {
15
+ display: 'flex',
16
+ flexWrap: 'wrap',
14
17
 
15
- vars: {
16
- [thresholdVar]: sys.layout.measure,
18
+ vars: {
19
+ [thresholdVar]: sys.layout.measure,
20
+ },
21
+ },
17
22
  },
18
23
  },
19
24
 
@@ -22,7 +27,11 @@ export const switcherRecipe = recipe({
22
27
  * The space (margin) between the child elements
23
28
  */
24
29
  spacing: mapContractVars(sys.spacing, (key) => ({
25
- gap: sys.spacing[key],
30
+ '@layer': {
31
+ [components]: {
32
+ gap: sys.spacing[key],
33
+ },
34
+ },
26
35
  })),
27
36
 
28
37
  /**
@@ -39,8 +48,12 @@ export const switcherRecipe = recipe({
39
48
  });
40
49
 
41
50
  globalStyle(`${switcherRecipe.classNames.base} > *`, {
42
- flexBasis: `calc((${thresholdVar} - 100%) * 999)`,
43
- flexGrow: 1,
51
+ '@layer': {
52
+ [components]: {
53
+ flexBasis: `calc((${thresholdVar} - 100%) * 999)`,
54
+ flexGrow: 1,
55
+ },
56
+ },
44
57
  });
45
58
 
46
59
  globalStyle(
@@ -48,7 +61,11 @@ globalStyle(
48
61
  switcherRecipe.classNames.variants.limit[2]
49
62
  } > :nth-last-child(n+3) ~ *`,
50
63
  {
51
- flexBasis: '100%',
64
+ '@layer': {
65
+ [components]: {
66
+ flexBasis: '100%',
67
+ },
68
+ },
52
69
  },
53
70
  );
54
71
 
@@ -57,7 +74,11 @@ globalStyle(
57
74
  switcherRecipe.classNames.variants.limit[3]
58
75
  } > :nth-last-child(n+4) ~ *`,
59
76
  {
60
- flexBasis: '100%',
77
+ '@layer': {
78
+ [components]: {
79
+ flexBasis: '100%',
80
+ },
81
+ },
61
82
  },
62
83
  );
63
84
 
@@ -66,7 +87,11 @@ globalStyle(
66
87
  switcherRecipe.classNames.variants.limit[4]
67
88
  } > :nth-last-child(n+5) ~ *`,
68
89
  {
69
- flexBasis: '100%',
90
+ '@layer': {
91
+ [components]: {
92
+ flexBasis: '100%',
93
+ },
94
+ },
70
95
  },
71
96
  );
72
97
 
@@ -75,7 +100,11 @@ globalStyle(
75
100
  switcherRecipe.classNames.variants.limit[5]
76
101
  } > :nth-last-child(n+6) ~ *`,
77
102
  {
78
- flexBasis: '100%',
103
+ '@layer': {
104
+ [components]: {
105
+ flexBasis: '100%',
106
+ },
107
+ },
79
108
  },
80
109
  );
81
110
 
@@ -84,7 +113,11 @@ globalStyle(
84
113
  switcherRecipe.classNames.variants.limit[6]
85
114
  } > :nth-last-child(n+7) ~ *`,
86
115
  {
87
- flexBasis: '100%',
116
+ '@layer': {
117
+ [components]: {
118
+ flexBasis: '100%',
119
+ },
120
+ },
88
121
  },
89
122
  );
90
123
 
@@ -1,11 +1,10 @@
1
1
  'use client';
2
2
 
3
+ import { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
3
4
  import { assignInlineVars } from '@vanilla-extract/dynamic';
4
5
  import { clsx } from 'clsx';
5
6
  import { ElementType } from 'react';
6
7
 
7
- import { PolymorphicComponentProps } from '@/types/utils.types';
8
-
9
8
  import { switcherRecipe, SwitcherVariants, thresholdVar } from './switcher.css';
10
9
 
11
10
  type SwitcherProps<TUse extends ElementType> =
@@ -0,0 +1 @@
1
+ export { Text } from './text';
@@ -0,0 +1,15 @@
1
+ import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
+
3
+ export const textRecipe = recipe({
4
+ variants: {
5
+ ellipsis: {
6
+ true: {
7
+ whiteSpace: 'nowrap',
8
+ textOverflow: 'ellipsis',
9
+ overflow: 'hidden',
10
+ },
11
+ },
12
+ },
13
+ });
14
+
15
+ export type TextVariants = NonNullable<RecipeVariants<typeof textRecipe>>;
@@ -0,0 +1,43 @@
1
+ import { getProp } from '@kalink-ui/dibbly';
2
+ import { PathsOf, PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
3
+ import { clsx } from 'clsx';
4
+ import { ElementType } from 'react';
5
+
6
+ import { typography as typographyVariants } from '../../styles/typography.css';
7
+ import { Box } from '../box';
8
+
9
+ import { textRecipe, type TextVariants } from './text.css';
10
+
11
+ type TextProps<TUse extends React.ElementType> =
12
+ PolymorphicComponentProps<TUse> & {
13
+ /**
14
+ * The typography used to render the text.
15
+ */
16
+ typography?: PathsOf<typeof typographyVariants>;
17
+ /**
18
+ * If true, use an ellipsis when the text overflows the element.
19
+ */
20
+ ellipsis?: TextVariants['ellipsis'];
21
+ };
22
+
23
+ export function Text<TUse extends ElementType>({
24
+ className,
25
+ typography,
26
+ ellipsis,
27
+ ...props
28
+ }: TextProps<TUse>) {
29
+ const { use = 'span', ...rest } = props;
30
+
31
+ return (
32
+ <Box
33
+ // See `frontend/components/box/box.types.ts` for why the cast is required
34
+ use={use as TextProps<TUse>['use']}
35
+ className={clsx(
36
+ textRecipe({ ellipsis }),
37
+ typography && getProp(typographyVariants, typography),
38
+ className,
39
+ )}
40
+ {...rest}
41
+ />
42
+ );
43
+ }
@@ -0,0 +1,6 @@
1
+ import { globalLayer } from '@vanilla-extract/css';
2
+
3
+ export const base = globalLayer('base');
4
+ export const components = globalLayer('components');
5
+ export const utilities = globalLayer('utilities');
6
+ export const overrides = globalLayer('overrides');
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Minimal reset based on Josh's Custom CSS Reset
3
+ * https://www.joshwcomeau.com/css/custom-css-reset/
4
+ */
5
+ import { globalStyle } from '@vanilla-extract/css';
6
+
7
+ import { base } from './layers.css';
8
+
9
+ globalStyle('*, *::before, *::after', {
10
+ '@layer': {
11
+ [base]: {
12
+ boxSizing: 'border-box',
13
+ },
14
+ },
15
+ });
16
+
17
+ globalStyle('*', {
18
+ '@layer': {
19
+ [base]: {
20
+ margin: 0,
21
+ },
22
+ },
23
+ });
24
+
25
+ globalStyle('body', {
26
+ '@layer': {
27
+ [base]: {
28
+ WebkitFontSmoothing: 'antialiased',
29
+ },
30
+ },
31
+ });
32
+
33
+ globalStyle('img, picture, video, canvas, svg', {
34
+ '@layer': {
35
+ [base]: {
36
+ display: 'block',
37
+ maxWidth: '100%',
38
+ },
39
+ },
40
+ });
41
+
42
+ globalStyle('input, button, textarea, select', {
43
+ '@layer': {
44
+ [base]: {
45
+ font: 'inherit',
46
+ },
47
+ },
48
+ });
49
+
50
+ globalStyle('p, h1, h2, h3, h4, h5, h6', {
51
+ '@layer': {
52
+ [base]: {
53
+ overflowWrap: 'break-word',
54
+ },
55
+ },
56
+ });
57
+
58
+ globalStyle('p', {
59
+ '@layer': {
60
+ [base]: {
61
+ textWrap: 'pretty',
62
+ },
63
+ },
64
+ });
65
+
66
+ globalStyle('h1, h2, h3, h4, h5, h6', {
67
+ '@layer': {
68
+ [base]: {
69
+ textWrap: 'balance',
70
+ },
71
+ },
72
+ });
73
+
74
+ globalStyle('button', {
75
+ '@layer': {
76
+ [base]: {
77
+ border: 'none',
78
+
79
+ cursor: 'pointer',
80
+ },
81
+ },
82
+ });
83
+
84
+ globalStyle('a', {
85
+ '@layer': {
86
+ [base]: {
87
+ textDecoration: 'none',
88
+ },
89
+ },
90
+ });
91
+
92
+ globalStyle('fieldset', {
93
+ '@layer': {
94
+ [base]: {
95
+ padding: 0,
96
+
97
+ border: 'none',
98
+ },
99
+ },
100
+ });
101
+
102
+ globalStyle('legend', {
103
+ '@layer': {
104
+ [base]: {
105
+ width: '100%',
106
+ },
107
+ },
108
+ });
109
+
110
+ globalStyle('pre', {
111
+ '@layer': {
112
+ [base]: {
113
+ whiteSpace: 'pre-wrap',
114
+ },
115
+ },
116
+ });