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