@plasmicpkgs/radix-ui 0.0.22 → 0.0.24

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/dist/index.js CHANGED
@@ -1,8 +1,1090 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
29
 
2
- 'use strict'
30
+ // src/index.tsx
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ Dialog: () => Dialog,
34
+ DialogClose: () => DialogClose,
35
+ DialogContent: () => DialogContent,
36
+ DialogDescription: () => DialogDescription,
37
+ DialogTitle: () => DialogTitle,
38
+ Popover: () => Popover,
39
+ SheetContent: () => SheetContent,
40
+ Tooltip: () => Tooltip,
41
+ popoverProps: () => popoverProps,
42
+ registerAll: () => registerAll,
43
+ registerDialog: () => registerDialog,
44
+ registerPopover: () => registerPopover,
45
+ registerTooltip: () => registerTooltip,
46
+ sheetVariants: () => sheetVariants
47
+ });
48
+ module.exports = __toCommonJS(src_exports);
3
49
 
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./radix-ui.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./radix-ui.cjs.development.js')
50
+ // src/popover.tsx
51
+ var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
52
+ var React2 = __toESM(require("react"));
53
+ var import_clsx = __toESM(require("clsx"));
54
+
55
+ // src/reg-util.ts
56
+ var import_registerComponent = __toESM(require("@plasmicapp/host/registerComponent"));
57
+ var import_registerGlobalContext = __toESM(require("@plasmicapp/host/registerGlobalContext"));
58
+ function registerComponentHelper(loader, component, meta) {
59
+ if (loader) {
60
+ loader.registerComponent(component, meta);
61
+ } else {
62
+ (0, import_registerComponent.default)(component, meta);
63
+ }
64
+ }
65
+
66
+ // src/util.tsx
67
+ var React = __toESM(require("react"));
68
+ var import_react = require("react");
69
+ var import_remeda = require("remeda");
70
+ var DEBUG_SLOWDOWN = 1;
71
+ var enterAnims = [
72
+ "fade-in",
73
+ "zoom-enter",
74
+ "slide-in-from-top",
75
+ "slide-in-from-right",
76
+ "slide-in-from-bottom",
77
+ "slide-in-from-left"
78
+ ];
79
+ var exitAnims = [
80
+ "fade-out",
81
+ "zoom-exit",
82
+ "slide-out-to-top",
83
+ "slide-out-to-right",
84
+ "slide-out-to-bottom",
85
+ "slide-out-to-left"
86
+ ];
87
+ var id = 0;
88
+ var _a;
89
+ var useId2 = (_a = React.useId) != null ? _a : () => (0, import_react.useState)(() => "" + id++);
90
+ var StyleWrapper = ({
91
+ children,
92
+ cssStr
93
+ }) => {
94
+ const dynClass = "pd__" + useId2().replace(/:/g, "");
95
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, children(dynClass), /* @__PURE__ */ React.createElement("style", null, dynClass ? cssStr.replace(/&/g, `.${dynClass}`) : ""));
96
+ };
97
+ var Animated = ({
98
+ children,
99
+ enterAnimations = ["fade-in"],
100
+ exitAnimations = ["fade-out"],
101
+ enterDuration = 0.15 * DEBUG_SLOWDOWN,
102
+ exitDuration = 0.15 * DEBUG_SLOWDOWN,
103
+ enterOpacity = 0,
104
+ exitOpacity = 0,
105
+ enterScale = 0.95,
106
+ exitScale = 0.95,
107
+ enterTranslateX = "100%",
108
+ exitTranslateX = "100%",
109
+ enterTranslateY = "100%",
110
+ exitTranslateY = "100%",
111
+ enterTiming = "ease",
112
+ exitTiming = "ease",
113
+ enterDelay = 0,
114
+ exitDelay = 0
115
+ }) => {
116
+ const pct = (x) => typeof x === "number" || (x == null ? void 0 : x.match(/.*\d$/)) ? x + "%" : x;
117
+ const neg = (x) => x.startsWith("-") ? x : "-" + x;
118
+ const animations = {
119
+ "fade-in": `--tw-enter-opacity: ${enterOpacity};`,
120
+ "fade-out": `--tw-exit-opacity: ${exitOpacity};`,
121
+ "slide-in-from-top": `--tw-enter-translate-y: ${neg(
122
+ pct(enterTranslateY)
123
+ )};`,
124
+ "slide-out-to-top": `--tw-exit-translate-y: ${neg(pct(exitTranslateY))};`,
125
+ "slide-in-from-right": `--tw-enter-translate-x: ${pct(enterTranslateX)};`,
126
+ "slide-out-to-right": `--tw-exit-translate-x: ${pct(exitTranslateX)};`,
127
+ "slide-in-from-bottom": `--tw-enter-translate-y: ${pct(enterTranslateY)};`,
128
+ "slide-out-to-bottom": `--tw-exit-translate-y: ${pct(exitTranslateY)};`,
129
+ "slide-in-from-left": `--tw-enter-translate-x: ${neg(
130
+ pct(enterTranslateX)
131
+ )};`,
132
+ "slide-out-to-left": `--tw-exit-translate-x: ${neg(pct(exitTranslateX))};`,
133
+ "zoom-enter": `--tw-enter-scale: ${enterScale};`,
134
+ "zoom-exit": `--tw-exit-scale: ${exitScale};`
135
+ };
136
+ return /* @__PURE__ */ React.createElement(
137
+ StyleWrapper,
138
+ {
139
+ cssStr: `
140
+ &&[data-state=closed] {
141
+ animation-duration: ${exitDuration}s;
142
+ animation-timing-function: ${exitTiming};
143
+ animation-delay: ${exitDelay};
144
+ ${exitAnimations.map((exitAnimation) => {
145
+ var _a2;
146
+ return (_a2 = animations[exitAnimation]) != null ? _a2 : "";
147
+ }).join(" ")}
148
+ }
149
+ &&,
150
+ &&[data-state=open] {
151
+ animation-duration: ${enterDuration}s;
152
+ animation-timing-function: ${enterTiming};
153
+ animation-delay: ${enterDelay};
154
+ ${enterAnimations.map((enterAnimation) => {
155
+ var _a2;
156
+ return (_a2 = animations[enterAnimation]) != null ? _a2 : "";
157
+ }).join(" ")}
158
+ }
159
+ `
160
+ },
161
+ children
162
+ );
163
+ };
164
+ function splitAnimProps(props) {
165
+ const keys = [
166
+ "enterAnimations",
167
+ "exitAnimations",
168
+ "enterDuration",
169
+ "exitDuration",
170
+ "enterTranslateX",
171
+ "exitTranslateX",
172
+ "enterTranslateY",
173
+ "exitTranslateY",
174
+ "enterTiming",
175
+ "exitTiming",
176
+ "enterDelay",
177
+ "exitDelay",
178
+ "enterScale",
179
+ "exitScale",
180
+ "enterOpacity",
181
+ "exitOpacity"
182
+ ];
183
+ const a = (0, import_remeda.pick)(props, keys);
184
+ const b = (0, import_remeda.omit)(props, keys);
185
+ return [a, b];
186
+ }
187
+ function mungeNames(names) {
188
+ return names.map((name) => ({
189
+ label: name.replace(/-/g, " "),
190
+ value: name
191
+ }));
192
+ }
193
+ var animPropTypes = ({
194
+ defaultEnterAnimations,
195
+ defaultExitAnimations
196
+ }) => {
197
+ const getEnterAnimations = (ps) => {
198
+ var _a2;
199
+ return (_a2 = ps.enterAnimations) != null ? _a2 : defaultEnterAnimations == null ? void 0 : defaultEnterAnimations(ps);
200
+ };
201
+ const getExitAnimations = (ps) => {
202
+ var _a2;
203
+ return (_a2 = ps.exitAnimations) != null ? _a2 : defaultExitAnimations == null ? void 0 : defaultExitAnimations(ps);
204
+ };
205
+ return {
206
+ enterAnimations: {
207
+ type: "choice",
208
+ options: mungeNames(enterAnims),
209
+ multiSelect: true,
210
+ defaultValueHint: defaultEnterAnimations != null ? defaultEnterAnimations : ["fade-in"]
211
+ },
212
+ exitAnimations: {
213
+ type: "choice",
214
+ options: mungeNames(exitAnims),
215
+ multiSelect: true,
216
+ defaultValueHint: defaultExitAnimations != null ? defaultExitAnimations : ["fade-out"]
217
+ },
218
+ enterDuration: { type: "number", defaultValueHint: 0.15 },
219
+ exitDuration: { type: "number", defaultValueHint: 0.15 },
220
+ enterTranslateX: {
221
+ type: "string",
222
+ defaultValueHint: "100%",
223
+ hidden: (ps) => {
224
+ var _a2, _b;
225
+ return !((_a2 = getEnterAnimations(ps)) == null ? void 0 : _a2.includes("slide-in-from-right")) && !((_b = getEnterAnimations(ps)) == null ? void 0 : _b.includes("slide-in-from-left"));
226
+ }
227
+ },
228
+ exitTranslateX: {
229
+ type: "string",
230
+ advanced: true,
231
+ defaultValueHint: "100%",
232
+ hidden: (ps) => {
233
+ var _a2, _b;
234
+ return !((_a2 = getExitAnimations(ps)) == null ? void 0 : _a2.includes("slide-out-to-right")) && !((_b = getExitAnimations(ps)) == null ? void 0 : _b.includes("slide-out-to-left"));
235
+ }
236
+ },
237
+ enterTranslateY: {
238
+ type: "string",
239
+ advanced: true,
240
+ defaultValueHint: "100%",
241
+ hidden: (ps) => {
242
+ var _a2, _b;
243
+ return !((_a2 = getEnterAnimations(ps)) == null ? void 0 : _a2.includes("slide-in-from-bottom")) && !((_b = getEnterAnimations(ps)) == null ? void 0 : _b.includes("slide-in-from-top"));
244
+ }
245
+ },
246
+ exitTranslateY: {
247
+ type: "string",
248
+ advanced: true,
249
+ defaultValueHint: "100%",
250
+ hidden: (ps) => {
251
+ var _a2, _b;
252
+ return !((_a2 = getExitAnimations(ps)) == null ? void 0 : _a2.includes("slide-out-to-bottom")) && !((_b = getExitAnimations(ps)) == null ? void 0 : _b.includes("slide-out-to-top"));
253
+ }
254
+ },
255
+ enterOpacity: {
256
+ type: "number",
257
+ advanced: true,
258
+ defaultValueHint: 0,
259
+ hidden: (ps) => {
260
+ var _a2;
261
+ return !((_a2 = getEnterAnimations(ps)) == null ? void 0 : _a2.includes("fade-in"));
262
+ }
263
+ },
264
+ exitOpacity: {
265
+ type: "number",
266
+ advanced: true,
267
+ defaultValueHint: 0,
268
+ hidden: (ps) => {
269
+ var _a2;
270
+ return !((_a2 = getExitAnimations(ps)) == null ? void 0 : _a2.includes("fade-out"));
271
+ }
272
+ },
273
+ enterScale: {
274
+ type: "number",
275
+ advanced: true,
276
+ defaultValueHint: 0.95,
277
+ hidden: (ps) => {
278
+ var _a2;
279
+ return !((_a2 = getEnterAnimations(ps)) == null ? void 0 : _a2.includes("zoom-enter"));
280
+ }
281
+ },
282
+ exitScale: {
283
+ type: "number",
284
+ advanced: true,
285
+ defaultValueHint: 0.95,
286
+ hidden: (ps) => {
287
+ var _a2;
288
+ return !((_a2 = getExitAnimations(ps)) == null ? void 0 : _a2.includes("zoom-exit"));
289
+ }
290
+ },
291
+ enterDelay: { type: "number", advanced: true, defaultValueHint: 0 },
292
+ exitDelay: { type: "number", advanced: true, defaultValueHint: 0 },
293
+ enterTiming: {
294
+ type: "string",
295
+ advanced: true,
296
+ defaultValueHint: "ease",
297
+ ...{
298
+ suggestions: ["linear", "ease", "ease-in", "ease-out", "ease-in-out"]
299
+ }
300
+ },
301
+ exitTiming: {
302
+ type: "string",
303
+ advanced: true,
304
+ defaultValueHint: "ease",
305
+ ...{
306
+ suggestions: ["linear", "ease", "ease-in", "ease-out", "ease-in-out"]
307
+ }
308
+ }
309
+ };
310
+ };
311
+ var overlayStates = {
312
+ open: {
313
+ type: "writable",
314
+ valueProp: "open",
315
+ onChangeProp: "onOpenChange",
316
+ variableType: "boolean"
317
+ }
318
+ };
319
+ var overlayProps = ({
320
+ defaultSlotContent,
321
+ triggerSlotName,
322
+ openDisplay
323
+ }) => ({
324
+ open: {
325
+ type: "boolean",
326
+ displayName: openDisplay,
327
+ editOnly: true,
328
+ uncontrolledProp: "defaultOpen"
329
+ },
330
+ modal: {
331
+ type: "boolean",
332
+ advanced: true,
333
+ description: "Disable interaction with outside elements. Only popover content will be visible to screen readers."
334
+ },
335
+ onOpenChange: {
336
+ type: "eventHandler",
337
+ argTypes: [
338
+ {
339
+ type: "boolean",
340
+ name: "open"
341
+ }
342
+ ]
343
+ },
344
+ [triggerSlotName]: {
345
+ type: "slot",
346
+ defaultValue: [defaultSlotContent],
347
+ ...{
348
+ mergeWithParent: true
349
+ }
350
+ },
351
+ themeResetClass: { type: "themeResetClass" }
352
+ });
353
+ function prefixClasses(x) {
354
+ return x.trim().split(/\s+/g).map((part) => `pl__${part}`).join(" ");
355
+ }
356
+ var prefixedBaseStyles = `
357
+ .box-border {
358
+ box-sizing: border-box;
359
+ }
360
+
361
+ .sr-only {
362
+ position: absolute;
363
+ width: 1px;
364
+ height: 1px;
365
+ padding: 0;
366
+ margin: -1px;
367
+ overflow: hidden;
368
+ clip: rect(0, 0, 0, 0);
369
+ white-space: nowrap;
370
+ border-width: 0;
371
+ }
372
+ .absolute {
373
+ position: absolute;
374
+ }
375
+ .relative {
376
+ position: relative;
377
+ }
378
+ .transition {
379
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
380
+ }
381
+ .h-full {
382
+ height: 100%;
383
+ }
384
+ .z-50 { z-index: 50; }
385
+ .fixed { position: fixed; }
386
+ .inset-0 { top: 0; left: 0; right: 0; bottom: 0; }
387
+ .bottom-0 {
388
+ bottom: 0px;
389
+ }
390
+ .left-0 {
391
+ left: 0px;
392
+ }
393
+ .right-0 {
394
+ right: 0px;
395
+ }
396
+ .top-0 {
397
+ top: 0px;
398
+ }
399
+ .right-4 {
400
+ right: 1rem;
401
+ }
402
+ .top-4 {
403
+ top: 1rem;
404
+ }
405
+ .h-4 { height: 1rem; }
406
+ .w-4 { width: 1rem; }
407
+ .outline-none { outline: none; }
408
+
409
+ @keyframes plsmc-enter {
410
+
411
+ from {
412
+ opacity: var(--tw-enter-opacity, 1);
413
+ transform: translate3d(var(--tw-enter-translate-x, 0), var(--tw-enter-translate-y, 0), 0) scale3d(var(--tw-enter-scale, 1), var(--tw-enter-scale, 1), var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0));
414
+ }
415
+ }
416
+
417
+ @keyframes plsmc-exit {
418
+
419
+ to {
420
+ opacity: var(--tw-exit-opacity, 1);
421
+ transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));
422
+ }
423
+ }
424
+ .animate-in,
425
+ .data-\\[state\\=open\\]\\:animate-in[data-state=open] {
426
+ animation-name: plsmc-enter;
427
+ animation-duration: 150ms;
428
+ --tw-enter-opacity: initial;
429
+ --tw-enter-scale: initial;
430
+ --tw-enter-rotate: initial;
431
+ --tw-enter-translate-x: initial;
432
+ --tw-enter-translate-y: initial;
433
+ }
434
+ .animate-out,
435
+ .data-\\[state\\=closed\\]\\:animate-out[data-state=closed] {
436
+ animation-name: plsmc-exit;
437
+ animation-duration: 150ms;
438
+ --tw-exit-opacity: initial;
439
+ --tw-exit-scale: initial;
440
+ --tw-exit-rotate: initial;
441
+ --tw-exit-translate-x: initial;
442
+ --tw-exit-translate-y: initial;
443
+ }
444
+ .data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom] {
445
+ --tw-enter-translate-y: -0.5rem;
446
+ }
447
+
448
+ .data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left] {
449
+ --tw-enter-translate-x: 0.5rem;
450
+ }
451
+
452
+ .data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right] {
453
+ --tw-enter-translate-x: -0.5rem;
454
+ }
455
+
456
+ .data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top] {
457
+ --tw-enter-translate-y: 0.5rem;
458
+ }
459
+
460
+ `.replace(/\n\./g, ".pl__");
461
+ function BaseStyles() {
462
+ return /* @__PURE__ */ React.createElement("style", { dangerouslySetInnerHTML: { __html: prefixedBaseStyles } });
463
+ }
464
+ var popoverProps = {
465
+ side: {
466
+ type: "choice",
467
+ options: ["top", "bottom", "left", "right"],
468
+ defaultValueHint: "bottom"
469
+ },
470
+ sideOffset: {
471
+ type: "number",
472
+ defaultValueHint: 4,
473
+ advanced: true
474
+ },
475
+ align: {
476
+ type: "choice",
477
+ options: ["center", "start", "end"],
478
+ defaultValueHint: "center"
479
+ },
480
+ alignOffset: {
481
+ type: "number",
482
+ defaultValueHint: 0,
483
+ advanced: true
484
+ },
485
+ ...animPropTypes({
486
+ defaultEnterAnimations: () => ["fade-in", "zoom-enter"],
487
+ defaultExitAnimations: () => ["fade-out", "zoom-exit"]
488
+ }),
489
+ slideIn: {
490
+ type: "boolean",
491
+ defaultValueHint: true,
492
+ description: "Add additional subtle slide-in animation on reveal, which can depend on where the tooltip is dynamically placed."
493
+ }
494
+ };
495
+
496
+ // src/popover.tsx
497
+ function Popover({
498
+ // root
499
+ open,
500
+ onOpenChange,
501
+ defaultOpen,
502
+ modal,
503
+ // content
504
+ className,
505
+ sideOffset = 4,
506
+ themeResetClass,
507
+ overlay,
508
+ slideIn = true,
509
+ // trigger/anchor
510
+ trigger = true,
511
+ children,
512
+ ...props
513
+ }) {
514
+ const [animProps, rest] = splitAnimProps(props);
515
+ return /* @__PURE__ */ React2.createElement(
516
+ Animated,
517
+ {
518
+ enterAnimations: ["fade-in", "zoom-enter"],
519
+ exitAnimations: ["fade-out", "zoom-exit"],
520
+ ...animProps
521
+ },
522
+ (dynClass) => /* @__PURE__ */ React2.createElement(
523
+ PopoverPrimitive.Root,
524
+ {
525
+ open,
526
+ onOpenChange,
527
+ defaultOpen,
528
+ modal
529
+ },
530
+ trigger ? /* @__PURE__ */ React2.createElement(PopoverPrimitive.Trigger, { asChild: true }, children) : /* @__PURE__ */ React2.createElement(PopoverPrimitive.Anchor, { asChild: true }, children),
531
+ /* @__PURE__ */ React2.createElement(PopoverPrimitive.Portal, null, /* @__PURE__ */ React2.createElement(
532
+ PopoverPrimitive.Content,
533
+ {
534
+ className: (0, import_clsx.default)(
535
+ prefixClasses(
536
+ "outline-none data-[state=open]:animate-in data-[state=closed]:animate-out"
537
+ ),
538
+ slideIn ? prefixClasses(
539
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
540
+ ) : "",
541
+ dynClass ? dynClass : "",
542
+ className,
543
+ themeResetClass
544
+ ),
545
+ sideOffset,
546
+ ...rest
547
+ },
548
+ overlay
549
+ )),
550
+ /* @__PURE__ */ React2.createElement(BaseStyles, null)
551
+ )
552
+ );
553
+ }
554
+ Popover.displayName = "PlasmicRadixPopover";
555
+ function registerPopover(PLASMIC) {
556
+ registerComponentHelper(PLASMIC, Popover, {
557
+ name: "hostless-radix-popover",
558
+ displayName: "Popover Core",
559
+ importPath: "@plasmicpkgs/radix-ui",
560
+ importName: "Popover",
561
+ states: overlayStates,
562
+ props: {
563
+ ...overlayProps({
564
+ triggerSlotName: "children",
565
+ defaultSlotContent: {
566
+ type: "default-component",
567
+ kind: "button",
568
+ props: {
569
+ children: { type: "text", value: `Show popover` }
570
+ }
571
+ }
572
+ }),
573
+ trigger: {
574
+ type: "boolean",
575
+ displayName: "Trigger on click",
576
+ defaultValueHint: true,
577
+ advanced: true
578
+ },
579
+ ...popoverProps,
580
+ overlay: {
581
+ type: "slot",
582
+ defaultValue: {
583
+ type: "vbox",
584
+ styles: {
585
+ padding: "16px",
586
+ width: "300px",
587
+ maxWidth: "100%",
588
+ borderWidth: "1px",
589
+ borderStyle: "solid",
590
+ borderColor: "#E2E8F0",
591
+ backgroundColor: "white",
592
+ borderRadius: "8px",
593
+ boxShadow: "0px 4px 16px 0px #00000033",
594
+ alignItems: "stretch"
595
+ },
596
+ children: ["Here is the popover content."]
597
+ },
598
+ ...{
599
+ mergeWithParent: true
600
+ }
601
+ }
602
+ }
603
+ });
604
+ }
605
+
606
+ // src/dialog.tsx
607
+ var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"));
608
+ var import_class_variance_authority = require("class-variance-authority");
609
+ var import_lucide_react = require("lucide-react");
610
+ var React3 = __toESM(require("react"));
611
+ var import_clsx2 = __toESM(require("clsx"));
612
+ var DialogClose = React3.forwardRef((props) => {
613
+ var _a2;
614
+ return /* @__PURE__ */ React3.createElement(DialogPrimitive.Close, { ...props, asChild: true }, /* @__PURE__ */ React3.createElement("div", { className: props.className }, (_a2 = props.children) != null ? _a2 : /* @__PURE__ */ React3.createElement(import_lucide_react.X, { className: prefixClasses("h-4 w-4") }), /* @__PURE__ */ React3.createElement("span", { className: prefixClasses("sr-only") }, "Close")));
615
+ });
616
+ DialogClose.displayName = "PlasmicRadixDialogClose";
617
+ var DialogOverlay = React3.forwardRef(({ className, ...props }, ref) => {
618
+ return /* @__PURE__ */ React3.createElement(Animated, { ...props }, (dynClass) => /* @__PURE__ */ React3.createElement(
619
+ DialogPrimitive.Overlay,
620
+ {
621
+ className: (0, import_clsx2.default)(
622
+ [
623
+ "fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out"
624
+ ].map(prefixClasses),
625
+ dynClass ? dynClass : "",
626
+ className
627
+ ),
628
+ ...props,
629
+ ref
630
+ }
631
+ ));
632
+ });
633
+ DialogOverlay.displayName = "PlasmicOverlay";
634
+ var DialogContent = React3.forwardRef(({ className, themeResetClass, ...props }, ref) => {
635
+ var _a2, _b;
636
+ const [animProps, rest] = splitAnimProps(props);
637
+ return /* @__PURE__ */ React3.createElement(
638
+ Animated,
639
+ {
640
+ ...animProps,
641
+ enterAnimations: (_a2 = animProps.enterAnimations) != null ? _a2 : ["zoom-enter", "fade-in"],
642
+ exitAnimations: (_b = animProps.exitAnimations) != null ? _b : ["zoom-exit", "fade-out"]
643
+ },
644
+ (dynClass) => /* @__PURE__ */ React3.createElement(
645
+ DialogPrimitive.Content,
646
+ {
647
+ ...rest,
648
+ className: (0, import_clsx2.default)(
649
+ prefixClasses(
650
+ "fixed z-50 outline-none relative box-border data-[state=open]:animate-in data-[state=closed]:animate-out"
651
+ ),
652
+ dynClass ? dynClass : "",
653
+ themeResetClass,
654
+ className
655
+ ),
656
+ ref
657
+ }
658
+ )
659
+ );
660
+ });
661
+ DialogContent.displayName = "PlasmicRadixDialogContent";
662
+ function getDefaultSheetAnims(side = "right") {
663
+ return {
664
+ right: ["slide-in-from-right", "slide-out-to-right"],
665
+ bottom: ["slide-in-from-bottom", "slide-out-to-bottom"],
666
+ left: ["slide-in-from-left", "slide-out-to-left"],
667
+ top: ["slide-in-from-top", "slide-out-to-top"]
668
+ }[side];
669
+ }
670
+ var SheetContent = React3.forwardRef(({ className, themeResetClass, side = "right", ...props }, ref) => {
671
+ var _a2, _b;
672
+ const [defaultEnterAnimation, defaultExitAnimation] = getDefaultSheetAnims(
673
+ side != null ? side : "right"
674
+ );
675
+ return /* @__PURE__ */ React3.createElement(
676
+ Animated,
677
+ {
678
+ ...props,
679
+ enterAnimations: (_a2 = props.enterAnimations) != null ? _a2 : [defaultEnterAnimation],
680
+ exitAnimations: (_b = props.exitAnimations) != null ? _b : [defaultExitAnimation]
681
+ },
682
+ (dynClass) => /* @__PURE__ */ React3.createElement(
683
+ DialogPrimitive.Content,
684
+ {
685
+ className: (0, import_clsx2.default)(
686
+ sheetVariants({ side }),
687
+ dynClass ? dynClass : "",
688
+ className
689
+ ),
690
+ ...props,
691
+ ref
692
+ }
693
+ )
694
+ );
695
+ });
696
+ SheetContent.displayName = "PlasmicRadixSheetContent";
697
+ var sheetVariants = (0, import_class_variance_authority.cva)(
698
+ prefixClasses(
699
+ "fixed z-50 outline-none relative data-[state=open]:animate-in data-[state=closed]:animate-out"
700
+ ),
701
+ {
702
+ variants: {
703
+ side: {
704
+ top: prefixClasses("inset-x-0 top-0"),
705
+ bottom: prefixClasses("inset-x-0 bottom-0"),
706
+ left: prefixClasses("inset-y-0 left-0 h-full"),
707
+ right: prefixClasses("inset-y-0 right-0 h-full")
708
+ }
709
+ },
710
+ defaultVariants: {
711
+ side: "right"
712
+ }
713
+ }
714
+ );
715
+ var Dialog = React3.forwardRef(
716
+ ({
717
+ open,
718
+ onOpenChange,
719
+ modal,
720
+ themeResetClass,
721
+ children,
722
+ noContain,
723
+ defaultOpen,
724
+ triggerSlot,
725
+ overlayClassName,
726
+ ...props
727
+ }, ref) => /* @__PURE__ */ React3.createElement(
728
+ DialogPrimitive.Root,
729
+ {
730
+ open,
731
+ modal,
732
+ onOpenChange,
733
+ defaultOpen
734
+ },
735
+ /* @__PURE__ */ React3.createElement(DialogPrimitive.Trigger, { asChild: true }, triggerSlot),
736
+ noContain ? /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(DialogPrimitive.Portal, null, /* @__PURE__ */ React3.createElement(
737
+ DialogOverlay,
738
+ {
739
+ ref,
740
+ ...props,
741
+ className: (0, import_clsx2.default)(overlayClassName, themeResetClass)
742
+ }
743
+ ), children)) : /* @__PURE__ */ React3.createElement(DialogPrimitive.Portal, null, /* @__PURE__ */ React3.createElement(
744
+ DialogOverlay,
745
+ {
746
+ ref,
747
+ ...props,
748
+ className: (0, import_clsx2.default)(overlayClassName, themeResetClass)
749
+ },
750
+ children
751
+ )),
752
+ /* @__PURE__ */ React3.createElement(BaseStyles, null)
753
+ )
754
+ );
755
+ Dialog.displayName = "PlasmicRadixDialog";
756
+ var DialogTitle = DialogPrimitive.Title;
757
+ var DialogDescription = DialogPrimitive.Description;
758
+ function registerDialog(PLASMIC) {
759
+ registerComponentHelper(PLASMIC, Dialog, {
760
+ name: "hostless-radix-dialog",
761
+ displayName: "Dialog Core",
762
+ importPath: "@plasmicpkgs/radix-ui",
763
+ importName: "Dialog",
764
+ styleSections: false,
765
+ defaultStyles: {
766
+ // Note: unable to set position styles since Plasmic coerces to auto layout
767
+ display: "flex",
768
+ alignItems: "center",
769
+ justifyContent: "center",
770
+ backdropFilter: "blur(10px)",
771
+ background: "rgba(255,255,255,0.8)"
772
+ },
773
+ props: {
774
+ ...overlayProps({
775
+ defaultSlotContent: {
776
+ type: "default-component",
777
+ kind: "button",
778
+ props: {
779
+ children: { type: "text", value: `Show dialog` }
780
+ }
781
+ },
782
+ triggerSlotName: "triggerSlot"
783
+ }),
784
+ overlayClassName: {
785
+ type: "class"
786
+ },
787
+ noContain: {
788
+ type: "boolean",
789
+ advanced: true,
790
+ description: "Place the dialog content over the overlay instead of inside the overlay. Useful for separating their animations, but you also won't be able to conveniently set layout on the overlay as a parent."
791
+ },
792
+ children: {
793
+ type: "slot",
794
+ allowedComponents: [
795
+ "hostless-radix-sheet-content",
796
+ "hostless-radix-dialog-content"
797
+ ],
798
+ defaultValue: {
799
+ type: "component",
800
+ name: "hostless-radix-dialog-content"
801
+ }
802
+ }
803
+ },
804
+ states: overlayStates
805
+ });
806
+ registerComponentHelper(PLASMIC, DialogClose, {
807
+ name: "hostless-radix-dialog-close",
808
+ displayName: "Dialog Close",
809
+ importPath: "@plasmicpkgs/radix-ui",
810
+ importName: "DialogClose",
811
+ parentComponentName: "hostless-radix-dialog",
812
+ defaultStyles: {
813
+ position: "absolute",
814
+ top: "16px",
815
+ right: "16px",
816
+ opacity: "0.7",
817
+ borderRadius: "999px"
818
+ },
819
+ props: {
820
+ children: {
821
+ type: "slot",
822
+ hidePlaceholder: true
823
+ }
824
+ }
825
+ });
826
+ const dialogStyles = {
827
+ width: "400px",
828
+ maxWidth: "100%",
829
+ background: "rgb(255,255,255)",
830
+ borderWidth: "1px",
831
+ borderStyle: "solid",
832
+ borderColor: "#E2E8F0",
833
+ boxShadow: "0px 4px 16px 0px #00000033"
834
+ };
835
+ registerComponentHelper(PLASMIC, SheetContent, {
836
+ name: "hostless-radix-sheet-content",
837
+ displayName: "Drawer Content",
838
+ importPath: "@plasmicpkgs/radix-ui",
839
+ importName: "SheetContent",
840
+ parentComponentName: "hostless-radix-dialog",
841
+ defaultStyles: {
842
+ // Positions can sometimes take effect since these can be implicitly inserted as children of other default content, thus escaping Plasmic's layout coersion.
843
+ position: "fixed",
844
+ top: 0,
845
+ right: 0,
846
+ bottom: 0,
847
+ padding: "16px",
848
+ ...dialogStyles
849
+ },
850
+ props: {
851
+ side: {
852
+ type: "choice",
853
+ options: ["right", "bottom", "left", "top"],
854
+ defaultValueHint: "right"
855
+ },
856
+ themeResetClass: { type: "themeResetClass" },
857
+ children: {
858
+ type: "slot",
859
+ defaultValue: [
860
+ {
861
+ type: "vbox",
862
+ styles: {
863
+ alignItems: "stretch",
864
+ gap: "8px"
865
+ },
866
+ children: [
867
+ {
868
+ type: "component",
869
+ name: "hostless-radix-dialog-title"
870
+ },
871
+ {
872
+ type: "component",
873
+ name: "hostless-radix-dialog-description"
874
+ }
875
+ ]
876
+ },
877
+ {
878
+ type: "component",
879
+ name: "hostless-radix-dialog-close"
880
+ }
881
+ ]
882
+ },
883
+ ...animPropTypes({
884
+ defaultEnterAnimations: (ps) => [getDefaultSheetAnims(ps.side)[0]],
885
+ defaultExitAnimations: (ps) => [getDefaultSheetAnims(ps.side)[1]]
886
+ })
887
+ }
888
+ });
889
+ registerComponentHelper(PLASMIC, DialogContent, {
890
+ name: "hostless-radix-dialog-content",
891
+ displayName: "Dialog Content",
892
+ importPath: "@plasmicpkgs/radix-ui",
893
+ importName: "DialogContent",
894
+ parentComponentName: "hostless-radix-dialog",
895
+ defaultStyles: {
896
+ // No need for position here, just relying on layout container parent.
897
+ padding: "24px",
898
+ borderRadius: "8px",
899
+ ...dialogStyles
900
+ },
901
+ props: {
902
+ themeResetClass: { type: "themeResetClass" },
903
+ children: {
904
+ type: "slot",
905
+ defaultValue: [
906
+ {
907
+ type: "vbox",
908
+ styles: {
909
+ alignItems: "stretch",
910
+ gap: "8px"
911
+ },
912
+ children: [
913
+ {
914
+ type: "component",
915
+ name: "hostless-radix-dialog-title"
916
+ },
917
+ {
918
+ type: "component",
919
+ name: "hostless-radix-dialog-description"
920
+ }
921
+ ]
922
+ },
923
+ {
924
+ type: "component",
925
+ name: "hostless-radix-dialog-close"
926
+ }
927
+ ]
928
+ },
929
+ ...animPropTypes({
930
+ defaultEnterAnimations: () => ["zoom-enter", "fade-in"],
931
+ defaultExitAnimations: () => ["zoom-exit", "fade-out"]
932
+ })
933
+ }
934
+ });
935
+ registerComponentHelper(PLASMIC, DialogTitle, {
936
+ name: "hostless-radix-dialog-title",
937
+ displayName: "Dialog Title",
938
+ importPath: "@plasmicpkgs/radix-ui",
939
+ importName: "DialogTitle",
940
+ parentComponentName: "hostless-radix-dialog",
941
+ props: {
942
+ children: {
943
+ type: "slot",
944
+ defaultValue: "Sheet title"
945
+ }
946
+ }
947
+ });
948
+ registerComponentHelper(PLASMIC, DialogDescription, {
949
+ name: "hostless-radix-dialog-description",
950
+ displayName: "Dialog Description",
951
+ importPath: "@plasmicpkgs/radix-ui",
952
+ importName: "DialogDescription",
953
+ parentComponentName: "hostless-radix-dialog",
954
+ props: {
955
+ children: {
956
+ type: "slot",
957
+ defaultValue: "Sheet description"
958
+ }
959
+ }
960
+ });
961
+ }
962
+
963
+ // src/tooltip.tsx
964
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"));
965
+ var import_clsx3 = __toESM(require("clsx"));
966
+ var React4 = __toESM(require("react"));
967
+ var Tooltip = React4.forwardRef(
968
+ ({
969
+ // content & custom
970
+ className,
971
+ sideOffset = 4,
972
+ themeResetClass,
973
+ slideIn = true,
974
+ overlay,
975
+ // root
976
+ delayDuration,
977
+ disableHoverableContent,
978
+ open,
979
+ onOpenChange,
980
+ defaultOpen,
981
+ // trigger/anchor
982
+ children,
983
+ ...props
984
+ }, ref) => {
985
+ const [animProps, rest] = splitAnimProps(props);
986
+ return /* @__PURE__ */ React4.createElement(
987
+ Animated,
988
+ {
989
+ enterAnimations: ["fade-in", "zoom-enter"],
990
+ exitAnimations: ["fade-out", "zoom-exit"],
991
+ ...animProps
992
+ },
993
+ (dynClass) => /* @__PURE__ */ React4.createElement(TooltipPrimitive.Provider, null, /* @__PURE__ */ React4.createElement(
994
+ TooltipPrimitive.Root,
995
+ {
996
+ ...{
997
+ delayDuration,
998
+ disableHoverableContent,
999
+ open,
1000
+ onOpenChange,
1001
+ defaultOpen
1002
+ }
1003
+ },
1004
+ /* @__PURE__ */ React4.createElement(TooltipPrimitive.Trigger, { asChild: true }, children),
1005
+ /* @__PURE__ */ React4.createElement(
1006
+ TooltipPrimitive.Content,
1007
+ {
1008
+ ref,
1009
+ sideOffset,
1010
+ className: (0, import_clsx3.default)(
1011
+ prefixClasses("animate-in data-[state=closed]:animate-out"),
1012
+ slideIn ? prefixClasses(
1013
+ "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
1014
+ ) : "",
1015
+ dynClass ? dynClass : "",
1016
+ className,
1017
+ themeResetClass
1018
+ ),
1019
+ ...rest
1020
+ },
1021
+ overlay
1022
+ ),
1023
+ /* @__PURE__ */ React4.createElement(BaseStyles, null)
1024
+ ))
1025
+ );
1026
+ }
1027
+ );
1028
+ Tooltip.displayName = "PlasmicRadixTooltip";
1029
+ function registerTooltip(PLASMIC) {
1030
+ registerComponentHelper(PLASMIC, Tooltip, {
1031
+ name: "hostless-radix-tooltip",
1032
+ displayName: "Tooltip Core",
1033
+ importPath: "@plasmicpkgs/radix-ui",
1034
+ importName: "Tooltip",
1035
+ props: {
1036
+ ...overlayProps({
1037
+ triggerSlotName: "children",
1038
+ defaultSlotContent: { type: "text", value: "I have a tooltip." },
1039
+ openDisplay: "Preview open"
1040
+ }),
1041
+ ...popoverProps,
1042
+ overlay: {
1043
+ type: "slot",
1044
+ defaultValue: {
1045
+ type: "vbox",
1046
+ styles: {
1047
+ padding: "16px",
1048
+ width: "300px",
1049
+ maxWidth: "100%",
1050
+ borderWidth: "1px",
1051
+ borderStyle: "solid",
1052
+ borderColor: "#E2E8F0",
1053
+ backgroundColor: "white",
1054
+ borderRadius: "8px",
1055
+ boxShadow: "0px 4px 16px 0px #00000033",
1056
+ alignItems: "stretch"
1057
+ },
1058
+ children: ["Here is the tooltip content."]
1059
+ },
1060
+ ...{
1061
+ mergeWithParent: true
1062
+ }
1063
+ }
1064
+ }
1065
+ });
1066
+ }
1067
+
1068
+ // src/index.tsx
1069
+ function registerAll(PLASMIC) {
1070
+ registerPopover(PLASMIC);
1071
+ registerDialog(PLASMIC);
1072
+ registerTooltip(PLASMIC);
8
1073
  }
1074
+ // Annotate the CommonJS export names for ESM import in node:
1075
+ 0 && (module.exports = {
1076
+ Dialog,
1077
+ DialogClose,
1078
+ DialogContent,
1079
+ DialogDescription,
1080
+ DialogTitle,
1081
+ Popover,
1082
+ SheetContent,
1083
+ Tooltip,
1084
+ popoverProps,
1085
+ registerAll,
1086
+ registerDialog,
1087
+ registerPopover,
1088
+ registerTooltip,
1089
+ sheetVariants
1090
+ });