@kalink-ui/seedly 0.5.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 (34) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +25 -14
  3. package/src/components/box/box.css.ts +34 -13
  4. package/src/components/box/box.tsx +1 -2
  5. package/src/components/button/button.tsx +4 -8
  6. package/src/components/center/center.css.ts +26 -9
  7. package/src/components/center/center.tsx +1 -2
  8. package/src/components/cluster/cluster.css.ts +69 -16
  9. package/src/components/cluster/cluster.tsx +1 -2
  10. package/src/components/cover/cover.css.ts +42 -13
  11. package/src/components/cover/cover.tsx +1 -2
  12. package/src/components/frame/frame.css.ts +54 -20
  13. package/src/components/frame/frame.tsx +1 -2
  14. package/src/components/grid/grid.css.ts +14 -5
  15. package/src/components/grid/grid.tsx +1 -2
  16. package/src/components/sidebar/sidebar.css.ts +43 -14
  17. package/src/components/sidebar/sidebar.tsx +1 -2
  18. package/src/components/stack/stack.css.ts +19 -6
  19. package/src/components/stack/stack.tsx +1 -2
  20. package/src/components/switcher/switcher.css.ts +45 -12
  21. package/src/components/switcher/switcher.tsx +1 -2
  22. package/src/components/text/index.ts +1 -0
  23. package/src/components/text/text.css.ts +15 -0
  24. package/src/components/text/text.tsx +43 -0
  25. package/src/styles/layers.css.ts +6 -0
  26. package/src/styles/reset.css.ts +116 -0
  27. package/src/styles/seed/seed.tsx +3 -3
  28. package/src/styles/system-contract.css.ts +2 -2
  29. package/src/styles/typography.css.ts +23 -0
  30. package/src/utils/extract-sprinkles-props.ts +1 -0
  31. package/src/utils/index.ts +0 -1
  32. package/src/types/index.ts +0 -5
  33. package/src/types/utils.types.ts +0 -15
  34. package/src/utils/is-object.ts +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @kalink-ui/seedly
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 87e2ae2: Create new Dibbly package to centralize utils and common types
8
+
3
9
  ## 0.5.0
4
10
 
5
11
  ### Minor Changes
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@kalink-ui/seedly",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
+ "description": "A set of components for building UIs with React and TypeScript",
4
5
  "sideEffects": false,
5
6
  "license": "MIT",
7
+ "author": "Louis Gollut",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/Kalink/kalink-ui.git"
11
+ },
6
12
  "exports": {
7
13
  "./box": "./src/components/box/index.ts",
8
14
  "./button": "./src/components/button/index.ts",
@@ -15,7 +21,10 @@
15
21
  "./stack": "./src/components/stack/index.ts",
16
22
  "./switcher": "./src/components/switcher/index.ts",
17
23
  "./styles": "./src/styles/index.ts",
24
+ "./styles/reset": "./src/styles/reset.css.ts",
25
+ "./styles/layers": "./src/styles/layers.css.ts",
18
26
  "./types": "./src/types/index.ts",
27
+ "./text": "./src/components/text/index.ts",
19
28
  "./utils": "./src/utils/index.ts"
20
29
  },
21
30
  "devDependencies": {
@@ -39,37 +48,39 @@
39
48
  "@vanilla-extract/sprinkles": "^1.6.3",
40
49
  "@vanilla-extract/vite-plugin": "^5.0.1",
41
50
  "@vitejs/plugin-react": "^4.3.4",
51
+ "eslint": "^9.21.0",
42
52
  "react": "^19.0.0",
43
53
  "react-dom": "^19.0.0",
44
54
  "storybook": "^8.6.4",
45
- "tsup": "^8.4.0",
46
55
  "type-fest": "^4.37.0",
47
56
  "typescript": "5.8.2",
48
57
  "vite": "^6.2.1",
49
58
  "vite-tsconfig-paths": "^5.1.4",
50
59
  "vitest": "^3.0.8",
51
- "@kalink-ui/eslint-config": "0.3.0",
52
- "@kalink-ui/typescript-config": "0.2.0"
60
+ "@kalink-ui/typescript-config": "0.3.0",
61
+ "@kalink-ui/eslint-config": "0.4.0",
62
+ "@kalink-ui/dibbly": "0.1.0"
53
63
  },
