@kimdw-rtk/ui 0.0.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 (158) hide show
  1. package/.babelrc +12 -0
  2. package/.turbo/turbo-check-types.log +2 -0
  3. package/.turbo/turbo-lint.log +12 -0
  4. package/.turbo/turbo-test.log +4084 -0
  5. package/.vscode/settings.json +4 -0
  6. package/eslint.config.mjs +4 -0
  7. package/jest.config.json +10 -0
  8. package/jest.setup.js +2 -0
  9. package/package.json +53 -0
  10. package/src/components/Accordion/Accordion.css.ts +29 -0
  11. package/src/components/Accordion/Accordion.spec.tsx +6 -0
  12. package/src/components/Accordion/Accordion.tsx +44 -0
  13. package/src/components/Accordion/AccordionContent.css.ts +29 -0
  14. package/src/components/Accordion/AccordionContent.tsx +87 -0
  15. package/src/components/Accordion/AccordionContext.ts +9 -0
  16. package/src/components/Accordion/AccordionTrigger.css.ts +46 -0
  17. package/src/components/Accordion/AccordionTrigger.tsx +41 -0
  18. package/src/components/Accordion/index.ts +3 -0
  19. package/src/components/Alert/index.tsx +25 -0
  20. package/src/components/Box/Box.css.ts +18 -0
  21. package/src/components/Box/Box.spec.tsx +6 -0
  22. package/src/components/Box/index.tsx +41 -0
  23. package/src/components/Button/Button.css.ts +241 -0
  24. package/src/components/Button/Button.spec.tsx +30 -0
  25. package/src/components/Button/index.tsx +60 -0
  26. package/src/components/Card/Card.css.ts +93 -0
  27. package/src/components/Card/Card.spec.tsx +24 -0
  28. package/src/components/Card/Card.tsx +41 -0
  29. package/src/components/Card/CardContent.css.ts +8 -0
  30. package/src/components/Card/CardContent.tsx +23 -0
  31. package/src/components/Card/CardInteraction.css.ts +11 -0
  32. package/src/components/Card/CardInteraction.tsx +36 -0
  33. package/src/components/Card/CardThumbnail.css.ts +6 -0
  34. package/src/components/Card/CardThumbnail.tsx +23 -0
  35. package/src/components/Card/index.ts +4 -0
  36. package/src/components/Chip/Chip.css.ts +75 -0
  37. package/src/components/Chip/Chip.spec.tsx +6 -0
  38. package/src/components/Chip/Chip.tsx +37 -0
  39. package/src/components/Chip/index.ts +1 -0
  40. package/src/components/Confirm/index.tsx +44 -0
  41. package/src/components/Dialog/Dialog.css.ts +25 -0
  42. package/src/components/Dialog/Dialog.spec.tsx +26 -0
  43. package/src/components/Dialog/Dialog.tsx +30 -0
  44. package/src/components/Dialog/DialogContent.css.ts +16 -0
  45. package/src/components/Dialog/DialogContent.tsx +26 -0
  46. package/src/components/Dialog/DialogFooter.css.ts +20 -0
  47. package/src/components/Dialog/DialogFooter.tsx +26 -0
  48. package/src/components/Dialog/DialogHeader.css.ts +31 -0
  49. package/src/components/Dialog/DialogHeader.tsx +37 -0
  50. package/src/components/Dialog/index.ts +4 -0
  51. package/src/components/Navigation/Navigation.spec.tsx +19 -0
  52. package/src/components/Navigation/NavigationAside.css.ts +7 -0
  53. package/src/components/Navigation/NavigationAside.tsx +23 -0
  54. package/src/components/Navigation/NavigationBar.css.ts +42 -0
  55. package/src/components/Navigation/NavigationBar.tsx +25 -0
  56. package/src/components/Navigation/NavigationContainer.css.ts +11 -0
  57. package/src/components/Navigation/NavigationContainer.tsx +26 -0
  58. package/src/components/Navigation/NavigationDrawer.css.ts +61 -0
  59. package/src/components/Navigation/NavigationDrawer.tsx +67 -0
  60. package/src/components/Navigation/NavigationItem.css.ts +43 -0
  61. package/src/components/Navigation/NavigationItem.tsx +24 -0
  62. package/src/components/Navigation/NavigationLogo.css.ts +5 -0
  63. package/src/components/Navigation/NavigationLogo.tsx +28 -0
  64. package/src/components/Navigation/NavigationMenu.css.ts +23 -0
  65. package/src/components/Navigation/NavigationMenu.tsx +25 -0
  66. package/src/components/Navigation/index.ts +7 -0
  67. package/src/components/Range/Range.css.ts +132 -0
  68. package/src/components/Range/Range.spec.tsx +6 -0
  69. package/src/components/Range/Range.tsx +90 -0
  70. package/src/components/Range/index.ts +1 -0
  71. package/src/components/ScrollArea/ScrollArea.css.ts +40 -0
  72. package/src/components/ScrollArea/ScrollArea.spec.tsx +6 -0
  73. package/src/components/ScrollArea/ScrollArea.tsx +68 -0
  74. package/src/components/ScrollArea/index.ts +1 -0
  75. package/src/components/Select/Select.css.ts +22 -0
  76. package/src/components/Select/Select.spec.tsx +65 -0
  77. package/src/components/Select/Select.tsx +111 -0
  78. package/src/components/Select/SelectContext.ts +59 -0
  79. package/src/components/Select/SelectOption.css.ts +14 -0
  80. package/src/components/Select/SelectOption.tsx +40 -0
  81. package/src/components/Select/SelectOptionList.css.ts +68 -0
  82. package/src/components/Select/SelectOptionList.tsx +59 -0
  83. package/src/components/Select/SelectTrigger.css.ts +73 -0
  84. package/src/components/Select/SelectTrigger.tsx +49 -0
  85. package/src/components/Select/index.tsx +2 -0
  86. package/src/components/Skeleton/Skeleton.css.ts +26 -0
  87. package/src/components/Skeleton/Skeleton.spec.tsx +6 -0
  88. package/src/components/Skeleton/index.tsx +27 -0
  89. package/src/components/Table/Table.css.ts +10 -0
  90. package/src/components/Table/Table.spec.tsx +12 -0
  91. package/src/components/Table/Table.tsx +27 -0
  92. package/src/components/Table/TableBody.tsx +14 -0
  93. package/src/components/Table/TableCell.css.ts +43 -0
  94. package/src/components/Table/TableCell.tsx +30 -0
  95. package/src/components/Table/TableHead.css.ts +10 -0
  96. package/src/components/Table/TableHead.tsx +30 -0
  97. package/src/components/Table/TableHeader.tsx +14 -0
  98. package/src/components/Table/TableRow.css.ts +3 -0
  99. package/src/components/Table/TableRow.tsx +24 -0
  100. package/src/components/Table/index.ts +6 -0
  101. package/src/components/Tabs/Tabs.spec.tsx +46 -0
  102. package/src/components/Tabs/Tabs.tsx +34 -0
  103. package/src/components/Tabs/TabsContent.tsx +32 -0
  104. package/src/components/Tabs/TabsList.css.ts +11 -0
  105. package/src/components/Tabs/TabsList.tsx +25 -0
  106. package/src/components/Tabs/TabsProvider.tsx +17 -0
  107. package/src/components/Tabs/TabsTrigger.css.ts +38 -0
  108. package/src/components/Tabs/TabsTrigger.tsx +43 -0
  109. package/src/components/Tabs/index.ts +4 -0
  110. package/src/components/TextField/TextField.css.ts +81 -0
  111. package/src/components/TextField/TextField.spec.tsx +6 -0
  112. package/src/components/TextField/index.tsx +38 -0
  113. package/src/components/Toast/Toast.css.ts +79 -0
  114. package/src/components/Toast/Toast.spec.tsx +6 -0
  115. package/src/components/Toast/index.tsx +48 -0
  116. package/src/components/Typography/Typography.css.ts +17 -0
  117. package/src/components/Typography/Typography.spec.tsx +35 -0
  118. package/src/components/Typography/index.tsx +57 -0
  119. package/src/components/index.ts +18 -0
  120. package/src/contexts/UIProvider.tsx +30 -0
  121. package/src/contexts/index.ts +1 -0
  122. package/src/hooks/index.ts +5 -0
  123. package/src/hooks/useDialog/index.tsx +51 -0
  124. package/src/hooks/useDialog/useDialog.spec.tsx +80 -0
  125. package/src/hooks/useMouseScroll/index.ts +63 -0
  126. package/src/hooks/usePointerSlider/index.ts +79 -0
  127. package/src/hooks/useRipple/index.tsx +152 -0
  128. package/src/hooks/useRipple/ripple.css.ts +40 -0
  129. package/src/hooks/useToast/ToastContainer.css.ts +12 -0
  130. package/src/hooks/useToast/ToastContainer.tsx +11 -0
  131. package/src/hooks/useToast/ToastProvider.tsx +131 -0
  132. package/src/hooks/useToast/index.ts +15 -0
  133. package/src/index.ts +8 -0
  134. package/src/styles/globalStyle.css.ts +36 -0
  135. package/src/styles/index.ts +4 -0
  136. package/src/styles/layers.css.ts +4 -0
  137. package/src/styles/overlay.css.ts +40 -0
  138. package/src/styles/sprinkles.css.ts +149 -0
  139. package/src/styles/sx.ts +13 -0
  140. package/src/tests/uiTest.tsx +54 -0
  141. package/src/themes/darkTheme.css.ts +30 -0
  142. package/src/themes/index.ts +3 -0
  143. package/src/themes/lightTheme.css.ts +30 -0
  144. package/src/themes/theme.css.ts +32 -0
  145. package/src/tokens/index.ts +5 -0
  146. package/src/tokens/scale/color.ts +604 -0
  147. package/src/tokens/semantic/breakpoint.ts +6 -0
  148. package/src/tokens/semantic/color.ts +10 -0
  149. package/src/tokens/semantic/spacing.ts +9 -0
  150. package/src/tokens/semantic/typography.ts +32 -0
  151. package/src/types/index.ts +1 -0
  152. package/src/types/ui.types.ts +26 -0
  153. package/src/utils/index.ts +1 -0
  154. package/src/utils/sprinklesUtils.ts +28 -0
  155. package/src/utils/styleUtils.css.ts +109 -0
  156. package/tsconfig.json +11 -0
  157. package/turbo/generators/config.ts +30 -0
  158. package/turbo/generators/templates/component.hbs +8 -0
