thread-ui 0.13.0 → 0.14.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 (166) hide show
  1. package/README.md +13 -7
  2. package/dist/components/content-display/carousel/carousel-context.d.ts +117 -9
  3. package/dist/components/content-display/carousel/carousel.d.ts +1 -1
  4. package/dist/components/content-display/carousel/carousel.js +19 -4
  5. package/dist/components/content-display/carousel/carousel.js.map +1 -1
  6. package/dist/components/content-display/carousel/carousel.types.d.ts +10 -9
  7. package/dist/components/content-display/carousel/components/carousel-controls.js +1 -1
  8. package/dist/components/content-display/carousel/components/carousel-controls.js.map +1 -1
  9. package/dist/components/content-display/carousel/components/carousel-header.d.ts +1 -1
  10. package/dist/components/content-display/carousel/components/carousel-header.js +6 -13
  11. package/dist/components/content-display/carousel/components/carousel-header.js.map +1 -1
  12. package/dist/components/content-display/carousel/components/carousel-item.js +1 -5
  13. package/dist/components/content-display/carousel/components/carousel-item.js.map +1 -1
  14. package/dist/components/content-display/gallery/components/gallery-content.js +3 -4
  15. package/dist/components/content-display/gallery/components/gallery-content.js.map +1 -1
  16. package/dist/components/content-display/gallery/gallery-context.d.ts +117 -9
  17. package/dist/components/content-display/gallery/gallery.d.ts +1 -1
  18. package/dist/components/content-display/gallery/gallery.js +2 -1
  19. package/dist/components/content-display/gallery/gallery.js.map +1 -1
  20. package/dist/components/content-display/gallery/gallery.types.d.ts +4 -5
  21. package/dist/components/content-display/lightbox/components/lightbox-title.js +5 -8
  22. package/dist/components/content-display/lightbox/components/lightbox-title.js.map +1 -1
  23. package/dist/components/content-display/lightbox/lightbox-context.d.ts +44 -2
  24. package/dist/components/content-display/lightbox/lightbox.types.d.ts +1 -1
  25. package/dist/components/layouts/column-layout/column-layout.d.ts +2 -2
  26. package/dist/components/layouts/column-layout/column-layout.js +6 -6
  27. package/dist/components/layouts/column-layout/column-layout.js.map +1 -1
  28. package/dist/components/layouts/column-layout/column-layout.types.d.ts +4 -7
  29. package/dist/components/layouts/footer/footer.d.ts +3 -3
  30. package/dist/components/layouts/footer/footer.js +4 -4
  31. package/dist/components/layouts/footer/footer.js.map +1 -1
  32. package/dist/components/layouts/footer/footer.types.d.ts +1 -1
  33. package/dist/components/layouts/layout-component.types.d.ts +2 -1
  34. package/dist/components/layouts/masonry-layout/masonry-layout.d.ts +1 -1
  35. package/dist/components/layouts/masonry-layout/masonry-layout.js +3 -3
  36. package/dist/components/layouts/masonry-layout/masonry-layout.js.map +1 -1
  37. package/dist/components/layouts/masonry-layout/masonry-layout.types.d.ts +4 -6
  38. package/dist/components/media-display/info-card/info-card.js +2 -2
  39. package/dist/components/media-display/info-card/info-card.js.map +1 -1
  40. package/dist/components/media-display/info-card/info-card.types.d.ts +1 -1
  41. package/dist/components/typography/heading/heading.js +1 -1
  42. package/dist/components/typography/heading/heading.js.map +1 -1
  43. package/dist/components/typography/page-header/page-header.d.ts +3 -3
  44. package/dist/components/typography/page-header/page-header.js +5 -5
  45. package/dist/components/typography/page-header/page-header.js.map +1 -1
  46. package/dist/components/typography/page-header/page-header.types.d.ts +3 -3
  47. package/dist/components/ui/button/button-recipe.js +11 -10
  48. package/dist/components/ui/button/button-recipe.js.map +1 -1
  49. package/dist/components/ui/card/card.d.ts +1 -1
  50. package/dist/components/ui/card/card.js +14 -9
  51. package/dist/components/ui/card/card.js.map +1 -1
  52. package/dist/components/ui/card/card.types.d.ts +2 -0
  53. package/dist/components/ui/loaders/skeleton-layout/skeleton-layout.types.d.ts +1 -1
  54. package/dist/components/ui/modal/modal-context.d.ts +2 -2
  55. package/dist/internal-components/content-header/content-header.d.ts +12 -0
  56. package/dist/internal-components/content-header/content-header.js +36 -0
  57. package/dist/internal-components/content-header/content-header.js.map +1 -0
  58. package/dist/internal-components/content-header/content-header.types.d.ts +32 -0
  59. package/dist/internal-components/content-header/content-header.types.js +2 -0
  60. package/dist/internal-components/content-header/content-header.types.js.map +1 -0
  61. package/dist/internal-components/content-header/index.d.ts +2 -0
  62. package/dist/internal-components/content-header/index.js +2 -0
  63. package/dist/internal-components/content-header/index.js.map +1 -0
  64. package/dist/internal-components/index.d.ts +2 -0
  65. package/dist/internal-components/index.js +2 -0
  66. package/dist/internal-components/index.js.map +1 -1
  67. package/dist/internal-components/modal-primitive/modal-primitive.d.ts +1 -1
  68. package/dist/internal-components/modal-primitive/modal-primitive.js +3 -2
  69. package/dist/internal-components/modal-primitive/modal-primitive.js.map +1 -1
  70. package/dist/internal-components/modal-primitive/modal-primitive.types.d.ts +2 -0
  71. package/dist/internal-components/surface/index.d.ts +2 -0
  72. package/dist/internal-components/surface/index.js +2 -0
  73. package/dist/internal-components/surface/index.js.map +1 -0
  74. package/dist/internal-components/surface/surface.d.ts +3 -0
  75. package/dist/internal-components/surface/surface.js +11 -0
  76. package/dist/internal-components/surface/surface.js.map +1 -0
  77. package/dist/internal-components/surface/surface.types.d.ts +15 -0
  78. package/dist/internal-components/surface/surface.types.js +2 -0
  79. package/dist/internal-components/surface/surface.types.js.map +1 -0
  80. package/dist/styled-system/recipes/button.js +6 -6
  81. package/dist/styled-system/tokens/index.js +8 -0
  82. package/dist/styled-system/tokens/tokens.d.ts +1 -1
  83. package/dist/styles/panda.css +1 -1
  84. package/dist/styles/theme.css +6 -0
  85. package/dist/theme/css-name-configurations/theme-css-names.d.ts +1 -0
  86. package/dist/theme/css-name-configurations/theme-css-names.js +3 -0
  87. package/dist/theme/css-name-configurations/theme-css-names.js.map +1 -1
  88. package/dist/theme/default-theme.js +2 -0
  89. package/dist/theme/default-theme.js.map +1 -1
  90. package/dist/theme/theme-surface-system.d.ts +2 -1
  91. package/dist/theme/theme-surface-system.js.map +1 -1
  92. package/dist/types/colors/utility-color-options.types.d.ts +1 -1
  93. package/dist/types/theme/theme.types.d.ts +1 -0
  94. package/dist/utils/theme-utilities/get-colored-text-color/get-colored-text-color.js +2 -0
  95. package/dist/utils/theme-utilities/get-colored-text-color/get-colored-text-color.js.map +1 -1
  96. package/dist/utils/theme-utilities/get-surface-styles/get-surface-styles.d.ts +2 -3
  97. package/dist/utils/theme-utilities/get-surface-styles/get-surface-styles.js.map +1 -1
  98. package/dist/utils/theme-utilities/get-text-color-styles/get-text-color-styles.js +1 -0
  99. package/dist/utils/theme-utilities/get-text-color-styles/get-text-color-styles.js.map +1 -1
  100. package/dist/utils/theme-utilities/get-utility-size-value/get-utility-size-value.d.ts +1 -1
  101. package/package.json +1 -1
  102. package/dist/styled-system/css/conditions..js +0 -36
  103. package/dist/styled-system/css/conditions.mjs +0 -36
  104. package/dist/styled-system/css/css..js +0 -45
  105. package/dist/styled-system/css/css.mjs +0 -45
  106. package/dist/styled-system/css/cva..js +0 -87
  107. package/dist/styled-system/css/cva.mjs +0 -87
  108. package/dist/styled-system/css/cx..js +0 -15
  109. package/dist/styled-system/css/cx.mjs +0 -15
  110. package/dist/styled-system/css/index..js +0 -4
  111. package/dist/styled-system/css/index.mjs +0 -4
  112. package/dist/styled-system/css/sva..js +0 -46
  113. package/dist/styled-system/css/sva.mjs +0 -46
  114. package/dist/styled-system/helpers..js +0 -316
  115. package/dist/styled-system/helpers.mjs +0 -316
  116. package/dist/styled-system/patterns/aspect-ratio..js +0 -38
  117. package/dist/styled-system/patterns/aspect-ratio.mjs +0 -38
  118. package/dist/styled-system/patterns/bleed..js +0 -24
  119. package/dist/styled-system/patterns/bleed.mjs +0 -24
  120. package/dist/styled-system/patterns/box..js +0 -15
  121. package/dist/styled-system/patterns/box.mjs +0 -15
  122. package/dist/styled-system/patterns/center..js +0 -21
  123. package/dist/styled-system/patterns/center.mjs +0 -21
  124. package/dist/styled-system/patterns/circle..js +0 -25
  125. package/dist/styled-system/patterns/circle.mjs +0 -25
  126. package/dist/styled-system/patterns/container..js +0 -22
  127. package/dist/styled-system/patterns/container.mjs +0 -22
  128. package/dist/styled-system/patterns/cq..js +0 -21
  129. package/dist/styled-system/patterns/cq.mjs +0 -21
  130. package/dist/styled-system/patterns/divider..js +0 -25
  131. package/dist/styled-system/patterns/divider.mjs +0 -25
  132. package/dist/styled-system/patterns/flex..js +0 -26
  133. package/dist/styled-system/patterns/flex.mjs +0 -26
  134. package/dist/styled-system/patterns/float..js +0 -52
  135. package/dist/styled-system/patterns/float.mjs +0 -52
  136. package/dist/styled-system/patterns/grid-item..js +0 -25
  137. package/dist/styled-system/patterns/grid-item.mjs +0 -25
  138. package/dist/styled-system/patterns/grid..js +0 -27
  139. package/dist/styled-system/patterns/grid.mjs +0 -27
  140. package/dist/styled-system/patterns/hstack..js +0 -24
  141. package/dist/styled-system/patterns/hstack.mjs +0 -24
  142. package/dist/styled-system/patterns/index..js +0 -20
  143. package/dist/styled-system/patterns/index.mjs +0 -20
  144. package/dist/styled-system/patterns/link-overlay..js +0 -24
  145. package/dist/styled-system/patterns/link-overlay.mjs +0 -24
  146. package/dist/styled-system/patterns/spacer..js +0 -21
  147. package/dist/styled-system/patterns/spacer.mjs +0 -21
  148. package/dist/styled-system/patterns/square..js +0 -24
  149. package/dist/styled-system/patterns/square.mjs +0 -24
  150. package/dist/styled-system/patterns/stack..js +0 -24
  151. package/dist/styled-system/patterns/stack.mjs +0 -24
  152. package/dist/styled-system/patterns/visually-hidden..js +0 -18
  153. package/dist/styled-system/patterns/visually-hidden.mjs +0 -18
  154. package/dist/styled-system/patterns/vstack..js +0 -24
  155. package/dist/styled-system/patterns/vstack.mjs +0 -24
  156. package/dist/styled-system/patterns/wrap..js +0 -25
  157. package/dist/styled-system/patterns/wrap.mjs +0 -25
  158. package/dist/styled-system/recipes/button..js +0 -445
  159. package/dist/styled-system/recipes/button.mjs +0 -445
  160. package/dist/styled-system/recipes/create-recipe..js +0 -82
  161. package/dist/styled-system/recipes/create-recipe.mjs +0 -82
  162. package/dist/styled-system/recipes/index..js +0 -1
  163. package/dist/styled-system/recipes/index.mjs +0 -1
  164. package/dist/styled-system/styles.css +0 -1
  165. package/dist/styled-system/tokens/index..js +0 -2104
  166. package/dist/styled-system/tokens/index.mjs +0 -2164
