@webstudio-is/sdk-components-react-radix 0.85.0 → 0.87.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.
- package/lib/__generated__/accordion.props.js +2134 -0
- package/lib/__generated__/button.props.js +454 -0
- package/lib/__generated__/dialog.props.js +0 -7
- package/lib/__generated__/input.props.js +451 -0
- package/lib/__generated__/label.props.js +421 -0
- package/lib/__generated__/popover.props.js +0 -7
- package/lib/__generated__/sheet.props.js +0 -7
- package/lib/__generated__/textarea.props.js +431 -0
- package/lib/__generated__/tooltip.props.js +0 -7
- package/lib/accordion.js +51 -0
- package/lib/accordion.ws.js +243 -0
- package/lib/button.js +8 -0
- package/lib/button.ws.js +133 -0
- package/lib/cjs/__generated__/accordion.props.js +2154 -0
- package/lib/cjs/__generated__/button.props.js +474 -0
- package/lib/cjs/__generated__/dialog.props.js +0 -7
- package/lib/cjs/__generated__/input.props.js +471 -0
- package/lib/cjs/__generated__/label.props.js +441 -0
- package/lib/cjs/__generated__/popover.props.js +0 -7
- package/lib/cjs/__generated__/sheet.props.js +0 -7
- package/lib/cjs/__generated__/textarea.props.js +451 -0
- package/lib/cjs/__generated__/tooltip.props.js +0 -7
- package/lib/cjs/accordion.js +60 -0
- package/lib/cjs/accordion.ws.js +261 -0
- package/lib/cjs/button.js +28 -0
- package/lib/cjs/button.ws.js +160 -0
- package/lib/cjs/collapsible.js +2 -16
- package/lib/cjs/collapsible.ws.js +1 -8
- package/lib/cjs/components.js +14 -0
- package/lib/cjs/dialog.js +38 -6
- package/lib/cjs/dialog.ws.js +15 -26
- package/lib/cjs/hooks.js +15 -1
- package/lib/cjs/input.js +28 -0
- package/lib/cjs/input.ws.js +103 -0
- package/lib/cjs/label.js +37 -0
- package/lib/cjs/label.ws.js +74 -0
- package/lib/cjs/metas.js +14 -0
- package/lib/cjs/popover.js +37 -5
- package/lib/cjs/popover.ws.js +15 -18
- package/lib/cjs/props.js +14 -0
- package/lib/cjs/sheet.js +34 -1
- package/lib/cjs/sheet.ws.js +33 -19
- package/lib/cjs/tabs.js +20 -1
- package/lib/cjs/tabs.ws.js +3 -25
- package/lib/cjs/textarea.js +28 -0
- package/lib/cjs/textarea.ws.js +98 -0
- package/lib/cjs/theme/tailwind-classes.js +186 -23
- package/lib/cjs/theme/tailwind-colors.js +10 -1
- package/lib/cjs/tooltip.js +36 -4
- package/lib/cjs/tooltip.ws.js +15 -18
- package/lib/collapsible.js +2 -16
- package/lib/collapsible.ws.js +1 -8
- package/lib/components.js +20 -0
- package/lib/dialog.js +38 -6
- package/lib/dialog.ws.js +15 -26
- package/lib/hooks.js +15 -1
- package/lib/input.js +8 -0
- package/lib/input.ws.js +75 -0
- package/lib/label.js +9 -0
- package/lib/label.ws.js +46 -0
- package/lib/metas.js +20 -0
- package/lib/popover.js +37 -5
- package/lib/popover.ws.js +15 -18
- package/lib/props.js +20 -0
- package/lib/sheet.js +34 -1
- package/lib/sheet.ws.js +33 -19
- package/lib/tabs.js +24 -2
- package/lib/tabs.ws.js +3 -25
- package/lib/textarea.js +8 -0
- package/lib/textarea.ws.js +70 -0
- package/lib/theme/tailwind-classes.js +191 -24
- package/lib/theme/tailwind-colors.js +10 -1
- package/lib/tooltip.js +36 -4
- package/lib/tooltip.ws.js +15 -18
- package/lib/types/__generated__/accordion.props.d.ts +6 -0
- package/lib/types/__generated__/button.props.d.ts +2 -0
- package/lib/types/__generated__/input.props.d.ts +2 -0
- package/lib/types/__generated__/label.props.d.ts +2 -0
- package/lib/types/__generated__/textarea.props.d.ts +2 -0
- package/lib/types/accordion.d.ts +12 -0
- package/lib/types/accordion.ws.d.ts +11 -0
- package/lib/types/button.d.ts +7 -0
- package/lib/types/button.stories.d.ts +20 -0
- package/lib/types/button.ws.d.ts +7 -0
- package/lib/types/components.d.ts +5 -0
- package/lib/types/dialog.d.ts +5 -11
- package/lib/types/input.d.ts +2 -0
- package/lib/types/input.stories.d.ts +20 -0
- package/lib/types/input.ws.d.ts +3 -0
- package/lib/types/label.d.ts +3 -0
- package/lib/types/label.stories.d.ts +9 -0
- package/lib/types/label.ws.d.ts +3 -0
- package/lib/types/metas.d.ts +5 -0
- package/lib/types/popover.d.ts +4 -10
- package/lib/types/props.d.ts +5 -0
- package/lib/types/sheet.d.ts +4 -4
- package/lib/types/tabs.d.ts +2 -0
- package/lib/types/textarea.d.ts +2 -0
- package/lib/types/textarea.stories.d.ts +14 -0
- package/lib/types/textarea.ws.d.ts +3 -0
- package/lib/types/theme/tailwind-classes.d.ts +16 -5
- package/lib/types/theme/tailwind-colors.d.ts +9 -0
- package/lib/types/tooltip.d.ts +3 -9
- package/package.json +9 -7
- package/src/__generated__/accordion.props.ts +2382 -0
- package/src/__generated__/button.props.ts +503 -0
- package/src/__generated__/dialog.props.ts +0 -7
- package/src/__generated__/input.props.ts +500 -0
- package/src/__generated__/label.props.ts +470 -0
- package/src/__generated__/popover.props.ts +0 -7
- package/src/__generated__/sheet.props.ts +0 -7
- package/src/__generated__/textarea.props.ts +480 -0
- package/src/__generated__/tooltip.props.ts +0 -7
- package/src/accordion.stories.tsx +21 -0
- package/src/accordion.tsx +81 -0
- package/src/accordion.ws.ts +270 -0
- package/src/button.stories.ts +35 -0
- package/src/button.tsx +25 -0
- package/src/button.ws.ts +155 -0
- package/src/collapsible.tsx +2 -16
- package/src/collapsible.ws.ts +1 -8
- package/src/components.ts +11 -0
- package/src/dialog.stories.tsx +21 -0
- package/src/dialog.tsx +50 -24
- package/src/dialog.ws.tsx +15 -26
- package/src/hooks.ts +15 -1
- package/src/input.stories.ts +31 -0
- package/src/input.tsx +12 -0
- package/src/input.ws.ts +78 -0
- package/src/label.stories.ts +22 -0
- package/src/label.tsx +15 -0
- package/src/label.ws.ts +48 -0
- package/src/metas.ts +11 -0
- package/src/popover.stories.tsx +21 -0
- package/src/popover.tsx +49 -23
- package/src/popover.ws.tsx +15 -18
- package/src/props.ts +11 -0
- package/src/sheet.tsx +39 -0
- package/src/sheet.ws.tsx +33 -19
- package/src/tabs.tsx +32 -1
- package/src/tabs.ws.ts +1 -23
- package/src/textarea.stories.ts +27 -0
- package/src/textarea.tsx +12 -0
- package/src/textarea.ws.ts +74 -0
- package/src/theme/tailwind-classes.ts +233 -38
- package/src/theme/tailwind-colors.ts +9 -16
- package/src/tooltip.stories.tsx +21 -0
- package/src/tooltip.tsx +46 -20
- package/src/tooltip.ws.tsx +15 -18
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { theme } from "./tailwind-theme";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
parseCssValue,
|
|
4
|
+
parseBoxShadow,
|
|
5
|
+
StyleValue
|
|
6
|
+
} from "@webstudio-is/css-data";
|
|
3
7
|
const preflight = () => {
|
|
4
8
|
const borderColorValue = parseCssValue("color", theme("colors")["border"]);
|
|
5
9
|
return [
|
|
@@ -75,38 +79,93 @@ const rounded = (radius) => {
|
|
|
75
79
|
}
|
|
76
80
|
];
|
|
77
81
|
};
|
|
78
|
-
const border = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
const border = (borderWidthOrColor) => {
|
|
83
|
+
if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
|
|
84
|
+
const key = `${borderWidthOrColor ?? "DEFAULT"}`;
|
|
85
|
+
const valueString = theme("borderWidth")?.[key] ?? "1px";
|
|
86
|
+
const value2 = parseCssValue("borderTopWidth", valueString);
|
|
87
|
+
return [
|
|
88
|
+
...preflight(),
|
|
89
|
+
{ property: "borderTopWidth", value: value2 },
|
|
90
|
+
{ property: "borderRightWidth", value: value2 },
|
|
91
|
+
{ property: "borderBottomWidth", value: value2 },
|
|
92
|
+
{ property: "borderLeftWidth", value: value2 }
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
const value = parseCssValue("color", theme("colors")[borderWidthOrColor]);
|
|
82
96
|
return [
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
97
|
+
{
|
|
98
|
+
property: "borderTopColor",
|
|
99
|
+
value
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
property: "borderRightColor",
|
|
103
|
+
value
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
property: "borderBottomColor",
|
|
107
|
+
value
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
property: "borderLeftColor",
|
|
111
|
+
value
|
|
112
|
+
}
|
|
88
113
|
];
|
|
89
114
|
};
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
115
|
+
const borderB = (borderWidthOrColor) => {
|
|
116
|
+
let widthValue = { type: "unit", value: 1, unit: "number" };
|
|
117
|
+
let colorValue = parseCssValue(
|
|
118
|
+
"color",
|
|
119
|
+
theme("colors")["border"]
|
|
120
|
+
);
|
|
121
|
+
if (typeof borderWidthOrColor === "number" || borderWidthOrColor === void 0) {
|
|
122
|
+
const key = `${borderWidthOrColor ?? "DEFAULT"}`;
|
|
123
|
+
const valueString = theme("borderWidth")[key] ?? "1px";
|
|
124
|
+
widthValue = parseCssValue("borderTopWidth", valueString);
|
|
125
|
+
} else {
|
|
126
|
+
colorValue = parseCssValue("color", theme("colors")[borderWidthOrColor]);
|
|
127
|
+
}
|
|
94
128
|
return [
|
|
95
|
-
{
|
|
96
|
-
|
|
129
|
+
{
|
|
130
|
+
property: "borderBottomWidth",
|
|
131
|
+
value: widthValue
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
property: "borderBottomStyle",
|
|
135
|
+
value: { type: "keyword", value: "solid" }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
property: "borderBottomColor",
|
|
139
|
+
value: colorValue
|
|
140
|
+
}
|
|
97
141
|
];
|
|
98
142
|
};
|
|
99
|
-
const
|
|
143
|
+
const paddingProperty = (property) => (padding) => {
|
|
100
144
|
const key = `${padding}`;
|
|
101
|
-
const valueString = theme("padding")[key];
|
|
102
|
-
const value = parseCssValue(
|
|
103
|
-
return [
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
145
|
+
const valueString = theme("padding")?.[key] ?? "0";
|
|
146
|
+
const value = parseCssValue(property, valueString);
|
|
147
|
+
return [{ property, value }];
|
|
148
|
+
};
|
|
149
|
+
const pt = (padding) => {
|
|
150
|
+
return paddingProperty("paddingTop")(padding);
|
|
151
|
+
};
|
|
152
|
+
const pb = (padding) => {
|
|
153
|
+
return paddingProperty("paddingBottom")(padding);
|
|
154
|
+
};
|
|
155
|
+
const pl = (padding) => {
|
|
156
|
+
return paddingProperty("paddingLeft")(padding);
|
|
157
|
+
};
|
|
158
|
+
const pr = (padding) => {
|
|
159
|
+
return paddingProperty("paddingRight")(padding);
|
|
160
|
+
};
|
|
161
|
+
const px = (padding) => {
|
|
162
|
+
return [pl(padding), pr(padding)].flat();
|
|
163
|
+
};
|
|
164
|
+
const py = (padding) => {
|
|
165
|
+
return [pt(padding), pb(padding)].flat();
|
|
107
166
|
};
|
|
108
167
|
const p = (padding) => {
|
|
109
|
-
return [
|
|
168
|
+
return [px(padding), py(padding)].flat();
|
|
110
169
|
};
|
|
111
170
|
const marginProperty = (property) => (margin) => {
|
|
112
171
|
const key = `${margin}`;
|
|
@@ -147,6 +206,12 @@ const h = (spacing) => {
|
|
|
147
206
|
const value = parseCssValue("height", valueString);
|
|
148
207
|
return [{ property: "height", value }];
|
|
149
208
|
};
|
|
209
|
+
const minH = (spacing) => {
|
|
210
|
+
const key = `${spacing}`;
|
|
211
|
+
const valueString = theme("height")?.[key] ?? "0";
|
|
212
|
+
const value = parseCssValue("minHeight", valueString);
|
|
213
|
+
return [{ property: "minHeight", value }];
|
|
214
|
+
};
|
|
150
215
|
const opacity = (opacity2) => {
|
|
151
216
|
const key = `${opacity2}`;
|
|
152
217
|
const valueString = theme("opacity")?.[key] ?? "0";
|
|
@@ -158,6 +223,16 @@ const opacity = (opacity2) => {
|
|
|
158
223
|
}
|
|
159
224
|
];
|
|
160
225
|
};
|
|
226
|
+
const cursor = (cursor2) => {
|
|
227
|
+
const valueString = theme("cursor")?.[cursor2] ?? "auto";
|
|
228
|
+
const value = parseCssValue("cursor", valueString);
|
|
229
|
+
return [
|
|
230
|
+
{
|
|
231
|
+
property: "cursor",
|
|
232
|
+
value
|
|
233
|
+
}
|
|
234
|
+
];
|
|
235
|
+
};
|
|
161
236
|
const maxW = (spacing) => {
|
|
162
237
|
const key = `${spacing}`;
|
|
163
238
|
const valueString = theme("maxWidth")?.[key] ?? "0";
|
|
@@ -264,6 +339,70 @@ const flex = (flexParam) => {
|
|
|
264
339
|
if (flexParam === void 0) {
|
|
265
340
|
return [{ property: "display", value: { type: "keyword", value: "flex" } }];
|
|
266
341
|
}
|
|
342
|
+
if (flexParam === 1) {
|
|
343
|
+
return [
|
|
344
|
+
{
|
|
345
|
+
property: "flexGrow",
|
|
346
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
property: "flexShrink",
|
|
350
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
property: "flexBasis",
|
|
354
|
+
value: { type: "unit", value: 0, unit: "%" }
|
|
355
|
+
}
|
|
356
|
+
];
|
|
357
|
+
}
|
|
358
|
+
if (flexParam === "auto") {
|
|
359
|
+
return [
|
|
360
|
+
{
|
|
361
|
+
property: "flexGrow",
|
|
362
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
property: "flexShrink",
|
|
366
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
property: "flexBasis",
|
|
370
|
+
value: { type: "keyword", value: "auto" }
|
|
371
|
+
}
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
if (flexParam === "initial") {
|
|
375
|
+
return [
|
|
376
|
+
{
|
|
377
|
+
property: "flexGrow",
|
|
378
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
property: "flexShrink",
|
|
382
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
property: "flexBasis",
|
|
386
|
+
value: { type: "keyword", value: "auto" }
|
|
387
|
+
}
|
|
388
|
+
];
|
|
389
|
+
}
|
|
390
|
+
if (flexParam === "none") {
|
|
391
|
+
return [
|
|
392
|
+
{
|
|
393
|
+
property: "flexGrow",
|
|
394
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
property: "flexShrink",
|
|
398
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
property: "flexBasis",
|
|
402
|
+
value: { type: "keyword", value: "auto" }
|
|
403
|
+
}
|
|
404
|
+
];
|
|
405
|
+
}
|
|
267
406
|
return [
|
|
268
407
|
{
|
|
269
408
|
property: "flexDirection",
|
|
@@ -362,6 +501,25 @@ const text = (sizeOrColor) => {
|
|
|
362
501
|
}
|
|
363
502
|
];
|
|
364
503
|
};
|
|
504
|
+
const underline = () => {
|
|
505
|
+
return [
|
|
506
|
+
{
|
|
507
|
+
property: "textDecorationLine",
|
|
508
|
+
value: { type: "keyword", value: "underline" }
|
|
509
|
+
}
|
|
510
|
+
];
|
|
511
|
+
};
|
|
512
|
+
const underlineOffset = (offset) => {
|
|
513
|
+
const key = `${offset}`;
|
|
514
|
+
const valueString = theme("textUnderlineOffset")[key];
|
|
515
|
+
const value = parseCssValue("textUnderlineOffset", valueString);
|
|
516
|
+
return [
|
|
517
|
+
{
|
|
518
|
+
property: "textUnderlineOffset",
|
|
519
|
+
value
|
|
520
|
+
}
|
|
521
|
+
];
|
|
522
|
+
};
|
|
365
523
|
const weights = {
|
|
366
524
|
thin: "100",
|
|
367
525
|
extralight: "200",
|
|
@@ -478,7 +636,9 @@ export {
|
|
|
478
636
|
backdropBlur,
|
|
479
637
|
bg,
|
|
480
638
|
border,
|
|
639
|
+
borderB,
|
|
481
640
|
bottom,
|
|
641
|
+
cursor,
|
|
482
642
|
disabled,
|
|
483
643
|
fixed,
|
|
484
644
|
flex,
|
|
@@ -499,6 +659,7 @@ export {
|
|
|
499
659
|
m,
|
|
500
660
|
maxW,
|
|
501
661
|
mb,
|
|
662
|
+
minH,
|
|
502
663
|
ml,
|
|
503
664
|
mr,
|
|
504
665
|
mt,
|
|
@@ -508,7 +669,11 @@ export {
|
|
|
508
669
|
outline,
|
|
509
670
|
overflow,
|
|
510
671
|
p,
|
|
672
|
+
pb,
|
|
673
|
+
pl,
|
|
511
674
|
pointerEvents,
|
|
675
|
+
pr,
|
|
676
|
+
pt,
|
|
512
677
|
px,
|
|
513
678
|
py,
|
|
514
679
|
relative,
|
|
@@ -521,6 +686,8 @@ export {
|
|
|
521
686
|
top,
|
|
522
687
|
tracking,
|
|
523
688
|
transition,
|
|
689
|
+
underline,
|
|
690
|
+
underlineOffset,
|
|
524
691
|
w,
|
|
525
692
|
whitespace,
|
|
526
693
|
z
|
|
@@ -8,7 +8,16 @@ const colors = {
|
|
|
8
8
|
foreground: "hsl(222.2 84% 4.9%)",
|
|
9
9
|
ring: "rgb(148, 163, 184)",
|
|
10
10
|
mutedForeground: "rgb(100, 116, 139)",
|
|
11
|
-
muted: `hsl(210 40% 96.1%)
|
|
11
|
+
muted: `hsl(210 40% 96.1%)`,
|
|
12
|
+
primary: "rgb(15, 23, 42)",
|
|
13
|
+
primaryForeground: "hsl(210 40% 98%)",
|
|
14
|
+
destructive: "rgb(239, 68, 68)",
|
|
15
|
+
destructiveForeground: "rgb(248, 250, 252)",
|
|
16
|
+
accent: "rgb(241, 245, 249)",
|
|
17
|
+
accentForeground: "rgb(15, 23, 42)",
|
|
18
|
+
input: "rgb(226, 232, 240)",
|
|
19
|
+
secondary: "rgb(241, 245, 249)",
|
|
20
|
+
secondaryForeground: "rgb(15, 23, 42)"
|
|
12
21
|
};
|
|
13
22
|
export {
|
|
14
23
|
colors
|
package/lib/tooltip.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
import { getClosestInstance } from "@webstudio-is/react-sdk";
|
|
3
4
|
import {
|
|
4
5
|
forwardRef,
|
|
5
6
|
Children
|
|
6
7
|
} from "react";
|
|
7
|
-
const Tooltip = forwardRef((
|
|
8
|
-
|
|
9
|
-
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { open, ...props }) });
|
|
8
|
+
const Tooltip = forwardRef((props, _ref) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { ...props }) });
|
|
10
10
|
});
|
|
11
11
|
const TooltipTrigger = forwardRef(({ children, ...props }, ref) => {
|
|
12
12
|
const firstChild = Children.toArray(children)[0];
|
|
@@ -21,8 +21,40 @@ const TooltipContent = forwardRef(({ sideOffset = 4, hideWhenDetached = true, ..
|
|
|
21
21
|
...props
|
|
22
22
|
}
|
|
23
23
|
) }));
|
|
24
|
+
const namespace = "@webstudio-is/sdk-components-react-radix";
|
|
25
|
+
const hooksTooltip = {
|
|
26
|
+
onNavigatorUnselect: (context, event) => {
|
|
27
|
+
for (const instance of event.instancePath) {
|
|
28
|
+
if (instance.component === `${namespace}:TooltipContent`) {
|
|
29
|
+
const tooltip = getClosestInstance(
|
|
30
|
+
event.instancePath,
|
|
31
|
+
instance,
|
|
32
|
+
`${namespace}:Tooltip`
|
|
33
|
+
);
|
|
34
|
+
if (tooltip) {
|
|
35
|
+
context.setPropVariable(tooltip.id, "open", false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
onNavigatorSelect: (context, event) => {
|
|
41
|
+
for (const instance of event.instancePath) {
|
|
42
|
+
if (instance.component === `${namespace}:TooltipContent`) {
|
|
43
|
+
const tooltip = getClosestInstance(
|
|
44
|
+
event.instancePath,
|
|
45
|
+
instance,
|
|
46
|
+
`${namespace}:Tooltip`
|
|
47
|
+
);
|
|
48
|
+
if (tooltip) {
|
|
49
|
+
context.setPropVariable(tooltip.id, "open", true);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
24
55
|
export {
|
|
25
56
|
Tooltip,
|
|
26
57
|
TooltipContent,
|
|
27
|
-
TooltipTrigger
|
|
58
|
+
TooltipTrigger,
|
|
59
|
+
hooksTooltip
|
|
28
60
|
};
|
package/lib/tooltip.ws.js
CHANGED
|
@@ -8,32 +8,27 @@ import {
|
|
|
8
8
|
propsTooltipTrigger
|
|
9
9
|
} from "./__generated__/tooltip.props";
|
|
10
10
|
import { div } from "@webstudio-is/react-sdk/css-normalize";
|
|
11
|
+
import { template as buttonTemplate } from "./button.ws";
|
|
11
12
|
const presetStyle = {
|
|
12
13
|
div
|
|
13
14
|
};
|
|
14
15
|
const metaTooltipTrigger = {
|
|
15
16
|
category: "hidden",
|
|
16
17
|
detachable: false,
|
|
17
|
-
invalidAncestors: [],
|
|
18
18
|
type: "container",
|
|
19
|
-
label: "Tooltip Trigger",
|
|
20
19
|
icon: TriggerIcon,
|
|
21
20
|
stylable: false
|
|
22
21
|
};
|
|
23
22
|
const metaTooltipContent = {
|
|
24
23
|
category: "hidden",
|
|
25
24
|
detachable: false,
|
|
26
|
-
invalidAncestors: [],
|
|
27
25
|
type: "container",
|
|
28
26
|
presetStyle,
|
|
29
|
-
label: "Tooltip Content",
|
|
30
27
|
icon: ContentIcon
|
|
31
28
|
};
|
|
32
29
|
const metaTooltip = {
|
|
33
30
|
category: "radix",
|
|
34
|
-
invalidAncestors: [],
|
|
35
31
|
type: "container",
|
|
36
|
-
label: "Tooltip",
|
|
37
32
|
icon: TooltipIcon,
|
|
38
33
|
order: 15,
|
|
39
34
|
stylable: false,
|
|
@@ -42,14 +37,20 @@ const metaTooltip = {
|
|
|
42
37
|
type: "instance",
|
|
43
38
|
component: "Tooltip",
|
|
44
39
|
dataSources: {
|
|
45
|
-
|
|
46
|
-
isOpen: { type: "variable", initialValue: "initial" }
|
|
40
|
+
tooltipOpen: { type: "variable", initialValue: false }
|
|
47
41
|
},
|
|
48
42
|
props: [
|
|
49
43
|
{
|
|
50
44
|
type: "dataSource",
|
|
51
|
-
name: "
|
|
52
|
-
dataSourceName: "
|
|
45
|
+
name: "open",
|
|
46
|
+
dataSourceName: "tooltipOpen"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: "onOpenChange",
|
|
50
|
+
type: "action",
|
|
51
|
+
value: [
|
|
52
|
+
{ type: "execute", args: ["open"], code: `tooltipOpen = open` }
|
|
53
|
+
]
|
|
53
54
|
}
|
|
54
55
|
],
|
|
55
56
|
children: [
|
|
@@ -57,13 +58,9 @@ const metaTooltip = {
|
|
|
57
58
|
type: "instance",
|
|
58
59
|
component: "TooltipTrigger",
|
|
59
60
|
props: [],
|
|
60
|
-
children:
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
component: "Button",
|
|
64
|
-
children: [{ type: "text", value: "Button" }]
|
|
65
|
-
}
|
|
66
|
-
]
|
|
61
|
+
children: buttonTemplate({
|
|
62
|
+
children: [{ type: "text", value: "Button" }]
|
|
63
|
+
})
|
|
67
64
|
},
|
|
68
65
|
{
|
|
69
66
|
type: "instance",
|
|
@@ -98,7 +95,7 @@ const metaTooltip = {
|
|
|
98
95
|
};
|
|
99
96
|
const propsMetaTooltip = {
|
|
100
97
|
props: propsTooltip,
|
|
101
|
-
initialProps: ["
|
|
98
|
+
initialProps: ["open", "delayDuration", "disableHoverableContent"]
|
|
102
99
|
};
|
|
103
100
|
const propsMetaTooltipTrigger = {
|
|
104
101
|
props: propsTooltipTrigger
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PropMeta } from "@webstudio-is/generate-arg-types";
|
|
2
|
+
export declare const propsAccordion: Record<string, PropMeta>;
|
|
3
|
+
export declare const propsAccordionItem: Record<string, PropMeta>;
|
|
4
|
+
export declare const propsAccordionHeader: Record<string, PropMeta>;
|
|
5
|
+
export declare const propsAccordionTrigger: Record<string, PropMeta>;
|
|
6
|
+
export declare const propsAccordionContent: Record<string, PropMeta>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ForwardRefExoticComponent, type ComponentPropsWithRef } from "react";
|
|
2
|
+
import { Header, Trigger, Content } from "@radix-ui/react-accordion";
|
|
3
|
+
import { type Hook } from "@webstudio-is/react-sdk";
|
|
4
|
+
export declare const Accordion: ForwardRefExoticComponent<Omit<ComponentPropsWithoutRef<ForwardRefExoticComponent<(import("@radix-ui/react-accordion").AccordionSingleProps | import("@radix-ui/react-accordion").AccordionMultipleProps) & import("react").RefAttributes<HTMLDivElement>>>, "value" | "type" | "defaultValue" | "asChild" | "onValueChange"> & {
|
|
5
|
+
value: string;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const AccordionItem: ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-accordion").AccordionItemProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "asChild"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const AccordionHeader: ForwardRefExoticComponent<Omit<ComponentPropsWithRef<typeof Header>, "asChild">>;
|
|
10
|
+
export declare const AccordionTrigger: ForwardRefExoticComponent<Omit<ComponentPropsWithRef<typeof Trigger>, "asChild">>;
|
|
11
|
+
export declare const AccordionContent: ForwardRefExoticComponent<Omit<ComponentPropsWithRef<typeof Content>, "asChild">>;
|
|
12
|
+
export declare const hooksAccordion: Hook;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WsComponentMeta, WsComponentPropsMeta } from "@webstudio-is/react-sdk";
|
|
2
|
+
export declare const metaAccordion: WsComponentMeta;
|
|
3
|
+
export declare const metaAccordionItem: WsComponentMeta;
|
|
4
|
+
export declare const metaAccordionHeader: WsComponentMeta;
|
|
5
|
+
export declare const metaAccordionTrigger: WsComponentMeta;
|
|
6
|
+
export declare const metaAccordionContent: WsComponentMeta;
|
|
7
|
+
export declare const propsMetaAccordion: WsComponentPropsMeta;
|
|
8
|
+
export declare const propsMetaAccordionItem: WsComponentPropsMeta;
|
|
9
|
+
export declare const propsMetaAccordionHeader: WsComponentPropsMeta;
|
|
10
|
+
export declare const propsMetaAccordionTrigger: WsComponentPropsMeta;
|
|
11
|
+
export declare const propsMetaAccordionContent: WsComponentPropsMeta;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type ButtonVariants = {
|
|
3
|
+
variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
4
|
+
size: "default" | "sm" | "lg" | "icon";
|
|
5
|
+
};
|
|
6
|
+
export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & ButtonVariants & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
import { Button as ButtonPrimitive } from "./button";
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
7
|
+
variant: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost";
|
|
8
|
+
size: "default" | "icon" | "sm" | "lg";
|
|
9
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
argTypes: {
|
|
11
|
+
variant: {
|
|
12
|
+
options: string[];
|
|
13
|
+
control: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
20
|
+
export declare const Button: StoryObj<typeof ButtonPrimitive>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EmbedTemplateInstance, type WsComponentMeta, type WsComponentPropsMeta } from "@webstudio-is/react-sdk";
|
|
2
|
+
export declare const template: (props?: {
|
|
3
|
+
props?: EmbedTemplateInstance["props"];
|
|
4
|
+
children?: WsComponentMeta["template"];
|
|
5
|
+
} | undefined) => NonNullable<WsComponentMeta["template"]>;
|
|
6
|
+
export declare const meta: WsComponentMeta;
|
|
7
|
+
export declare const propsMeta: WsComponentPropsMeta;
|
|
@@ -4,3 +4,8 @@ export { Popover, PopoverTrigger, PopoverContent } from "./popover";
|
|
|
4
4
|
export { Tooltip, TooltipTrigger, TooltipContent } from "./tooltip";
|
|
5
5
|
export { Sheet, SheetTrigger, SheetOverlay, SheetContent, SheetClose, SheetTitle, SheetDescription, } from "./sheet";
|
|
6
6
|
export { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs";
|
|
7
|
+
export { Button } from "./button";
|
|
8
|
+
export { Input } from "./input";
|
|
9
|
+
export { Textarea } from "./textarea";
|
|
10
|
+
export { Label } from "./label";
|
|
11
|
+
export { Accordion, AccordionItem, AccordionHeader, AccordionTrigger, AccordionContent, } from "./accordion";
|
package/lib/types/dialog.d.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
1
|
import { type ReactNode } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
**/
|
|
7
|
-
type BuilderDialogProps = {
|
|
8
|
-
isOpen: "initial" | "open" | "closed";
|
|
9
|
-
};
|
|
10
|
-
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogProps & BuilderDialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
import { type Hook } from "@webstudio-is/react-sdk";
|
|
4
|
+
export declare const Dialog: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogProps, "defaultOpen"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
5
|
/**
|
|
12
6
|
* We're not exposing the 'asChild' property for the Trigger.
|
|
13
7
|
* Instead, we're enforcing 'asChild=true' for the Trigger and making it style-less.
|
|
@@ -16,10 +10,10 @@ export declare const Dialog: import("react").ForwardRefExoticComponent<DialogPri
|
|
|
16
10
|
*/
|
|
17
11
|
export declare const DialogTrigger: import("react").ForwardRefExoticComponent<{
|
|
18
12
|
children: ReactNode;
|
|
19
|
-
} & import("react").RefAttributes<
|
|
13
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
20
14
|
export declare const DialogOverlay: import("react").ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
15
|
export declare const DialogContent: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
22
16
|
export declare const DialogClose: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
23
17
|
export declare const DialogTitle: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogTitleProps & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
24
18
|
export declare const DialogDescription: import("react").ForwardRefExoticComponent<DialogPrimitive.DialogDescriptionProps & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
25
|
-
export
|
|
19
|
+
export declare const hooksDialog: Hook;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
import { Input as InputPrimitive } from "./input";
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
7
|
+
argTypes: {
|
|
8
|
+
placeholder: {
|
|
9
|
+
type: "string";
|
|
10
|
+
};
|
|
11
|
+
type: {
|
|
12
|
+
options: string[];
|
|
13
|
+
control: {
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
20
|
+
export declare const Input: StoryObj<typeof InputPrimitive>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
export declare const Label: import("react").ForwardRefExoticComponent<Omit<Omit<LabelPrimitive.LabelProps & import("react").RefAttributes<HTMLLabelElement>, "ref">, "asChild"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StoryObj } from "@storybook/react";
|
|
3
|
+
import { Label as LabelPrimitive } from "./label";
|
|
4
|
+
declare const _default: {
|
|
5
|
+
title: string;
|
|
6
|
+
component: import("react").ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-label").LabelProps & import("react").RefAttributes<HTMLLabelElement>, "ref">, "asChild"> & import("react").RefAttributes<HTMLLabelElement>>;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const Label: StoryObj<typeof LabelPrimitive>;
|
package/lib/types/metas.d.ts
CHANGED
|
@@ -4,3 +4,8 @@ export { metaPopover as Popover, metaPopoverTrigger as PopoverTrigger, metaPopov
|
|
|
4
4
|
export { metaTooltip as Tooltip, metaTooltipTrigger as TooltipTrigger, metaTooltipContent as TooltipContent, } from "./tooltip.ws";
|
|
5
5
|
export { metaSheet as Sheet, metaSheetTrigger as SheetTrigger, metaSheetOverlay as SheetOverlay, metaSheetContent as SheetContent, metaSheetClose as SheetClose, metaSheetTitle as SheetTitle, metaSheetDescription as SheetDescription, } from "./sheet.ws";
|
|
6
6
|
export { metaTabs as Tabs, metaTabsList as TabsList, metaTabsTrigger as TabsTrigger, metaTabsContent as TabsContent, } from "./tabs.ws";
|
|
7
|
+
export { meta as Button } from "./button.ws";
|
|
8
|
+
export { meta as Input } from "./input.ws";
|
|
9
|
+
export { meta as Textarea } from "./textarea.ws";
|
|
10
|
+
export { meta as Label } from "./label.ws";
|
|
11
|
+
export { metaAccordion as Accordion, metaAccordionItem as AccordionItem, metaAccordionHeader as AccordionHeader, metaAccordionTrigger as AccordionTrigger, metaAccordionContent as AccordionContent, } from "./accordion.ws";
|