@webstudio-is/sdk-components-react-radix 0.185.0 → 0.191.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 +2631 -0
- package/lib/__generated__/checkbox.props.js +1084 -0
- package/lib/__generated__/collapsible.props.js +1024 -0
- package/lib/__generated__/dialog.props.js +2599 -0
- package/lib/__generated__/label.props.js +519 -0
- package/lib/__generated__/navigation-menu.props.js +3660 -0
- package/lib/__generated__/popover.props.js +564 -0
- package/lib/__generated__/radio-group.props.js +1619 -0
- package/lib/__generated__/select.props.js +3681 -0
- package/lib/__generated__/switch.props.js +1084 -0
- package/lib/__generated__/tabs.props.js +2121 -0
- package/lib/__generated__/tooltip.props.js +575 -0
- package/lib/accordion.js +36 -0
- package/lib/accordion.ws.js +254 -0
- package/lib/checkbox.js +8 -0
- package/lib/checkbox.ws.js +141 -0
- package/lib/collapsible.js +26 -0
- package/lib/collapsible.ws.js +92 -0
- package/lib/components.js +60 -406
- package/lib/dialog.js +84 -0
- package/lib/dialog.ws.js +260 -0
- package/lib/hooks.js +20 -655
- package/lib/label.js +7 -0
- package/lib/label.ws.js +43 -0
- package/lib/metas.js +62 -4570
- package/lib/navigation-menu.js +59 -0
- package/lib/navigation-menu.ws.js +481 -0
- package/lib/popover.js +48 -0
- package/lib/popover.ws.js +96 -0
- package/lib/props.js +60 -24208
- package/lib/radio-group.js +9 -0
- package/lib/radio-group.ws.js +159 -0
- package/lib/select.js +46 -0
- package/lib/select.ws.js +308 -0
- package/lib/sheet.js +43 -0
- package/lib/sheet.ws.js +217 -0
- package/lib/switch.js +8 -0
- package/lib/switch.ws.js +140 -0
- package/lib/tabs.js +31 -0
- package/lib/tabs.ws.js +187 -0
- package/lib/theme/__generated__/tailwind-theme.js +503 -0
- package/lib/theme/styles.js +52 -0
- package/lib/theme/tailwind-classes.js +474 -0
- package/lib/tooltip.js +45 -0
- package/lib/tooltip.ws.js +97 -0
- package/lib/types/theme/styles.d.ts +92 -44
- package/package.json +19 -20
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { zIndex as h, borderRadius as m, colors as n, width as g, height as k, opacity as x, cursor as S, maxWidth as W, blur as B, listStyleType as C, spacing as T, lineHeight as L, letterSpacing as R, fontSize as i, fontSizeLineHeight as V, boxShadow as D, borderWidth as y, padding as G, margin as z, inset as F, ringOffsetWidth as E, lineClamp as j, ringWidth as H } from "./__generated__/tailwind-theme.js";
|
|
2
|
+
const ue = (e, t) => t.startsWith("--") ? {
|
|
3
|
+
property: e,
|
|
4
|
+
value: { type: "var", value: t.slice(2) }
|
|
5
|
+
} : {
|
|
6
|
+
property: e,
|
|
7
|
+
value: { type: "unparsed", value: t }
|
|
8
|
+
}, I = () => {
|
|
9
|
+
const e = n.border;
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
property: "borderTopStyle",
|
|
13
|
+
value: { type: "keyword", value: "solid" }
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
property: "borderRightStyle",
|
|
17
|
+
value: { type: "keyword", value: "solid" }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
property: "borderBottomStyle",
|
|
21
|
+
value: { type: "keyword", value: "solid" }
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
property: "borderLeftStyle",
|
|
25
|
+
value: { type: "keyword", value: "solid" }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
property: "borderTopColor",
|
|
29
|
+
value: e
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
property: "borderRightColor",
|
|
33
|
+
value: e
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
property: "borderBottomColor",
|
|
37
|
+
value: e
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
property: "borderLeftColor",
|
|
41
|
+
value: e
|
|
42
|
+
}
|
|
43
|
+
];
|
|
44
|
+
}, pe = (e) => [
|
|
45
|
+
{
|
|
46
|
+
property: "zIndex",
|
|
47
|
+
value: h[e]
|
|
48
|
+
}
|
|
49
|
+
], U = (e) => [
|
|
50
|
+
{
|
|
51
|
+
property: "overflowX",
|
|
52
|
+
value: { type: "keyword", value: e }
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
property: "overflowY",
|
|
56
|
+
value: { type: "keyword", value: e }
|
|
57
|
+
}
|
|
58
|
+
], le = (e = "DEFAULT") => {
|
|
59
|
+
const t = m[e];
|
|
60
|
+
return [
|
|
61
|
+
{ property: "borderTopLeftRadius", value: t },
|
|
62
|
+
{ property: "borderTopRightRadius", value: t },
|
|
63
|
+
{ property: "borderBottomRightRadius", value: t },
|
|
64
|
+
{ property: "borderBottomLeftRadius", value: t }
|
|
65
|
+
];
|
|
66
|
+
}, ae = (e) => {
|
|
67
|
+
if (typeof e == "number" || e === void 0) {
|
|
68
|
+
const r = y[e ?? "DEFAULT"];
|
|
69
|
+
return [
|
|
70
|
+
...I(),
|
|
71
|
+
{ property: "borderTopWidth", value: r },
|
|
72
|
+
{ property: "borderRightWidth", value: r },
|
|
73
|
+
{ property: "borderBottomWidth", value: r },
|
|
74
|
+
{ property: "borderLeftWidth", value: r }
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
const t = n[e];
|
|
78
|
+
return [
|
|
79
|
+
{ property: "borderTopColor", value: t },
|
|
80
|
+
{ property: "borderRightColor", value: t },
|
|
81
|
+
{ property: "borderBottomColor", value: t },
|
|
82
|
+
{ property: "borderLeftColor", value: t }
|
|
83
|
+
];
|
|
84
|
+
}, ie = (e) => {
|
|
85
|
+
let t = { type: "unit", value: 1, unit: "number" }, r = n.border;
|
|
86
|
+
return t = y.DEFAULT, [
|
|
87
|
+
{
|
|
88
|
+
property: "borderBottomWidth",
|
|
89
|
+
value: t
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
property: "borderBottomStyle",
|
|
93
|
+
value: { type: "keyword", value: "solid" }
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
property: "borderBottomColor",
|
|
97
|
+
value: r
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
}, u = (e) => (t) => [{ property: e, value: G[t] }], $ = (e) => u("paddingTop")(e), A = (e) => u("paddingBottom")(e), M = (e) => u("paddingLeft")(e), O = (e) => u("paddingRight")(e), _ = (e) => [M(e), O(e)].flat(), X = (e) => [$(e), A(e)].flat(), ye = (e) => [_(e), X(e)].flat(), p = (e) => (t) => [{ property: e, value: z[t] }], Y = (e) => p("marginLeft")(e), q = (e) => p("marginRight")(e), J = (e) => p("marginTop")(e), K = (e) => p("marginBottom")(e), N = (e) => [Y(e), q(e)].flat(), Q = (e) => [J(e), K(e)].flat(), se = (e) => [N(e), Q(e)].flat(), ve = (e) => [{ property: "width", value: g[e] }], ce = (e) => [{ property: "height", value: k[e] }], de = (e) => [
|
|
101
|
+
{
|
|
102
|
+
property: "opacity",
|
|
103
|
+
value: x[e]
|
|
104
|
+
}
|
|
105
|
+
], be = (e) => [
|
|
106
|
+
{
|
|
107
|
+
property: "cursor",
|
|
108
|
+
value: S[e]
|
|
109
|
+
}
|
|
110
|
+
], fe = (e) => [{ property: "maxWidth", value: W[e] }], o = (e, t) => ({ property: e, value: F[t] }), we = (e) => [o("top", e)], he = (e) => [o("right", e)], me = (e) => [o("left", e)], ge = (e) => [
|
|
111
|
+
o("left", e),
|
|
112
|
+
o("right", e),
|
|
113
|
+
o("top", e),
|
|
114
|
+
o("bottom", e)
|
|
115
|
+
], ke = (e) => {
|
|
116
|
+
let t = e;
|
|
117
|
+
return t = "1 / 1", [
|
|
118
|
+
{
|
|
119
|
+
property: "aspectRatio",
|
|
120
|
+
value: { type: "unparsed", value: t }
|
|
121
|
+
}
|
|
122
|
+
];
|
|
123
|
+
}, xe = (e) => [{ property: "backdropFilter", value: B[e] }], Se = (e) => [{ property: "listStyleType", value: C[e] }], We = (e) => [
|
|
124
|
+
{
|
|
125
|
+
property: "userSelect",
|
|
126
|
+
value: {
|
|
127
|
+
type: "keyword",
|
|
128
|
+
value: "none"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
], Be = (e, t) => {
|
|
132
|
+
const r = n[e];
|
|
133
|
+
return t !== void 0 && r.type === "rgb" && (r.alpha = t / 100), [
|
|
134
|
+
{
|
|
135
|
+
property: "backgroundColor",
|
|
136
|
+
value: r
|
|
137
|
+
}
|
|
138
|
+
];
|
|
139
|
+
}, Ce = () => [{ property: "position", value: { type: "keyword", value: "fixed" } }], Te = () => [
|
|
140
|
+
{ property: "position", value: { type: "keyword", value: "relative" } }
|
|
141
|
+
], Le = () => [
|
|
142
|
+
{ property: "position", value: { type: "keyword", value: "absolute" } }
|
|
143
|
+
], Z = {
|
|
144
|
+
start: "flex-start",
|
|
145
|
+
end: "flex-end",
|
|
146
|
+
center: "center",
|
|
147
|
+
baseline: "baseline",
|
|
148
|
+
stretch: "stretch"
|
|
149
|
+
}, Re = (e) => [
|
|
150
|
+
{
|
|
151
|
+
property: "alignItems",
|
|
152
|
+
value: {
|
|
153
|
+
type: "keyword",
|
|
154
|
+
value: Z[e]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
], P = {
|
|
158
|
+
start: "flex-start",
|
|
159
|
+
end: "flex-end",
|
|
160
|
+
center: "center",
|
|
161
|
+
between: "space-between",
|
|
162
|
+
around: "space-around",
|
|
163
|
+
evenly: "space-evenly",
|
|
164
|
+
stretch: "stretch"
|
|
165
|
+
}, Ve = (e) => [
|
|
166
|
+
{
|
|
167
|
+
property: "justifyContent",
|
|
168
|
+
value: {
|
|
169
|
+
type: "keyword",
|
|
170
|
+
value: P[e]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
], De = () => [
|
|
174
|
+
{ property: "display", value: { type: "keyword", value: "inline-flex" } }
|
|
175
|
+
], Ge = () => [{ property: "display", value: { type: "keyword", value: "block" } }], ee = { row: "row", col: "column" }, ze = (e) => e === void 0 ? [{ property: "display", value: { type: "keyword", value: "flex" } }] : e === 1 ? [
|
|
176
|
+
{
|
|
177
|
+
property: "flexGrow",
|
|
178
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
property: "flexShrink",
|
|
182
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
property: "flexBasis",
|
|
186
|
+
value: { type: "unit", value: 0, unit: "%" }
|
|
187
|
+
}
|
|
188
|
+
] : e === "auto" ? [
|
|
189
|
+
{
|
|
190
|
+
property: "flexGrow",
|
|
191
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
property: "flexShrink",
|
|
195
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
property: "flexBasis",
|
|
199
|
+
value: { type: "keyword", value: "auto" }
|
|
200
|
+
}
|
|
201
|
+
] : e === "initial" ? [
|
|
202
|
+
{
|
|
203
|
+
property: "flexGrow",
|
|
204
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
property: "flexShrink",
|
|
208
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
property: "flexBasis",
|
|
212
|
+
value: { type: "keyword", value: "auto" }
|
|
213
|
+
}
|
|
214
|
+
] : e === "none" ? [
|
|
215
|
+
{
|
|
216
|
+
property: "flexGrow",
|
|
217
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
property: "flexShrink",
|
|
221
|
+
value: { type: "unit", value: 0, unit: "number" }
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
property: "flexBasis",
|
|
225
|
+
value: { type: "keyword", value: "auto" }
|
|
226
|
+
}
|
|
227
|
+
] : [
|
|
228
|
+
{
|
|
229
|
+
property: "flexDirection",
|
|
230
|
+
value: {
|
|
231
|
+
type: "keyword",
|
|
232
|
+
value: ee[e]
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
], Fe = () => [
|
|
236
|
+
{
|
|
237
|
+
property: "flexGrow",
|
|
238
|
+
value: { type: "unit", value: 1, unit: "number" }
|
|
239
|
+
}
|
|
240
|
+
], Ee = (e) => [
|
|
241
|
+
{
|
|
242
|
+
property: "flexGrow",
|
|
243
|
+
value: { type: "unit", value: e, unit: "number" }
|
|
244
|
+
}
|
|
245
|
+
], je = (e) => {
|
|
246
|
+
const t = T[e];
|
|
247
|
+
return [
|
|
248
|
+
{ property: "rowGap", value: t },
|
|
249
|
+
{ property: "columnGap", value: t }
|
|
250
|
+
];
|
|
251
|
+
}, He = (e) => [
|
|
252
|
+
...U("hidden"),
|
|
253
|
+
{
|
|
254
|
+
property: "display",
|
|
255
|
+
value: {
|
|
256
|
+
type: "keyword",
|
|
257
|
+
value: "-webkit-box"
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
property: "-webkit-box-orient",
|
|
262
|
+
value: {
|
|
263
|
+
type: "keyword",
|
|
264
|
+
value: "vertical"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
property: "-webkit-line-clamp",
|
|
269
|
+
value: j[e]
|
|
270
|
+
}
|
|
271
|
+
], Ie = (e) => [{ property: "lineHeight", value: L[e] }], Ue = (e) => [
|
|
272
|
+
{ property: "letterSpacing", value: R[e] }
|
|
273
|
+
], $e = (e) => [
|
|
274
|
+
{
|
|
275
|
+
property: "outlineWidth",
|
|
276
|
+
value: { type: "unit", value: 2, unit: "px" }
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
property: "outlineStyle",
|
|
280
|
+
value: { type: "keyword", value: "solid" }
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
property: "outlineColor",
|
|
284
|
+
value: { type: "keyword", value: "transparent" }
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
property: "outlineOffset",
|
|
288
|
+
value: { type: "unit", value: 2, unit: "px" }
|
|
289
|
+
}
|
|
290
|
+
], te = Object.keys(i), re = (e) => te.includes(e), Ae = (e) => re(e) ? [
|
|
291
|
+
{ property: "fontSize", value: i[e] },
|
|
292
|
+
{ property: "lineHeight", value: V[e] }
|
|
293
|
+
] : [
|
|
294
|
+
{
|
|
295
|
+
property: "color",
|
|
296
|
+
value: n[e]
|
|
297
|
+
}
|
|
298
|
+
], Me = () => [
|
|
299
|
+
{
|
|
300
|
+
property: "textDecorationLine",
|
|
301
|
+
value: { type: "keyword", value: "none" }
|
|
302
|
+
}
|
|
303
|
+
], Oe = () => [
|
|
304
|
+
{
|
|
305
|
+
property: "textDecorationLine",
|
|
306
|
+
value: { type: "keyword", value: "underline" }
|
|
307
|
+
}
|
|
308
|
+
], oe = {
|
|
309
|
+
thin: "100",
|
|
310
|
+
extralight: "200",
|
|
311
|
+
light: "300",
|
|
312
|
+
normal: "400",
|
|
313
|
+
medium: "500",
|
|
314
|
+
semibold: "600",
|
|
315
|
+
bold: "700",
|
|
316
|
+
extrabold: "800",
|
|
317
|
+
black: "900"
|
|
318
|
+
}, _e = (e) => [
|
|
319
|
+
{
|
|
320
|
+
property: "fontWeight",
|
|
321
|
+
value: { type: "keyword", value: oe[e] }
|
|
322
|
+
}
|
|
323
|
+
], Xe = (e) => [
|
|
324
|
+
{
|
|
325
|
+
property: "whiteSpaceCollapse",
|
|
326
|
+
value: { type: "keyword", value: "collapse" }
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
property: "textWrapMode",
|
|
330
|
+
value: { type: "keyword", value: "wrap" }
|
|
331
|
+
}
|
|
332
|
+
], Ye = (e) => [
|
|
333
|
+
{
|
|
334
|
+
property: "boxShadow",
|
|
335
|
+
value: D[e]
|
|
336
|
+
}
|
|
337
|
+
], qe = (e, t, r = "background", s = 0) => {
|
|
338
|
+
const a = H[t], l = E[s], v = n[e], c = n[r], d = {
|
|
339
|
+
type: "tuple",
|
|
340
|
+
value: [
|
|
341
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
342
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
343
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
344
|
+
l,
|
|
345
|
+
c
|
|
346
|
+
]
|
|
347
|
+
}, b = a.value, f = l.type === "unit" ? l.value : 0, w = {
|
|
348
|
+
type: "tuple",
|
|
349
|
+
value: [
|
|
350
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
351
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
352
|
+
{ type: "unit", value: 0, unit: "number" },
|
|
353
|
+
{
|
|
354
|
+
type: "unit",
|
|
355
|
+
value: b + f,
|
|
356
|
+
unit: a.unit
|
|
357
|
+
},
|
|
358
|
+
v
|
|
359
|
+
]
|
|
360
|
+
};
|
|
361
|
+
return [
|
|
362
|
+
{
|
|
363
|
+
property: "boxShadow",
|
|
364
|
+
value: {
|
|
365
|
+
type: "layers",
|
|
366
|
+
value: [d, w]
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
];
|
|
370
|
+
}, Je = (e) => [{ property: "pointerEvents", value: { type: "keyword", value: e } }], Ke = (e) => e === "none" ? [
|
|
371
|
+
{
|
|
372
|
+
property: "transitionProperty",
|
|
373
|
+
value: { type: "keyword", value: "all" }
|
|
374
|
+
}
|
|
375
|
+
] : [
|
|
376
|
+
{
|
|
377
|
+
property: "transitionProperty",
|
|
378
|
+
value: { type: "keyword", value: e }
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
property: "transitionTimingFunction",
|
|
382
|
+
value: { type: "unparsed", value: "cubic-bezier(0.4, 0, 0.2, 1)" }
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
property: "transitionDuration",
|
|
386
|
+
value: { type: "unparsed", value: "150ms" }
|
|
387
|
+
}
|
|
388
|
+
], Ne = (e) => [
|
|
389
|
+
{
|
|
390
|
+
property: "transitionDuration",
|
|
391
|
+
value: { type: "unit", value: e, unit: "ms" }
|
|
392
|
+
}
|
|
393
|
+
], Qe = (e) => e.map((t) => ({
|
|
394
|
+
...t,
|
|
395
|
+
state: ":hover"
|
|
396
|
+
})), Ze = (e) => e.map((t) => ({
|
|
397
|
+
...t,
|
|
398
|
+
state: ":focus"
|
|
399
|
+
})), Pe = (e) => e.map((t) => ({
|
|
400
|
+
...t,
|
|
401
|
+
state: ":focus-visible"
|
|
402
|
+
})), et = (e) => e.map((t) => ({
|
|
403
|
+
...t,
|
|
404
|
+
state: ":disabled"
|
|
405
|
+
})), tt = (e, t) => e.map((r) => ({
|
|
406
|
+
...r,
|
|
407
|
+
state: t
|
|
408
|
+
}));
|
|
409
|
+
export {
|
|
410
|
+
Le as absolute,
|
|
411
|
+
ke as aspect,
|
|
412
|
+
xe as backdropBlur,
|
|
413
|
+
Be as bg,
|
|
414
|
+
Ge as block,
|
|
415
|
+
ae as border,
|
|
416
|
+
ie as borderB,
|
|
417
|
+
be as cursor,
|
|
418
|
+
et as disabled,
|
|
419
|
+
Ne as duration,
|
|
420
|
+
Ce as fixed,
|
|
421
|
+
ze as flex,
|
|
422
|
+
Ze as focus,
|
|
423
|
+
Pe as focusVisible,
|
|
424
|
+
_e as font,
|
|
425
|
+
je as gap,
|
|
426
|
+
Fe as grow,
|
|
427
|
+
ce as h,
|
|
428
|
+
Qe as hover,
|
|
429
|
+
De as inlineFlex,
|
|
430
|
+
ge as inset,
|
|
431
|
+
Re as items,
|
|
432
|
+
Ve as justify,
|
|
433
|
+
Ie as leading,
|
|
434
|
+
me as left,
|
|
435
|
+
He as lineClamp,
|
|
436
|
+
Se as list,
|
|
437
|
+
se as m,
|
|
438
|
+
fe as maxW,
|
|
439
|
+
K as mb,
|
|
440
|
+
Y as ml,
|
|
441
|
+
q as mr,
|
|
442
|
+
J as mt,
|
|
443
|
+
N as mx,
|
|
444
|
+
Q as my,
|
|
445
|
+
Me as noUnderline,
|
|
446
|
+
de as opacity,
|
|
447
|
+
$e as outline,
|
|
448
|
+
U as overflow,
|
|
449
|
+
ye as p,
|
|
450
|
+
A as pb,
|
|
451
|
+
M as pl,
|
|
452
|
+
Je as pointerEvents,
|
|
453
|
+
O as pr,
|
|
454
|
+
ue as property,
|
|
455
|
+
$ as pt,
|
|
456
|
+
_ as px,
|
|
457
|
+
X as py,
|
|
458
|
+
Te as relative,
|
|
459
|
+
he as right,
|
|
460
|
+
qe as ring,
|
|
461
|
+
le as rounded,
|
|
462
|
+
We as select,
|
|
463
|
+
Ye as shadow,
|
|
464
|
+
Ee as shrink,
|
|
465
|
+
tt as state,
|
|
466
|
+
Ae as text,
|
|
467
|
+
we as top,
|
|
468
|
+
Ue as tracking,
|
|
469
|
+
Ke as transition,
|
|
470
|
+
Oe as underline,
|
|
471
|
+
ve as w,
|
|
472
|
+
Xe as whitespace,
|
|
473
|
+
pe as z
|
|
474
|
+
};
|
package/lib/tooltip.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "@radix-ui/react-tooltip";
|
|
3
|
+
import { getClosestInstance as a } from "@webstudio-is/react-sdk/runtime";
|
|
4
|
+
import { forwardRef as c, Children as p } from "react";
|
|
5
|
+
const m = c((t, o) => /* @__PURE__ */ r(e.Provider, { children: /* @__PURE__ */ r(e.Root, { ...t }) })), h = c(({ children: t, ...o }, n) => {
|
|
6
|
+
const i = p.toArray(t)[0];
|
|
7
|
+
return /* @__PURE__ */ r(e.Trigger, { asChild: !0, ref: n, ...o, children: i ?? /* @__PURE__ */ r("button", { children: "Add button or link" }) });
|
|
8
|
+
}), T = c(({ sideOffset: t = 4, hideWhenDetached: o = !0, ...n }, i) => /* @__PURE__ */ r(e.Portal, { children: /* @__PURE__ */ r(
|
|
9
|
+
e.Content,
|
|
10
|
+
{
|
|
11
|
+
ref: i,
|
|
12
|
+
hideWhenDetached: o,
|
|
13
|
+
sideOffset: t,
|
|
14
|
+
...n
|
|
15
|
+
}
|
|
16
|
+
) })), s = "@webstudio-is/sdk-components-react-radix", P = {
|
|
17
|
+
onNavigatorUnselect: (t, o) => {
|
|
18
|
+
for (const n of o.instancePath)
|
|
19
|
+
if (n.component === `${s}:TooltipContent`) {
|
|
20
|
+
const i = a(
|
|
21
|
+
o.instancePath,
|
|
22
|
+
n,
|
|
23
|
+
`${s}:Tooltip`
|
|
24
|
+
);
|
|
25
|
+
i && t.setMemoryProp(i, "open", void 0);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
onNavigatorSelect: (t, o) => {
|
|
29
|
+
for (const n of o.instancePath)
|
|
30
|
+
if (n.component === `${s}:TooltipContent`) {
|
|
31
|
+
const i = a(
|
|
32
|
+
o.instancePath,
|
|
33
|
+
n,
|
|
34
|
+
`${s}:Tooltip`
|
|
35
|
+
);
|
|
36
|
+
i && t.setMemoryProp(i, "open", !0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
m as Tooltip,
|
|
42
|
+
T as TooltipContent,
|
|
43
|
+
h as TooltipTrigger,
|
|
44
|
+
P as hooksTooltip
|
|
45
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { TriggerIcon as e, ContentIcon as o, TooltipIcon as n } from "@webstudio-is/icons/svg";
|
|
2
|
+
import "@webstudio-is/react-sdk";
|
|
3
|
+
import { div as r } from "@webstudio-is/sdk/normalize.css";
|
|
4
|
+
import { z as p, overflow as i, rounded as a, border as l, bg as s, px as c, py as d, text as t, shadow as m } from "./theme/tailwind-classes.js";
|
|
5
|
+
import { propsTooltip as g, propsTooltipTrigger as h, propsTooltipContent as y } from "./__generated__/tooltip.props.js";
|
|
6
|
+
import { getButtonStyles as T } from "./theme/styles.js";
|
|
7
|
+
const f = {
|
|
8
|
+
div: r
|
|
9
|
+
}, B = {
|
|
10
|
+
category: "hidden",
|
|
11
|
+
detachable: !1,
|
|
12
|
+
type: "container",
|
|
13
|
+
icon: e,
|
|
14
|
+
stylable: !1
|
|
15
|
+
}, I = {
|
|
16
|
+
category: "hidden",
|
|
17
|
+
detachable: !1,
|
|
18
|
+
type: "container",
|
|
19
|
+
presetStyle: f,
|
|
20
|
+
icon: o
|
|
21
|
+
}, M = {
|
|
22
|
+
category: "radix",
|
|
23
|
+
order: 7,
|
|
24
|
+
type: "container",
|
|
25
|
+
icon: n,
|
|
26
|
+
stylable: !1,
|
|
27
|
+
description: "Displays content that is related to the trigger, when the trigger is hovered with the mouse or focused with the keyboard. You are reading an example of a tooltip right now.",
|
|
28
|
+
template: [
|
|
29
|
+
{
|
|
30
|
+
type: "instance",
|
|
31
|
+
component: "Tooltip",
|
|
32
|
+
props: [],
|
|
33
|
+
children: [
|
|
34
|
+
{
|
|
35
|
+
type: "instance",
|
|
36
|
+
component: "TooltipTrigger",
|
|
37
|
+
children: [
|
|
38
|
+
{
|
|
39
|
+
type: "instance",
|
|
40
|
+
component: "Button",
|
|
41
|
+
styles: T("outline"),
|
|
42
|
+
children: [{ type: "text", value: "Button", placeholder: !0 }]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "instance",
|
|
48
|
+
component: "TooltipContent",
|
|
49
|
+
/**
|
|
50
|
+
* z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md
|
|
51
|
+
**/
|
|
52
|
+
styles: [
|
|
53
|
+
p(50),
|
|
54
|
+
i("hidden"),
|
|
55
|
+
a("md"),
|
|
56
|
+
l(),
|
|
57
|
+
s("popover"),
|
|
58
|
+
c(3),
|
|
59
|
+
d(1.5),
|
|
60
|
+
t("sm"),
|
|
61
|
+
t("popoverForeground"),
|
|
62
|
+
m("md")
|
|
63
|
+
].flat(),
|
|
64
|
+
children: [
|
|
65
|
+
{
|
|
66
|
+
type: "instance",
|
|
67
|
+
component: "Text",
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
type: "text",
|
|
71
|
+
value: "The text you can edit",
|
|
72
|
+
placeholder: !0
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}, D = {
|
|
82
|
+
props: g,
|
|
83
|
+
initialProps: ["open", "delayDuration", "disableHoverableContent"]
|
|
84
|
+
}, O = {
|
|
85
|
+
props: h
|
|
86
|
+
}, P = {
|
|
87
|
+
props: y,
|
|
88
|
+
initialProps: ["side", "sideOffset", "align", "alignOffset"]
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
M as metaTooltip,
|
|
92
|
+
I as metaTooltipContent,
|
|
93
|
+
B as metaTooltipTrigger,
|
|
94
|
+
D as propsMetaTooltip,
|
|
95
|
+
P as propsMetaTooltipContent,
|
|
96
|
+
O as propsMetaTooltipTrigger
|
|
97
|
+
};
|