@@ -0,0 +1,28 @@
1
+ import { sprinkles } from '#styles';
2
+
3
+ type SprinklesKey =
4
+ typeof sprinkles.properties extends Set<infer U> ? U : never;
5
+
6
+ export const filterSprinkles = (props: { [key: string]: unknown }) => {
7
+ const result = {} as { [key in SprinklesKey]: unknown };
8
+
9
+ for (const key in props) {
10
+ if (sprinkles.properties.has(key as SprinklesKey)) {
11
+ result[key as SprinklesKey] = props[key];
12
+ }
13
+ }
14
+
15
+ return result as Parameters<typeof sprinkles>[0];
16
+ };
17
+
18
+ export const omitSprinkles = (props: { [key: string]: unknown }) => {
19
+ const result = {} as { [key: string]: unknown };
20
+
21
+ for (const key in props) {
22
+ if (!sprinkles.properties.has(key as SprinklesKey)) {
23
+ result[key as SprinklesKey] = props[key];
24
+ }
25
+ }
26
+
27
+ return result;
28
+ };
@@ -0,0 +1,109 @@
1
+ import { style, type StyleRule } from '@vanilla-extract/css';
2
+ import { recipe } from '@vanilla-extract/recipes';
3
+
4
+ import { componentsLayer } from '#styles';
5
+
6
+ type StyleRuleWithoutLayer =
7
+ | Omit<StyleRule, '@layer'>
8
+ | string
9
+ | (Omit<StyleRule, '@layer'> | string)[];
10
+ type RecipeStyleRuleWithoutLayer =
11
+ | Omit<StyleRule, '@layer'>
12
+ | string
13
+ | (Omit<StyleRule, '@layer'> | string)[];
14
+ type VariantDefinitions = Record<string, RecipeStyleRuleWithoutLayer>;
15
+ type BooleanMap<T> = T extends 'true' | 'false' ? boolean : T;
16
+ type VariantGroups = Record<string, VariantDefinitions>;
17
+ type VariantSelection<Variants extends VariantGroups> = {
18
+ [VariantGroup in keyof Variants]?:
19
+ | BooleanMap<keyof Variants[VariantGroup]>
20
+ | undefined;
21
+ };
22
+
23
+ interface CompoundVariant<Variants extends VariantGroups> {
24
+ variants: VariantSelection<Variants>;
25
+ style: RecipeStyleRuleWithoutLayer;
26
+ }
27
+ type PatternOptions<Variants extends VariantGroups> = {
28
+ base?: RecipeStyleRuleWithoutLayer;
29
+ variants?: Variants;
30
+ defaultVariants?: VariantSelection<Variants>;
31
+ compoundVariants?: Array<CompoundVariant<Variants>>;
32
+ };
33
+
34
+ export const styleWithLayer = (
35
+ rule: StyleRuleWithoutLayer,
36
+ layer: string = componentsLayer,
37
+ ) => {
38
+ if (Array.isArray(rule)) {
39
+ return rule
40
+ .map((ruleItem) => {
41
+ if (typeof ruleItem === 'string') {
42
+ return ruleItem;
43
+ }
44
+ return style({ '@layer': { [layer]: ruleItem } });
45
+ })
46
+ .join(' ');
47
+ } else if (typeof rule === 'string') {
48
+ return rule;
49
+ }
50
+
51
+ return style({ '@layer': { [layer]: rule } });
52
+ };
53
+
54
+ export const recipeWithLayer = <Variants extends VariantGroups>(
55
+ options: PatternOptions<Variants>,
56
+ layer: string = componentsLayer,
57
+ ) => {
58
+ const { base, compoundVariants, defaultVariants, variants } = options;
59
+
60
+ let layeredBase: RecipeStyleRuleWithoutLayer | undefined;
61
+
62
+ if (base) {
63
+ if (typeof base === 'string') {
64
+ layeredBase = base;
65
+ } else if (Array.isArray(base)) {
66
+ layeredBase = base
67
+ .map((rule) => {
68
+ if (typeof rule === 'string') {
69
+ return rule;
70
+ }
71
+
72
+ if (Array.isArray(rule)) {
73
+ return rule.join(' ');
74
+ }
75
+
76
+ return style({ '@layer': { [layer]: rule } });
77
+ })
78
+ .join(' ');
79
+ } else {
80
+ layeredBase = style({ '@layer': { [layer]: base } });
81
+ }
82
+ }
83
+
84
+ let layeredVariants: Variants | undefined;
85
+
86
+ if (variants) {
87
+ layeredVariants = Object.entries(variants).reduce(
88
+ (prev, [variantKey, variantValue]) => {
89
+ return {
90
+ ...prev,
91
+ [variantKey]: Object.entries(variantValue).reduce(
92
+ (prev, [key, value]) => {
93
+ return { ...prev, [key]: styleWithLayer(value, layer) };
94
+ },
95
+ {},
96
+ ),
97
+ };
98
+ },
99
+ {} as Variants,
100
+ );
101
+ }
102
+
103
+ return recipe({
104
+ base: layeredBase,
105
+ compoundVariants,
106
+ defaultVariants,
107
+ variants: layeredVariants,
108
+ });
109
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "@repo/typescript-config/react-library.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./src",
5
+ "outDir": "dist",
6
+ "types": ["@testing-library/jest-dom"],
7
+ "lib": ["ESNext", "DOM"]
8
+ },
9
+ "include": ["src"],
10
+ "exclude": ["node_modules", "dist"]
11
+ }
@@ -0,0 +1,30 @@
1
+ import type { PlopTypes } from '@turbo/gen';
2
+
3
+ // Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation
4
+
5
+ export default function generator(plop: PlopTypes.NodePlopAPI): void {
6
+ // A simple generator to add a new React component to the internal UI library
7
+ plop.setGenerator('react-component', {
8
+ description: 'Adds a new react component',
9
+ prompts: [
10
+ {
11
+ type: 'input',
12
+ name: 'name',
13
+ message: 'What is the name of the component?',
14
+ },
15
+ ],
16
+ actions: [
17
+ {
18
+ type: 'add',
19
+ path: 'src/{{kebabCase name}}.tsx',
20
+ templateFile: 'templates/component.hbs',
21
+ },
22
+ {
23
+ type: 'append',
24
+ path: 'package.json',
25
+ pattern: /"exports": {(?<insertion>)/g,
26
+ template: ' "./{{kebabCase name}}": "./src/{{kebabCase name}}.tsx",',
27
+ },
28
+ ],
29
+ });
30
+ }
@@ -0,0 +1,8 @@
1
+ export const {{ pascalCase name }} = ({ children }: { children: React.ReactNode }) => {
2
+ return (
3
+ <div>
4
+ <h1>{{ pascalCase name }} Component</h1>
5
+ {children}
6
+ </div>
7
+ );
8
+ };