@plasmicpkgs/radix-ui 0.0.2

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.
@@ -0,0 +1,713 @@
1
+ import { createElement, Fragment, useId as useId$1, useState, forwardRef } from 'react';
2
+ import { Root, Trigger, Anchor, Portal, Content } from '@radix-ui/react-popover';
3
+ import clsx from 'clsx';
4
+ import { pick, omit } from 'remeda';
5
+ import registerComponent from '@plasmicapp/host/registerComponent';
6
+ import '@plasmicapp/host/registerGlobalContext';
7
+ import { Close, Overlay, Content as Content$1, Root as Root$1, Portal as Portal$1, Title, Description } from '@radix-ui/react-dialog';
8
+ import { cva } from 'class-variance-authority';
9
+ import { X } from 'lucide-react';
10
+
11
+ function _extends() {
12
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var source = arguments[i];
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
19
+ }
20
+ }
21
+ return target;
22
+ };
23
+ return _extends.apply(this, arguments);
24
+ }
25
+ function _objectWithoutPropertiesLoose(source, excluded) {
26
+ if (source == null) return {};
27
+ var target = {};
28
+ var sourceKeys = Object.keys(source);
29
+ var key, i;
30
+ for (i = 0; i < sourceKeys.length; i++) {
31
+ key = sourceKeys[i];
32
+ if (excluded.indexOf(key) >= 0) continue;
33
+ target[key] = source[key];
34
+ }
35
+ return target;
36
+ }
37
+
38
+ var _React$useId;
39
+ var DEBUG_SLOWDOWN = 1;
40
+ var enterAnims = ["fade-in", "zoom-enter", "slide-in-from-top", "slide-in-from-right", "slide-in-from-bottom", "slide-in-from-left"];
41
+ var exitAnims = ["fade-out", "zoom-exit", "slide-out-to-top", "slide-out-to-right", "slide-out-to-bottom", "slide-out-to-left"];
42
+ // https://github.com/reactwg/react-18/discussions/111#discussioncomment-1517837
43
+ var id = 0;
44
+ var useId = (_React$useId = useId$1) != null ? _React$useId : function () {
45
+ return useState(function () {
46
+ return "" + id++;
47
+ });
48
+ };
49
+ /** Allow attaching pseudoclasses and other CSS selectors to this unique component instance */
50
+ var StyleWrapper = function StyleWrapper(_ref) {
51
+ var children = _ref.children,
52
+ css = _ref.css;
53
+ var dynClass = "pd__" + useId().replace(/:/g, "");
54
+ return createElement(Fragment, null, children(dynClass), createElement("style", null, dynClass ? css.replace(/&/g, "." + dynClass) : ""));
55
+ };
56
+ var Animated = function Animated(_ref2) {
57
+ var children = _ref2.children,
58
+ _ref2$enterAnimations = _ref2.enterAnimations,
59
+ enterAnimations = _ref2$enterAnimations === void 0 ? ["fade-in"] : _ref2$enterAnimations,
60
+ _ref2$exitAnimations = _ref2.exitAnimations,
61
+ exitAnimations = _ref2$exitAnimations === void 0 ? ["fade-out"] : _ref2$exitAnimations,
62
+ _ref2$enterDuration = _ref2.enterDuration,
63
+ enterDuration = _ref2$enterDuration === void 0 ? 0.15 * DEBUG_SLOWDOWN : _ref2$enterDuration,
64
+ _ref2$exitDuration = _ref2.exitDuration,
65
+ exitDuration = _ref2$exitDuration === void 0 ? 0.15 * DEBUG_SLOWDOWN : _ref2$exitDuration,
66
+ _ref2$enterOpacity = _ref2.enterOpacity,
67
+ enterOpacity = _ref2$enterOpacity === void 0 ? 0 : _ref2$enterOpacity,
68
+ _ref2$exitOpacity = _ref2.exitOpacity,
69
+ exitOpacity = _ref2$exitOpacity === void 0 ? 0 : _ref2$exitOpacity,
70
+ _ref2$enterScale = _ref2.enterScale,
71
+ enterScale = _ref2$enterScale === void 0 ? 0.95 : _ref2$enterScale,
72
+ _ref2$exitScale = _ref2.exitScale,
73
+ exitScale = _ref2$exitScale === void 0 ? 0.95 : _ref2$exitScale,
74
+ _ref2$enterTranslateX = _ref2.enterTranslateX,
75
+ enterTranslateX = _ref2$enterTranslateX === void 0 ? "100%" : _ref2$enterTranslateX,
76
+ _ref2$exitTranslateX = _ref2.exitTranslateX,
77
+ exitTranslateX = _ref2$exitTranslateX === void 0 ? "100%" : _ref2$exitTranslateX,
78
+ _ref2$enterTranslateY = _ref2.enterTranslateY,
79
+ enterTranslateY = _ref2$enterTranslateY === void 0 ? "100%" : _ref2$enterTranslateY,
80
+ _ref2$exitTranslateY = _ref2.exitTranslateY,
81
+ exitTranslateY = _ref2$exitTranslateY === void 0 ? "100%" : _ref2$exitTranslateY,
82
+ _ref2$enterTiming = _ref2.enterTiming,
83
+ enterTiming = _ref2$enterTiming === void 0 ? "ease-out" : _ref2$enterTiming,
84
+ _ref2$exitTiming = _ref2.exitTiming,
85
+ exitTiming = _ref2$exitTiming === void 0 ? "ease-out" : _ref2$exitTiming,
86
+ _ref2$enterDelay = _ref2.enterDelay,
87
+ enterDelay = _ref2$enterDelay === void 0 ? 0 : _ref2$enterDelay,
88
+ _ref2$exitDelay = _ref2.exitDelay,
89
+ exitDelay = _ref2$exitDelay === void 0 ? 0 : _ref2$exitDelay;
90
+ var pct = function pct(x) {
91
+ return typeof x === "number" || x != null && x.match(/.*\d$/) ? x + "%" : x;
92
+ };
93
+ var neg = function neg(x) {
94
+ return x.startsWith("-") ? x : "-" + x;
95
+ };
96
+ var animations = {
97
+ "fade-in": "--tw-enter-opacity: " + enterOpacity + ";",
98
+ "fade-out": "--tw-exit-opacity: " + exitOpacity + ";",
99
+ "slide-in-from-top": "--tw-enter-translate-y: " + neg(pct(enterTranslateY)) + ";",
100
+ "slide-out-to-top": "--tw-exit-translate-y: " + neg(pct(exitTranslateY)) + ";",
101
+ "slide-in-from-right": "--tw-enter-translate-x: " + pct(enterTranslateX) + ";",
102
+ "slide-out-to-right": "--tw-exit-translate-x: " + pct(exitTranslateX) + ";",
103
+ "slide-in-from-bottom": "--tw-enter-translate-y: " + pct(enterTranslateY) + ";",
104
+ "slide-out-to-bottom": "--tw-exit-translate-y: " + pct(exitTranslateY) + ";",
105
+ "slide-in-from-left": "--tw-enter-translate-x: " + neg(pct(enterTranslateX)) + ";",
106
+ "slide-out-to-left": "--tw-exit-translate-x: " + neg(pct(exitTranslateX)) + ";",
107
+ "zoom-enter": "--tw-enter-scale: " + enterScale + ";",
108
+ "zoom-exit": "--tw-exit-scale: " + exitScale + ";"
109
+ };
110
+ return createElement(StyleWrapper, {
111
+ css: "\n &[data-state=\"closed\"] {\n animation-duration: " + exitDuration + "s;\n animation-timing-function: " + exitTiming + ";\n animation-delay: " + exitDelay + ";\n " + exitAnimations.map(function (exitAnimation) {
112
+ var _animations$exitAnima;
113
+ return (_animations$exitAnima = animations[exitAnimation]) != null ? _animations$exitAnima : "";
114
+ }).join(" ") + "\n }\n &[data-state=\"open\"] {\n animation-duration: " + enterDuration + "s;\n animation-timing-function: " + enterTiming + ";\n animation-delay: " + enterDelay + ";\n " + enterAnimations.map(function (enterAnimation) {
115
+ var _animations$enterAnim;
116
+ return (_animations$enterAnim = animations[enterAnimation]) != null ? _animations$enterAnim : "";
117
+ }).join(" ") + "\n }\n "
118
+ }, children);
119
+ };
120
+ function splitAnimProps(props) {
121
+ var keys = ["enterAnimations", "exitAnimations", "enterDuration", "exitDuration", "enterTranslateX", "exitTranslateX", "enterTranslateY", "exitTranslateY", "enterTiming", "exitTiming", "enterDelay", "exitDelay", "enterScale", "exitScale", "enterOpacity", "exitOpacity"];
122
+ var a = pick(props, keys);
123
+ var b = omit(props, keys);
124
+ return [a, b];
125
+ }
126
+ function mungeNames(names) {
127
+ return names.map(function (name) {
128
+ return {
129
+ label: name.replace(/-/g, " "),
130
+ value: name
131
+ };
132
+ });
133
+ }
134
+ var animPropTypes = function animPropTypes(_ref3) {
135
+ var defaultEnterAnimations = _ref3.defaultEnterAnimations,
136
+ defaultExitAnimations = _ref3.defaultExitAnimations;
137
+ var getEnterAnimations = function getEnterAnimations(ps) {
138
+ var _ps$enterAnimations;
139
+ return (_ps$enterAnimations = ps.enterAnimations) != null ? _ps$enterAnimations : defaultEnterAnimations;
140
+ };
141
+ var getExitAnimations = function getExitAnimations(ps) {
142
+ var _ps$exitAnimations;
143
+ return (_ps$exitAnimations = ps.exitAnimations) != null ? _ps$exitAnimations : defaultExitAnimations;
144
+ };
145
+ return {
146
+ enterAnimations: {
147
+ type: "choice",
148
+ options: mungeNames(enterAnims),
149
+ multiSelect: true,
150
+ defaultValueHint: defaultEnterAnimations != null ? defaultEnterAnimations : ["fade-in"]
151
+ },
152
+ exitAnimations: {
153
+ type: "choice",
154
+ options: mungeNames(exitAnims),
155
+ multiSelect: true,
156
+ defaultValueHint: defaultExitAnimations != null ? defaultExitAnimations : ["fade-out"]
157
+ },
158
+ enterDuration: {
159
+ type: "number",
160
+ defaultValueHint: 0.15
161
+ },
162
+ exitDuration: {
163
+ type: "number",
164
+ defaultValueHint: 0.15
165
+ },
166
+ enterTranslateX: {
167
+ type: "string",
168
+ defaultValueHint: "100%",
169
+ hidden: function hidden(ps) {
170
+ var _getEnterAnimations, _getEnterAnimations2;
171
+ return !((_getEnterAnimations = getEnterAnimations(ps)) != null && _getEnterAnimations.includes("slide-in-from-right")) && !((_getEnterAnimations2 = getEnterAnimations(ps)) != null && _getEnterAnimations2.includes("slide-in-from-left"));
172
+ }
173
+ },
174
+ exitTranslateX: {
175
+ type: "string",
176
+ defaultValueHint: "100%",
177
+ hidden: function hidden(ps) {
178
+ var _getExitAnimations, _getExitAnimations2;
179
+ return !((_getExitAnimations = getExitAnimations(ps)) != null && _getExitAnimations.includes("slide-out-to-right")) && !((_getExitAnimations2 = getExitAnimations(ps)) != null && _getExitAnimations2.includes("slide-out-to-left"));
180
+ }
181
+ },
182
+ enterTranslateY: {
183
+ type: "string",
184
+ defaultValueHint: "100%",
185
+ hidden: function hidden(ps) {
186
+ var _getEnterAnimations3, _getEnterAnimations4;
187
+ return !((_getEnterAnimations3 = getEnterAnimations(ps)) != null && _getEnterAnimations3.includes("slide-in-from-bottom")) && !((_getEnterAnimations4 = getEnterAnimations(ps)) != null && _getEnterAnimations4.includes("slide-in-from-top"));
188
+ }
189
+ },
190
+ exitTranslateY: {
191
+ type: "string",
192
+ defaultValueHint: "100%",
193
+ hidden: function hidden(ps) {
194
+ var _getExitAnimations3, _getExitAnimations4;
195
+ return !((_getExitAnimations3 = getExitAnimations(ps)) != null && _getExitAnimations3.includes("slide-out-to-bottom")) && !((_getExitAnimations4 = getExitAnimations(ps)) != null && _getExitAnimations4.includes("slide-out-to-top"));
196
+ }
197
+ },
198
+ enterOpacity: {
199
+ type: "number",
200
+ defaultValueHint: 0,
201
+ hidden: function hidden(ps) {
202
+ var _getEnterAnimations5;
203
+ return !((_getEnterAnimations5 = getEnterAnimations(ps)) != null && _getEnterAnimations5.includes("fade-in"));
204
+ }
205
+ },
206
+ exitOpacity: {
207
+ type: "number",
208
+ defaultValueHint: 0,
209
+ hidden: function hidden(ps) {
210
+ var _getExitAnimations5;
211
+ return !((_getExitAnimations5 = getExitAnimations(ps)) != null && _getExitAnimations5.includes("fade-out"));
212
+ }
213
+ },
214
+ enterScale: {
215
+ type: "number",
216
+ defaultValueHint: 0.95,
217
+ hidden: function hidden(ps) {
218
+ var _getEnterAnimations6;
219
+ return !((_getEnterAnimations6 = getEnterAnimations(ps)) != null && _getEnterAnimations6.includes("zoom-enter"));
220
+ }
221
+ },
222
+ exitScale: {
223
+ type: "number",
224
+ defaultValueHint: 0.95,
225
+ hidden: function hidden(ps) {
226
+ var _getExitAnimations6;
227
+ return !((_getExitAnimations6 = getExitAnimations(ps)) != null && _getExitAnimations6.includes("zoom-exit"));
228
+ }
229
+ },
230
+ enterDelay: {
231
+ type: "number",
232
+ advanced: true,
233
+ defaultValueHint: 0
234
+ },
235
+ exitDelay: {
236
+ type: "number",
237
+ advanced: true,
238
+ defaultValueHint: 0
239
+ },
240
+ enterTiming: _extends({
241
+ type: "string",
242
+ advanced: true,
243
+ defaultValueHint: "ease-out"
244
+ }, {
245
+ suggestions: ["linear", "ease", "ease-in", "ease-out", "ease-in-out"]
246
+ }),
247
+ exitTiming: _extends({
248
+ type: "string",
249
+ advanced: true,
250
+ defaultValueHint: "ease-out"
251
+ }, {
252
+ suggestions: ["linear", "ease", "ease-in", "ease-out", "ease-in-out"]
253
+ })
254
+ };
255
+ };
256
+ var popoverProps = {
257
+ open: {
258
+ type: "boolean",
259
+ editOnly: true,
260
+ uncontrolledProp: "defaultOpen"
261
+ },
262
+ modal: {
263
+ type: "boolean",
264
+ advanced: true,
265
+ description: "Disable interaction with outside elements. Only popover content will be visible to screen readers."
266
+ },
267
+ onOpenChange: {
268
+ type: "eventHandler",
269
+ argTypes: [{
270
+ type: "boolean",
271
+ name: "open"
272
+ }]
273
+ }
274
+ };
275
+
276
+ function registerComponentHelper(loader, component, meta) {
277
+ if (loader) {
278
+ loader.registerComponent(component, meta);
279
+ } else {
280
+ registerComponent(component, meta);
281
+ }
282
+ }
283
+
284
+ var _excluded = ["open", "onOpenChange", "defaultOpen", "modal", "className", "sideOffset", "themeResetClass", "overlay", "slideIn", "trigger", "children"];
285
+ function Popover(_ref) {
286
+ var open = _ref.open,
287
+ onOpenChange = _ref.onOpenChange,
288
+ defaultOpen = _ref.defaultOpen,
289
+ modal = _ref.modal,
290
+ className = _ref.className,
291
+ _ref$sideOffset = _ref.sideOffset,
292
+ sideOffset = _ref$sideOffset === void 0 ? 4 : _ref$sideOffset,
293
+ themeResetClass = _ref.themeResetClass,
294
+ overlay = _ref.overlay,
295
+ _ref$slideIn = _ref.slideIn,
296
+ slideIn = _ref$slideIn === void 0 ? true : _ref$slideIn,
297
+ _ref$trigger = _ref.trigger,
298
+ trigger = _ref$trigger === void 0 ? true : _ref$trigger,
299
+ children = _ref.children,
300
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
301
+ var _splitAnimProps = splitAnimProps(props),
302
+ animProps = _splitAnimProps[0],
303
+ rest = _splitAnimProps[1];
304
+ return createElement(Animated, Object.assign({
305
+ enterAnimations: ["fade-in", "zoom-enter"],
306
+ exitAnimations: ["fade-out", "zoom-exit"]
307
+ }, animProps), function (plsmcId) {
308
+ return createElement(Root, {
309
+ open: open,
310
+ onOpenChange: onOpenChange,
311
+ defaultOpen: defaultOpen,
312
+ modal: modal
313
+ }, trigger ? createElement(Trigger, null, children) : createElement(Anchor, null, children), createElement(Portal, null, createElement(Content, Object.assign({
314
+ className: clsx("outline-none data-[state=open]:animate-in data-[state=closed]:animate-out", slideIn ? "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" : "", plsmcId ? plsmcId : "", className, themeResetClass),
315
+ sideOffset: sideOffset
316
+ }, rest), overlay)));
317
+ });
318
+ }
319
+ Popover.displayName = Content.displayName;
320
+ function registerPopover(PLASMIC) {
321
+ registerComponentHelper(PLASMIC, Popover, {
322
+ name: "hostless-radix-popover",
323
+ displayName: "Popover",
324
+ importPath: "@plasmicpkgs/radix-ui/popover",
325
+ importName: "Popover",
326
+ props: _extends({}, popoverProps, {
327
+ trigger: {
328
+ type: "boolean",
329
+ displayName: "Trigger on click",
330
+ defaultValueHint: true,
331
+ advanced: true
332
+ },
333
+ themeResetClass: {
334
+ type: "themeResetClass"
335
+ },
336
+ side: {
337
+ type: "choice",
338
+ options: ["top", "bottom", "left", "right"],
339
+ defaultValueHint: "bottom"
340
+ },
341
+ sideOffset: {
342
+ type: "number",
343
+ defaultValueHint: 4,
344
+ advanced: true
345
+ },
346
+ align: {
347
+ type: "choice",
348
+ options: ["center", "start", "end"],
349
+ defaultValueHint: "center"
350
+ },
351
+ alignOffset: {
352
+ type: "number",
353
+ defaultValueHint: 0,
354
+ advanced: true
355
+ },
356
+ overlay: _extends({
357
+ type: "slot",
358
+ defaultValue: {
359
+ type: "vbox",
360
+ styles: {
361
+ padding: "16px",
362
+ width: "300px",
363
+ maxWidth: "100%",
364
+ borderWidth: "1px",
365
+ borderStyle: "solid",
366
+ borderColor: "#E2E8F0",
367
+ backgroundColor: "white",
368
+ borderRadius: "8px",
369
+ boxShadow: "0px 4px 16px 0px #00000033",
370
+ alignItems: "stretch"
371
+ },
372
+ children: ["Hello World"]
373
+ }
374
+ }, {
375
+ mergeWithParent: true
376
+ }),
377
+ children: _extends({
378
+ type: "slot",
379
+ defaultValue: ["Popover here"]
380
+ }, {
381
+ mergeWithParent: true
382
+ })
383
+ }, animPropTypes({
384
+ defaultEnterAnimations: function defaultEnterAnimations() {
385
+ return ["fade-in", "zoom-enter"];
386
+ },
387
+ defaultExitAnimations: function defaultExitAnimations() {
388
+ return ["fade-out", "zoom-exit"];
389
+ }
390
+ }), {
391
+ slideIn: {
392
+ type: "boolean",
393
+ defaultValueHint: true,
394
+ description: "Add additional subtle slide-in animation on reveal, which can depend on where the popover is dynamically placed."
395
+ }
396
+ })
397
+ });
398
+ }
399
+
400
+ var _excluded$1 = ["className"],
401
+ _excluded2 = ["className", "themeResetClass"],
402
+ _excluded3 = ["className", "themeResetClass", "side"],
403
+ _excluded4 = ["open", "onOpenChange", "modal", "className", "themeResetClass", "children", "noContain", "defaultOpen"];
404
+ function prefixClasses(x) {
405
+ return x.trim().split(/\s+/g).map(function (part) {
406
+ return "plsmc__" + part;
407
+ }).join(" ");
408
+ }
409
+ var baseSty = /*#__PURE__*/"\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n.absolute {\n position: absolute;\n}\n.relative {\n position: relative;\n}\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n}\n.h-full {\n height: 100%;\n}\n.z-50 { z-index: 50; }\n.fixed { position: fixed; }\n.inset-0 { top: 0; left: 0; right: 0; bottom: 0; }\n.bottom-0 {\n bottom: 0px;\n}\n.left-0 {\n left: 0px;\n}\n.right-0 {\n right: 0px;\n}\n.top-0 {\n top: 0px;\n}\n.right-4 {\n right: 1rem;\n}\n.top-4 {\n top: 1rem;\n}\n.h-4 { height: 1rem; }\n.w-4 { width: 1rem; }\n.outline-none { outline: none; }\n\n@keyframes plsmc-enter {\n\n from {\n opacity: var(--tw-enter-opacity, 1);\n 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));\n }\n}\n\n@keyframes plsmc-exit {\n\n to {\n opacity: var(--tw-exit-opacity, 1);\n 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));\n }\n}\n.data-\\[state\\=open\\]\\:animate-in[data-state=open] {\n animation-name: plsmc-enter;\n animation-duration: 150ms;\n --tw-enter-opacity: initial;\n --tw-enter-scale: initial;\n --tw-enter-rotate: initial;\n --tw-enter-translate-x: initial;\n --tw-enter-translate-y: initial;\n}\n.data-\\[state\\=closed\\]\\:animate-out[data-state=closed] {\n animation-name: plsmc-exit;\n animation-duration: 150ms;\n --tw-exit-opacity: initial;\n --tw-exit-scale: initial;\n --tw-exit-rotate: initial;\n --tw-exit-translate-x: initial;\n --tw-exit-translate-y: initial;\n}\n.data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom] {\n --tw-enter-translate-y: -0.5rem;\n}\n\n.data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left] {\n --tw-enter-translate-x: 0.5rem;\n}\n\n.data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right] {\n --tw-enter-translate-x: -0.5rem;\n}\n\n.data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top] {\n --tw-enter-translate-y: 0.5rem;\n}\n\n".replace(/\n\./g, ".plsmc__");
410
+ var DialogClose = /*#__PURE__*/forwardRef(function (props) {
411
+ var _props$children;
412
+ return createElement(Close, Object.assign({}, props), (_props$children = props.children) != null ? _props$children : createElement(X, {
413
+ className: prefixClasses("h-4 w-4") + " " + props.className
414
+ }), createElement("span", {
415
+ className: "sr-only"
416
+ }, "Close"));
417
+ });
418
+ DialogClose.displayName = Close.displayName;
419
+ var DialogOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
420
+ var className = _ref.className,
421
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
422
+ return createElement(Animated, Object.assign({}, props), function (plsmcId) {
423
+ return createElement(Overlay, Object.assign({
424
+ className: clsx(["fixed inset-0 z-50 data-[state=open]:animate-in data-[state=closed]:animate-out"].map(prefixClasses), plsmcId ? plsmcId : "", className)
425
+ }, props, {
426
+ ref: ref
427
+ }));
428
+ });
429
+ });
430
+ DialogOverlay.displayName = Overlay.displayName;
431
+ var DialogContent = /*#__PURE__*/forwardRef(function (_ref2, ref) {
432
+ var _animProps$enterAnima, _animProps$exitAnimat;
433
+ var className = _ref2.className,
434
+ themeResetClass = _ref2.themeResetClass,
435
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
436
+ var _splitAnimProps = splitAnimProps(props),
437
+ animProps = _splitAnimProps[0],
438
+ rest = _splitAnimProps[1];
439
+ return createElement(Animated, Object.assign({}, animProps, {
440
+ enterAnimations: (_animProps$enterAnima = animProps.enterAnimations) != null ? _animProps$enterAnima : ["zoom-enter", "fade-in"],
441
+ exitAnimations: (_animProps$exitAnimat = animProps.exitAnimations) != null ? _animProps$exitAnimat : ["zoom-exit", "fade-out"]
442
+ }), function (dynClass) {
443
+ return createElement(Content$1, Object.assign({}, rest, {
444
+ className: clsx("fixed z-50 data-[state=open]:animate-in data-[state=closed]:animate-out", dynClass ? dynClass : "", themeResetClass, className),
445
+ ref: ref
446
+ }));
447
+ });
448
+ });
449
+ DialogContent.displayName = Content$1.displayName;
450
+ function getDefaultSheetAnims(side) {
451
+ if (side === void 0) {
452
+ side = "right";
453
+ }
454
+ return {
455
+ right: ["slide-in-from-right", "slide-out-to-right"],
456
+ bottom: ["slide-in-from-bottom", "slide-out-to-bottom"],
457
+ left: ["slide-in-from-left", "slide-out-to-left"],
458
+ top: ["slide-in-from-top", "slide-out-to-top"]
459
+ }[side];
460
+ }
461
+ var SheetContent = /*#__PURE__*/forwardRef(function (_ref3, ref) {
462
+ var _props$enterAnimation, _props$exitAnimations;
463
+ var className = _ref3.className,
464
+ _ref3$side = _ref3.side,
465
+ side = _ref3$side === void 0 ? "right" : _ref3$side,
466
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
467
+ var _getDefaultSheetAnims = getDefaultSheetAnims(side != null ? side : "right"),
468
+ defaultEnterAnimation = _getDefaultSheetAnims[0],
469
+ defaultExitAnimation = _getDefaultSheetAnims[1];
470
+ return createElement(Animated, Object.assign({}, props, {
471
+ enterAnimations: (_props$enterAnimation = props.enterAnimations) != null ? _props$enterAnimation : [defaultEnterAnimation],
472
+ exitAnimations: (_props$exitAnimations = props.exitAnimations) != null ? _props$exitAnimations : [defaultExitAnimation]
473
+ }), function (plsmcId) {
474
+ return createElement(Content$1, Object.assign({
475
+ className: clsx(sheetVariants({
476
+ side: side
477
+ }), plsmcId ? plsmcId : "", className)
478
+ }, props, {
479
+ ref: ref
480
+ }));
481
+ });
482
+ });
483
+ SheetContent.displayName = Content$1.displayName;
484
+ var sheetVariants = /*#__PURE__*/cva( /*#__PURE__*/prefixClasses("fixed z-50 data-[state=open]:animate-in data-[state=closed]:animate-out"), {
485
+ variants: {
486
+ side: {
487
+ top: /*#__PURE__*/prefixClasses("inset-x-0 top-0"),
488
+ bottom: /*#__PURE__*/prefixClasses("inset-x-0 bottom-0"),
489
+ left: /*#__PURE__*/prefixClasses("inset-y-0 left-0 h-full"),
490
+ right: /*#__PURE__*/prefixClasses("inset-y-0 right-0 h-full")
491
+ }
492
+ },
493
+ defaultVariants: {
494
+ side: "right"
495
+ }
496
+ });
497
+ var Dialog = /*#__PURE__*/forwardRef(function (_ref4, ref) {
498
+ var open = _ref4.open,
499
+ onOpenChange = _ref4.onOpenChange,
500
+ modal = _ref4.modal,
501
+ className = _ref4.className,
502
+ themeResetClass = _ref4.themeResetClass,
503
+ children = _ref4.children,
504
+ noContain = _ref4.noContain,
505
+ defaultOpen = _ref4.defaultOpen,
506
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
507
+ return createElement(Root$1, {
508
+ open: open,
509
+ modal: modal,
510
+ onOpenChange: onOpenChange,
511
+ defaultOpen: defaultOpen
512
+ }, createElement(Portal$1, null, noContain ? createElement(Fragment, null, createElement(DialogOverlay, Object.assign({}, props, {
513
+ className: clsx(className, themeResetClass)
514
+ })), children) : createElement(DialogOverlay, Object.assign({}, props, {
515
+ className: clsx(className, themeResetClass)
516
+ }), children)), createElement("style", null, baseSty));
517
+ });
518
+ Dialog.displayName = Root$1.displayName;
519
+ var DialogTitle = Title;
520
+ var DialogDescription = Description;
521
+ function registerDialog(PLASMIC) {
522
+ registerComponentHelper(PLASMIC, Dialog, {
523
+ name: "hostless-radix-dialog",
524
+ displayName: "Dialog",
525
+ importPath: "@plasmicpkgs/radix-ui/dialog",
526
+ importName: "Dialog",
527
+ defaultStyles: {
528
+ // Note: unable to set position styles since Plasmic coerces to auto layout
529
+ display: "flex",
530
+ alignItems: "center",
531
+ justifyContent: "center",
532
+ backdropFilter: "blur(10px)",
533
+ background: "rgba(255,255,255,0.8)"
534
+ },
535
+ props: _extends({}, popoverProps, {
536
+ noContain: {
537
+ type: "boolean",
538
+ advanced: true,
539
+ 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."
540
+ },
541
+ themeResetClass: {
542
+ type: "themeResetClass"
543
+ },
544
+ children: {
545
+ type: "slot",
546
+ allowedComponents: ["hostless-radix-sheet-content", "hostless-radix-dialog-content"],
547
+ defaultValue: {
548
+ type: "component",
549
+ name: "hostless-radix-dialog-content"
550
+ }
551
+ }
552
+ })
553
+ });
554
+ registerComponentHelper(PLASMIC, DialogClose, {
555
+ name: "hostless-radix-dialog-close",
556
+ displayName: "Dialog Close",
557
+ importPath: "@plasmicpkgs/radix-ui/dialog",
558
+ importName: "DialogClose",
559
+ parentComponentName: "hostless-radix-dialog",
560
+ defaultStyles: {
561
+ position: "absolute",
562
+ top: "16px",
563
+ right: "16px",
564
+ opacity: "0.7",
565
+ borderRadius: "999px"
566
+ },
567
+ props: {
568
+ children: {
569
+ type: "slot",
570
+ hidePlaceholder: true
571
+ }
572
+ }
573
+ });
574
+ var dialogStyles = {
575
+ width: "400px",
576
+ maxWidth: "100%",
577
+ background: "rgb(255,255,255)",
578
+ borderWidth: "1px",
579
+ borderStyle: "solid",
580
+ borderColor: "#E2E8F0",
581
+ boxShadow: "0px 4px 16px 0px #00000033"
582
+ };
583
+ registerComponentHelper(PLASMIC, SheetContent, {
584
+ name: "hostless-radix-sheet-content",
585
+ displayName: "Drawer Content",
586
+ importPath: "@plasmicpkgs/radix-ui/dialog",
587
+ importName: "SheetContent",
588
+ parentComponentName: "hostless-radix-dialog",
589
+ defaultStyles: _extends({
590
+ // Positions can sometimes take effect since these can be implicitly inserted as children of other default content, thus escaping Plasmic's layout coersion.
591
+ position: "fixed",
592
+ top: 0,
593
+ right: 0,
594
+ bottom: 0,
595
+ padding: "16px"
596
+ }, dialogStyles),
597
+ props: _extends({
598
+ side: {
599
+ type: "choice",
600
+ options: ["right", "bottom", "left", "top"],
601
+ defaultValueHint: "right"
602
+ },
603
+ themeResetClass: {
604
+ type: "themeResetClass"
605
+ },
606
+ children: {
607
+ type: "slot",
608
+ defaultValue: [{
609
+ type: "vbox",
610
+ styles: {
611
+ alignItems: "stretch",
612
+ gap: "8px"
613
+ },
614
+ children: [{
615
+ type: "component",
616
+ name: "hostless-radix-dialog-title"
617
+ }, {
618
+ type: "component",
619
+ name: "hostless-radix-dialog-description"
620
+ }]
621
+ }, {
622
+ type: "component",
623
+ name: "hostless-radix-dialog-close"
624
+ }]
625
+ }
626
+ }, animPropTypes({
627
+ defaultEnterAnimations: function defaultEnterAnimations(ps) {
628
+ return [getDefaultSheetAnims(ps.side)[0]];
629
+ },
630
+ defaultExitAnimations: function defaultExitAnimations(ps) {
631
+ return [getDefaultSheetAnims(ps.side)[1]];
632
+ }
633
+ }))
634
+ });
635
+ registerComponentHelper(PLASMIC, DialogContent, {
636
+ name: "hostless-radix-dialog-content",
637
+ displayName: "Dialog Content",
638
+ importPath: "@plasmicpkgs/radix-ui/dialog",
639
+ importName: "DialogContent",
640
+ parentComponentName: "hostless-radix-dialog",
641
+ defaultStyles: _extends({
642
+ // No need for position here, just relying on layout container parent.
643
+ padding: "24px",
644
+ borderRadius: "8px"
645
+ }, dialogStyles),
646
+ props: _extends({
647
+ themeResetClass: {
648
+ type: "themeResetClass"
649
+ },
650
+ children: {
651
+ type: "slot",
652
+ defaultValue: [{
653
+ type: "vbox",
654
+ styles: {
655
+ alignItems: "stretch",
656
+ gap: "8px"
657
+ },
658
+ children: [{
659
+ type: "component",
660
+ name: "hostless-radix-dialog-title"
661
+ }, {
662
+ type: "component",
663
+ name: "hostless-radix-dialog-description"
664
+ }]
665
+ }, {
666
+ type: "component",
667
+ name: "hostless-radix-dialog-close"
668
+ }]
669
+ }
670
+ }, animPropTypes({
671
+ defaultEnterAnimations: function defaultEnterAnimations() {
672
+ return ["zoom-enter", "fade-in"];
673
+ },
674
+ defaultExitAnimations: function defaultExitAnimations() {
675
+ return ["zoom-exit", "fade-out"];
676
+ }
677
+ }))
678
+ });
679
+ registerComponentHelper(PLASMIC, DialogTitle, {
680
+ name: "hostless-radix-dialog-title",
681
+ displayName: "Dialog Title",
682
+ importPath: "@plasmicpkgs/radix-ui/dialog",
683
+ importName: "DialogTitle",
684
+ parentComponentName: "hostless-radix-dialog",
685
+ props: {
686
+ children: {
687
+ type: "slot",
688
+ defaultValue: "Sheet title"
689
+ }
690
+ }
691
+ });
692
+ registerComponentHelper(PLASMIC, DialogDescription, {
693
+ name: "hostless-radix-dialog-description",
694
+ displayName: "Dialog Description",
695
+ importPath: "@plasmicpkgs/radix-ui/dialog",
696
+ importName: "DialogDescription",
697
+ parentComponentName: "hostless-radix-dialog",
698
+ props: {
699
+ children: {
700
+ type: "slot",
701
+ defaultValue: "Sheet description"
702
+ }
703
+ }
704
+ });
705
+ }
706
+
707
+ function registerAll(PLASMIC) {
708
+ registerPopover(PLASMIC);
709
+ registerDialog(PLASMIC);
710
+ }
711
+
712
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle, Popover, SheetContent, prefixClasses, registerAll, registerDialog, registerPopover, sheetVariants };
713
+ //# sourceMappingURL=radix-ui.esm.js.map