@mich8060/chg-design-system 0.1.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 (260) hide show
  1. package/.github/workflows/figma-sync.yml +30 -0
  2. package/ARCHITECTURE_FIX.md +241 -0
  3. package/LICENSE +21 -0
  4. package/README.lib.md +103 -0
  5. package/README.md +177 -0
  6. package/figma.config.json +9 -0
  7. package/package.json +67 -0
  8. package/package.lib.json +49 -0
  9. package/public/data/figma-variables.json +40026 -0
  10. package/public/favicon.ico +0 -0
  11. package/public/index.html +46 -0
  12. package/public/logo192.png +0 -0
  13. package/public/logo512.png +0 -0
  14. package/public/manifest.json +25 -0
  15. package/public/robots.txt +3 -0
  16. package/public/styles/tokens.css +1994 -0
  17. package/scripts/index.js +896 -0
  18. package/scripts/publish-lib.js +150 -0
  19. package/scripts/validate.js +94 -0
  20. package/src/App.css +457 -0
  21. package/src/App.css.map +1 -0
  22. package/src/App.js +161 -0
  23. package/src/App.scss +548 -0
  24. package/src/App.test.js +8 -0
  25. package/src/assets/images/.gitkeep +0 -0
  26. package/src/assets/images/doctors/Avatar-1.png +0 -0
  27. package/src/assets/images/doctors/Avatar-10.png +0 -0
  28. package/src/assets/images/doctors/Avatar-11.png +0 -0
  29. package/src/assets/images/doctors/Avatar-12.png +0 -0
  30. package/src/assets/images/doctors/Avatar-13.png +0 -0
  31. package/src/assets/images/doctors/Avatar-14.png +0 -0
  32. package/src/assets/images/doctors/Avatar-15.png +0 -0
  33. package/src/assets/images/doctors/Avatar-16.png +0 -0
  34. package/src/assets/images/doctors/Avatar-17.png +0 -0
  35. package/src/assets/images/doctors/Avatar-18.png +0 -0
  36. package/src/assets/images/doctors/Avatar-19.png +0 -0
  37. package/src/assets/images/doctors/Avatar-2.png +0 -0
  38. package/src/assets/images/doctors/Avatar-20.png +0 -0
  39. package/src/assets/images/doctors/Avatar-21.png +0 -0
  40. package/src/assets/images/doctors/Avatar-3.png +0 -0
  41. package/src/assets/images/doctors/Avatar-4.png +0 -0
  42. package/src/assets/images/doctors/Avatar-5.png +0 -0
  43. package/src/assets/images/doctors/Avatar-6.png +0 -0
  44. package/src/assets/images/doctors/Avatar-7.png +0 -0
  45. package/src/assets/images/doctors/Avatar-8.png +0 -0
  46. package/src/assets/images/doctors/Avatar-9.png +0 -0
  47. package/src/assets/images/doctors/Avatar.png +0 -0
  48. package/src/assets/images/doctors/index.js +141 -0
  49. package/src/data/figma-variables.json +90305 -0
  50. package/src/index.js +20 -0
  51. package/src/index.scss +10 -0
  52. package/src/pages/AccordionDemo.jsx +206 -0
  53. package/src/pages/AccordionDemo.scss +34 -0
  54. package/src/pages/ActionMenuDemo.jsx +957 -0
  55. package/src/pages/ActionMenuDemo.scss +34 -0
  56. package/src/pages/AvatarDemo.jsx +328 -0
  57. package/src/pages/AvatarDemo.scss +40 -0
  58. package/src/pages/BadgeDemo.jsx +254 -0
  59. package/src/pages/BadgeDemo.scss +40 -0
  60. package/src/pages/BorderRadiusDemo.jsx +112 -0
  61. package/src/pages/BorderRadiusDemo.scss +50 -0
  62. package/src/pages/BrandingDemo.jsx +117 -0
  63. package/src/pages/BreadcrumbDemo.jsx +172 -0
  64. package/src/pages/ButtonDemo.jsx +708 -0
  65. package/src/pages/ButtonDemo.scss +34 -0
  66. package/src/pages/CheckboxDemo.jsx +194 -0
  67. package/src/pages/ChipDemo.jsx +359 -0
  68. package/src/pages/ChipDemo.scss +40 -0
  69. package/src/pages/ColorsDemo.jsx +566 -0
  70. package/src/pages/ColorsDemo.scss +243 -0
  71. package/src/pages/ComponentsUsage.jsx +401 -0
  72. package/src/pages/DatepickerDemo.jsx +223 -0
  73. package/src/pages/DividerDemo.jsx +337 -0
  74. package/src/pages/DotStatusDemo.jsx +223 -0
  75. package/src/pages/DropdownDemo.jsx +229 -0
  76. package/src/pages/FieldDemo.jsx +253 -0
  77. package/src/pages/FigmaVariablesDemo.jsx +426 -0
  78. package/src/pages/FigmaVariablesDemo.scss +316 -0
  79. package/src/pages/FileUploadDemo.jsx +186 -0
  80. package/src/pages/FlexDemo.jsx +144 -0
  81. package/src/pages/FlexDemo.scss +119 -0
  82. package/src/pages/FontInstallation.jsx +252 -0
  83. package/src/pages/FontInstallation.scss +40 -0
  84. package/src/pages/Home.jsx +3156 -0
  85. package/src/pages/IconDemo.jsx +1680 -0
  86. package/src/pages/ImageAspectDemo.jsx +152 -0
  87. package/src/pages/InputDemo.jsx +245 -0
  88. package/src/pages/Installation.jsx +257 -0
  89. package/src/pages/Installation.scss +40 -0
  90. package/src/pages/KeyDemo.jsx +184 -0
  91. package/src/pages/MenuDemo.jsx +139 -0
  92. package/src/pages/MicroCalendarDemo.jsx +165 -0
  93. package/src/pages/PaginationDemo.jsx +176 -0
  94. package/src/pages/PillToggleDemo.jsx +212 -0
  95. package/src/pages/ProgressCircleDemo.jsx +206 -0
  96. package/src/pages/ProgressIndicatorDemo.jsx +227 -0
  97. package/src/pages/RadioDemo.jsx +282 -0
  98. package/src/pages/ShadowsDemo.jsx +118 -0
  99. package/src/pages/ShadowsDemo.scss +93 -0
  100. package/src/pages/SliderDemo.jsx +226 -0
  101. package/src/pages/SpacingDemo.jsx +160 -0
  102. package/src/pages/SpacingDemo.scss +107 -0
  103. package/src/pages/StatusDemo.jsx +196 -0
  104. package/src/pages/StepsDemo.jsx +308 -0
  105. package/src/pages/TableDemo.jsx +376 -0
  106. package/src/pages/TabsDemo.jsx +221 -0
  107. package/src/pages/ToastDemo.jsx +195 -0
  108. package/src/pages/ToggleDemo.jsx +187 -0
  109. package/src/pages/TokensDemo.jsx +637 -0
  110. package/src/pages/TokensDemo.scss +270 -0
  111. package/src/pages/TokensUsage.jsx +220 -0
  112. package/src/pages/TooltipDemo.jsx +170 -0
  113. package/src/pages/TypographyDemo.jsx +229 -0
  114. package/src/pages/TypographyDemo.scss +105 -0
  115. package/src/pages/UtilitiesDemo.jsx +381 -0
  116. package/src/pages/UtilitiesDemo.scss +214 -0
  117. package/src/reportWebVitals.js +13 -0
  118. package/src/setupTests.js +5 -0
  119. package/src/styles/_typography.scss +932 -0
  120. package/src/styles/_utilities.scss +3635 -0
  121. package/src/styles/_variables.scss +887 -0
  122. package/src/styles/prism-custom.css +206 -0
  123. package/src/styles/prism-custom.css.map +1 -0
  124. package/src/styles/prism-custom.scss +205 -0
  125. package/src/styles/tokens.css +4416 -0
  126. package/src/styles/tokens.css.map +1 -0
  127. package/src/styles/tokens.scss +1456 -0
  128. package/src/ui/Accordion/Accordion.jsx +70 -0
  129. package/src/ui/Accordion/Accordion.scss +82 -0
  130. package/src/ui/Accordion/index.js +1 -0
  131. package/src/ui/ActionMenu/ActionMenu.jsx +383 -0
  132. package/src/ui/ActionMenu/ActionMenu.scss +198 -0
  133. package/src/ui/ActionMenu/index.js +1 -0
  134. package/src/ui/Avatar/Avatar.jsx +49 -0
  135. package/src/ui/Avatar/Avatar.scss +82 -0
  136. package/src/ui/Avatar/index.js +1 -0
  137. package/src/ui/Badge/Badge.jsx +64 -0
  138. package/src/ui/Badge/Badge.scss +84 -0
  139. package/src/ui/Badge/index.js +1 -0
  140. package/src/ui/Branding/Branding.jsx +65 -0
  141. package/src/ui/Branding/Branding.scss +116 -0
  142. package/src/ui/Branding/index.js +1 -0
  143. package/src/ui/Breadcrumb/Breadcrumb.jsx +162 -0
  144. package/src/ui/Breadcrumb/Breadcrumb.scss +46 -0
  145. package/src/ui/Breadcrumb/index.js +2 -0
  146. package/src/ui/Button/Button.figma.tsx +49 -0
  147. package/src/ui/Button/Button.jsx +135 -0
  148. package/src/ui/Button/Button.scss +188 -0
  149. package/src/ui/Button/index.js +1 -0
  150. package/src/ui/Card/Card.jsx +25 -0
  151. package/src/ui/Card/Card.scss +47 -0
  152. package/src/ui/Card/index.js +1 -0
  153. package/src/ui/Checkbox/Checkbox.jsx +70 -0
  154. package/src/ui/Checkbox/Checkbox.scss +96 -0
  155. package/src/ui/Checkbox/index.js +1 -0
  156. package/src/ui/Chip/Chip.jsx +104 -0
  157. package/src/ui/Chip/Chip.scss +118 -0
  158. package/src/ui/Chip/index.js +1 -0
  159. package/src/ui/CopyButton/CopyButton.jsx +102 -0
  160. package/src/ui/CopyButton/CopyButton.scss +56 -0
  161. package/src/ui/CopyButton/index.js +1 -0
  162. package/src/ui/Datepicker/Datepicker.jsx +326 -0
  163. package/src/ui/Datepicker/Datepicker.scss +187 -0
  164. package/src/ui/Datepicker/index.js +2 -0
  165. package/src/ui/Divider/Divider.jsx +89 -0
  166. package/src/ui/Divider/Divider.scss +112 -0
  167. package/src/ui/Divider/index.js +1 -0
  168. package/src/ui/DotStatus/DotStatus.jsx +64 -0
  169. package/src/ui/DotStatus/DotStatus.scss +87 -0
  170. package/src/ui/DotStatus/index.js +1 -0
  171. package/src/ui/Dropdown/Dropdown.jsx +200 -0
  172. package/src/ui/Dropdown/Dropdown.scss +156 -0
  173. package/src/ui/Dropdown/index.js +1 -0
  174. package/src/ui/Field/Field.jsx +89 -0
  175. package/src/ui/Field/Field.scss +119 -0
  176. package/src/ui/Field/index.js +1 -0
  177. package/src/ui/FileUpload/FileUpload.figma.tsx +28 -0
  178. package/src/ui/FileUpload/FileUpload.jsx +153 -0
  179. package/src/ui/FileUpload/FileUpload.scss +78 -0
  180. package/src/ui/FileUpload/index.js +2 -0
  181. package/src/ui/Flex/Flex.jsx +42 -0
  182. package/src/ui/Flex/Flex.scss +119 -0
  183. package/src/ui/Flex/index.js +1 -0
  184. package/src/ui/Icon/Icon.figma.tsx +22 -0
  185. package/src/ui/Icon/Icon.jsx +47 -0
  186. package/src/ui/Icon/index.js +1 -0
  187. package/src/ui/ImageAspect/ImageAspect.jsx +56 -0
  188. package/src/ui/ImageAspect/ImageAspect.scss +62 -0
  189. package/src/ui/ImageAspect/index.js +1 -0
  190. package/src/ui/Input/Input.figma.tsx +35 -0
  191. package/src/ui/Input/Input.jsx +68 -0
  192. package/src/ui/Input/Input.scss +64 -0
  193. package/src/ui/Input/index.js +2 -0
  194. package/src/ui/Key/Key.jsx +37 -0
  195. package/src/ui/Key/Key.scss +34 -0
  196. package/src/ui/Key/index.js +1 -0
  197. package/src/ui/Menu/Menu.jsx +389 -0
  198. package/src/ui/Menu/Menu.scss +382 -0
  199. package/src/ui/Menu/index.js +1 -0
  200. package/src/ui/MicroCalendar/MicroCalendar.jsx +392 -0
  201. package/src/ui/MicroCalendar/MicroCalendar.scss +277 -0
  202. package/src/ui/MicroCalendar/index.js +1 -0
  203. package/src/ui/Pagination/Pagination.jsx +237 -0
  204. package/src/ui/Pagination/Pagination.scss +182 -0
  205. package/src/ui/Pagination/index.js +1 -0
  206. package/src/ui/PillToggle/PillToggle.jsx +56 -0
  207. package/src/ui/PillToggle/PillToggle.scss +84 -0
  208. package/src/ui/PillToggle/index.js +1 -0
  209. package/src/ui/Playground/Playground.jsx +524 -0
  210. package/src/ui/Playground/Playground.scss +310 -0
  211. package/src/ui/Playground/index.js +2 -0
  212. package/src/ui/ProgressCircle/ProgressCircle.jsx +147 -0
  213. package/src/ui/ProgressCircle/ProgressCircle.scss +143 -0
  214. package/src/ui/ProgressCircle/index.js +1 -0
  215. package/src/ui/ProgressIndicator/ProgressIndicator.jsx +92 -0
  216. package/src/ui/ProgressIndicator/ProgressIndicator.scss +133 -0
  217. package/src/ui/ProgressIndicator/index.js +1 -0
  218. package/src/ui/Radio/Radio.jsx +57 -0
  219. package/src/ui/Radio/Radio.scss +84 -0
  220. package/src/ui/Radio/index.js +1 -0
  221. package/src/ui/Slider/Slider.jsx +283 -0
  222. package/src/ui/Slider/Slider.scss +156 -0
  223. package/src/ui/Slider/index.js +1 -0
  224. package/src/ui/Status/Status.jsx +66 -0
  225. package/src/ui/Status/Status.scss +90 -0
  226. package/src/ui/Status/index.js +1 -0
  227. package/src/ui/Steps/Steps.jsx +201 -0
  228. package/src/ui/Steps/Steps.scss +240 -0
  229. package/src/ui/Steps/index.js +1 -0
  230. package/src/ui/Table/Table.jsx +143 -0
  231. package/src/ui/Table/Table.scss +90 -0
  232. package/src/ui/Table/index.js +1 -0
  233. package/src/ui/Tabs/TabItem.jsx +86 -0
  234. package/src/ui/Tabs/Tabs.figma.tsx +30 -0
  235. package/src/ui/Tabs/Tabs.jsx +318 -0
  236. package/src/ui/Tabs/Tabs.scss +164 -0
  237. package/src/ui/Tabs/Untitled +1 -0
  238. package/src/ui/Tabs/index.js +3 -0
  239. package/src/ui/Tag/Tag.figma.tsx +29 -0
  240. package/src/ui/Tag/Tag.jsx +93 -0
  241. package/src/ui/Tag/Tag.scss +229 -0
  242. package/src/ui/Tag/index.js +2 -0
  243. package/src/ui/Textarea/Textarea.figma.tsx +35 -0
  244. package/src/ui/Textarea/Textarea.jsx +68 -0
  245. package/src/ui/Textarea/Textarea.scss +69 -0
  246. package/src/ui/Textarea/index.js +2 -0
  247. package/src/ui/Toast/Toast.jsx +75 -0
  248. package/src/ui/Toast/Toast.scss +132 -0
  249. package/src/ui/Toast/index.js +2 -0
  250. package/src/ui/Toggle/Toggle.jsx +73 -0
  251. package/src/ui/Toggle/Toggle.scss +139 -0
  252. package/src/ui/Toggle/index.js +1 -0
  253. package/src/ui/Tooltip/Tooltip.figma.tsx +24 -0
  254. package/src/ui/Tooltip/Tooltip.jsx +123 -0
  255. package/src/ui/Tooltip/Tooltip.scss +80 -0
  256. package/src/ui/Tooltip/index.js +2 -0
  257. package/src/ui/index.js +63 -0
  258. package/src/utils/formatDate.js +27 -0
  259. package/src/utils/headerVariants.js +69 -0
  260. package/vite.config.lib.js +55 -0
