@webstudio-is/sdk-components-react-radix 0.95.0 → 0.97.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 (63) hide show
  1. package/lib/components.js +278 -35
  2. package/lib/hooks.js +475 -11
  3. package/lib/metas.js +4616 -58
  4. package/lib/props.js +23280 -57
  5. package/lib/types/theme/tailwind-classes.d.ts +4 -4
  6. package/package.json +9 -9
  7. package/lib/__generated__/accordion.props.js +0 -2619
  8. package/lib/__generated__/checkbox.props.js +0 -1080
  9. package/lib/__generated__/collapsible.props.js +0 -1026
  10. package/lib/__generated__/dialog.props.js +0 -2595
  11. package/lib/__generated__/label.props.js +0 -519
  12. package/lib/__generated__/navigation-menu.props.js +0 -2557
  13. package/lib/__generated__/popover.props.js +0 -558
  14. package/lib/__generated__/radio-group.props.js +0 -1623
  15. package/lib/__generated__/select.props.js +0 -3674
  16. package/lib/__generated__/sheet.props.js +0 -2614
  17. package/lib/__generated__/switch.props.js +0 -1080
  18. package/lib/__generated__/tabs.props.js +0 -2119
  19. package/lib/__generated__/tooltip.props.js +0 -569
  20. package/lib/accordion.js +0 -51
  21. package/lib/accordion.stories.js +0 -18
  22. package/lib/accordion.ws.js +0 -259
  23. package/lib/checkbox.js +0 -10
  24. package/lib/checkbox.stories.js +0 -19
  25. package/lib/checkbox.ws.js +0 -148
  26. package/lib/collapsible.js +0 -31
  27. package/lib/collapsible.stories.js +0 -18
  28. package/lib/collapsible.ws.js +0 -103
  29. package/lib/dialog.js +0 -53
  30. package/lib/dialog.stories.js +0 -18
  31. package/lib/dialog.ws.js +0 -289
  32. package/lib/label.js +0 -7
  33. package/lib/label.stories.js +0 -19
  34. package/lib/label.ws.js +0 -44
  35. package/lib/navigation-menu.js +0 -76
  36. package/lib/navigation-menu.stories.js +0 -18
  37. package/lib/navigation-menu.ws.js +0 -486
  38. package/lib/popover.js +0 -58
  39. package/lib/popover.stories.js +0 -18
  40. package/lib/popover.ws.js +0 -110
  41. package/lib/props-descriptions.js +0 -34
  42. package/lib/radio-group.js +0 -7
  43. package/lib/radio-group.stories.js +0 -19
  44. package/lib/radio-group.ws.js +0 -166
  45. package/lib/select.js +0 -65
  46. package/lib/select.stories.js +0 -18
  47. package/lib/select.ws.js +0 -321
  48. package/lib/sheet.js +0 -59
  49. package/lib/sheet.stories.js +0 -18
  50. package/lib/sheet.ws.js +0 -225
  51. package/lib/switch.js +0 -4
  52. package/lib/switch.stories.js +0 -19
  53. package/lib/switch.ws.js +0 -140
  54. package/lib/tabs.js +0 -38
  55. package/lib/tabs.stories.js +0 -18
  56. package/lib/tabs.ws.js +0 -169
  57. package/lib/theme/__generated__/tailwind-theme.js +0 -517
  58. package/lib/theme/styles.js +0 -63
  59. package/lib/theme/tailwind-classes.js +0 -651
  60. package/lib/theme/tailwind-colors.js +0 -23
  61. package/lib/tooltip.js +0 -55
  62. package/lib/tooltip.stories.js +0 -18
  63. package/lib/tooltip.ws.js +0 -111