@@ -1,445 +0,0 @@
1
- import { memo, splitProps } from '../helpers.mjs';
2
- import { createRecipe, mergeRecipes } from './create-recipe.mjs';
3
-
4
- const buttonFn = /* @__PURE__ */ createRecipe('button', {
5
- "color": "primary",
6
- "size": "md",
7
- "fullWidth": false,
8
- "disabled": false
9
- }, [
10
- {
11
- "color": "primary",
12
- "disabled": true,
13
- "css": {
14
- "_hover": {
15
- "backgroundColor": "primary.main",
16
- "color": "text.inverted",
17
- "borderColor": "primary.main"
18
- }
19
- }
20
- },
21
- {
22
- "color": "secondary",
23
- "disabled": true,
24
- "css": {
25
- "_hover": {
26
- "backgroundColor": "secondary.main",
27
- "color": "text.inverted",
28
- "borderColor": "secondary.main"
29
- }
30
- }
31
- },
32
- {
33
- "color": "tertiary",
34
- "disabled": true,
35
- "css": {
36
- "_hover": {
37
- "backgroundColor": "tertiary.main",
38
- "color": "text.inverted",
39
- "borderColor": "tertiary.main"
40
- }
41
- }
42
- },
43
- {
44
- "color": "gray",
45
- "disabled": true,
46
- "css": {
47
- "_hover": {
48
- "backgroundColor": "gray.main",
49
- "color": "text.inverted",
50
- "borderColor": "gray.main"
51
- }
52
- }
53
- },
54
- {
55
- "color": "success",
56
- "disabled": true,
57
- "css": {
58
- "_hover": {
59
- "backgroundColor": "success.main",
60
- "color": "text.inverted",
61
- "borderColor": "success.main"
62
- }
63
- }
64
- },
65
- {
66
- "color": "warning",
67
- "disabled": true,
68
- "css": {
69
- "_hover": {
70
- "backgroundColor": "warning.main",
71
- "color": "text.inverted",
72
- "borderColor": "warning.main"
73
- }
74
- }
75
- },
76
- {
77
- "color": "error",
78
- "disabled": true,
79
- "css": {
80
- "_hover": {
81
- "backgroundColor": "error.main",
82
- "color": "text.inverted",
83
- "borderColor": "error.main"
84
- }
85
- }
86
- },
87
- {
88
- "color": "info",
89
- "disabled": true,
90
- "css": {
91
- "_hover": {
92
- "backgroundColor": "info.main",
93
- "color": "text.inverted",
94
- "borderColor": "info.main"
95
- }
96
- }
97
- },
98
- {
99
- "color": "text",
100
- "disabled": true,
101
- "css": {
102
- "_hover": {
103
- "backgroundColor": "text.standard",
104
- "color": "text.inverted",
105
- "borderColor": "text.standard"
106
- }
107
- }
108
- },
109
- {
110
- "color": "neutral",
111
- "disabled": true,
112
- "css": {
113
- "_hover": {
114
- "backgroundColor": "transparent",
115
- "color": "text.standard",
116
- "borderColor": "text.standard"
117
- }
118
- }
119
- },
120
- {
121
- "color": "black",
122
- "disabled": true,
123
- "css": {
124
- "_hover": {
125
- "backgroundColor": "black",
126
- "color": "text.inverted",
127
- "borderColor": "white"
128
- }
129
- }
130
- },
131
- {
132
- "textVariant": true,
133
- "disabled": true,
134
- "css": {
135
- "_hover": {
136
- "textDecoration": "none",
137
- "backgroundColor": "transparent"
138
- }
139
- }
140
- },
141
- {
142
- "textVariant": true,
143
- "color": "primary",
144
- "css": {
145
- "color": "primary.main",
146
- "_hover": {
147
- "color": "primary.main"
148
- }
149
- }
150
- },
151
- {
152
- "textVariant": true,
153
- "color": "secondary",
154
- "css": {
155
- "color": "secondary.main",
156
- "_hover": {
157
- "color": "secondary.main"
158
- }
159
- }
160
- },
161
- {
162
- "textVariant": true,
163
- "color": "tertiary",
164
- "css": {
165
- "color": "tertiary.main",
166
- "_hover": {
167
- "color": "tertiary.main"
168
- }
169
- }
170
- },
171
- {
172
- "textVariant": true,
173
- "color": "gray",
174
- "css": {
175
- "color": "gray.main",
176
- "_hover": {
177
- "color": "gray.main"
178
- }
179
- }
180
- },
181
- {
182
- "textVariant": true,
183
- "color": "success",
184
- "css": {
185
- "color": "success.main",
186
- "_hover": {
187
- "color": "success.main"
188
- }
189
- }
190
- },
191
- {
192
- "textVariant": true,
193
- "color": "warning",
194
- "css": {
195
- "color": "warning.main",
196
- "_hover": {
197
- "color": "warning.main"
198
- }
199
- }
200
- },
201
- {
202
- "textVariant": true,
203
- "color": "error",
204
- "css": {
205
- "color": "error.main",
206
- "_hover": {
207
- "color": "error.main"
208
- }
209
- }
210
- },
211
- {
212
- "textVariant": true,
213
- "color": "info",
214
- "css": {
215
- "color": "info.main",
216
- "_hover": {
217
- "color": "info.main"
218
- }
219
- }
220
- },
221
- {
222
- "textVariant": true,
223
- "color": "neutral",
224
- "css": {
225
- "color": "text.standard",
226
- "_hover": {
227
- "color": "text.standard",
228
- "backgroundColor": "transparent"
229
- }
230
- }
231
- },
232
- {
233
- "textVariant": true,
234
- "color": "black",
235
- "css": {
236
- "color": "black",
237
- "_hover": {
238
- "color": "black"
239
- }
240
- }
241
- },
242
- {
243
- "textVariant": true,
244
- "color": "text",
245
- "css": {
246
- "color": "text.standard",
247
- "_hover": {
248
- "color": "text.standard"
249
- }
250
- }
251
- },
252
- {
253
- "highlightOnHover": true,
254
- "disabled": false,
255
- "textVariant": false,
256
- "color": "primary",
257
- "css": {
258
- "_hover": {
259
- "color": "white",
260
- "backgroundColor": "primary.light",
261
- "borderColor": "primary.main"
262
- }
263
- }
264
- },
265
- {
266
- "highlightOnHover": true,
267
- "disabled": false,
268
- "textVariant": false,
269
- "color": "secondary",
270
- "css": {
271
- "_hover": {
272
- "color": "white",
273
- "backgroundColor": "secondary.light",
274
- "borderColor": "secondary.main"
275
- }
276
- }
277
- },
278
- {
279
- "highlightOnHover": true,
280
- "disabled": false,
281
- "textVariant": false,
282
- "color": "tertiary",
283
- "css": {
284
- "_hover": {
285
- "color": "white",
286
- "backgroundColor": "tertiary.light",
287
- "borderColor": "tertiary.main"
288
- }
289
- }
290
- },
291
- {
292
- "highlightOnHover": true,
293
- "disabled": false,
294
- "textVariant": false,
295
- "color": "gray",
296
- "css": {
297
- "_hover": {
298
- "backgroundColor": "gray.light",
299
- "borderColor": "gray.main"
300
- }
301
- }
302
- },
303
- {
304
- "highlightOnHover": true,
305
- "disabled": false,
306
- "textVariant": false,
307
- "color": "success",
308
- "css": {
309
- "_hover": {
310
- "color": "white",
311
- "backgroundColor": "success.light",
312
- "borderColor": "success.main"
313
- }
314
- }
315
- },
316
- {
317
- "highlightOnHover": true,
318
- "disabled": false,
319
- "textVariant": false,
320
- "color": "warning",
321
- "css": {
322
- "_hover": {
323
- "color": "white",
324
- "backgroundColor": "warning.light",
325
- "borderColor": "warning.main"
326
- }
327
- }
328
- },
329
- {
330
- "highlightOnHover": true,
331
- "disabled": false,
332
- "textVariant": false,
333
- "color": "error",
334
- "css": {
335
- "_hover": {
336
- "color": "white",
337
- "backgroundColor": "error.light",
338
- "borderColor": "error.main"
339
- }
340
- }
341
- },
342
- {
343
- "highlightOnHover": true,
344
- "disabled": false,
345
- "textVariant": false,
346
- "color": "info",
347
- "css": {
348
- "_hover": {
349
- "color": "white",
350
- "backgroundColor": "info.light",
351
- "borderColor": "info.main"
352
- }
353
- }
354
- },
355
- {
356
- "highlightOnHover": true,
357
- "disabled": false,
358
- "textVariant": false,
359
- "color": "black",
360
- "css": {
361
- "_hover": {
362
- "backgroundColor": "gray.light",
363
- "borderColor": "white"
364
- }
365
- }
366
- },
367
- {
368
- "highlightOnHover": true,
369
- "disabled": false,
370
- "textVariant": false,
371
- "color": "text",
372
- "css": {
373
- "_hover": {
374
- "backgroundColor": "surface",
375
- "borderColor": "text.standard"
376
- }
377
- }
378
- },
379
- {
380
- "highlightOnHover": true,
381
- "disabled": false,
382
- "textVariant": false,
383
- "color": "neutral",
384
- "css": {
385
- "_hover": {
386
- "backgroundColor": "surface",
387
- "borderColor": "text.standard"
388
- }
389
- }
390
- }
391
- ])
392
-
393
- const buttonVariantMap = {
394
- "color": [
395
- "primary",
396
- "secondary",
397
- "tertiary",
398
- "black",
399
- "gray",
400
- "success",
401
- "warning",
402
- "error",
403
- "info",
404
- "text",
405
- "neutral"
406
- ],
407
- "size": [
408
- "sm",
409
- "md",
410
- "lg"
411
- ],
412
- "fullWidth": [
413
- "true",
414
- "false"
415
- ],
416
- "disabled": [
417
- "true",
418
- "false"
419
- ],
420
- "textVariant": [
421
- "true"
422
- ],
423
- "highlightOnHover": [
424
- "true",
425
- "false"
426
- ]
427
- }
428
-
429
- const buttonVariantKeys = Object.keys(buttonVariantMap)
430
-
431
- export const button = /* @__PURE__ */ Object.assign(memo(buttonFn.recipeFn), {
432
- __recipe__: true,
433
- __name__: 'button',
434
- __getCompoundVariantCss__: buttonFn.__getCompoundVariantCss__,
435
- raw: (props) => props,
436
- variantKeys: buttonVariantKeys,
437
- variantMap: buttonVariantMap,
438
- merge(recipe) {
439
- return mergeRecipes(this, recipe)
440
- },
441
- splitVariantProps(props) {
442
- return splitProps(props, buttonVariantKeys)
443
- },
444
- getVariantProps: buttonFn.getVariantProps,
445
- })
@@ -1,82 +0,0 @@
1
- import { finalizeConditions, sortConditions } from '../css/conditions..js';
2
- import { css } from '../css/css..js';
3
- import { assertCompoundVariant, getCompoundVariantCss } from '../css/cva..js';
4
- import { cx } from '../css/cx..js';
5
- import { compact, createCss, splitProps, uniq, withoutSpace } from '../helpers..js';
6
-
7
- export const createRecipe = (name, defaultVariants, compoundVariants) => {
8
- const getVariantProps = (variants) => {
9
- return {
10
- [name]: '__ignore__',
11
- ...defaultVariants,
12
- ...compact(variants),
13
- };
14
- };
15
-
16
- const recipeFn = (variants, withCompoundVariants = true) => {
17
- const transform = (prop, value) => {
18
- assertCompoundVariant(name, compoundVariants, variants, prop)
19
-
20
- if (value === '__ignore__') {
21
- return { className: name }
22
- }
23
-
24
- value = withoutSpace(value)
25
- return { className: `${name}--${prop}_${value}` }
26
- }
27
-
28
- const recipeCss = createCss({
29
-
30
- conditions: {
31
- shift: sortConditions,
32
- finalize: finalizeConditions,
33
- breakpoints: { keys: ["base","sm","md","lg","xl","2xl"] }
34
- },
35
- utility: {
36
- prefix: "thread-ui",
37
- toHash: (path, hashFn) => hashFn(path.join(":")),
38
- transform,
39
- }
40
- })
41
-
42
- const recipeStyles = getVariantProps(variants)
43
-
44
- if (withCompoundVariants) {
45
- const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
46
- return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
47
- }
48
-
49
- return recipeCss(recipeStyles)
50
- }
51
-
52
- return {
53
- recipeFn,
54
- getVariantProps,
55
- __getCompoundVariantCss__: (variants) => {
56
- return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
57
- },
58
- }
59
- }
60
-
61
- export const mergeRecipes = (recipeA, recipeB) => {
62
- if (recipeA && !recipeB) return recipeA
63
- if (!recipeA && recipeB) return recipeB
64
-
65
- const recipeFn = (...args) => cx(recipeA(...args), recipeB(...args))
66
- const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys)
67
- const variantMap = variantKeys.reduce((acc, key) => {
68
- acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
69
- return acc
70
- }, {})
71
-
72
- return Object.assign(recipeFn, {
73
- __recipe__: true,
74
- __name__: `${recipeA.__name__} ${recipeB.__name__}`,
75
- raw: (props) => props,
76
- variantKeys,
77
- variantMap,
78
- splitVariantProps(props) {
79
- return splitProps(props, variantKeys)
80
- },
81
- })
82
- }
@@ -1,82 +0,0 @@
1
- import { finalizeConditions, sortConditions } from '../css/conditions.mjs';
2
- import { css } from '../css/css.mjs';
3
- import { assertCompoundVariant, getCompoundVariantCss } from '../css/cva.mjs';
4
- import { cx } from '../css/cx.mjs';
5
- import { compact, createCss, splitProps, uniq, withoutSpace } from '../helpers.mjs';
6
-
7
- export const createRecipe = (name, defaultVariants, compoundVariants) => {
8
- const getVariantProps = (variants) => {
9
- return {
10
- [name]: '__ignore__',
11
- ...defaultVariants,
12
- ...compact(variants),
13
- };
14
- };
15
-
16
- const recipeFn = (variants, withCompoundVariants = true) => {
17
- const transform = (prop, value) => {
18
- assertCompoundVariant(name, compoundVariants, variants, prop)
19
-
20
- if (value === '__ignore__') {
21
- return { className: name }
22
- }
23
-
24
- value = withoutSpace(value)
25
- return { className: `${name}--${prop}_${value}` }
26
- }
27
-
28
- const recipeCss = createCss({
29
-
30
- conditions: {
31
- shift: sortConditions,
32
- finalize: finalizeConditions,
33
- breakpoints: { keys: ["base","sm","md","lg","xl","2xl"] }
34
- },
35
- utility: {
36
- prefix: "thread-ui",
37
- toHash: (path, hashFn) => hashFn(path.join(":")),
38
- transform,
39
- }
40
- })
41
-
42
- const recipeStyles = getVariantProps(variants)
43
-
44
- if (withCompoundVariants) {
45
- const compoundVariantStyles = getCompoundVariantCss(compoundVariants, recipeStyles)
46
- return cx(recipeCss(recipeStyles), css(compoundVariantStyles))
47
- }
48
-
49
- return recipeCss(recipeStyles)
50
- }
51
-
52
- return {
53
- recipeFn,
54
- getVariantProps,
55
- __getCompoundVariantCss__: (variants) => {
56
- return getCompoundVariantCss(compoundVariants, getVariantProps(variants));
57
- },
58
- }
59
- }
60
-
61
- export const mergeRecipes = (recipeA, recipeB) => {
62
- if (recipeA && !recipeB) return recipeA
63
- if (!recipeA && recipeB) return recipeB
64
-
65
- const recipeFn = (...args) => cx(recipeA(...args), recipeB(...args))
66
- const variantKeys = uniq(recipeA.variantKeys, recipeB.variantKeys)
67
- const variantMap = variantKeys.reduce((acc, key) => {
68
- acc[key] = uniq(recipeA.variantMap[key], recipeB.variantMap[key])
69
- return acc
70
- }, {})
71
-
72
- return Object.assign(recipeFn, {
73
- __recipe__: true,
74
- __name__: `${recipeA.__name__} ${recipeB.__name__}`,
75
- raw: (props) => props,
76
- variantKeys,
77
- variantMap,
78
- splitVariantProps(props) {
79
- return splitProps(props, variantKeys)
80
- },
81
- })
82
- }
@@ -1 +0,0 @@
1
- export * from './button..js';
@@ -1 +0,0 @@
1
- export * from './button.mjs';