thread-ui 0.7.14 → 0.8.1

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 (80) hide show
  1. package/README.md +11 -0
  2. package/dist/components/media/info-card/info-card.d.ts +3 -3
  3. package/dist/components/media/info-card/info-card.js +5 -5
  4. package/dist/components/media/info-card/info-card.js.map +1 -1
  5. package/dist/components/media/info-card/info-card.types.d.ts +3 -2
  6. package/dist/index.d.ts +0 -2
  7. package/dist/index.js +0 -4
  8. package/dist/index.js.map +1 -1
  9. package/dist/internal-components/image/is-html-image-props.js +1 -2
  10. package/dist/internal-components/image/is-html-image-props.js.map +1 -1
  11. package/dist/styled-system/css/conditions..js +36 -0
  12. package/dist/styled-system/css/conditions.js +36 -0
  13. package/dist/styled-system/css/css..js +45 -0
  14. package/dist/styled-system/css/css.js +45 -0
  15. package/dist/styled-system/css/cva..js +87 -0
  16. package/dist/styled-system/css/cva.js +87 -0
  17. package/dist/styled-system/css/cx..js +15 -0
  18. package/dist/styled-system/css/cx.js +15 -0
  19. package/dist/styled-system/css/index..js +4 -0
  20. package/dist/styled-system/css/index.js +4 -0
  21. package/dist/styled-system/css/sva..js +46 -0
  22. package/dist/styled-system/css/sva.js +46 -0
  23. package/dist/styled-system/helpers..js +316 -0
  24. package/dist/styled-system/helpers.js +316 -0
  25. package/dist/styled-system/patterns/aspect-ratio..js +38 -0
  26. package/dist/styled-system/patterns/aspect-ratio.js +38 -0
  27. package/dist/styled-system/patterns/bleed..js +24 -0
  28. package/dist/styled-system/patterns/bleed.js +24 -0
  29. package/dist/styled-system/patterns/box..js +15 -0
  30. package/dist/styled-system/patterns/box.js +15 -0
  31. package/dist/styled-system/patterns/center..js +21 -0
  32. package/dist/styled-system/patterns/center.js +21 -0
  33. package/dist/styled-system/patterns/circle..js +25 -0
  34. package/dist/styled-system/patterns/circle.js +25 -0
  35. package/dist/styled-system/patterns/container..js +22 -0
  36. package/dist/styled-system/patterns/container.js +22 -0
  37. package/dist/styled-system/patterns/cq..js +21 -0
  38. package/dist/styled-system/patterns/cq.js +21 -0
  39. package/dist/styled-system/patterns/divider..js +25 -0
  40. package/dist/styled-system/patterns/divider.js +25 -0
  41. package/dist/styled-system/patterns/flex..js +26 -0
  42. package/dist/styled-system/patterns/flex.js +26 -0
  43. package/dist/styled-system/patterns/float..js +52 -0
  44. package/dist/styled-system/patterns/float.js +52 -0
  45. package/dist/styled-system/patterns/grid-item..js +25 -0
  46. package/dist/styled-system/patterns/grid-item.js +25 -0
  47. package/dist/styled-system/patterns/grid..js +27 -0
  48. package/dist/styled-system/patterns/grid.js +27 -0
  49. package/dist/styled-system/patterns/hstack..js +24 -0
  50. package/dist/styled-system/patterns/hstack.js +24 -0
  51. package/dist/styled-system/patterns/index..js +20 -0
  52. package/dist/styled-system/patterns/index.js +20 -0
  53. package/dist/styled-system/patterns/link-overlay..js +24 -0
  54. package/dist/styled-system/patterns/link-overlay.js +24 -0
  55. package/dist/styled-system/patterns/spacer..js +21 -0
  56. package/dist/styled-system/patterns/spacer.js +21 -0
  57. package/dist/styled-system/patterns/square..js +24 -0
  58. package/dist/styled-system/patterns/square.js +24 -0
  59. package/dist/styled-system/patterns/stack..js +24 -0
  60. package/dist/styled-system/patterns/stack.js +24 -0
  61. package/dist/styled-system/patterns/visually-hidden..js +18 -0
  62. package/dist/styled-system/patterns/visually-hidden.js +18 -0
  63. package/dist/styled-system/patterns/vstack..js +24 -0
  64. package/dist/styled-system/patterns/vstack.js +24 -0
  65. package/dist/styled-system/patterns/wrap..js +25 -0
  66. package/dist/styled-system/patterns/wrap.js +25 -0
  67. package/dist/styled-system/recipes/button..js +445 -0
  68. package/dist/styled-system/recipes/button.js +445 -0
  69. package/dist/styled-system/recipes/create-recipe..js +82 -0
  70. package/dist/styled-system/recipes/create-recipe.js +82 -0
  71. package/dist/styled-system/recipes/index..js +1 -0
  72. package/dist/styled-system/recipes/index.js +1 -0
  73. package/dist/styled-system/styles.css +1 -1
  74. package/dist/styled-system/tokens/index..js +2104 -0
  75. package/dist/styled-system/tokens/index.js +2104 -0
  76. package/dist/styles/theme.css +115 -0
  77. package/dist/styles/thread.css +3 -115
  78. package/dist/types/image/image.types.d.ts +1 -1
  79. package/package.json +3 -4
  80. /package/dist/styles/{styles.css → tailwind.css} +0 -0