54
64
  "peerDependencies": {
55
- "@vanilla-extract/css": "^1",
56
- "@vanilla-extract/css-utils": "^0.1",
57
- "@vanilla-extract/dynamic": "^2",
58
- "@vanilla-extract/recipes": "^0.5",
59
- "@vanilla-extract/sprinkles": "^1",
60
- "react": "^19",
61
- "react-dom": "^19"
62
- },
63
- "publishConfig": {
64
- "access": "public"
65
+ "@vanilla-extract/css": "^1.17.1",
66
+ "@vanilla-extract/css-utils": "^0.1.4",
67
+ "@vanilla-extract/dynamic": "^2.1.2",
68
+ "@vanilla-extract/recipes": "^0.5.5",
69
+ "@vanilla-extract/sprinkles": "^1.6.3",
70
+ "react": "^19.0.0",
71
+ "react-dom": "^19.0.0"
65
72
  },
66
73
  "dependencies": {
67
74
  "clsx": "^2.1.1"
68
75
  },
76
+ "publishConfig": {
77
+ "access": "public"
78
+ },
69
79
  "scripts": {
70
80
  "lint": "eslint . --max-warnings 0",
71
81
  "build-storybook": "storybook build",
72
82
  "dev": "storybook dev -p 6006 --no-open",
83
+ "test": "vitest",
73
84
  "tsc": "tsc --noEmit"
74
85
  }
75
86
  }
