@castui/cast-ui 2.0.0 → 3.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 (151) hide show
  1. package/README.md +20 -570
  2. package/dist/components/Button/Button.d.ts +36 -14
  3. package/dist/components/Button/Button.d.ts.map +1 -1
  4. package/dist/components/Button/Button.js +87 -66
  5. package/dist/components/Button/Button.js.map +1 -1
  6. package/dist/components/Button/index.d.ts +2 -0
  7. package/dist/components/Button/index.d.ts.map +1 -0
  8. package/dist/components/Button/index.js +2 -0
  9. package/dist/components/Button/index.js.map +1 -0
  10. package/dist/components/Icon/Icon.d.ts +22 -8
  11. package/dist/components/Icon/Icon.d.ts.map +1 -1
  12. package/dist/components/Icon/Icon.js +25 -26
  13. package/dist/components/Icon/Icon.js.map +1 -1
  14. package/dist/components/Icon/index.d.ts +2 -0
  15. package/dist/components/Icon/index.d.ts.map +1 -0
  16. package/dist/components/Icon/index.js +2 -0
  17. package/dist/components/Icon/index.js.map +1 -0
  18. package/dist/index.d.ts +4 -51
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +8 -31
  21. package/dist/index.js.map +1 -1
  22. package/dist/theme/ThemeContext.d.ts +59 -0
  23. package/dist/theme/ThemeContext.d.ts.map +1 -0
  24. package/dist/theme/ThemeContext.js +92 -0
  25. package/dist/theme/ThemeContext.js.map +1 -0
  26. package/dist/theme/index.d.ts +3 -6
  27. package/dist/theme/index.d.ts.map +1 -1
  28. package/dist/theme/index.js +2 -3
  29. package/dist/theme/index.js.map +1 -1
  30. package/dist/theme/themes.d.ts +14 -0
  31. package/dist/theme/themes.d.ts.map +1 -0
  32. package/dist/theme/themes.js +98 -0
  33. package/dist/theme/themes.js.map +1 -0
  34. package/dist/theme/types.d.ts +30 -467
  35. package/dist/theme/types.d.ts.map +1 -1
  36. package/dist/theme/types.js +3 -7
  37. package/dist/theme/types.js.map +1 -1
  38. package/dist/tokens/colors.d.ts +35 -0
  39. package/dist/tokens/colors.d.ts.map +1 -0
  40. package/dist/tokens/colors.js +74 -0
  41. package/dist/tokens/colors.js.map +1 -0
  42. package/dist/tokens/index.d.ts +3 -0
  43. package/dist/tokens/index.d.ts.map +1 -0
  44. package/dist/tokens/index.js +3 -0
  45. package/dist/tokens/index.js.map +1 -0
  46. package/dist/tokens/typography.d.ts +27 -0
  47. package/dist/tokens/typography.d.ts.map +1 -0
  48. package/dist/tokens/typography.js +30 -0
  49. package/dist/tokens/typography.js.map +1 -0
  50. package/package.json +2 -7
  51. package/dist/components/Alert/Alert.d.ts +0 -14
  52. package/dist/components/Alert/Alert.d.ts.map +0 -1
  53. package/dist/components/Alert/Alert.js +0 -57
  54. package/dist/components/Alert/Alert.js.map +0 -1
  55. package/dist/components/AppBar/AppBar.d.ts +0 -11
  56. package/dist/components/AppBar/AppBar.d.ts.map +0 -1
  57. package/dist/components/AppBar/AppBar.js +0 -32
  58. package/dist/components/AppBar/AppBar.js.map +0 -1
  59. package/dist/components/Autocomplete/Autocomplete.d.ts +0 -18
  60. package/dist/components/Autocomplete/Autocomplete.d.ts.map +0 -1
  61. package/dist/components/Autocomplete/Autocomplete.js +0 -72
  62. package/dist/components/Autocomplete/Autocomplete.js.map +0 -1
  63. package/dist/components/Backdrop/Backdrop.d.ts +0 -8
  64. package/dist/components/Backdrop/Backdrop.d.ts.map +0 -1
  65. package/dist/components/Backdrop/Backdrop.js +0 -25
  66. package/dist/components/Backdrop/Backdrop.js.map +0 -1
  67. package/dist/components/Badge/Badge.d.ts +0 -11
  68. package/dist/components/Badge/Badge.d.ts.map +0 -1
  69. package/dist/components/Badge/Badge.js +0 -42
  70. package/dist/components/Badge/Badge.js.map +0 -1
  71. package/dist/components/Card/Card.d.ts +0 -20
  72. package/dist/components/Card/Card.d.ts.map +0 -1
  73. package/dist/components/Card/Card.js +0 -58
  74. package/dist/components/Card/Card.js.map +0 -1
  75. package/dist/components/Checkbox/Checkbox.d.ts +0 -12
  76. package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
  77. package/dist/components/Checkbox/Checkbox.js +0 -39
  78. package/dist/components/Checkbox/Checkbox.js.map +0 -1
  79. package/dist/components/Chip/Chip.d.ts +0 -13
  80. package/dist/components/Chip/Chip.d.ts.map +0 -1
  81. package/dist/components/Chip/Chip.js +0 -29
  82. package/dist/components/Chip/Chip.js.map +0 -1
  83. package/dist/components/Dialog/Dialog.d.ts +0 -15
  84. package/dist/components/Dialog/Dialog.d.ts.map +0 -1
  85. package/dist/components/Dialog/Dialog.js +0 -41
  86. package/dist/components/Dialog/Dialog.js.map +0 -1
  87. package/dist/components/Divider/Divider.d.ts +0 -6
  88. package/dist/components/Divider/Divider.d.ts.map +0 -1
  89. package/dist/components/Divider/Divider.js +0 -25
  90. package/dist/components/Divider/Divider.js.map +0 -1
  91. package/dist/components/FAB/FAB.d.ts +0 -14
  92. package/dist/components/FAB/FAB.d.ts.map +0 -1
  93. package/dist/components/FAB/FAB.js +0 -55
  94. package/dist/components/FAB/FAB.js.map +0 -1
  95. package/dist/components/Link/Link.d.ts +0 -11
  96. package/dist/components/Link/Link.d.ts.map +0 -1
  97. package/dist/components/Link/Link.js +0 -26
  98. package/dist/components/Link/Link.js.map +0 -1
  99. package/dist/components/Select/Select.d.ts +0 -18
  100. package/dist/components/Select/Select.d.ts.map +0 -1
  101. package/dist/components/Select/Select.js +0 -72
  102. package/dist/components/Select/Select.js.map +0 -1
  103. package/dist/components/Skeleton/Skeleton.d.ts +0 -11
  104. package/dist/components/Skeleton/Skeleton.d.ts.map +0 -1
  105. package/dist/components/Skeleton/Skeleton.js +0 -27
  106. package/dist/components/Skeleton/Skeleton.js.map +0 -1
  107. package/dist/components/Snackbar/Snackbar.d.ts +0 -14
  108. package/dist/components/Snackbar/Snackbar.d.ts.map +0 -1
  109. package/dist/components/Snackbar/Snackbar.js +0 -40
  110. package/dist/components/Snackbar/Snackbar.js.map +0 -1
  111. package/dist/components/SpeedDial/SpeedDial.d.ts +0 -18
  112. package/dist/components/SpeedDial/SpeedDial.d.ts.map +0 -1
  113. package/dist/components/SpeedDial/SpeedDial.js +0 -55
  114. package/dist/components/SpeedDial/SpeedDial.js.map +0 -1
  115. package/dist/components/Switch/Switch.d.ts +0 -12
  116. package/dist/components/Switch/Switch.d.ts.map +0 -1
  117. package/dist/components/Switch/Switch.js +0 -39
  118. package/dist/components/Switch/Switch.js.map +0 -1
  119. package/dist/components/Table/Table.d.ts +0 -15
  120. package/dist/components/Table/Table.d.ts.map +0 -1
  121. package/dist/components/Table/Table.js +0 -62
  122. package/dist/components/Table/Table.js.map +0 -1
  123. package/dist/components/TextField/TextField.d.ts +0 -19
  124. package/dist/components/TextField/TextField.d.ts.map +0 -1
  125. package/dist/components/TextField/TextField.js +0 -60
  126. package/dist/components/TextField/TextField.js.map +0 -1
  127. package/dist/components/Typography/Typography.d.ts +0 -21
  128. package/dist/components/Typography/Typography.d.ts.map +0 -1
  129. package/dist/components/Typography/Typography.js +0 -41
  130. package/dist/components/Typography/Typography.js.map +0 -1
  131. package/dist/default.reference.json +0 -421
  132. package/dist/theme/ThemeProvider.d.ts +0 -34
  133. package/dist/theme/ThemeProvider.d.ts.map +0 -1
  134. package/dist/theme/ThemeProvider.js +0 -41
  135. package/dist/theme/ThemeProvider.js.map +0 -1
  136. package/dist/theme/createTheme.d.ts +0 -49
  137. package/dist/theme/createTheme.d.ts.map +0 -1
  138. package/dist/theme/createTheme.js +0 -85
  139. package/dist/theme/createTheme.js.map +0 -1
  140. package/dist/theme/fonts.d.ts +0 -96
  141. package/dist/theme/fonts.d.ts.map +0 -1
  142. package/dist/theme/fonts.js +0 -148
  143. package/dist/theme/fonts.js.map +0 -1
  144. package/dist/tokens/generated/default.d.ts +0 -3
  145. package/dist/tokens/generated/default.d.ts.map +0 -1
  146. package/dist/tokens/generated/default.js +0 -422
  147. package/dist/tokens/generated/default.js.map +0 -1
  148. package/dist/tokens/generated/index.d.ts +0 -2
  149. package/dist/tokens/generated/index.d.ts.map +0 -1
  150. package/dist/tokens/generated/index.js +0 -3
  151. package/dist/tokens/generated/index.js.map +0 -1