@@ -0,0 +1,445 @@
1
+ import { memo, splitProps } from '../helpers.js';
2
+ import { createRecipe, mergeRecipes } from './create-recipe.js';
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": "background",
17
+ "borderColor": "primary.main"
18
+ }
19
+ }
20
+ },
21
+ {
22
+ "color": "secondary",
23
+ "disabled": true,
24
+ "css": {
25
+ "_hover": {
26
+ "backgroundColor": "secondary.main",
27
+ "color": "background",
28
+ "borderColor": "secondary.main"
29
+ }
30
+ }
31
+ },
32
+ {
33
+ "color": "tertiary",
34
+ "disabled": true,
35
+ "css": {
36
+ "_hover": {
37
+ "backgroundColor": "tertiary.main",
38
+ "color": "background",
39
+ "borderColor": "tertiary.main"
40
+ }
41
+ }
42
+ },
43
+ {
44
+ "color": "gray",
45
+ "disabled": true,
46
+ "css": {
47
+ "_hover": {
48
+ "backgroundColor": "gray.main",
49
+ "color": "background",
50
+ "borderColor": "gray.main"
51
+ }
52
+ }
53
+ },
54
+ {
55
+ "color": "success",
56
+ "disabled": true,
57
+ "css": {
58
+ "_hover": {
59
+ "backgroundColor": "success.main",
60
+ "color": "background",
61
+ "borderColor": "success.main"
62
+ }
63
+ }
64
+ },
65
+ {
66
+ "color": "warning",
67
+ "disabled": true,
68
+ "css": {
69
+ "_hover": {
70
+ "backgroundColor": "warning.main",
71
+ "color": "background",
72
+ "borderColor": "warning.main"
73
+ }
74
+ }
75
+ },
76
+ {
77
+ "color": "error",
78
+ "disabled": true,
79
+ "css": {
80
+ "_hover": {
81
+ "backgroundColor": "error.main",
82
+ "color": "background",
83
+ "borderColor": "error.main"
84
+ }
85
+ }
86
+ },
87
+ {
88
+ "color": "info",
89
+ "disabled": true,
90
+ "css": {
91
+ "_hover": {
92
+ "backgroundColor": "info.main",
93
+ "color": "background",
94
+ "borderColor": "info.main"
95
+ }
96
+ }
97
+ },
98
+ {
99
+ "color": "text",
100
+ "disabled": true,
101
+ "css": {
102
+ "_hover": {
103
+ "backgroundColor": "text.standard",
104
+ "color": "background",
105
+ "borderColor": "text.standard"
106
+ }
107
+ }
108
+ },
109
+ {
110
+ "color": "neutral",
111
+ "disabled": true,
112
+ "css": {
113
+ "_hover": {
114
+ "backgroundColor": "background",
115
+ "color": "text.standard",
116
+ "borderColor": "text.standard",
117
+ "borderWidth": "md"
118
+ }
119
+ }
120
+ },
121
+ {
122
+ "color": "black",
123
+ "disabled": true,
124
+ "css": {
125
+ "_hover": {
126
+ "backgroundColor": "black",
127
+ "color": "background",
128
+ "borderColor": "white"
129
+ }
130
+ }
131
+ },
132
+ {
133
+ "textVariant": true,
134
+ "disabled": true,
135
+ "css": {
136
+ "_hover": {
137
+ "textDecoration": "none",
138
+ "backgroundColor": "transparent"
139
+ }
140
+ }
141
+ },
142
+ {
143
+ "textVariant": true,
144
+ "color": "primary",
145
+ "css": {
146
+ "color": "primary.main",
147
+ "_hover": {
148
+ "color": "primary.main"
149
+ }
150
+ }
151
+ },
152
+ {
153
+ "textVariant": true,
154
+ "color": "secondary",
155
+ "css": {
156
+ "color": "secondary.main",
157
+ "_hover": {
158
+ "color": "secondary.main"
159
+ }
160
+ }
161
+ },
162
+ {
163
+ "textVariant": true,
164
+ "color": "tertiary",
165
+ "css": {
166
+ "color": "tertiary.main",
167
+ "_hover": {
168
+ "color": "tertiary.main"
169
+ }
170
+ }
171
+ },
172
+ {
173
+ "textVariant": true,
174
+ "color": "gray",
175
+ "css": {
176
+ "color": "gray.main",
177
+ "_hover": {
178
+ "color": "gray.main"
179
+ }
180
+ }
181
+ },
182
+ {
183
+ "textVariant": true,
184
+ "color": "success",
185
+ "css": {
186
+ "color": "success.main",
187
+ "_hover": {
188
+ "color": "success.main"
189
+ }
190
+ }
191
+ },
192
+ {
193
+ "textVariant": true,
194
+ "color": "warning",
195
+ "css": {
196
+ "color": "warning.main",
197
+ "_hover": {
198
+ "color": "warning.main"
199
+ }
200
+ }
201
+ },
202
+ {
203
+ "textVariant": true,
204
+ "color": "error",
205
+ "css": {
206
+ "color": "error.main",
207
+ "_hover": {
208
+ "color": "error.main"
209
+ }
210
+ }
211
+ },
212
+ {
213
+ "textVariant": true,
214
+ "color": "info",
215
+ "css": {
216
+ "color": "info.main",
217
+ "_hover": {
218
+ "color": "info.main"
219
+ }
220
+ }
221
+ },
222
+ {
223
+ "textVariant": true,
224
+ "color": "neutral",
225
+ "css": {
226
+ "color": "text.standard",
227
+ "_hover": {
228
+ "color": "text.standard"
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
+ })
@@ -0,0 +1,82 @@
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
+ }
@@ -0,0 +1,82 @@
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
+ }
@@ -0,0 +1 @@
1
+ export * from './button..js';
@@ -0,0 +1 @@
1
+ export * from './button.js';