@@ -1,6 +1,7 @@
1
1
  import { createVar } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -11,35 +12,55 @@ export const boxRecipe = recipe({
11
12
  variants: {
12
13
  variant: {
13
14
  solid: {
14
- color: colorForeground,
15
- backgroundColor: colorBackground,
15
+ '@layer': {
16
+ [components]: {
17
+ color: colorForeground,
18
+ backgroundColor: colorBackground,
19
+ },
16
20
 
17
- vars: {
18
- [colorForeground]: sys.color.foreground,
19
- [colorBackground]: sys.color.background,
21
+ vars: {
22
+ [colorForeground]: sys.color.foreground,
23
+ [colorBackground]: sys.color.background,
24
+ },
20
25
  },
21
26
  },
22
27
 
23
28
  outline: {
24
- color: colorBackground,
25
- backgroundColor: 'transparent',
29
+ '@layer': {
30
+ [components]: {
31
+ color: colorBackground,
32
+ backgroundColor: 'transparent',
26
33
 
27
- borderColor: colorBackground,
28
- borderStyle: 'solid',
29
- borderWidth: '1px',
34
+ borderColor: colorBackground,
35
+ borderStyle: 'solid',
36
+ borderWidth: '1px',
37
+ },
38
+ },
30
39
  },
31
40
  },
32
41
 
33
42
  spacing: mapContractVars(sys.spacing, (key) => ({
34
- padding: sys.spacing[key],
43
+ '@layer': {
44
+ [components]: {
45
+ padding: sys.spacing[key],
46
+ },
47
+ },
35
48
  })),
36
49
 
37
50
  elevation: mapContractVars(sys.elevation, (key) => ({
38
- boxShadow: sys.elevation[key],
51
+ '@layer': {
52
+ [components]: {
53
+ boxShadow: sys.elevation[key],
54
+ },
55
+ },
39
56
  })),
40
57
 
41
58
  radius: mapContractVars(sys.shape.corner, (key) => ({
42
- borderRadius: sys.shape.corner[key],
59
+ '@layer': {
60
+ [components]: {
61
+ borderRadius: sys.shape.corner[key],
62
+ },
63
+ },
43
64
  })),
44
65
  },
45
66
  });
@@ -2,8 +2,7 @@ import { clsx } from 'clsx';
2
2
 
3
3
  import { boxRecipe, type BoxVariants } from './box.css';
4
4
 
5
- import type { PolymorphicComponentProps } from '../../types/utils.types.js';
6
-
5
+ import type { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
7
6
 
8
7
  type BoxProps<TUse extends React.ElementType> =
9
8
  PolymorphicComponentProps<TUse> & {
@@ -4,8 +4,7 @@ import { Box } from '../box';
4
4
 
5
5
  import { buttonRecipe, type ButtonVariants } from './button.css';
6
6
 
7
- import type { PolymorphicComponentProps } from '../../types/utils.types';
8
-
7
+ import type { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
9
8
 
10
9
  type ButtonProps<TUse extends React.ElementType> =
11
10
  PolymorphicComponentProps<TUse> & {
@@ -16,7 +15,6 @@ type ButtonProps<TUse extends React.ElementType> =
16
15
  };
17
16
 
18
17
  export const Button = <TUse extends React.ElementType = 'button'>({
19
- children,
20
18
  className,
21
19
  variant,
22
20
  ...props
@@ -24,12 +22,10 @@ export const Button = <TUse extends React.ElementType = 'button'>({
24
22
  const { use: Comp = 'button', ...rest } = props;
25
23
 
26
24
  return (
27
- <Comp
28
- use={Box}
25
+ <Box
26
+ use={Comp}
29
27
  className={clsx(buttonRecipe({ variant }), className)}
30
28
  {...rest}
31
- >
32
- {children}
33
- </Comp>
29
+ />
34
30
  );
35
31
  };
@@ -1,33 +1,50 @@
1
1
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { components } from '../../styles/layers.css';
3
4
  import { sys } from '../../styles/system-contract.css';
4
5
  import { mapContractVars } from '../../utils/map-contract-vars';
5
6
 
6
7
  export const centerRecipe = recipe({
7
8
  base: {
8
- display: 'block',
9
- boxSizing: 'content-box',
10
- marginInline: 'auto',
11
- maxInlineSize: sys.layout.measure,
9
+ '@layer': {
10
+ [components]: {
11
+ display: 'block',
12
+ boxSizing: 'content-box',
13
+ marginInline: 'auto',
14
+ maxInlineSize: sys.layout.measure,
15
+ },
16
+ },
12
17
  },
13
18
 
14
19
  variants: {
15
20
  andText: {
16
21
  true: {
17
- textAlign: 'center',
22
+ '@layer': {
23
+ [components]: {
24
+ textAlign: 'center',
25
+ },
26
+ },
18
27
  },
19
28
  },
20
29
 
21
30
  intrinsic: {
22
31
  true: {
23
- display: 'flex',
24
- flexDirection: 'column',
25
- alignItems: 'center',
32
+ '@layer': {
33
+ [components]: {
34
+ display: 'flex',
35
+ flexDirection: 'column',
36
+ alignItems: 'center',
37
+ },
38
+ },
26
39
  },
27
40
  },
28
41
 
29
42
  gutters: mapContractVars(sys.spacing, (key) => ({
30
- paddingInline: sys.spacing[key],
43
+ '@layer': {
44
+ [components]: {
45
+ paddingInline: sys.spacing[key],
46
+ },
47
+ },
31
48
  })),
32
49
  },
33
50
  });
@@ -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 { centerRecipe, CenterVariants } from './center.css';
7
6
 
8
7
  type CenterProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
@@ -1,57 +1,110 @@
1
1
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { components } from '../../styles/layers.css';
3
4
  import { sys } from '../../styles/system-contract.css';
4
5
  import { mapContractVars } from '../../utils/map-contract-vars';
5
6
 
6
7
  export const clusterRecipe = recipe({
7
8
  base: {
8
- display: 'flex',
9
- flexWrap: 'wrap',
10
- justifyContent: 'flex-start',
11
- alignItems: 'flex-start',
9
+ '@layer': {
10
+ [components]: {
11
+ display: 'flex',
12
+ flexWrap: 'wrap',
13
+ justifyContent: 'flex-start',
14
+ alignItems: 'flex-start',
15
+ },
16
+ },
12
17
  },
13
18
 
14
19
  variants: {
15
20
  spacing: mapContractVars(sys.spacing, (key) => ({
16
- gap: sys.spacing[key],
21
+ '@layer': {
22
+ [components]: {
23
+ gap: sys.spacing[key],
24
+ },
25
+ },
17
26
  })),
18
27
 
19
28
  justify: {
20
29
  start: {
21
- justifyContent: 'flex-start',
30
+ '@layer': {
31
+ [components]: {
32
+ justifyContent: 'flex-start',
33
+ },
34
+ },
22
35
  },
23
36
  end: {
24
- justifyContent: 'flex-end',
37
+ '@layer': {
38
+ [components]: {
39
+ justifyContent: 'flex-end',
40
+ },
41
+ },
25
42
  },
26
43
  center: {
27
- justifyContent: 'center',
44
+ '@layer': {
45
+ [components]: {
46
+ justifyContent: 'center',
47
+ },
48
+ },
28
49
  },
29
50
  spaceBetween: {
30
- justifyContent: 'space-between',
51
+ '@layer': {
52
+ [components]: {
53
+ justifyContent: 'space-between',
54
+ },
55
+ },
31
56
  },
32
57
  spaceAround: {
33
- justifyContent: 'space-around',
58
+ '@layer': {
59
+ [components]: {
60
+ justifyContent: 'space-around',
61
+ },
62
+ },
34
63
  },
35
64
  spaceEvenly: {
36
- justifyContent: 'space-evenly',
65
+ '@layer': {
66
+ [components]: {
67
+ justifyContent: 'space-evenly',
68
+ },
69
+ },
37
70
  },
38
71
  },
39
72
 
40
73
  align: {
41
74
  start: {
42
- alignItems: 'flex-start',
75
+ '@layer': {
76
+ [components]: {
77
+ alignItems: 'flex-start',
78
+ },
79
+ },
43
80
  },
44
81
  end: {
45
- alignItems: 'flex-end',
82
+ '@layer': {
83
+ [components]: {
84
+ alignItems: 'flex-end',
85
+ },
86
+ },
46
87
  },
47
88
  center: {
48
- alignItems: 'center',
89
+ '@layer': {
90
+ [components]: {
91
+ alignItems: 'center',
92
+ },
93
+ },
49
94
  },
50
95
  stretch: {
51
- alignItems: 'stretch',
96
+ '@layer': {
97
+ [components]: {
98
+ alignItems: 'stretch',
99
+ },
100
+ },
52
101
  },
53
102
  baseline: {
54
- alignItems: 'baseline',
103
+ '@layer': {
104
+ [components]: {
105
+ alignItems: 'baseline',
106
+ },
107
+ },
55
108
  },
56
109
  },
57
110
  },
@@ -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 { clusterRecipe, ClusterVariants } from './cluster.css';
7
6
 
8
7
  type ClusterProps<TUse extends ElementType> =
@@ -1,6 +1,7 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -9,52 +10,80 @@ export const minSizeVar = createVar();
9
10
 
10
11
  export const coverRecipe = recipe({
11
12
  base: {
12
- display: 'flex',
13
- flexDirection: 'column',
13
+ '@layer': {
14
+ [components]: {
15
+ display: 'flex',
16
+ flexDirection: 'column',
14
17
 
15
- minBlockSize: minSizeVar,
16
- padding: spaceVar,
18
+ minBlockSize: minSizeVar,
19
+ padding: spaceVar,
17
20
 
18
- vars: {
19
- [minSizeVar]: '100vh',
21
+ vars: {
22
+ [minSizeVar]: '100vh',
23
+ },
24
+ },
20
25
  },
21
26
  },
22
27
 
23
28
  variants: {
24
29
  spacing: mapContractVars(sys.spacing, (key) => ({
25
- sys: {
26
- [spaceVar]: sys.spacing[key],
30
+ '@layer': {
31
+ [components]: {
32
+ vars: {
33
+ [spaceVar]: sys.spacing[key],
34
+ },
35
+ },
27
36
  },
28
37
  })),
29
38
 
30
39
  noPad: {
31
40
  true: {
32
- padding: 0,
41
+ '@layer': {
42
+ [components]: {
43
+ padding: 0,
44
+ },
45
+ },
33
46
  },
34
47
  },
35
48
  },
36
49
  });
37
50
 
38
51
  globalStyle(`${coverRecipe.classNames.base} > *`, {
39
- marginBlock: spaceVar,
52
+ '@layer': {
53
+ [components]: {
54
+ marginBlock: spaceVar,
55
+ },
56
+ },
40
57
  });
41
58
 
42
59
  globalStyle(
43
60
  `${coverRecipe.classNames.base} > :first-child:not([data-cover-center])`,
44
61
  {
45
- marginBlockStart: 0,
62
+ '@layer': {
63
+ [components]: {
64
+ marginBlockStart: 0,
65
+ },
66
+ },
46
67
  },
47
68
  );
48
69
 
49
70
  globalStyle(
50
71
  `${coverRecipe.classNames.base} > :last-child:not([data-cover-center])`,
51
72
  {
52
- marginBlockEnd: 0,
73
+ '@layer': {
74
+ [components]: {
75
+ marginBlockEnd: 0,
76
+ },
77
+ },
53
78
  },
54
79
  );
55
80
 
56
81
  globalStyle(`${coverRecipe.classNames.base} > [data-cover-center]`, {
57
- marginBlock: 'auto',
82
+ '@layer': {
83
+ [components]: {
84
+ marginBlock: 'auto',
85
+ },
86
+ },
58
87
  });
59
88
 
60
89
  export type CoverVariants = NonNullable<RecipeVariants<typeof coverRecipe>>;
@@ -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 { coverRecipe, CoverVariants, minSizeVar } from './cover.css';
10
9
 
11
10
  type CoverProps<TUse extends ElementType> = PolymorphicComponentProps<TUse> & {
@@ -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,6 +1,7 @@
1
1
  import { createVar } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -8,17 +9,25 @@ 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,6 +1,7 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -9,22 +10,34 @@ 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,6 +1,7 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -8,9 +9,13 @@ 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,6 +1,7 @@
1
1
  import { createVar, globalStyle } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { components } from '../../styles/layers.css';
4
5
  import { sys } from '../../styles/system-contract.css';
5
6
  import { mapContractVars } from '../../utils/map-contract-vars';
6
7
 
@@ -9,11 +10,15 @@ 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
+ });
@@ -6,7 +6,7 @@ import {
6
6
  type SprinklesFnBase,
7
7
  } from '../../utils/extract-sprinkles-props';
8
8
 
9
- import type { PolymorphicComponentProps } from '../../types/utils.types';
9
+ import type { PolymorphicComponentProps } from '@kalink-ui/dibbly/types';
10
10
  import type { ElementType } from 'react';
11
11
 
12
12
  /**
@@ -22,10 +22,10 @@ export type SeedProps<
22
22
  TSprinklesFn extends SprinklesFnBase,
23
23
  > = PolymorphicComponentProps<TUse> & GetSprinkles<TSprinklesFn>;
24
24
 
25
- export interface CreateSeedParams<SprinklesFn> {
25
+ export type CreateSeedParams<SprinklesFn> = {
26
26
  sprinkles: SprinklesFn;
27
27
  defaultClassName?: string;
28
- }
28
+ };
29
29
 
30
30
  export function plantSeed<SprinklesFn extends SprinklesFnBase>({
31
31
  sprinkles,
@@ -1,12 +1,12 @@
1
1
  import { createThemeContract } from '@vanilla-extract/css';
2
2
 
3
- const typeContract = {
3
+ export const typeContract = {
4
4
  font: null,
5
5
  weight: null,
6
6
  lineHeight: null,
7
7
  tracking: null,
8
8
  size: null,
9
- };
9
+ } as const;
10
10
 
11
11
  export const sys = createThemeContract({
12
12
  layout: {
@@ -0,0 +1,23 @@
1
+ import { styleVariants } from '@vanilla-extract/css';
2
+
3
+ import { sys } from './system-contract.css';
4
+
5
+ type TypographySize = 'large' | 'medium' | 'small';
6
+
7
+ export const typography = Object.entries(sys.typography).reduce(
8
+ (acc, [key, value]) => {
9
+ return {
10
+ ...acc,
11
+ [key]: styleVariants(value, (variant) => {
12
+ return {
13
+ fontFamily: variant.font,
14
+ fontWeight: variant.weight,
15
+ lineHeight: variant.lineHeight,
16
+ letterSpacing: variant.tracking,
17
+ fontSize: variant.size,
18
+ };
19
+ }),
20
+ };
21
+ },
22
+ {} as Record<keyof typeof sys.typography, Record<TypographySize, string>>,
23
+ );
@@ -1,6 +1,7 @@
1
1
  import type { SprinklesProperties } from '@vanilla-extract/sprinkles';
2
2
  import type { UnknownRecord } from 'type-fest';
3
3
 
4
+ /* eslint-disable-next-line @typescript-eslint/consistent-type-definitions */
4
5
  export interface SprinklesFnBase {
5
6
  /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
6
7
  (...args: any): string;
@@ -1,3 +1,2 @@
1
1
  export { extractSprinklesProps } from './extract-sprinkles-props';
2
- export { isObject } from './is-object';
3
2
  export { mapContractVars } from './map-contract-vars';
@@ -1,5 +0,0 @@
1
- export {
2
- type PolymorphicComponentProps,
3
- type DistributiveOmit,
4
- type UnwrapArray,
5
- } from './utils.types';
@@ -1,15 +0,0 @@
1
- import type { ComponentPropsWithRef, ElementType } from 'react';
2
-
3
- /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
4
- export type DistributiveOmit<T, TOmitted extends PropertyKey> = T extends any
5
- ? Omit<T, TOmitted>
6
- : never;
7
-
8
- export type UnwrapArray<R> = R extends unknown[] ? UnwrapArray<R[number]> : R;
9
-
10
- export type PolymorphicComponentProps<TUse extends ElementType> = {
11
- use?: TUse;
12
- } & DistributiveOmit<
13
- ComponentPropsWithRef<ElementType extends TUse ? 'div' : TUse>,
14
- 'use'
15
- >;
@@ -1,3 +0,0 @@
1
- export const isObject = <T extends object>(value: unknown): value is T => {
2
- return !!value && typeof value === "object" && !Array.isArray(value);
3
- };