@@ -1,421 +0,0 @@
1
- {
2
- "name": "default",
3
- "semantic": {
4
- "colour": {
5
- "surface": "#FFFFFF",
6
- "onSurface": "#0F172A",
7
- "onSurfaceMuted": "#475569",
8
- "surfaceContainer": "#F8FAFC",
9
- "primary": "#0F172A",
10
- "onPrimary": "#FFFFFF",
11
- "primaryHover": "#1E293B",
12
- "primaryPressed": "#475569",
13
- "secondary": "#E2E8F0",
14
- "onSecondary": "#0F172A",
15
- "success": "#0C6F1E",
16
- "onSuccess": "#FFFFFF",
17
- "error": "#6F0C0C",
18
- "onError": "#FFFFFF",
19
- "warning": "#947C3E",
20
- "onWarning": "#FFFFFF",
21
- "border": "#E2E8F0",
22
- "borderSubtle": "#F8FAFC",
23
- "disabledContainer": "#E2E8F0",
24
- "onDisabled": "#94A3B8",
25
- "primaryContainer": "#E2E8F0",
26
- "onPrimaryContainer": "#0F172A",
27
- "secondaryContainer": "#F8FAFC",
28
- "onSecondaryContainer": "#1E293B",
29
- "errorContainer": "#FDF2F2",
30
- "onErrorContainer": "#4A0808",
31
- "successContainer": "#F0FDF1",
32
- "onSuccessContainer": "#084A14",
33
- "warningContainer": "#FDF8EB",
34
- "onWarningContainer": "#6B592D",
35
- "overlay": "#000000"
36
- },
37
- "fontFamily": {
38
- "brand": "system-ui",
39
- "interface": "system-ui",
40
- "data": "JetBrains Mono"
41
- },
42
- "fontSize": {
43
- "display": 39,
44
- "h1": 31,
45
- "h2": 25,
46
- "h3": 20,
47
- "body": 16,
48
- "subtitle": 20,
49
- "small": 12.8,
50
- "caption": 12.8,
51
- "overline": 12.8,
52
- "label": 12.8,
53
- "button": 16
54
- },
55
- "fontWeight": {
56
- "heading": 700,
57
- "body": 400,
58
- "button": 500
59
- },
60
- "lineHeight": {
61
- "display": 48,
62
- "h1": 40,
63
- "h2": 32,
64
- "h3": 24,
65
- "body": 24,
66
- "subtitle": 24,
67
- "small": 20,
68
- "caption": 16,
69
- "overline": 16,
70
- "label": 16,
71
- "button": 20
72
- },
73
- "letterSpacing": {
74
- "heading": -0.02,
75
- "body": 0,
76
- "label": 0.02
77
- },
78
- "paragraphSpacing": {
79
- "body": 16,
80
- "editorial": 24
81
- },
82
- "paragraphIndent": {
83
- "editorial": 0
84
- },
85
- "borderRadius": {
86
- "small": 4,
87
- "medium": 8,
88
- "large": 12,
89
- "full": 9999
90
- },
91
- "spacing": {
92
- "xs": 4,
93
- "sm": 8,
94
- "md": 12,
95
- "lg": 16,
96
- "xl": 24
97
- },
98
- "borderWidth": {
99
- "thin": 1,
100
- "medium": 2
101
- },
102
- "elevation": {
103
- "none": 0,
104
- "xs": 1,
105
- "sm": 2,
106
- "md": 3,
107
- "lg": 4,
108
- "xl": 6
109
- },
110
- "size": {
111
- "xs": 2,
112
- "sm": 4,
113
- "md": 16,
114
- "lg": 24,
115
- "xl": 32,
116
- "xxl": 48,
117
- "xxxl": 64
118
- },
119
- "opacity": {
120
- "disabled": 40,
121
- "overlay": 50
122
- }
123
- },
124
- "component": {
125
- "button": {
126
- "paddingHorizontal": 16,
127
- "paddingVertical": 8,
128
- "gap": 8,
129
- "cornerRadius": 8,
130
- "borderWidth": 2,
131
- "textSize": 16,
132
- "fontWeight": 500,
133
- "lineHeight": 20,
134
- "fontFamily": "system-ui",
135
- "filled": {
136
- "background": "#0F172A",
137
- "content": "#FFFFFF"
138
- },
139
- "outline": {
140
- "background": "#FFFFFF",
141
- "border": "#0F172A",
142
- "content": "#0F172A"
143
- },
144
- "text": {
145
- "background": "#FFFFFF",
146
- "content": "#0F172A"
147
- },
148
- "state": {
149
- "hoverBackground": "#1E293B",
150
- "pressedBackground": "#475569",
151
- "disabledBackground": "#E2E8F0",
152
- "disabledContent": "#94A3B8"
153
- }
154
- },
155
- "card": {
156
- "padding": 16,
157
- "gap": 12,
158
- "background": "#F8FAFC",
159
- "stroke": "#E2E8F0",
160
- "strokeWidth": 2,
161
- "cornerRadius": 12,
162
- "elevation": 1,
163
- "headingSize": 20,
164
- "headingWeight": 700,
165
- "headingLineHeight": 24,
166
- "headingFontFamily": "system-ui",
167
- "bodySize": 16,
168
- "bodyWeight": 400,
169
- "bodyLineHeight": 24,
170
- "bodyFontFamily": "system-ui",
171
- "headingColour": "#0F172A",
172
- "bodyColour": "#475569"
173
- },
174
- "textField": {
175
- "paddingHorizontal": 12,
176
- "paddingVertical": 8,
177
- "cornerRadius": 8,
178
- "borderWidth": 2,
179
- "background": "#FFFFFF",
180
- "borderColour": "#E2E8F0",
181
- "focusBorderColour": "#0F172A",
182
- "errorBorderColour": "#6F0C0C",
183
- "textColour": "#0F172A",
184
- "placeholderColour": "#475569",
185
- "textSize": 16,
186
- "textFontWeight": 400,
187
- "textLineHeight": 24,
188
- "fontFamily": "system-ui",
189
- "labelColour": "#0F172A",
190
- "labelSize": 12.8,
191
- "labelFontWeight": 500,
192
- "labelLineHeight": 20,
193
- "labelFontFamily": "system-ui",
194
- "helperColour": "#475569",
195
- "errorColour": "#6F0C0C",
196
- "helperSize": 12.8,
197
- "helperFontWeight": 400,
198
- "helperLineHeight": 20,
199
- "helperFontFamily": "system-ui"
200
- },
201
- "checkbox": {
202
- "size": 16,
203
- "cornerRadius": 4,
204
- "borderWidth": 2,
205
- "gap": 8,
206
- "borderColour": "#E2E8F0",
207
- "checkedBackground": "#0F172A",
208
- "checkedIconColour": "#FFFFFF",
209
- "labelColour": "#0F172A",
210
- "labelSize": 16,
211
- "labelFontWeight": 400,
212
- "labelLineHeight": 24,
213
- "labelFontFamily": "system-ui",
214
- "disabledOpacity": 40
215
- },
216
- "fab": {
217
- "size": 48,
218
- "cornerRadius": 9999,
219
- "background": "#0F172A",
220
- "iconColour": "#FFFFFF",
221
- "iconSize": 24,
222
- "hoverBackground": "#1E293B",
223
- "pressedBackground": "#475569",
224
- "elevation": 4,
225
- "extendedPaddingHorizontal": 16,
226
- "extendedGap": 8
227
- },
228
- "autocomplete": {
229
- "dropdownBackground": "#FFFFFF",
230
- "dropdownCornerRadius": 8,
231
- "dropdownElevation": 2,
232
- "optionHoverBackground": "#F8FAFC",
233
- "optionTextColour": "#0F172A",
234
- "optionTextSize": 16,
235
- "optionFontWeight": 400,
236
- "optionLineHeight": 24,
237
- "optionPaddingHorizontal": 16,
238
- "optionPaddingVertical": 8,
239
- "fontFamily": "system-ui"
240
- },
241
- "select": {
242
- "dropdownBackground": "#FFFFFF",
243
- "dropdownCornerRadius": 8,
244
- "dropdownElevation": 2,
245
- "optionHoverBackground": "#F8FAFC",
246
- "indicatorColour": "#475569",
247
- "optionTextColour": "#0F172A",
248
- "optionTextSize": 16,
249
- "optionFontWeight": 400,
250
- "optionLineHeight": 24,
251
- "optionPaddingHorizontal": 16,
252
- "optionPaddingVertical": 8,
253
- "fontFamily": "system-ui",
254
- "selectedOptionBackground": "#E2E8F0"
255
- },
256
- "switch": {
257
- "trackWidth": 48,
258
- "trackHeight": 24,
259
- "trackCornerRadius": 9999,
260
- "trackOffBackground": "#E2E8F0",
261
- "trackOnBackground": "#0F172A",
262
- "thumbSize": 16,
263
- "thumbCornerRadius": 9999,
264
- "thumbOffBackground": "#FFFFFF",
265
- "thumbOnBackground": "#FFFFFF",
266
- "thumbOffset": 4,
267
- "labelColour": "#0F172A",
268
- "labelSize": 16,
269
- "labelFontWeight": 400,
270
- "labelLineHeight": 24,
271
- "labelFontFamily": "system-ui",
272
- "gap": 8
273
- },
274
- "badge": {
275
- "minSize": 16,
276
- "paddingHorizontal": 4,
277
- "cornerRadius": 9999,
278
- "background": "#6F0C0C",
279
- "contentColour": "#FFFFFF",
280
- "textSize": 12.8,
281
- "fontWeight": 500,
282
- "lineHeight": 16,
283
- "fontFamily": "system-ui"
284
- },
285
- "chip": {
286
- "paddingHorizontal": 12,
287
- "paddingVertical": 4,
288
- "gap": 4,
289
- "cornerRadius": 4,
290
- "background": "#F8FAFC",
291
- "contentColour": "#1E293B",
292
- "selectedBackground": "#E2E8F0",
293
- "selectedContentColour": "#0F172A",
294
- "borderWidth": 2,
295
- "borderColour": "#E2E8F0",
296
- "textSize": 12.8,
297
- "fontWeight": 400,
298
- "lineHeight": 20,
299
- "fontFamily": "system-ui"
300
- },
301
- "divider": {
302
- "colour": "#E2E8F0",
303
- "thickness": 1,
304
- "margin": 8
305
- },
306
- "icon": {
307
- "sizeSmall": 16,
308
- "sizeMedium": 24,
309
- "sizeLarge": 32
310
- },
311
- "table": {
312
- "headerBackground": "#F8FAFC",
313
- "headerTextColour": "#0F172A",
314
- "headerFontWeight": 700,
315
- "headerTextSize": 12.8,
316
- "headerLineHeight": 20,
317
- "cellTextColour": "#0F172A",
318
- "cellTextSize": 16,
319
- "cellFontWeight": 400,
320
- "cellLineHeight": 24,
321
- "cellPaddingHorizontal": 12,
322
- "cellPaddingVertical": 8,
323
- "rowBorderColour": "#F8FAFC",
324
- "rowBorderWidth": 1,
325
- "rowHoverBackground": "#F8FAFC",
326
- "cornerRadius": 8,
327
- "fontFamily": "system-ui"
328
- },
329
- "alert": {
330
- "padding": 16,
331
- "gap": 8,
332
- "cornerRadius": 8,
333
- "borderWidth": 2,
334
- "background": "#F8FAFC",
335
- "borderColour": "#E2E8F0",
336
- "titleColour": "#0F172A",
337
- "bodyColour": "#0F172A",
338
- "iconColour": "#0F172A",
339
- "fontFamily": "system-ui",
340
- "iconSize": 24,
341
- "titleSize": 16,
342
- "titleFontWeight": 700,
343
- "titleLineHeight": 24,
344
- "bodySize": 12.8,
345
- "bodyFontWeight": 400,
346
- "bodyLineHeight": 20
347
- },
348
- "backdrop": {
349
- "colour": "#000000",
350
- "opacity": 50
351
- },
352
- "skeleton": {
353
- "background": "#F8FAFC",
354
- "highlight": "#F8FAFC",
355
- "cornerRadius": 4,
356
- "circleSize": 32
357
- },
358
- "snackbar": {
359
- "background": "#0F172A",
360
- "contentColour": "#FFFFFF",
361
- "actionColour": "#1E293B",
362
- "padding": 16,
363
- "gap": 8,
364
- "cornerRadius": 8,
365
- "elevation": 3,
366
- "textSize": 16,
367
- "fontWeight": 400,
368
- "lineHeight": 24,
369
- "fontFamily": "system-ui"
370
- },
371
- "dialog": {
372
- "background": "#FFFFFF",
373
- "cornerRadius": 12,
374
- "padding": 24,
375
- "gap": 16,
376
- "elevation": 6,
377
- "titleSize": 20,
378
- "titleFontWeight": 700,
379
- "titleLineHeight": 24,
380
- "titleFontFamily": "system-ui",
381
- "titleColour": "#0F172A",
382
- "bodySize": 16,
383
- "bodyFontWeight": 400,
384
- "bodyLineHeight": 24,
385
- "bodyFontFamily": "system-ui",
386
- "bodyColour": "#0F172A"
387
- },
388
- "appBar": {
389
- "height": 64,
390
- "paddingHorizontal": 16,
391
- "background": "#FFFFFF",
392
- "titleColour": "#0F172A",
393
- "titleSize": 20,
394
- "titleFontWeight": 700,
395
- "titleLineHeight": 24,
396
- "titleFontFamily": "system-ui",
397
- "iconColour": "#0F172A",
398
- "borderColour": "#F8FAFC",
399
- "elevation": 0
400
- },
401
- "link": {
402
- "colour": "#0F172A",
403
- "hoverColour": "#1E293B",
404
- "visitedColour": "#475569",
405
- "underlineOffset": 2,
406
- "fontSize": 16,
407
- "fontWeight": 400,
408
- "lineHeight": 24,
409
- "fontFamily": "system-ui"
410
- },
411
- "speedDial": {
412
- "actionSize": 32,
413
- "actionBackground": "#F8FAFC",
414
- "actionIconColour": "#0F172A",
415
- "actionIconSize": 24,
416
- "actionCornerRadius": 9999,
417
- "gap": 8,
418
- "actionElevation": 2
419
- }
420
- }
421
- }
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import type { CastTheme } from './types';
3
- export interface CastThemeProviderProps {
4
- /** The theme object to provide. Defaults to the Default base theme. */
5
- theme?: CastTheme;
6
- children?: React.ReactNode;
7
- }
8
- /**
9
- * Wraps the component tree with the selected Cast theme.
10
- *
11
- * ```tsx
12
- * import { CastThemeProvider, createTheme } from '@castui/cast-ui';
13
- * import overrides from './my-brand.json';
14
- *
15
- * const myTheme = createTheme(overrides);
16
- *
17
- * <CastThemeProvider theme={myTheme}>
18
- * <App />
19
- * </CastThemeProvider>
20
- * ```
21
- */
22
- export declare function CastThemeProvider({ theme, children, }: CastThemeProviderProps): import("react/jsx-runtime").JSX.Element;
23
- /**
24
- * Returns the current Cast theme object.
25
- *
26
- * Must be called inside an `<CastThemeProvider>`.
27
- *
28
- * ```tsx
29
- * const theme = useTheme();
30
- * <View style={{ backgroundColor: theme.semantic.colour.surface }} />
31
- * ```
32
- */
33
- export declare function useTheme(): CastTheme;
34
- //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAazC,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAoB,EACpB,QAAQ,GACT,EAAE,sBAAsB,2CAIxB;AAMD;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,IAAI,SAAS,CAEpC"}
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from 'react';
3
- import { defaultTheme } from '../tokens/generated';
4
- // ---------------------------------------------------------------------------
5
- // Context
6
- // ---------------------------------------------------------------------------
7
- const ThemeContext = createContext(defaultTheme);
8
- /**
9
- * Wraps the component tree with the selected Cast theme.
10
- *
11
- * ```tsx
12
- * import { CastThemeProvider, createTheme } from '@castui/cast-ui';
13
- * import overrides from './my-brand.json';
14
- *
15
- * const myTheme = createTheme(overrides);
16
- *
17
- * <CastThemeProvider theme={myTheme}>
18
- * <App />
19
- * </CastThemeProvider>
20
- * ```
21
- */
22
- export function CastThemeProvider({ theme = defaultTheme, children, }) {
23
- return (_jsx(ThemeContext.Provider, { value: theme, children: children }));
24
- }
25
- // ---------------------------------------------------------------------------
26
- // Hook
27
- // ---------------------------------------------------------------------------
28
- /**
29
- * Returns the current Cast theme object.
30
- *
31
- * Must be called inside an `<CastThemeProvider>`.
32
- *
33
- * ```tsx
34
- * const theme = useTheme();
35
- * <View style={{ backgroundColor: theme.semantic.colour.surface }} />
36
- * ```
37
- */
38
- export function useTheme() {
39
- return useContext(ThemeContext);
40
- }
41
- //# sourceMappingURL=ThemeProvider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ThemeProvider.js","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,MAAM,YAAY,GAAG,aAAa,CAAY,YAAY,CAAC,CAAC;AAY5D;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,GAAG,YAAY,EACpB,QAAQ,GACe;IACvB,OAAO,CACL,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAyB,CACxE,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,OAAO;AACP,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Theme creation utility.
3
- *
4
- * `createTheme()` deep-merges partial overrides with the default base theme,
5
- * producing a complete `CastTheme` object. This is the primary API for
6
- * creating custom branded themes.
7
- *
8
- * ```ts
9
- * import { createTheme, defaultTheme } from '@castui/cast-ui';
10
- * import overrides from './my-brand.json';
11
- *
12
- * const myTheme = createTheme(overrides);
13
- * // → complete CastTheme with your overrides applied on top of defaultTheme
14
- * ```
15
- */
16
- import type { CastTheme } from './types';
17
- /**
18
- * Recursively makes all properties of `T` optional.
19
- * Useful for typing partial theme overrides passed to `createTheme()`.
20
- */
21
- export type DeepPartial<T> = {
22
- [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
23
- };
24
- /**
25
- * Create a complete `CastTheme` by deep-merging partial overrides with a
26
- * base theme (defaults to `defaultTheme`).
27
- *
28
- * Works with both small partial overrides *and* complete theme objects
29
- * exported from Figma.
30
- *
31
- * @param overrides – Partial theme values to apply on top of the base.
32
- * @param base – Optional base theme. Defaults to `defaultTheme`.
33
- * @returns A complete, merged `CastTheme` object.
34
- *
35
- * @example
36
- * ```ts
37
- * // Minimal override – only change the primary colour
38
- * const myTheme = createTheme({
39
- * name: 'my-brand',
40
- * semantic: { colour: { primary: '#FF0000' } },
41
- * });
42
- *
43
- * // Full override from a JSON file
44
- * import overrides from './my-brand.json';
45
- * const myTheme = createTheme(overrides);
46
- * ```
47
- */
48
- export declare function createTheme(overrides: DeepPartial<CastTheme>, base?: CastTheme): CastTheme;
49
- //# sourceMappingURL=createTheme.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createTheme.d.ts","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AA0DF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,EACjC,IAAI,CAAC,EAAE,SAAS,GACf,SAAS,CAMX"}
@@ -1,85 +0,0 @@
1
- /**
2
- * Theme creation utility.
3
- *
4
- * `createTheme()` deep-merges partial overrides with the default base theme,
5
- * producing a complete `CastTheme` object. This is the primary API for
6
- * creating custom branded themes.
7
- *
8
- * ```ts
9
- * import { createTheme, defaultTheme } from '@castui/cast-ui';
10
- * import overrides from './my-brand.json';
11
- *
12
- * const myTheme = createTheme(overrides);
13
- * // → complete CastTheme with your overrides applied on top of defaultTheme
14
- * ```
15
- */
16
- // ---------------------------------------------------------------------------
17
- // Deep merge
18
- // ---------------------------------------------------------------------------
19
- /**
20
- * Recursively merge `source` into `target`, returning a new object.
21
- * - Objects are recursed into.
22
- * - Arrays and primitives from `source` replace `target` values.
23
- */
24
- function deepMerge(target, source) {
25
- const result = { ...target };
26
- for (const key of Object.keys(source)) {
27
- const sourceVal = source[key];
28
- const targetVal = result[key];
29
- if (sourceVal !== null &&
30
- typeof sourceVal === 'object' &&
31
- !Array.isArray(sourceVal) &&
32
- targetVal !== null &&
33
- typeof targetVal === 'object' &&
34
- !Array.isArray(targetVal)) {
35
- result[key] = deepMerge(targetVal, sourceVal);
36
- }
37
- else {
38
- result[key] = sourceVal;
39
- }
40
- }
41
- return result;
42
- }
43
- // ---------------------------------------------------------------------------
44
- // createTheme
45
- // ---------------------------------------------------------------------------
46
- // Lazy reference to avoid circular import at module load time.
47
- // `defaultTheme` is generated and imports from `types.ts`; this file also
48
- // imports from `types.ts`, but we only need the *value* at call time.
49
- let _defaultTheme;
50
- function getDefaultTheme() {
51
- if (!_defaultTheme) {
52
- // eslint-disable-next-line @typescript-eslint/no-require-imports
53
- _defaultTheme = require('../tokens/generated').defaultTheme;
54
- }
55
- return _defaultTheme;
56
- }
57
- /**
58
- * Create a complete `CastTheme` by deep-merging partial overrides with a
59
- * base theme (defaults to `defaultTheme`).
60
- *
61
- * Works with both small partial overrides *and* complete theme objects
62
- * exported from Figma.
63
- *
64
- * @param overrides – Partial theme values to apply on top of the base.
65
- * @param base – Optional base theme. Defaults to `defaultTheme`.
66
- * @returns A complete, merged `CastTheme` object.
67
- *
68
- * @example
69
- * ```ts
70
- * // Minimal override – only change the primary colour
71
- * const myTheme = createTheme({
72
- * name: 'my-brand',
73
- * semantic: { colour: { primary: '#FF0000' } },
74
- * });
75
- *
76
- * // Full override from a JSON file
77
- * import overrides from './my-brand.json';
78
- * const myTheme = createTheme(overrides);
79
- * ```
80
- */
81
- export function createTheme(overrides, base) {
82
- const baseTheme = base ?? getDefaultTheme();
83
- return deepMerge(baseTheme, overrides);
84
- }
85
- //# sourceMappingURL=createTheme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createTheme.js","sourceRoot":"","sources":["../../src/theme/createTheme.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;GAIG;AACH,SAAS,SAAS,CAChB,MAAS,EACT,MAA+B;IAE/B,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,EAA6B,CAAC;IAExD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAE9B,IACE,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;YACzB,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,KAAK,QAAQ;YAC7B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EACzB,CAAC;YACD,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CACrB,SAAoC,EACpC,SAAoC,CACrC,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC;AAED,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E,+DAA+D;AAC/D,0EAA0E;AAC1E,sEAAsE;AACtE,IAAI,aAAoC,CAAC;AAEzC,SAAS,eAAe;IACtB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,iEAAiE;QACjE,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC,YAAyB,CAAC;IAC3E,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,WAAW,CACzB,SAAiC,EACjC,IAAgB;IAEhB,MAAM,SAAS,GAAG,IAAI,IAAI,eAAe,EAAE,CAAC;IAC5C,OAAO,SAAS,CACd,SAA+C,EAC/C,SAA+C,CACxB,CAAC;AAC5B,CAAC"}