@@ -0,0 +1,30 @@
1
+ name: Figma Sync
2
+
3
+ on:
4
+ workflow_dispatch: {}
5
+ push:
6
+ branches: [ main ]
7
+ schedule:
8
+ - cron: "0 3 * * *" # nightly at 3am UTC
9
+
10
+ jobs:
11
+ sync:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-node@v4
16
+ with:
17
+ node-version: 20
18
+ - run: npm ci
19
+ - run: npm run pull:figma
20
+ env:
21
+ FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
22
+ FIGMA_FILE_ID: ${{ secrets.FIGMA_FILE_ID }}
23
+ - run: npm run build:tokens
24
+ - name: Commit & push changes
25
+ run: |
26
+ git config user.name "github-actions[bot]"
27
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
28
+ git add src/scss/ tokens/
29
+ git commit -m "chore: sync tokens from Figma" || echo "No changes"
30
+ git push
@@ -0,0 +1,241 @@
1
+ # CSS Token Generator Architecture Fix
2
+
3
+ ## Root Cause Analysis
4
+
5
+ ### Problem 1: Brand Values Injected into Design System Light (`:root`)
6
+
7
+ **Location**: `generate_structured_css.py` lines 636-648
8
+
9
+ **Issue**: Non-color variables (buttons, surfaces, borders) get brand override values **hard-coded** directly into `:root`:
10
+
11
+ ```python
12
+ # Lines 636-648: PROBLEMATIC CODE
13
+ if var_id in ds_var_brand_overrides and ds_var_brand_overrides[var_id]:
14
+ brand_override_value = ds_var_brand_overrides[var_id]['CompHealth'] # Hard-codes CompHealth!
15
+ css_value = format_value_for_css(brand_override_value, var_type, var_name)
16
+ scss_parts.append(f" {css_name}: {css_value};") # Hard value in :root
17
+ ```
18
+
19
+ **Result**:
20
+ - `:root` contains `--uds-button-border-primary-default: #009add;` (CompHealth value)
21
+ - `[data-brand="modio"]` tries to override, but both have same specificity
22
+ - Since `:root` comes first, brand blocks can't override it
23
+
24
+ **Generated CSS (BROKEN)**:
25
+ ```css
26
+ :root {
27
+ --uds-button-border-primary-default: #009add; /* CompHealth hard-coded! */
28
+ }
29
+
30
+ [data-brand="modio"] {
31
+ --uds-button-border-primary-default: #3b82f6; /* Can't override :root */
32
+ }
33
+ ```
34
+
35
+ ### Problem 2: Component Tokens Finalized Too Early
36
+
37
+ **Location**: `generate_structured_css.py` lines 632-681
38
+
39
+ **Issue**: Component tokens (buttons, surfaces) are resolved to **hard values** instead of referencing semantic color tokens:
40
+
41
+ **Current (BROKEN)**:
42
+ ```css
43
+ :root {
44
+ --uds-button-surface-primary-default: #009add; /* Hard value */
45
+ --uds-surface-brand-primary: #eae4ee; /* Hard value */
46
+ }
47
+ ```
48
+
49
+ **Should be**:
50
+ ```css
51
+ :root {
52
+ --uds-button-surface-primary-default: var(--uds-color-primary-500); /* References semantic token */
53
+ --uds-surface-brand-primary: var(--uds-color-primary-50); /* References semantic token */
54
+ }
55
+ ```
56
+
57
+ ### Problem 3: Brand Overrides Skipped When Already Injected
58
+
59
+ **Location**: `generate_structured_css.py` lines 1003-1005
60
+
61
+ **Issue**: Brand overrides are skipped if they were already injected into Design System:
62
+
63
+ ```python
64
+ # Lines 1003-1005: PROBLEMATIC CODE
65
+ if ds_var_id in ds_var_brand_overrides and brand_name in ds_var_brand_overrides[ds_var_id]:
66
+ # This variable was already updated in the Design System section, skip adding to brand overrides
67
+ continue # Prevents brand blocks from overriding!
68
+ ```
69
+
70
+ **Result**: Brand blocks are empty because variables were already "handled" in `:root`.
71
+
72
+ ### Problem 4: Same Specificity, Order-Dependent Cascade
73
+
74
+ **Issue**: Both `:root` and `[data-brand="X"]` have the same specificity. The generator writes:
75
+ 1. `:root` (with hard-coded brand values)
76
+ 2. `[data-brand="X"]` (trying to override)
77
+
78
+ Since they have same specificity, the **last one wins**. But if `:root` has hard values and brand blocks come later, they should win - but they're being skipped due to Problem 3.
79
+
80
+ ## Required Fixes
81
+
82
+ ### Fix 1: Remove Brand Injection from Design System Light
83
+
84
+ **Location**: `generate_structured_css.py` lines 632-681
85
+
86
+ **Change**: Remove the brand override injection logic. Design System Light should **always** use Design System values, never brand values.
87
+
88
+ **Before**:
89
+ ```python
90
+ else:
91
+ # Non-color variables get their values directly
92
+ # Check if there's a brand override for this variable - if so, use the first brand's override value
93
+ if var_id in ds_var_brand_overrides and ds_var_brand_overrides[var_id]:
94
+ brand_override_value = ds_var_brand_overrides[var_id]['CompHealth']
95
+ css_value = format_value_for_css(brand_override_value, var_type, var_name)
96
+ scss_parts.append(f" {css_name}: {css_value};") # ❌ REMOVE THIS
97
+ ```
98
+
99
+ **After**:
100
+ ```python
101
+ else:
102
+ # Non-color variables get their values directly from Design System
103
+ # NEVER inject brand values here - they belong in [data-brand] blocks
104
+ if light_mode_id:
105
+ value = resolve_value_for_mode(var_id, light_mode_id, fallback_to_first_mode=True)
106
+ css_value = format_value_for_css(value, var_type, var_name)
107
+ if css_value:
108
+ scss_parts.append(f" {css_name}: {css_value};")
109
+ ```
110
+
111
+ ### Fix 2: Ensure Component Tokens Reference Semantic Tokens
112
+
113
+ **Location**: `generate_structured_css.py` lines 632-681
114
+
115
+ **Change**: For component tokens that depend on colors, check if they should reference semantic color tokens instead of hard values.
116
+
117
+ **Note**: This may require analyzing the variable name to determine if it's a derived token. For now, the immediate fix is to remove brand injection. Component tokens should reference `--uds-color-*` tokens when they represent color-derived values.
118
+
119
+ **Example**:
120
+ - `uds/button/surface/primary/default` should reference `var(--uds-color-primary-500)` if it's color-derived
121
+ - This requires understanding the token structure from Figma
122
+
123
+ **For now**: Removing brand injection (Fix 1) will ensure brand blocks can override properly.
124
+
125
+ ### Fix 3: Remove Skip Logic for Brand Overrides
126
+
127
+ **Location**: `generate_structured_css.py` lines 1003-1005
128
+
129
+ **Change**: Remove the logic that skips brand overrides if they were already in Design System.
130
+
131
+ **Before**:
132
+ ```python
133
+ if ds_var_id in ds_var_brand_overrides and brand_name in ds_var_brand_overrides[ds_var_id]:
134
+ # This variable was already updated in the Design System section, skip adding to brand overrides
135
+ continue # ❌ REMOVE THIS
136
+ ```
137
+
138
+ **After**:
139
+ ```python
140
+ # Always include brand overrides in brand blocks
141
+ # Design System Light no longer injects brand values, so brand blocks must contain all overrides
142
+ ```
143
+
144
+ ### Fix 4: Update Filtering Logic
145
+
146
+ **Location**: `generate_structured_css.py` lines 1045-1069
147
+
148
+ **Change**: Update the filtering logic to not exclude variables that were in `ds_var_brand_overrides`, since we're no longer injecting them into Design System.
149
+
150
+ **Before**:
151
+ ```python
152
+ # Check if this DS variable was updated in the Design System section
153
+ if ds_var_id in ds_var_brand_overrides and brand_name in ds_var_brand_overrides[ds_var_id]:
154
+ should_exclude = True # ❌ This logic is now wrong
155
+ ```
156
+
157
+ **After**:
158
+ ```python
159
+ # Since Design System Light no longer injects brand values,
160
+ # we don't need to exclude variables that were in ds_var_brand_overrides
161
+ # Brand blocks should contain all brand-specific overrides
162
+ ```
163
+
164
+ ## Implementation Checklist
165
+
166
+ - [ ] **Fix 1**: Remove brand injection logic (lines 636-648)
167
+ - [ ] **Fix 2**: Ensure Design System Light always uses Design System values (lines 632-681)
168
+ - [ ] **Fix 3**: Remove skip logic for brand overrides (lines 1003-1005)
169
+ - [ ] **Fix 4**: Update filtering logic to not exclude based on `ds_var_brand_overrides` (lines 1045-1069)
170
+ - [ ] **Fix 5**: Remove or repurpose `ds_var_brand_overrides` tracking (it's no longer needed for injection)
171
+
172
+ ## Expected Output After Fix
173
+
174
+ ### Design System Light (`:root`)
175
+ ```css
176
+ :root {
177
+ /* Brand Color Variables (Defaults) */
178
+ --brand-color-primary-500: #009add; /* Design System default */
179
+
180
+ /* UDS Color Variables */
181
+ --uds-color-primary-500: var(--brand-color-primary-500);
182
+
183
+ /* Component Tokens - Use Design System values */
184
+ --uds-button-surface-primary-default: #009add; /* From Design System, not brand */
185
+ --uds-surface-brand-primary: #e3f5fa; /* From Design System */
186
+ }
187
+ ```
188
+
189
+ ### Brand Override Block
190
+ ```css
191
+ [data-brand="comphealth"] {
192
+ /* Brand Color Overrides */
193
+ --brand-color-primary-500: #644d7b; /* CompHealth value */
194
+
195
+ /* Component Tokens Override (if needed) */
196
+ --uds-button-surface-primary-default: var(--uds-color-primary-500); /* References semantic token */
197
+ }
198
+ ```
199
+
200
+ **Cascade Flow**:
201
+ 1. `:root` sets `--brand-color-primary-500: #009add` (DS default)
202
+ 2. `[data-brand="comphealth"]` overrides `--brand-color-primary-500: #644d7b`
203
+ 3. `--uds-color-primary-500: var(--brand-color-primary-500)` automatically updates
204
+ 4. Component tokens that reference `--uds-color-primary-500` automatically update
205
+
206
+ ## Verification Checklist
207
+
208
+ After applying fixes, verify in DevTools:
209
+
210
+ 1. **Check `:root` has no hard-coded brand values**:
211
+ - Search for `--uds-button-*` in `:root` - should be Design System values only
212
+ - Search for `--uds-surface-*` in `:root` - should be Design System values only
213
+
214
+ 2. **Check brand blocks contain overrides**:
215
+ - `[data-brand="comphealth"]` should have `--brand-color-*` variables
216
+ - `[data-brand="comphealth"]` should have component token overrides if they differ
217
+
218
+ 3. **Test brand switching**:
219
+ - Set `data-brand="comphealth"` on `<html>`
220
+ - Verify buttons/surfaces change color
221
+ - Set `data-brand="modio"` on `<html>`
222
+ - Verify buttons/surfaces change to Modio colors
223
+
224
+ 4. **Verify cascade**:
225
+ - `--uds-color-primary-500` should reference `var(--brand-color-primary-500)`
226
+ - Changing `--brand-color-primary-500` in brand block should update `--uds-color-primary-500`
227
+ - Component tokens should reference semantic tokens (or hard values if not color-derived)
228
+
229
+ ## Files to Modify
230
+
231
+ 1. `scripts/generate_structured_css.py`
232
+ - Lines 632-681: Remove brand injection logic
233
+ - Lines 1003-1005: Remove skip logic
234
+ - Lines 1045-1069: Update filtering logic
235
+ - Lines 564-611: Consider removing `ds_var_brand_overrides` tracking (or repurpose it)
236
+
237
+ ## Notes
238
+
239
+ - **Preserving structure**: All variable names, output format, and collection structure remain unchanged
240
+ - **Minimal changes**: Only removing problematic injection logic, not redesigning the system
241
+ - **Cascade correctness**: After fixes, cascade will work as expected: Core → Brand primitives → Design System → Component tokens
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 CHG Healthcare
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.lib.md ADDED
@@ -0,0 +1,103 @@
1
+ # @chg/uds-components
2
+
3
+ CHG Healthcare Unified Design System - React Component Library
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @chg/uds-components
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```jsx
14
+ import { Button, Chip, Avatar, Badge } from "@chg/uds-components";
15
+ import "@chg/uds-components/styles.css"; // Required for component styles
16
+
17
+ function App() {
18
+ return (
19
+ <div>
20
+ <Button appearance="primary">Click Me</Button>
21
+ <Chip label="Tag" />
22
+ <Avatar initials="JD" />
23
+ <Badge count={5} variant="red" />
24
+ </div>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Available Components
30
+
31
+ ### Layout & Structure
32
+ - `Accordion`, `AccordionItem` - Expandable content sections
33
+ - `Card` - Content container with styling
34
+ - `Divider` - Visual separator
35
+ - `Flex` - Flexbox layout helper
36
+ - `ImageAspect` - Maintains image aspect ratios
37
+ - `Steps` - Step indicator for multi-step flows
38
+ - `Table` - Data table component
39
+ - `Tabs`, `TabItem` - Tabbed navigation
40
+
41
+ ### Navigation
42
+ - `ActionMenu` - Dropdown action menu with keyboard support
43
+ - `Breadcrumb` - Navigation breadcrumbs
44
+ - `Dropdown` - Dropdown select component
45
+ - `Menu` - Navigation menu
46
+ - `Pagination` - Page navigation
47
+
48
+ ### Form Controls
49
+ - `Button` - Primary interaction element
50
+ - `Checkbox` - Checkbox input
51
+ - `Chip` - Tag/filter chips
52
+ - `Datepicker` - Date selection
53
+ - `Field` - Form field wrapper
54
+ - `FileUpload` - File upload component
55
+ - `Input` - Text input field
56
+ - `PillToggle` - Toggle button group
57
+ - `Radio` - Radio button input
58
+ - `Slider` - Range slider
59
+ - `Textarea` - Multi-line text input
60
+ - `Toggle` - On/off toggle switch
61
+
62
+ ### Data Display
63
+ - `Avatar` - User avatar with image or initials
64
+ - `Badge` - Notification badge
65
+ - `DotStatus` - Status dot indicator
66
+ - `Icon` - Phosphor icon wrapper
67
+ - `Key` - Keyboard shortcut display
68
+ - `ProgressCircle` - Circular progress indicator
69
+ - `ProgressIndicator` - Linear progress bar
70
+ - `Status` - Status indicator component
71
+ - `Tag` - Categorization tags
72
+
73
+ ### Feedback
74
+ - `Toast` - Notification toast messages
75
+ - `Tooltip` - Hover tooltips
76
+
77
+ ### Branding
78
+ - `Branding` - Logo and brand assets
79
+
80
+ ## Design Tokens
81
+
82
+ The component library uses CSS custom properties (variables) for theming. Import the styles to get all design tokens:
83
+
84
+ ```css
85
+ @import "@chg/uds-components/styles.css";
86
+ ```
87
+
88
+ Or include them in your build:
89
+
90
+ ```scss
91
+ @use "@chg/uds-components/styles.css";
92
+ ```
93
+
94
+ ## Peer Dependencies
95
+
96
+ This library requires:
97
+ - `react` >= 17.0.0
98
+ - `react-dom` >= 17.0.0
99
+ - `react-router-dom` (optional, only needed for Card and Breadcrumb components)
100
+
101
+ ## License
102
+
103
+ MIT
package/README.md ADDED
@@ -0,0 +1,177 @@
1
+ # CHG Design System (UDS)
2
+
3
+ A unified design system for CHG Healthcare brands, featuring React components, design tokens synced from Figma, and comprehensive documentation.
4
+
5
+ ## Overview
6
+
7
+ This design system provides:
8
+
9
+ - **40+ React Components** — Fully styled, accessible UI components
10
+ - **Design Tokens** — Colors, spacing, typography, and more synced directly from Figma
11
+ - **Multi-Brand Support** — Theming for CompHealth, Connect, LocumSmart, Modio, and Weatherby
12
+ - **Figma Code Connect** — Bridge between design and development
13
+ - **Documentation Site** — Interactive component demos and usage guidelines
14
+
15
+ ## Getting Started
16
+
17
+ ### Prerequisites
18
+
19
+ - Node.js 18+
20
+ - npm or yarn
21
+
22
+ ### Installation
23
+
24
+ ```bash
25
+ # Install dependencies
26
+ npm install
27
+
28
+ # Start the documentation site
29
+ npm start
30
+ ```
31
+
32
+ The development server runs at [http://localhost:3000](http://localhost:3000).
33
+
34
+ ## Available Scripts
35
+
36
+ ### Development
37
+
38
+ | Command | Description |
39
+ |---------|-------------|
40
+ | `npm start` | Start the documentation site in development mode |
41
+ | `npm test` | Run tests in watch mode |
42
+ | `npm run sass:watch` | Watch and compile SCSS files |
43
+
44
+ ### Design Tokens
45
+
46
+ | Command | Description |
47
+ |---------|-------------|
48
+ | `npm run tokens:generate` | Fetch and generate tokens from Figma |
49
+ | `npm run tokens:validate` | Validate token references |
50
+ | `npm run tokens:compile` | Compile SCSS tokens to CSS |
51
+ | `npm run tokens:watch` | Watch and compile token changes |
52
+
53
+ ### Library Build
54
+
55
+ | Command | Description |
56
+ |---------|-------------|
57
+ | `npm run build:lib` | Build the component library for distribution |
58
+ | `npm run build:lib:watch` | Build library in watch mode |
59
+ | `npm run publish:lib` | Publish the library package |
60
+
61
+ ### Figma Code Connect
62
+
63
+ | Command | Description |
64
+ |---------|-------------|
65
+ | `npm run codeconnect:publish` | Publish Code Connect mappings to Figma |
66
+ | `npm run codeconnect:unpublish` | Remove Code Connect mappings |
67
+
68
+ ### Production
69
+
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `npm run build` | Build the documentation site for production |
73
+
74
+ ## Project Structure
75
+
76
+ ```
77
+ ├── src/
78
+ │ ├── ui/ # Component library
79
+ │ │ ├── Accordion/
80
+ │ │ ├── Button/
81
+ │ │ ├── Card/
82
+ │ │ └── ...
83
+ │ ├── pages/ # Documentation pages
84
+ │ ├── styles/ # Global styles and tokens
85
+ │ │ ├── _variables.scss # Generated Figma variables
86
+ │ │ ├── tokens.scss # CSS custom properties
87
+ │ │ └── _typography.scss # Typography utilities
88
+ │ └── assets/ # Images and static assets
89
+ ├── scripts/
90
+ │ ├── index.js # Token generation script
91
+ │ ├── validate.js # Token validation
92
+ │ └── publish-lib.js # Library publishing
93
+ ├── dist/ # Built library output
94
+ └── build/ # Built documentation site
95
+ ```
96
+
97
+ ## Components
98
+
99
+ The design system includes a comprehensive set of components:
100
+
101
+ **Form Controls:** Button, Checkbox, Datepicker, Dropdown, Field, FileUpload, Input, Radio, Slider, Textarea, Toggle
102
+
103
+ **Data Display:** Accordion, Avatar, Badge, Card, Chip, DotStatus, Icon, ImageAspect, Key, Status, Table, Tag, Tooltip
104
+
105
+ **Navigation:** ActionMenu, Breadcrumb, Menu, Pagination, PillToggle, Steps, Tabs
106
+
107
+ **Feedback:** ProgressCircle, ProgressIndicator, Toast
108
+
109
+ **Layout:** Divider, Flex
110
+
111
+ ## Design Tokens
112
+
113
+ Tokens are synced from Figma and include:
114
+
115
+ - **Colors** — Brand colors, semantic colors, neutrals
116
+ - **Spacing** — Consistent spacing scale
117
+ - **Typography** — Font families, sizes, weights, line heights
118
+ - **Border Radius** — Corner radius values
119
+ - **Shadows** — Elevation and depth
120
+ - **Animation** — Timing and duration values
121
+
122
+ ### Syncing Tokens from Figma
123
+
124
+ 1. Create a `.env` file with your Figma credentials:
125
+
126
+ ```env
127
+ FIGMA_ACCESS_TOKEN=your_figma_token
128
+ FIGMA_FILE_KEY=your_file_key
129
+ ```
130
+
131
+ 2. Run the token generation script:
132
+
133
+ ```bash
134
+ npm run tokens:generate
135
+ ```
136
+
137
+ ## Using the Component Library
138
+
139
+ ### Installation in Your Project
140
+
141
+ ```bash
142
+ npm install @chg/uds-components
143
+ ```
144
+
145
+ ### Usage
146
+
147
+ ```jsx
148
+ import { Button, Card, Input } from '@chg/uds-components';
149
+ import '@chg/uds-components/styles.css';
150
+
151
+ function App() {
152
+ return (
153
+ <Card>
154
+ <Input label="Email" type="email" />
155
+ <Button variant="primary">Submit</Button>
156
+ </Card>
157
+ );
158
+ }
159
+ ```
160
+
161
+ ## Browser Support
162
+
163
+ - Chrome (last 2 versions)
164
+ - Firefox (last 2 versions)
165
+ - Safari (last 2 versions)
166
+ - Edge (last 2 versions)
167
+
168
+ ## Contributing
169
+
170
+ 1. Create a feature branch from `main`
171
+ 2. Make your changes
172
+ 3. Ensure tests pass and components render correctly
173
+ 4. Submit a pull request
174
+
175
+ ## License
176
+
177
+ See [LICENSE](./LICENSE) for details.
@@ -0,0 +1,9 @@
1
+ {
2
+ "codeConnect": {
3
+ "parser": "react",
4
+ "label": "React",
5
+ "include": ["src/ui/**/*.{tsx,jsx}"],
6
+ "exclude": ["**/node_modules/**", "**/dist/**", "build/**"],
7
+ "interactiveSetupFigmaFileUrl": "https://www.figma.com/file/LkIyThUA0oVNsDEAyOF7ER/Design-System--Components?node-id=18-2"
8
+ }
9
+ }
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@mich8060/chg-design-system",
3
+ "version": "0.1.0",
4
+ "license": "UNLICENSED",
5
+ "dependencies": {
6
+ "@figma/code-connect": "^1.3.9",
7
+ "@phosphor-icons/react": "^2.1.10",
8
+ "@testing-library/dom": "^10.4.0",
9
+ "@testing-library/jest-dom": "^6.6.3",
10
+ "@testing-library/react": "^16.2.0",
11
+ "@testing-library/user-event": "^13.5.0",
12
+ "dotenv": "^16.6.1",
13
+ "node-fetch": "^3.3.2",
14
+ "prismjs": "^1.30.0",
15
+ "react": "^19.0.0",
16
+ "react-dom": "^19.0.0",
17
+ "react-router-dom": "^6.28.0",
18
+ "react-scripts": "5.0.1",
19
+ "web-vitals": "^2.1.4"
20
+ },
21
+ "codeConnect": {
22
+ "parser": "react"
23
+ },
24
+ "scripts": {
25
+ "start": "react-scripts start",
26
+ "build": "react-scripts build",
27
+ "build:lib": "vite build --config vite.config.lib.js",
28
+ "build:lib:watch": "vite build --config vite.config.lib.js --watch",
29
+ "publish:lib": "node scripts/publish-lib.js",
30
+ "test": "react-scripts test",
31
+ "eject": "react-scripts eject",
32
+ "tokens:generate": "node scripts/index.js",
33
+ "tokens:validate": "node scripts/validate.js",
34
+ "tokens:compile": "sass scripts/tokens.scss tokens/tokens.css",
35
+ "tokens:watch": "sass --watch tokens/tokens.scss:tokens/tokens.css",
36
+ "codeconnect:publish": "code-connect publish",
37
+ "codeconnect:unpublish": "code-connect unpublish",
38
+ "sass:watch": "sass --watch src/styles/prism-custom.scss:src/styles/prism-custom.css"
39
+ },
40
+ "eslintConfig": {
41
+ "extends": [
42
+ "react-app",
43
+ "react-app/jest"
44
+ ]
45
+ },
46
+ "browserslist": {
47
+ "production": [
48
+ ">0.2%",
49
+ "not dead",
50
+ "not op_mini all"
51
+ ],
52
+ "development": [
53
+ "last 1 chrome version",
54
+ "last 1 firefox version",
55
+ "last 1 safari version"
56
+ ]
57
+ },
58
+ "devDependencies": {
59
+ "@vitejs/plugin-react": "^4.2.1",
60
+ "prettier": "3.8.1",
61
+ "sass": "^1.97.3",
62
+ "vite": "^5.4.0"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ }
67
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@chg/uds-components",
3
+ "version": "1.0.0",
4
+ "description": "CHG Healthcare Unified Design System - React Component Library",
5
+ "author": "Michael Stevens",
6
+ "license": "MIT",
7
+ "main": "uds-components.umd.js",
8
+ "module": "uds-components.es.js",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./uds-components.es.js",
12
+ "require": "./uds-components.umd.js"
13
+ },
14
+ "./styles.css": "./styles.css"
15
+ },
16
+ "files": [
17
+ "uds-components.es.js",
18
+ "uds-components.es.js.map",
19
+ "uds-components.umd.js",
20
+ "uds-components.umd.js.map",
21
+ "styles.css",
22
+ "README.md"
23
+ ],
24
+ "sideEffects": [
25
+ "**/*.css",
26
+ "**/*.scss"
27
+ ],
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/chg-healthcare/uds-components.git"
31
+ },
32
+ "keywords": [
33
+ "react",
34
+ "components",
35
+ "ui",
36
+ "design-system",
37
+ "uds",
38
+ "chg"
39
+ ],
40
+ "peerDependencies": {
41
+ "react": ">=17.0.0",
42
+ "react-dom": ">=17.0.0"
43
+ },
44
+ "peerDependenciesMeta": {
45
+ "react-router-dom": {
46
+ "optional": true
47
+ }
48
+ }
49
+ }