@@ -1,651 +0,0 @@
1
- "use strict";
2
- import * as theme from "./__generated__/tailwind-theme";
3
- export const property = (property2, value) => {
4
- if (value.startsWith("--")) {
5
- return {
6
- property: property2,
7
- value: { type: "var", value: value.slice(2), fallbacks: [] }
8
- };
9
- }
10
- return {
11
- property: property2,
12
- value: { type: "unparsed", value }
13
- };
14
- };
15
- const preflight = () => {
16
- const borderColorValue = theme.colors.border;
17
- return [
18
- {
19
- property: "borderTopStyle",
20
- value: { type: "keyword", value: "solid" }
21
- },
22
- {
23
- property: "borderRightStyle",
24
- value: { type: "keyword", value: "solid" }
25
- },
26
- {
27
- property: "borderBottomStyle",
28
- value: { type: "keyword", value: "solid" }
29
- },
30
- {
31
- property: "borderLeftStyle",
32
- value: { type: "keyword", value: "solid" }
33
- },
34
- {
35
- property: "borderTopColor",
36
- value: borderColorValue
37
- },
38
- {
39
- property: "borderRightColor",
40
- value: borderColorValue
41
- },
42
- {
43
- property: "borderBottomColor",
44
- value: borderColorValue
45
- },
46
- {
47
- property: "borderLeftColor",
48
- value: borderColorValue
49
- }
50
- ];
51
- };
52
- export const z = (value) => {
53
- return [
54
- {
55
- property: "zIndex",
56
- value: theme.zIndex[value]
57
- }
58
- ];
59
- };
60
- export const overflow = (value) => [
61
- {
62
- property: "overflow",
63
- value: { type: "keyword", value }
64
- }
65
- ];
66
- export const rounded = (value = "DEFAULT") => {
67
- const styleValue = theme.borderRadius[value];
68
- return [
69
- { property: "borderTopLeftRadius", value: styleValue },
70
- { property: "borderTopRightRadius", value: styleValue },
71
- { property: "borderBottomRightRadius", value: styleValue },
72
- { property: "borderBottomLeftRadius", value: styleValue }
73
- ];
74
- };
75
- export const border = (borderWidthOrColor) => {
76
- if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
77
- const styleValue2 = theme.borderWidth[borderWidthOrColor ?? "DEFAULT"];
78
- return [
79
- ...preflight(),
80
- { property: "borderTopWidth", value: styleValue2 },
81
- { property: "borderRightWidth", value: styleValue2 },
82
- { property: "borderBottomWidth", value: styleValue2 },
83
- { property: "borderLeftWidth", value: styleValue2 }
84
- ];
85
- }
86
- const styleValue = theme.colors[borderWidthOrColor];
87
- return [
88
- { property: "borderTopColor", value: styleValue },
89
- { property: "borderRightColor", value: styleValue },
90
- { property: "borderBottomColor", value: styleValue },
91
- { property: "borderLeftColor", value: styleValue }
92
- ];
93
- };
94
- export const borderB = (borderWidthOrColor) => {
95
- let widthValue = { type: "unit", value: 1, unit: "number" };
96
- let colorValue = theme.colors.border;
97
- if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
98
- widthValue = theme.borderWidth[borderWidthOrColor ?? "DEFAULT"];
99
- } else {
100
- colorValue = theme.colors[borderWidthOrColor];
101
- }
102
- return [
103
- {
104
- property: "borderBottomWidth",
105
- value: widthValue
106
- },
107
- {
108
- property: "borderBottomStyle",
109
- value: { type: "keyword", value: "solid" }
110
- },
111
- {
112
- property: "borderBottomColor",
113
- value: colorValue
114
- }
115
- ];
116
- };
117
- const paddingProperty = (property2) => (padding) => {
118
- return [{ property: property2, value: theme.padding[padding] }];
119
- };
120
- export const pt = (padding) => {
121
- return paddingProperty("paddingTop")(padding);
122
- };
123
- export const pb = (padding) => {
124
- return paddingProperty("paddingBottom")(padding);
125
- };
126
- export const pl = (padding) => {
127
- return paddingProperty("paddingLeft")(padding);
128
- };
129
- export const pr = (padding) => {
130
- return paddingProperty("paddingRight")(padding);
131
- };
132
- export const px = (padding) => {
133
- return [pl(padding), pr(padding)].flat();
134
- };
135
- export const py = (padding) => {
136
- return [pt(padding), pb(padding)].flat();
137
- };
138
- export const p = (padding) => {
139
- return [px(padding), py(padding)].flat();
140
- };
141
- const marginProperty = (property2) => (margin) => {
142
- return [{ property: property2, value: theme.margin[margin] }];
143
- };
144
- export const ml = (margin) => {
145
- return marginProperty("marginLeft")(margin);
146
- };
147
- export const mr = (margin) => {
148
- return marginProperty("marginRight")(margin);
149
- };
150
- export const mt = (margin) => {
151
- return marginProperty("marginTop")(margin);
152
- };
153
- export const mb = (margin) => {
154
- return marginProperty("marginBottom")(margin);
155
- };
156
- export const mx = (margin) => {
157
- return [ml(margin), mr(margin)].flat();
158
- };
159
- export const my = (margin) => {
160
- return [mt(margin), mb(margin)].flat();
161
- };
162
- export const m = (margin) => {
163
- return [mx(margin), my(margin)].flat();
164
- };
165
- export const w = (spacing) => {
166
- return [{ property: "width", value: theme.width[spacing] }];
167
- };
168
- export const h = (spacing) => {
169
- return [{ property: "height", value: theme.height[spacing] }];
170
- };
171
- export const minH = (spacing) => {
172
- return [{ property: "minHeight", value: theme.minHeight[spacing] }];
173
- };
174
- export const opacity = (opacity2) => {
175
- return [
176
- {
177
- property: "opacity",
178
- value: theme.opacity[opacity2]
179
- }
180
- ];
181
- };
182
- export const cursor = (cursor2) => {
183
- return [
184
- {
185
- property: "cursor",
186
- value: theme.cursor[cursor2]
187
- }
188
- ];
189
- };
190
- export const maxW = (spacing) => {
191
- return [{ property: "maxWidth", value: theme.maxWidth[spacing] }];
192
- };
193
- const positionStyle = (property2, spacing) => {
194
- return { property: property2, value: theme.inset[spacing] };
195
- };
196
- export const top = (spacing) => [positionStyle("top", spacing)];
197
- export const right = (spacing) => [positionStyle("right", spacing)];
198
- export const bottom = (spacing) => [positionStyle("bottom", spacing)];
199
- export const left = (spacing) => [positionStyle("left", spacing)];
200
- export const inset = (spacing) => [
201
- positionStyle("left", spacing),
202
- positionStyle("right", spacing),
203
- positionStyle("top", spacing),
204
- positionStyle("bottom", spacing)
205
- ];
206
- export const aspect = (value) => {
207
- let unparsed = value;
208
- if (value === "square") {
209
- unparsed = "1 / 1";
210
- }
211
- if (value === "video") {
212
- unparsed = "16 / 9";
213
- }
214
- return [
215
- {
216
- property: "aspectRatio",
217
- value: { type: "unparsed", value: unparsed }
218
- }
219
- ];
220
- };
221
- export const backdropBlur = (blur) => {
222
- return [{ property: "backdropFilter", value: theme.blur[blur] }];
223
- };
224
- export const list = (listStyle) => {
225
- return [{ property: "listStyleType", value: theme.listStyleType[listStyle] }];
226
- };
227
- export const select = (_selectValue) => {
228
- return [
229
- {
230
- property: "userSelect",
231
- value: {
232
- type: "keyword",
233
- value: "none"
234
- }
235
- }
236
- ];
237
- };
238
- export const bg = (color, alpha) => {
239
- const value = theme.colors[color];
240
- if (alpha !== void 0 && value.type === "rgb") {
241
- value.alpha = alpha / 100;
242
- }
243
- return [
244
- {
245
- property: "backgroundColor",
246
- value
247
- }
248
- ];
249
- };
250
- export const fixed = () => {
251
- return [{ property: "position", value: { type: "keyword", value: "fixed" } }];
252
- };
253
- export const relative = () => {
254
- return [
255
- { property: "position", value: { type: "keyword", value: "relative" } }
256
- ];
257
- };
258
- export const absolute = () => {
259
- return [
260
- { property: "position", value: { type: "keyword", value: "absolute" } }
261
- ];
262
- };
263
- export const grid = () => {
264
- return [{ property: "display", value: { type: "keyword", value: "grid" } }];
265
- };
266
- const alignItems = {
267
- start: "flex-start",
268
- end: "flex-end",
269
- center: "center",
270
- baseline: "baseline",
271
- stretch: "stretch"
272
- };
273
- export const items = (alignItemsParam) => {
274
- return [
275
- {
276
- property: "alignItems",
277
- value: {
278
- type: "keyword",
279
- value: alignItems[alignItemsParam]
280
- }
281
- }
282
- ];
283
- };
284
- const justifyContent = {
285
- start: "flex-start",
286
- end: "flex-end",
287
- center: "center",
288
- between: "space-between",
289
- around: "space-around",
290
- evenly: "space-evenly",
291
- stretch: "stretch"
292
- };
293
- export const justify = (justifyContentParam) => {
294
- return [
295
- {
296
- property: "justifyContent",
297
- value: {
298
- type: "keyword",
299
- value: justifyContent[justifyContentParam]
300
- }
301
- }
302
- ];
303
- };
304
- export const inlineFlex = () => {
305
- return [
306
- { property: "display", value: { type: "keyword", value: "inline-flex" } }
307
- ];
308
- };
309
- export const block = () => {
310
- return [{ property: "display", value: { type: "keyword", value: "block" } }];
311
- };
312
- const flexDirection = { row: "row", col: "column" };
313
- export const flex = (flexParam) => {
314
- if (flexParam === void 0) {
315
- return [{ property: "display", value: { type: "keyword", value: "flex" } }];
316
- }
317
- if (flexParam === 1) {
318
- return [
319
- {
320
- property: "flexGrow",
321
- value: { type: "unit", value: 1, unit: "number" }
322
- },
323
- {
324
- property: "flexShrink",
325
- value: { type: "unit", value: 1, unit: "number" }
326
- },
327
- {
328
- property: "flexBasis",
329
- value: { type: "unit", value: 0, unit: "%" }
330
- }
331
- ];
332
- }
333
- if (flexParam === "auto") {
334
- return [
335
- {
336
- property: "flexGrow",
337
- value: { type: "unit", value: 1, unit: "number" }
338
- },
339
- {
340
- property: "flexShrink",
341
- value: { type: "unit", value: 1, unit: "number" }
342
- },
343
- {
344
- property: "flexBasis",
345
- value: { type: "keyword", value: "auto" }
346
- }
347
- ];
348
- }
349
- if (flexParam === "initial") {
350
- return [
351
- {
352
- property: "flexGrow",
353
- value: { type: "unit", value: 0, unit: "number" }
354
- },
355
- {
356
- property: "flexShrink",
357
- value: { type: "unit", value: 1, unit: "number" }
358
- },
359
- {
360
- property: "flexBasis",
361
- value: { type: "keyword", value: "auto" }
362
- }
363
- ];
364
- }
365
- if (flexParam === "none") {
366
- return [
367
- {
368
- property: "flexGrow",
369
- value: { type: "unit", value: 0, unit: "number" }
370
- },
371
- {
372
- property: "flexShrink",
373
- value: { type: "unit", value: 0, unit: "number" }
374
- },
375
- {
376
- property: "flexBasis",
377
- value: { type: "keyword", value: "auto" }
378
- }
379
- ];
380
- }
381
- return [
382
- {
383
- property: "flexDirection",
384
- value: {
385
- type: "keyword",
386
- value: flexDirection[flexParam]
387
- }
388
- }
389
- ];
390
- };
391
- export const grow = () => {
392
- return [
393
- {
394
- property: "flexGrow",
395
- value: { type: "unit", value: 1, unit: "number" }
396
- }
397
- ];
398
- };
399
- export const shrink = (value) => {
400
- return [
401
- {
402
- property: "flexGrow",
403
- value: { type: "unit", value, unit: "number" }
404
- }
405
- ];
406
- };
407
- export const gap = (gapValue) => {
408
- const value = theme.spacing[gapValue];
409
- return [
410
- { property: "rowGap", value },
411
- { property: "columnGap", value }
412
- ];
413
- };
414
- export const lineClamp = (lineClampValue) => {
415
- return [
416
- {
417
- property: "overflow",
418
- value: {
419
- type: "keyword",
420
- value: "hidden"
421
- }
422
- },
423
- {
424
- property: "display",
425
- value: {
426
- type: "keyword",
427
- value: "-webkit-box"
428
- }
429
- },
430
- {
431
- property: "-webkit-box-orient",
432
- value: {
433
- type: "keyword",
434
- value: "vertical"
435
- }
436
- },
437
- {
438
- property: "-webkit-line-clamp",
439
- value: theme.lineClamp[lineClampValue]
440
- }
441
- ];
442
- };
443
- export const leading = (lineHeight) => {
444
- return [{ property: "lineHeight", value: theme.lineHeight[lineHeight] }];
445
- };
446
- export const tracking = (letterSpacing) => {
447
- return [
448
- { property: "letterSpacing", value: theme.letterSpacing[letterSpacing] }
449
- ];
450
- };
451
- export const outline = (_value) => {
452
- return [
453
- {
454
- property: "outlineWidth",
455
- value: { type: "unit", value: 2, unit: "px" }
456
- },
457
- {
458
- property: "outlineStyle",
459
- value: { type: "keyword", value: "solid" }
460
- },
461
- {
462
- property: "outlineColor",
463
- value: { type: "keyword", value: "transparent" }
464
- },
465
- {
466
- property: "outlineOffset",
467
- value: { type: "unit", value: 2, unit: "px" }
468
- }
469
- ];
470
- };
471
- const textSizes = Object.keys(theme.fontSize);
472
- const isTextSize = (value) => textSizes.includes(value);
473
- export const text = (sizeOrColor) => {
474
- if (isTextSize(sizeOrColor)) {
475
- return [
476
- { property: "fontSize", value: theme.fontSize[sizeOrColor] },
477
- { property: "lineHeight", value: theme.fontSizeLineHeight[sizeOrColor] }
478
- ];
479
- }
480
- return [
481
- {
482
- property: "color",
483
- value: theme.colors[sizeOrColor]
484
- }
485
- ];
486
- };
487
- export const noUnderline = () => {
488
- return [
489
- {
490
- property: "textDecorationLine",
491
- value: { type: "keyword", value: "none" }
492
- }
493
- ];
494
- };
495
- export const underline = () => {
496
- return [
497
- {
498
- property: "textDecorationLine",
499
- value: { type: "keyword", value: "underline" }
500
- }
501
- ];
502
- };
503
- export const underlineOffset = (offset) => {
504
- return [
505
- {
506
- property: "textUnderlineOffset",
507
- value: theme.textUnderlineOffset[offset]
508
- }
509
- ];
510
- };
511
- const weights = {
512
- thin: "100",
513
- extralight: "200",
514
- light: "300",
515
- normal: "400",
516
- medium: "500",
517
- semibold: "600",
518
- bold: "700",
519
- extrabold: "800",
520
- black: "900"
521
- };
522
- export const font = (weight) => {
523
- return [
524
- {
525
- property: "fontWeight",
526
- value: { type: "keyword", value: weights[weight] }
527
- }
528
- ];
529
- };
530
- export const whitespace = (value) => {
531
- return [
532
- {
533
- property: "whiteSpace",
534
- value: { type: "keyword", value }
535
- }
536
- ];
537
- };
538
- export const shadow = (shadowSize) => {
539
- return [
540
- {
541
- property: "boxShadow",
542
- value: theme.boxShadow[shadowSize]
543
- }
544
- ];
545
- };
546
- export const ring = (ringColor, ringWidth, ringOffsetColor = "background", ringOffsetWidth = 0) => {
547
- const ringWidthStyleValue = theme.ringWidth[ringWidth];
548
- const ringOffsetWidthStyleValue = theme.ringOffsetWidth[ringOffsetWidth];
549
- const ringColorStyleValue = theme.colors[ringColor];
550
- const ringOffsetColorStyleValue = theme.colors[ringOffsetColor];
551
- const ringOffsetShadow = {
552
- type: "tuple",
553
- value: [
554
- { type: "unit", value: 0, unit: "number" },
555
- { type: "unit", value: 0, unit: "number" },
556
- { type: "unit", value: 0, unit: "number" },
557
- ringOffsetWidthStyleValue,
558
- ringOffsetColorStyleValue
559
- ]
560
- };
561
- const ringWidthValue = ringWidthStyleValue.type === "unit" ? ringWidthStyleValue.value : 0;
562
- const ringOffsetWidthValue = ringOffsetWidthStyleValue.type === "unit" ? ringOffsetWidthStyleValue.value : 0;
563
- const ringShadow = {
564
- type: "tuple",
565
- value: [
566
- { type: "unit", value: 0, unit: "number" },
567
- { type: "unit", value: 0, unit: "number" },
568
- { type: "unit", value: 0, unit: "number" },
569
- {
570
- type: "unit",
571
- value: ringWidthValue + ringOffsetWidthValue,
572
- unit: ringWidthStyleValue.type === "unit" ? ringWidthStyleValue.unit : "number"
573
- },
574
- ringColorStyleValue
575
- ]
576
- };
577
- return [
578
- {
579
- property: "boxShadow",
580
- value: {
581
- type: "layers",
582
- value: [ringOffsetShadow, ringShadow]
583
- }
584
- }
585
- ];
586
- };
587
- export const pointerEvents = (value) => {
588
- return [{ property: "pointerEvents", value: { type: "keyword", value } }];
589
- };
590
- export const transition = (value) => {
591
- if (value === "none") {
592
- return [
593
- {
594
- property: "transitionProperty",
595
- value: { type: "keyword", value: "all" }
596
- }
597
- ];
598
- }
599
- return [
600
- {
601
- property: "transitionProperty",
602
- value: { type: "keyword", value }
603
- },
604
- {
605
- property: "transitionTimingFunction",
606
- value: { type: "unparsed", value: "cubic-bezier(0.4, 0, 0.2, 1)" }
607
- },
608
- {
609
- property: "transitionDuration",
610
- value: { type: "unparsed", value: "150ms" }
611
- }
612
- ];
613
- };
614
- export const duration = (ms) => {
615
- return [
616
- {
617
- property: "transitionDuration",
618
- value: { type: "unit", value: ms, unit: "ms" }
619
- }
620
- ];
621
- };
622
- export const hover = (value) => {
623
- return value.map((decl) => ({
624
- ...decl,
625
- state: ":hover"
626
- }));
627
- };
628
- export const focus = (value) => {
629
- return value.map((decl) => ({
630
- ...decl,
631
- state: ":focus"
632
- }));
633
- };
634
- export const focusVisible = (value) => {
635
- return value.map((decl) => ({
636
- ...decl,
637
- state: ":focus-visible"
638
- }));
639
- };
640
- export const disabled = (value) => {
641
- return value.map((decl) => ({
642
- ...decl,
643
- state: ":disabled"
644
- }));
645
- };
646
- export const state = (value, state2) => {
647
- return value.map((decl) => ({
648
- ...decl,
649
- state: state2
650
- }));
651
- };
@@ -1,23 +0,0 @@
1
- "use strict";
2
- export const colors = {
3
- transparent: "transparent",
4
- current: "currentColor",
5
- inherit: "inherit",
6
- popover: "rgb(255, 255, 255)",
7
- popoverForeground: "rgb(2, 8, 23)",
8
- border: "rgb(226, 232, 240)",
9
- background: "rgb(255, 255, 255)",
10
- foreground: "hsl(222.2 84% 4.9%)",
11
- ring: "rgb(148, 163, 184)",
12
- mutedForeground: "rgb(100, 116, 139)",
13
- muted: `hsl(210 40% 96.1%)`,
14
- primary: "rgb(15, 23, 42)",
15
- primaryForeground: "hsl(210 40% 98%)",
16
- destructive: "rgb(239, 68, 68)",
17
- destructiveForeground: "rgb(248, 250, 252)",
18
- accent: "rgb(241, 245, 249)",
19
- accentForeground: "rgb(15, 23, 42)",
20
- input: "rgb(226, 232, 240)",
21
- secondary: "rgb(241, 245, 249)",
22
- secondaryForeground: "rgb(15, 23, 42)"
23
- };