@jarllyng/nostromo 3.11.0 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-5N5KJBMP.js +3 -0
- package/dist/chunk-5N5KJBMP.js.map +1 -0
- package/dist/chunk-75OZKMEA.cjs +3 -0
- package/dist/chunk-75OZKMEA.cjs.map +1 -0
- package/dist/chunk-DB6MHAU3.cjs +3 -0
- package/dist/chunk-DB6MHAU3.cjs.map +1 -0
- package/dist/chunk-ERGAJKFH.cjs +3 -0
- package/dist/chunk-ERGAJKFH.cjs.map +1 -0
- package/dist/chunk-PLEQSJHY.js +3 -0
- package/dist/chunk-PLEQSJHY.js.map +1 -0
- package/dist/chunk-QESG3HCL.js +3 -0
- package/dist/chunk-QESG3HCL.js.map +1 -0
- package/dist/chunk-QQTI6OI3.js +3 -0
- package/dist/chunk-QQTI6OI3.js.map +1 -0
- package/dist/chunk-RKSTEJKG.cjs +3 -0
- package/dist/chunk-RKSTEJKG.cjs.map +1 -0
- package/dist/components/core/alert.d.cts +1 -1
- package/dist/components/core/alert.d.ts +1 -1
- package/dist/components/core/badge.d.cts +1 -1
- package/dist/components/core/badge.d.ts +1 -1
- package/dist/components/core/breadcrumb.d.cts +1 -1
- package/dist/components/core/breadcrumb.d.ts +1 -1
- package/dist/components/core/button.d.cts +2 -2
- package/dist/components/core/button.d.ts +2 -2
- package/dist/components/core/checkbox.d.cts +1 -1
- package/dist/components/core/checkbox.d.ts +1 -1
- package/dist/components/core/command.cjs +3 -0
- package/dist/components/core/command.cjs.map +1 -0
- package/dist/components/core/command.d.cts +169 -0
- package/dist/components/core/command.d.ts +169 -0
- package/dist/components/core/command.js +3 -0
- package/dist/components/core/command.js.map +1 -0
- package/dist/components/core/dialog.cjs +1 -1
- package/dist/components/core/dialog.d.cts +10 -1
- package/dist/components/core/dialog.d.ts +10 -1
- package/dist/components/core/dialog.js +1 -1
- package/dist/components/core/drawer.cjs +3 -0
- package/dist/components/core/drawer.cjs.map +1 -0
- package/dist/components/core/drawer.d.cts +70 -0
- package/dist/components/core/drawer.d.ts +70 -0
- package/dist/components/core/drawer.js +3 -0
- package/dist/components/core/drawer.js.map +1 -0
- package/dist/components/core/error-message.d.cts +1 -1
- package/dist/components/core/error-message.d.ts +1 -1
- package/dist/components/core/form.cjs +1 -1
- package/dist/components/core/form.js +1 -1
- package/dist/components/core/helper-text.d.cts +1 -1
- package/dist/components/core/helper-text.d.ts +1 -1
- package/dist/components/core/icon.d.cts +2 -2
- package/dist/components/core/icon.d.ts +2 -2
- package/dist/components/core/input.d.cts +1 -1
- package/dist/components/core/input.d.ts +1 -1
- package/dist/components/core/label.d.cts +1 -1
- package/dist/components/core/label.d.ts +1 -1
- package/dist/components/core/pagination.d.cts +1 -1
- package/dist/components/core/pagination.d.ts +1 -1
- package/dist/components/core/progress.d.cts +3 -3
- package/dist/components/core/progress.d.ts +3 -3
- package/dist/components/core/radio-group.d.cts +1 -1
- package/dist/components/core/radio-group.d.ts +1 -1
- package/dist/components/core/resizable.d.cts +5 -5
- package/dist/components/core/resizable.d.ts +5 -5
- package/dist/components/core/select.d.cts +3 -3
- package/dist/components/core/select.d.ts +3 -3
- package/dist/components/core/sidebar.cjs +3 -0
- package/dist/components/core/sidebar.cjs.map +1 -0
- package/dist/components/core/sidebar.d.cts +131 -0
- package/dist/components/core/sidebar.d.ts +131 -0
- package/dist/components/core/sidebar.js +3 -0
- package/dist/components/core/sidebar.js.map +1 -0
- package/dist/components/core/skeleton.d.cts +1 -1
- package/dist/components/core/skeleton.d.ts +1 -1
- package/dist/components/core/switch.d.cts +1 -1
- package/dist/components/core/switch.d.ts +1 -1
- package/dist/components/core/textarea.d.cts +1 -1
- package/dist/components/core/textarea.d.ts +1 -1
- package/dist/components/core/toast.d.cts +2 -2
- package/dist/components/core/toast.d.ts +2 -2
- package/dist/components/core/tooltip.d.cts +2 -2
- package/dist/components/core/tooltip.d.ts +2 -2
- package/dist/components/marketing/features.d.cts +2 -2
- package/dist/components/marketing/features.d.ts +2 -2
- package/dist/components/marketing/gallery.d.cts +1 -1
- package/dist/components/marketing/gallery.d.ts +1 -1
- package/dist/components/marketing/pricing.d.cts +1 -1
- package/dist/components/marketing/pricing.d.ts +1 -1
- package/dist/components/marketing/testimonials.d.cts +1 -1
- package/dist/components/marketing/testimonials.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/themes/lv-426.css +22 -0
- package/dist/themes/mother.css +22 -0
- package/dist/themes/nostromo.css +22 -0
- package/dist/themes/sulaco.css +22 -0
- package/dist/tokens.css +12 -0
- package/package.json +46 -2
- package/dist/chunk-MY2KMTUS.js +0 -3
- package/dist/chunk-MY2KMTUS.js.map +0 -1
- package/dist/chunk-NBX6FKCA.cjs +0 -3
- package/dist/chunk-NBX6FKCA.cjs.map +0 -1
package/dist/themes/mother.css
CHANGED
|
@@ -88,6 +88,17 @@
|
|
|
88
88
|
--nostromo-color-popover-foreground: var(--nostromo-color-neutral-900);
|
|
89
89
|
--nostromo-color-card: var(--nostromo-color-neutral-50);
|
|
90
90
|
--nostromo-color-card-foreground: var(--nostromo-color-neutral-900);
|
|
91
|
+
|
|
92
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
93
|
+
its border and ring, so the family is themeable without inventing
|
|
94
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
95
|
+
sidebar a surface of its own. */
|
|
96
|
+
--nostromo-color-sidebar: var(--nostromo-color-neutral-50);
|
|
97
|
+
--nostromo-color-sidebar-foreground: var(--nostromo-color-neutral-900);
|
|
98
|
+
--nostromo-color-sidebar-border: var(--nostromo-color-neutral-200);
|
|
99
|
+
--nostromo-color-sidebar-accent: var(--nostromo-color-brand-100);
|
|
100
|
+
--nostromo-color-sidebar-accent-foreground: var(--nostromo-color-brand-900);
|
|
101
|
+
--nostromo-color-sidebar-ring: var(--nostromo-color-brand-500);
|
|
91
102
|
--nostromo-color-border: var(--nostromo-color-neutral-200);
|
|
92
103
|
--nostromo-color-input: var(--nostromo-color-neutral-200);
|
|
93
104
|
/* Contrast validated: primary-foreground/primary 4.52:1 */
|
|
@@ -182,6 +193,17 @@
|
|
|
182
193
|
--nostromo-color-neutral-900
|
|
183
194
|
); /* Changed from 800 to 900 for better contrast */
|
|
184
195
|
--nostromo-color-card-foreground: var(--nostromo-color-neutral-50);
|
|
196
|
+
|
|
197
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
198
|
+
its border and ring, so the family is themeable without inventing
|
|
199
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
200
|
+
sidebar a surface of its own. */
|
|
201
|
+
--nostromo-color-sidebar: var(--nostromo-color-neutral-900);
|
|
202
|
+
--nostromo-color-sidebar-foreground: var(--nostromo-color-neutral-50);
|
|
203
|
+
--nostromo-color-sidebar-border: var(--nostromo-color-neutral-700);
|
|
204
|
+
--nostromo-color-sidebar-accent: var(--nostromo-color-brand-800);
|
|
205
|
+
--nostromo-color-sidebar-accent-foreground: var(--nostromo-color-brand-100);
|
|
206
|
+
--nostromo-color-sidebar-ring: var(--nostromo-color-brand-400);
|
|
185
207
|
--nostromo-color-border: var(--nostromo-color-neutral-700);
|
|
186
208
|
--nostromo-color-input: var(--nostromo-color-neutral-700);
|
|
187
209
|
--nostromo-color-primary: var(
|
package/dist/themes/nostromo.css
CHANGED
|
@@ -177,6 +177,17 @@
|
|
|
177
177
|
--nostromo-color-popover-foreground: 0 0% 9%;
|
|
178
178
|
--nostromo-color-card: 0 0% 98%;
|
|
179
179
|
--nostromo-color-card-foreground: 0 0% 9%;
|
|
180
|
+
|
|
181
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
182
|
+
its border and ring, so the family is themeable without inventing
|
|
183
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
184
|
+
sidebar a surface of its own. */
|
|
185
|
+
--nostromo-color-sidebar: 0 0% 98%;
|
|
186
|
+
--nostromo-color-sidebar-foreground: 0 0% 9%;
|
|
187
|
+
--nostromo-color-sidebar-border: 0 0% 90%;
|
|
188
|
+
--nostromo-color-sidebar-accent: 262 84% 90%;
|
|
189
|
+
--nostromo-color-sidebar-accent-foreground: 262 84% 15%;
|
|
190
|
+
--nostromo-color-sidebar-ring: 262 84% 52%;
|
|
180
191
|
--nostromo-color-border: 0 0% 90%;
|
|
181
192
|
--nostromo-color-input: 0 0% 90%;
|
|
182
193
|
--nostromo-color-primary: 262 84% 52%;
|
|
@@ -252,6 +263,17 @@
|
|
|
252
263
|
--nostromo-color-popover-foreground: 0 0% 95%; /* Light text on dark popover */
|
|
253
264
|
--nostromo-color-card: 0 0% 15%;
|
|
254
265
|
--nostromo-color-card-foreground: 0 0% 95%;
|
|
266
|
+
|
|
267
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
268
|
+
its border and ring, so the family is themeable without inventing
|
|
269
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
270
|
+
sidebar a surface of its own. */
|
|
271
|
+
--nostromo-color-sidebar: 0 0% 15%;
|
|
272
|
+
--nostromo-color-sidebar-foreground: 0 0% 95%;
|
|
273
|
+
--nostromo-color-sidebar-border: 0 0% 75%;
|
|
274
|
+
--nostromo-color-sidebar-accent: 262 84% 25%;
|
|
275
|
+
--nostromo-color-sidebar-accent-foreground: 262 84% 90%;
|
|
276
|
+
--nostromo-color-sidebar-ring: 262 84% 60%;
|
|
255
277
|
--nostromo-color-border: 0 0% 75%;
|
|
256
278
|
--nostromo-color-input: 0 0% 75%;
|
|
257
279
|
--nostromo-color-primary: 262 84% 60%;
|
package/dist/themes/sulaco.css
CHANGED
|
@@ -88,6 +88,17 @@
|
|
|
88
88
|
--nostromo-color-popover-foreground: var(--nostromo-color-neutral-900);
|
|
89
89
|
--nostromo-color-card: var(--nostromo-color-neutral-50);
|
|
90
90
|
--nostromo-color-card-foreground: var(--nostromo-color-neutral-900);
|
|
91
|
+
|
|
92
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
93
|
+
its border and ring, so the family is themeable without inventing
|
|
94
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
95
|
+
sidebar a surface of its own. */
|
|
96
|
+
--nostromo-color-sidebar: var(--nostromo-color-neutral-50);
|
|
97
|
+
--nostromo-color-sidebar-foreground: var(--nostromo-color-neutral-900);
|
|
98
|
+
--nostromo-color-sidebar-border: var(--nostromo-color-neutral-200);
|
|
99
|
+
--nostromo-color-sidebar-accent: var(--nostromo-color-brand-100);
|
|
100
|
+
--nostromo-color-sidebar-accent-foreground: var(--nostromo-color-brand-900);
|
|
101
|
+
--nostromo-color-sidebar-ring: var(--nostromo-color-brand-500);
|
|
91
102
|
--nostromo-color-border: var(--nostromo-color-neutral-200);
|
|
92
103
|
--nostromo-color-input: var(--nostromo-color-neutral-200);
|
|
93
104
|
/* Contrast validated: primary-foreground/primary 4.52:1 */
|
|
@@ -177,6 +188,17 @@
|
|
|
177
188
|
--nostromo-color-popover-foreground: var(--nostromo-color-neutral-50);
|
|
178
189
|
--nostromo-color-card: var(--nostromo-color-neutral-800);
|
|
179
190
|
--nostromo-color-card-foreground: var(--nostromo-color-neutral-50);
|
|
191
|
+
|
|
192
|
+
/* Sidebar. Defaults to this scheme's card surface, its accent pair and
|
|
193
|
+
its border and ring, so the family is themeable without inventing
|
|
194
|
+
colours that no contrast test has seen. Override any of them to give the
|
|
195
|
+
sidebar a surface of its own. */
|
|
196
|
+
--nostromo-color-sidebar: var(--nostromo-color-neutral-800);
|
|
197
|
+
--nostromo-color-sidebar-foreground: var(--nostromo-color-neutral-50);
|
|
198
|
+
--nostromo-color-sidebar-border: var(--nostromo-color-neutral-700);
|
|
199
|
+
--nostromo-color-sidebar-accent: var(--nostromo-color-brand-800);
|
|
200
|
+
--nostromo-color-sidebar-accent-foreground: var(--nostromo-color-brand-100);
|
|
201
|
+
--nostromo-color-sidebar-ring: var(--nostromo-color-brand-400);
|
|
180
202
|
--nostromo-color-border: var(--nostromo-color-neutral-700);
|
|
181
203
|
--nostromo-color-input: var(--nostromo-color-neutral-700);
|
|
182
204
|
--nostromo-color-primary: var(--nostromo-color-brand-400);
|
package/dist/tokens.css
CHANGED
|
@@ -100,6 +100,18 @@
|
|
|
100
100
|
--color-popover-foreground: hsl(var(--nostromo-color-popover-foreground));
|
|
101
101
|
--color-card: hsl(var(--nostromo-color-card));
|
|
102
102
|
--color-card-foreground: hsl(var(--nostromo-color-card-foreground));
|
|
103
|
+
|
|
104
|
+
/* Sidebar surface. Its own family so a sidebar can be coloured apart from a
|
|
105
|
+
card; every theme defaults it to that theme's card, accent, border and
|
|
106
|
+
ring, so nothing looks different until someone overrides it. */
|
|
107
|
+
--color-sidebar: hsl(var(--nostromo-color-sidebar));
|
|
108
|
+
--color-sidebar-foreground: hsl(var(--nostromo-color-sidebar-foreground));
|
|
109
|
+
--color-sidebar-border: hsl(var(--nostromo-color-sidebar-border));
|
|
110
|
+
--color-sidebar-accent: hsl(var(--nostromo-color-sidebar-accent));
|
|
111
|
+
--color-sidebar-accent-foreground: hsl(
|
|
112
|
+
var(--nostromo-color-sidebar-accent-foreground)
|
|
113
|
+
);
|
|
114
|
+
--color-sidebar-ring: hsl(var(--nostromo-color-sidebar-ring));
|
|
103
115
|
--color-background: hsl(var(--nostromo-color-background));
|
|
104
116
|
--color-foreground: hsl(var(--nostromo-color-foreground));
|
|
105
117
|
--color-border: hsl(var(--nostromo-color-border));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jarllyng/nostromo",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0",
|
|
4
4
|
"description": "Accessible React component library with CSS-first Tailwind v4 theming",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -120,6 +120,11 @@
|
|
|
120
120
|
"import": "./dist/components/core/collapsible.js",
|
|
121
121
|
"require": "./dist/components/core/collapsible.cjs"
|
|
122
122
|
},
|
|
123
|
+
"./command": {
|
|
124
|
+
"types": "./dist/components/core/command.d.ts",
|
|
125
|
+
"import": "./dist/components/core/command.js",
|
|
126
|
+
"require": "./dist/components/core/command.cjs"
|
|
127
|
+
},
|
|
123
128
|
"./components/core/accordion": {
|
|
124
129
|
"types": "./dist/components/core/accordion.d.ts",
|
|
125
130
|
"import": "./dist/components/core/accordion.js",
|
|
@@ -200,6 +205,11 @@
|
|
|
200
205
|
"import": "./dist/components/core/collapsible.js",
|
|
201
206
|
"require": "./dist/components/core/collapsible.cjs"
|
|
202
207
|
},
|
|
208
|
+
"./components/core/command": {
|
|
209
|
+
"types": "./dist/components/core/command.d.ts",
|
|
210
|
+
"import": "./dist/components/core/command.js",
|
|
211
|
+
"require": "./dist/components/core/command.cjs"
|
|
212
|
+
},
|
|
203
213
|
"./components/core/context-menu": {
|
|
204
214
|
"types": "./dist/components/core/context-menu.d.ts",
|
|
205
215
|
"import": "./dist/components/core/context-menu.js",
|
|
@@ -215,6 +225,11 @@
|
|
|
215
225
|
"import": "./dist/components/core/dialog.js",
|
|
216
226
|
"require": "./dist/components/core/dialog.cjs"
|
|
217
227
|
},
|
|
228
|
+
"./components/core/drawer": {
|
|
229
|
+
"types": "./dist/components/core/drawer.d.ts",
|
|
230
|
+
"import": "./dist/components/core/drawer.js",
|
|
231
|
+
"require": "./dist/components/core/drawer.cjs"
|
|
232
|
+
},
|
|
218
233
|
"./components/core/dropdown-menu": {
|
|
219
234
|
"types": "./dist/components/core/dropdown-menu.d.ts",
|
|
220
235
|
"import": "./dist/components/core/dropdown-menu.js",
|
|
@@ -320,6 +335,11 @@
|
|
|
320
335
|
"import": "./dist/components/core/sheet.js",
|
|
321
336
|
"require": "./dist/components/core/sheet.cjs"
|
|
322
337
|
},
|
|
338
|
+
"./components/core/sidebar": {
|
|
339
|
+
"types": "./dist/components/core/sidebar.d.ts",
|
|
340
|
+
"import": "./dist/components/core/sidebar.js",
|
|
341
|
+
"require": "./dist/components/core/sidebar.cjs"
|
|
342
|
+
},
|
|
323
343
|
"./components/core/skeleton": {
|
|
324
344
|
"types": "./dist/components/core/skeleton.d.ts",
|
|
325
345
|
"import": "./dist/components/core/skeleton.js",
|
|
@@ -410,6 +430,11 @@
|
|
|
410
430
|
"import": "./dist/components/core/dialog.js",
|
|
411
431
|
"require": "./dist/components/core/dialog.cjs"
|
|
412
432
|
},
|
|
433
|
+
"./drawer": {
|
|
434
|
+
"types": "./dist/components/core/drawer.d.ts",
|
|
435
|
+
"import": "./dist/components/core/drawer.js",
|
|
436
|
+
"require": "./dist/components/core/drawer.cjs"
|
|
437
|
+
},
|
|
413
438
|
"./dropdown-menu": {
|
|
414
439
|
"types": "./dist/components/core/dropdown-menu.d.ts",
|
|
415
440
|
"import": "./dist/components/core/dropdown-menu.js",
|
|
@@ -541,6 +566,11 @@
|
|
|
541
566
|
"import": "./dist/components/core/sheet.js",
|
|
542
567
|
"require": "./dist/components/core/sheet.cjs"
|
|
543
568
|
},
|
|
569
|
+
"./sidebar": {
|
|
570
|
+
"types": "./dist/components/core/sidebar.d.ts",
|
|
571
|
+
"import": "./dist/components/core/sidebar.js",
|
|
572
|
+
"require": "./dist/components/core/sidebar.cjs"
|
|
573
|
+
},
|
|
544
574
|
"./skeleton": {
|
|
545
575
|
"types": "./dist/components/core/skeleton.d.ts",
|
|
546
576
|
"import": "./dist/components/core/skeleton.js",
|
|
@@ -650,13 +680,15 @@
|
|
|
650
680
|
"@radix-ui/react-toggle-group": "^1.1.19",
|
|
651
681
|
"class-variance-authority": "^0.7.1",
|
|
652
682
|
"clsx": "^2.1.1",
|
|
683
|
+
"cmdk": "^1.1.1",
|
|
653
684
|
"date-fns": "^4.4.0",
|
|
654
685
|
"embla-carousel-react": "^8.6.0",
|
|
655
686
|
"input-otp": "^1.4.2",
|
|
656
687
|
"phosphor-react": "^1.4.1",
|
|
657
688
|
"react-resizable-panels": "^4.12.3",
|
|
658
689
|
"recharts": "^3.10.1",
|
|
659
|
-
"tailwind-merge": "^3.6.0"
|
|
690
|
+
"tailwind-merge": "^3.6.0",
|
|
691
|
+
"vaul": "^1.1.2"
|
|
660
692
|
},
|
|
661
693
|
"devDependencies": {
|
|
662
694
|
"@eslint/js": "^9.39.5",
|
|
@@ -793,6 +825,18 @@
|
|
|
793
825
|
{
|
|
794
826
|
"path": "dist/components/core/resizable.js",
|
|
795
827
|
"limit": "22 KB"
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
"path": "dist/components/core/command.js",
|
|
831
|
+
"limit": "30 KB"
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
"path": "dist/components/core/drawer.js",
|
|
835
|
+
"limit": "32 KB"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"path": "dist/components/core/sidebar.js",
|
|
839
|
+
"limit": "32 KB"
|
|
796
840
|
}
|
|
797
841
|
],
|
|
798
842
|
"peerDependenciesMeta": {
|
package/dist/chunk-MY2KMTUS.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {a}from'./chunk-AC2JBXHQ.js';import*as e from'react';import {cva}from'class-variance-authority';var w=cva("fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-300 transition-all",{variants:{variant:{default:"border-border shadow-lg hover:shadow-xl",elevated:"border-border shadow-xl hover:shadow-2xl",outlined:"border-2 border-border shadow-md hover:border-primary hover:shadow-lg",filled:"border-border bg-muted shadow-md hover:shadow-lg",destructive:"border-error-200 bg-error-50 shadow-lg hover:shadow-xl"},size:{default:"max-w-lg sm:max-w-xl md:max-w-2xl lg:max-w-4xl",sm:"max-w-sm sm:max-w-md",lg:"max-w-2xl sm:max-w-3xl md:max-w-4xl lg:max-w-5xl",xl:"max-w-4xl sm:max-w-5xl md:max-w-6xl lg:max-w-7xl",full:"max-w-[95vw] sm:max-w-[90vw]"},animation:{default:"animate-in fade-in-0 zoom-in-95 duration-300",slide:"animate-in slide-in-from-bottom-4 duration-300",scale:"animate-in zoom-in-95 duration-300",none:""}},defaultVariants:{variant:"default",size:"default",animation:"default"}}),D=cva("fixed inset-0 z-40 transition-all duration-300",{variants:{variant:{default:"bg-black/50 backdrop-blur-sm",subtle:"bg-black/30 backdrop-blur-none",strong:"bg-black/70 backdrop-blur-md",colored:"bg-brand-500/20 backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),x=e.createContext(null);function p(a){let t=e.useContext(x);if(!t)throw new Error(`${a} must be used inside <Dialog>`);return t}var H=({open:a$1,defaultOpen:t=false,onOpenChange:o,children:r,backdropVariant:i="default"})=>{let l=e.useId(),[s,u]=e.useState(t),n=a$1!==void 0,d=n?a$1:s,c=e.useCallback(g=>{n||u(g),o?.(g);},[n,o]);e.useEffect(()=>{if(!d)return;let g=v=>{v.key==="Escape"&&c(false);};return document.addEventListener("keydown",g),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow="unset";}},[d,c]);let f=e.useMemo(()=>({open:d,setOpen:c,titleId:l}),[d,c,l]);return e.createElement(x.Provider,{value:f},r,d&&e.createElement("div",{className:a(D({variant:i})),onClick:()=>c(false),"aria-hidden":"true"}))},h=e.forwardRef(({asChild:a,children:t,onClick:o,...r},i)=>{let{open:l,setOpen:s}=p("DialogTrigger"),u=n=>{o?.(n),n.defaultPrevented||s(true);};return a&&e.isValidElement(t)?e.cloneElement(t,{onClick:u,"aria-expanded":l}):e.createElement("button",{ref:i,type:"button","aria-expanded":l,"aria-haspopup":"dialog",onClick:u,...r},t)});h.displayName="DialogTrigger";var R=e.forwardRef(({className:a$1,children:t,onClose:o,variant:r,size:i,animation:l,...s},u)=>{let{open:n,setOpen:d,titleId:c}=p("DialogContent");if(!n)return null;let f=s["aria-label"]!==void 0||s["aria-labelledby"]!==void 0;return e.createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none"},e.createElement("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":f?void 0:c,className:a(w({variant:r,size:i,animation:l}),"pointer-events-auto p-4 sm:p-6 sm:rounded-lg",a$1),...s},t,e.createElement("button",{type:"button",className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",onClick:o??(()=>d(false))},e.createElement("span",{className:"sr-only"},"Close"),e.createElement("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))))});R.displayName="DialogContent";var y=e.forwardRef(({className:a$1,...t},o)=>e.createElement("div",{ref:o,className:a("flex flex-col space-y-1.5 text-center sm:text-left",a$1),...t}));y.displayName="DialogHeader";var k=e.forwardRef(({className:a$1,id:t,...o},r)=>{let{titleId:i}=p("DialogTitle");return e.createElement("h2",{ref:r,id:t??i,className:a("text-lg font-semibold leading-none tracking-tight",a$1),...o})});k.displayName="DialogTitle";var C=e.forwardRef(({className:a$1,...t},o)=>e.createElement("p",{ref:o,className:a("text-sm text-muted-foreground",a$1),...t}));C.displayName="DialogDescription";export{w as a,D as b,H as c,h as d,R as e,y as f,k as g,C as h};//# sourceMappingURL=chunk-MY2KMTUS.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-MY2KMTUS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/core/dialog.tsx"],"names":["dialogVariants","cva","backdropVariants","DialogContext","useDialogContext","component","context","Dialog","controlledOpen","defaultOpen","onOpenChange","children","backdropVariant","titleId","uncontrolledOpen","setUncontrolledOpen","isControlled","open","setOpen","next","handleEscape","e","cn","DialogTrigger","asChild","onClick","props","ref","handleClick","event","DialogContent","className","onClose","variant","size","animation","h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cesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst dialogVariants = cva(\n \"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-300 transition-all\",\n {\n variants: {\n variant: {\n default: \"border-border shadow-lg hover:shadow-xl\",\n elevated: \"border-border shadow-xl hover:shadow-2xl\",\n outlined:\n \"border-2 border-border shadow-md hover:border-primary hover:shadow-lg\",\n filled: \"border-border bg-muted shadow-md hover:shadow-lg\",\n destructive: \"border-error-200 bg-error-50 shadow-lg hover:shadow-xl\",\n },\n size: {\n default: \"max-w-lg sm:max-w-xl md:max-w-2xl lg:max-w-4xl\",\n sm: \"max-w-sm sm:max-w-md\",\n lg: \"max-w-2xl sm:max-w-3xl md:max-w-4xl lg:max-w-5xl\",\n xl: \"max-w-4xl sm:max-w-5xl md:max-w-6xl lg:max-w-7xl\",\n full: \"max-w-[95vw] sm:max-w-[90vw]\",\n },\n animation: {\n default: \"animate-in fade-in-0 zoom-in-95 duration-300\",\n slide: \"animate-in slide-in-from-bottom-4 duration-300\",\n scale: \"animate-in zoom-in-95 duration-300\",\n none: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n animation: \"default\",\n },\n },\n);\n\nconst backdropVariants = cva(\"fixed inset-0 z-40 transition-all duration-300\", {\n variants: {\n variant: {\n default: \"bg-black/50 backdrop-blur-sm\",\n subtle: \"bg-black/30 backdrop-blur-none\",\n strong: \"bg-black/70 backdrop-blur-md\",\n colored: \"bg-brand-500/20 backdrop-blur-sm\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\nexport interface DialogProps {\n open?: boolean;\n /** Uncontrolled initial state, for when a DialogTrigger owns the opening. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: React.ReactNode;\n backdropVariant?: VariantProps<typeof backdropVariants>[\"variant\"];\n}\n\nexport interface DialogContentProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof dialogVariants> {\n onClose?: () => void;\n}\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {}\n\nexport interface DialogDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\ninterface DialogContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n /**\n * Ties `DialogContent`'s `aria-labelledby` to whatever `DialogTitle` renders.\n * Adding `role=\"dialog\"` without this fails axe's aria-dialog-name rule - the\n * role only means something to a screen reader if the node has a name.\n */\n titleId: string;\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\n\nfunction useDialogContext(component: string): DialogContextValue {\n const context = React.useContext(DialogContext);\n if (!context) {\n throw new Error(`${component} must be used inside <Dialog>`);\n }\n return context;\n}\n\n/**\n * Dialog root.\n *\n * Renders its children whether or not it is open, and puts the open state on\n * context. It used to return `null` while closed and draw the overlay itself,\n * which made `DialogTrigger` impossible: a trigger nested in the dialog was\n * unmounted exactly when you needed to click it. The overlay moved to\n * `DialogContent`, which is what actually knows it is being shown.\n *\n * Works controlled (`open` + `onOpenChange`) or uncontrolled (`defaultOpen`).\n */\nconst Dialog: React.FC<DialogProps> = ({\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n children,\n backdropVariant = \"default\",\n}) => {\n const titleId = React.useId();\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n React.useEffect(() => {\n if (!open) return;\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n\n document.addEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"hidden\";\n\n return () => {\n document.removeEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"unset\";\n };\n }, [open, setOpen]);\n\n const context = React.useMemo(\n () => ({ open, setOpen, titleId }),\n [open, setOpen, titleId],\n );\n\n return (\n <DialogContext.Provider value={context}>\n {children}\n {open && (\n <div\n className={cn(backdropVariants({ variant: backdropVariant }))}\n onClick={() => setOpen(false)}\n aria-hidden=\"true\"\n />\n )}\n </DialogContext.Provider>\n );\n};\n\nexport interface DialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child element instead of a button, forwarding the click. */\n asChild?: boolean;\n}\n\nconst DialogTrigger = React.forwardRef<HTMLButtonElement, DialogTriggerProps>(\n ({ asChild, children, onClick, ...props }, ref) => {\n const { open, setOpen } = useDialogContext(\"DialogTrigger\");\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) setOpen(true);\n };\n\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(\n children as React.ReactElement<{\n onClick?: React.MouseEventHandler;\n \"aria-expanded\"?: boolean;\n }>,\n { onClick: handleClick, \"aria-expanded\": open },\n );\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-expanded={open}\n aria-haspopup=\"dialog\"\n onClick={handleClick}\n {...props}\n >\n {children}\n </button>\n );\n },\n);\n\nDialogTrigger.displayName = \"DialogTrigger\";\n\nconst DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(\n (\n { className, children, onClose, variant, size, animation, ...props },\n ref,\n ) => {\n const { open, setOpen, titleId } = useDialogContext(\"DialogContent\");\n\n if (!open) return null;\n\n // A caller-supplied name wins; otherwise point at the DialogTitle.\n const hasOwnLabel =\n props[\"aria-label\"] !== undefined ||\n props[\"aria-labelledby\"] !== undefined;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none\">\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={hasOwnLabel ? undefined : titleId}\n className={cn(\n dialogVariants({ variant, size, animation }),\n \"pointer-events-auto p-4 sm:p-6 sm:rounded-lg\",\n className,\n )}\n {...props}\n >\n {children}\n <button\n type=\"button\"\n className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none\"\n onClick={onClose ?? (() => setOpen(false))}\n >\n <span className=\"sr-only\">Close</span>\n <svg\n className=\"h-4 w-4\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n </div>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nconst DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col space-y-1.5 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n ),\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogTitle = React.forwardRef<HTMLHeadingElement, DialogTitleProps>(\n ({ className, id, ...props }, ref) => {\n const { titleId } = useDialogContext(\"DialogTitle\");\n\n return (\n <h2\n ref={ref}\n // Falls back to the shared id so DialogContent's aria-labelledby resolves.\n id={id ?? titleId}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nDialogTitle.displayName = \"DialogTitle\";\n\nconst DialogDescription = React.forwardRef<\n HTMLParagraphElement,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport {\n Dialog,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n dialogVariants,\n backdropVariants,\n};\n"]}
|
package/dist/chunk-NBX6FKCA.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),e=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var e__namespace=/*#__PURE__*/_interopNamespace(e);var w=classVarianceAuthority.cva("fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-300 transition-all",{variants:{variant:{default:"border-border shadow-lg hover:shadow-xl",elevated:"border-border shadow-xl hover:shadow-2xl",outlined:"border-2 border-border shadow-md hover:border-primary hover:shadow-lg",filled:"border-border bg-muted shadow-md hover:shadow-lg",destructive:"border-error-200 bg-error-50 shadow-lg hover:shadow-xl"},size:{default:"max-w-lg sm:max-w-xl md:max-w-2xl lg:max-w-4xl",sm:"max-w-sm sm:max-w-md",lg:"max-w-2xl sm:max-w-3xl md:max-w-4xl lg:max-w-5xl",xl:"max-w-4xl sm:max-w-5xl md:max-w-6xl lg:max-w-7xl",full:"max-w-[95vw] sm:max-w-[90vw]"},animation:{default:"animate-in fade-in-0 zoom-in-95 duration-300",slide:"animate-in slide-in-from-bottom-4 duration-300",scale:"animate-in zoom-in-95 duration-300",none:""}},defaultVariants:{variant:"default",size:"default",animation:"default"}}),D=classVarianceAuthority.cva("fixed inset-0 z-40 transition-all duration-300",{variants:{variant:{default:"bg-black/50 backdrop-blur-sm",subtle:"bg-black/30 backdrop-blur-none",strong:"bg-black/70 backdrop-blur-md",colored:"bg-brand-500/20 backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),x=e__namespace.createContext(null);function p(a){let t=e__namespace.useContext(x);if(!t)throw new Error(`${a} must be used inside <Dialog>`);return t}var H=({open:a,defaultOpen:t=false,onOpenChange:o,children:r,backdropVariant:i="default"})=>{let l=e__namespace.useId(),[s,u]=e__namespace.useState(t),n=a!==void 0,d=n?a:s,c=e__namespace.useCallback(g=>{n||u(g),o?.(g);},[n,o]);e__namespace.useEffect(()=>{if(!d)return;let g=v=>{v.key==="Escape"&&c(false);};return document.addEventListener("keydown",g),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow="unset";}},[d,c]);let f=e__namespace.useMemo(()=>({open:d,setOpen:c,titleId:l}),[d,c,l]);return e__namespace.createElement(x.Provider,{value:f},r,d&&e__namespace.createElement("div",{className:chunkITRGJNWL_cjs.a(D({variant:i})),onClick:()=>c(false),"aria-hidden":"true"}))},h=e__namespace.forwardRef(({asChild:a,children:t,onClick:o,...r},i)=>{let{open:l,setOpen:s}=p("DialogTrigger"),u=n=>{o?.(n),n.defaultPrevented||s(true);};return a&&e__namespace.isValidElement(t)?e__namespace.cloneElement(t,{onClick:u,"aria-expanded":l}):e__namespace.createElement("button",{ref:i,type:"button","aria-expanded":l,"aria-haspopup":"dialog",onClick:u,...r},t)});h.displayName="DialogTrigger";var R=e__namespace.forwardRef(({className:a,children:t,onClose:o,variant:r,size:i,animation:l,...s},u)=>{let{open:n,setOpen:d,titleId:c}=p("DialogContent");if(!n)return null;let f=s["aria-label"]!==void 0||s["aria-labelledby"]!==void 0;return e__namespace.createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none"},e__namespace.createElement("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":f?void 0:c,className:chunkITRGJNWL_cjs.a(w({variant:r,size:i,animation:l}),"pointer-events-auto p-4 sm:p-6 sm:rounded-lg",a),...s},t,e__namespace.createElement("button",{type:"button",className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",onClick:o??(()=>d(false))},e__namespace.createElement("span",{className:"sr-only"},"Close"),e__namespace.createElement("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},e__namespace.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})))))});R.displayName="DialogContent";var y=e__namespace.forwardRef(({className:a,...t},o)=>e__namespace.createElement("div",{ref:o,className:chunkITRGJNWL_cjs.a("flex flex-col space-y-1.5 text-center sm:text-left",a),...t}));y.displayName="DialogHeader";var k=e__namespace.forwardRef(({className:a,id:t,...o},r)=>{let{titleId:i}=p("DialogTitle");return e__namespace.createElement("h2",{ref:r,id:t??i,className:chunkITRGJNWL_cjs.a("text-lg font-semibold leading-none tracking-tight",a),...o})});k.displayName="DialogTitle";var C=e__namespace.forwardRef(({className:a,...t},o)=>e__namespace.createElement("p",{ref:o,className:chunkITRGJNWL_cjs.a("text-sm text-muted-foreground",a),...t}));C.displayName="DialogDescription";exports.a=w;exports.b=D;exports.c=H;exports.d=h;exports.e=R;exports.f=y;exports.g=k;exports.h=C;//# sourceMappingURL=chunk-NBX6FKCA.cjs.map
|
|
3
|
-
//# sourceMappingURL=chunk-NBX6FKCA.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/core/dialog.tsx"],"names":["dialogVariants","cva","backdropVariants","DialogContext","e","useDialogContext","component","context","Dialog","controlledOpen","defaultOpen","onOpenChange","children","backdropVariant","titleId","uncontrolledOpen","setUncontrolledOpen","isControlled","open","setOpen","next","handleEscape","cn","DialogTrigger","asChild","onClick","props","ref","handleClick","event","DialogContent","className","onClose","variant","size","animation","hasOwnLabel","DialogHeader","DialogTitle","id","DialogDescription"],"mappings":"ufAIA,IAAMA,CAAAA,CAAiBC,0BAAAA,CACrB,oJAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OA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J,CACF,EACA0B,CAAAA,CAAc,WAAA,CAAc,eAAA,CAE5B,IAAMO,CAAAA,CAAqBjC,YAAA,CAAA,UAAA,CACzB,CAAC,CAAE,UAAA2B,CAAAA,CAAW,GAAGL,CAAM,CAAA,CAAGC,CAAAA,GACxBvB,YAAA,CAAA,aAAA,CAAC,KAAA,CAAA,CACC,GAAA,CAAKuB,EACL,SAAA,CAAWL,mBAAAA,CACT,oDAAA,CACAS,CACF,CAAA,CACC,GAAGL,CAAAA,CACN,CAEJ,EACAW,CAAAA,CAAa,WAAA,CAAc,cAAA,CAE3B,IAAMC,CAAAA,CAAoBlC,YAAA,CAAA,UAAA,CACxB,CAAC,CAAE,SAAA,CAAA2B,CAAAA,CAAW,EAAA,CAAAQ,CAAAA,CAAI,GAAGb,CAAM,CAAA,CAAGC,CAAAA,GAAQ,CACpC,GAAM,CAAE,OAAA,CAAAb,CAAQ,CAAA,CAAIT,CAAAA,CAAiB,aAAa,CAAA,CAElD,OACED,YAAA,CAAA,aAAA,CAAC,IAAA,CAAA,CACC,GAAA,CAAKuB,CAAAA,CAEL,EAAA,CAAIY,CAAAA,EAAMzB,CAAAA,CACV,SAAA,CAAWQ,oBACT,mDAAA,CACAS,CACF,CAAA,CACC,GAAGL,CAAAA,CACN,CAEJ,CACF,EACAY,EAAY,WAAA,CAAc,aAAA,CAE1B,IAAME,CAAAA,CAA0BpC,YAAA,CAAA,UAAA,CAG9B,CAAC,CAAE,SAAA,CAAA2B,EAAW,GAAGL,CAAM,CAAA,CAAGC,CAAAA,GAC1BvB,YAAA,CAAA,aAAA,CAAC,GAAA,CAAA,CACC,GAAA,CAAKuB,CAAAA,CACL,UAAWL,mBAAAA,CAAG,+BAAA,CAAiCS,CAAS,CAAA,CACvD,GAAGL,CAAAA,CACN,CACD,EACDc,EAAkB,WAAA,CAAc,mBAAA","file":"chunk-NBX6FKCA.cjs","sourcesContent":["import * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst dialogVariants = cva(\n \"fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background shadow-lg duration-300 transition-all\",\n {\n variants: {\n variant: {\n default: \"border-border shadow-lg hover:shadow-xl\",\n elevated: \"border-border shadow-xl hover:shadow-2xl\",\n outlined:\n \"border-2 border-border shadow-md hover:border-primary hover:shadow-lg\",\n filled: \"border-border bg-muted shadow-md hover:shadow-lg\",\n destructive: \"border-error-200 bg-error-50 shadow-lg hover:shadow-xl\",\n },\n size: {\n default: \"max-w-lg sm:max-w-xl md:max-w-2xl lg:max-w-4xl\",\n sm: \"max-w-sm sm:max-w-md\",\n lg: \"max-w-2xl sm:max-w-3xl md:max-w-4xl lg:max-w-5xl\",\n xl: \"max-w-4xl sm:max-w-5xl md:max-w-6xl lg:max-w-7xl\",\n full: \"max-w-[95vw] sm:max-w-[90vw]\",\n },\n animation: {\n default: \"animate-in fade-in-0 zoom-in-95 duration-300\",\n slide: \"animate-in slide-in-from-bottom-4 duration-300\",\n scale: \"animate-in zoom-in-95 duration-300\",\n none: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n animation: \"default\",\n },\n },\n);\n\nconst backdropVariants = cva(\"fixed inset-0 z-40 transition-all duration-300\", {\n variants: {\n variant: {\n default: \"bg-black/50 backdrop-blur-sm\",\n subtle: \"bg-black/30 backdrop-blur-none\",\n strong: \"bg-black/70 backdrop-blur-md\",\n colored: \"bg-brand-500/20 backdrop-blur-sm\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n});\n\nexport interface DialogProps {\n open?: boolean;\n /** Uncontrolled initial state, for when a DialogTrigger owns the opening. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n children: React.ReactNode;\n backdropVariant?: VariantProps<typeof backdropVariants>[\"variant\"];\n}\n\nexport interface DialogContentProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof dialogVariants> {\n onClose?: () => void;\n}\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {}\n\nexport interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {}\n\nexport interface DialogDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {}\n\ninterface DialogContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n /**\n * Ties `DialogContent`'s `aria-labelledby` to whatever `DialogTitle` renders.\n * Adding `role=\"dialog\"` without this fails axe's aria-dialog-name rule - the\n * role only means something to a screen reader if the node has a name.\n */\n titleId: string;\n}\n\nconst DialogContext = React.createContext<DialogContextValue | null>(null);\n\nfunction useDialogContext(component: string): DialogContextValue {\n const context = React.useContext(DialogContext);\n if (!context) {\n throw new Error(`${component} must be used inside <Dialog>`);\n }\n return context;\n}\n\n/**\n * Dialog root.\n *\n * Renders its children whether or not it is open, and puts the open state on\n * context. It used to return `null` while closed and draw the overlay itself,\n * which made `DialogTrigger` impossible: a trigger nested in the dialog was\n * unmounted exactly when you needed to click it. The overlay moved to\n * `DialogContent`, which is what actually knows it is being shown.\n *\n * Works controlled (`open` + `onOpenChange`) or uncontrolled (`defaultOpen`).\n */\nconst Dialog: React.FC<DialogProps> = ({\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n children,\n backdropVariant = \"default\",\n}) => {\n const titleId = React.useId();\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : uncontrolledOpen;\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange],\n );\n\n React.useEffect(() => {\n if (!open) return;\n\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setOpen(false);\n };\n\n document.addEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"hidden\";\n\n return () => {\n document.removeEventListener(\"keydown\", handleEscape);\n document.body.style.overflow = \"unset\";\n };\n }, [open, setOpen]);\n\n const context = React.useMemo(\n () => ({ open, setOpen, titleId }),\n [open, setOpen, titleId],\n );\n\n return (\n <DialogContext.Provider value={context}>\n {children}\n {open && (\n <div\n className={cn(backdropVariants({ variant: backdropVariant }))}\n onClick={() => setOpen(false)}\n aria-hidden=\"true\"\n />\n )}\n </DialogContext.Provider>\n );\n};\n\nexport interface DialogTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Render the child element instead of a button, forwarding the click. */\n asChild?: boolean;\n}\n\nconst DialogTrigger = React.forwardRef<HTMLButtonElement, DialogTriggerProps>(\n ({ asChild, children, onClick, ...props }, ref) => {\n const { open, setOpen } = useDialogContext(\"DialogTrigger\");\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) setOpen(true);\n };\n\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(\n children as React.ReactElement<{\n onClick?: React.MouseEventHandler;\n \"aria-expanded\"?: boolean;\n }>,\n { onClick: handleClick, \"aria-expanded\": open },\n );\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n aria-expanded={open}\n aria-haspopup=\"dialog\"\n onClick={handleClick}\n {...props}\n >\n {children}\n </button>\n );\n },\n);\n\nDialogTrigger.displayName = \"DialogTrigger\";\n\nconst DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps>(\n (\n { className, children, onClose, variant, size, animation, ...props },\n ref,\n ) => {\n const { open, setOpen, titleId } = useDialogContext(\"DialogContent\");\n\n if (!open) return null;\n\n // A caller-supplied name wins; otherwise point at the DialogTitle.\n const hasOwnLabel =\n props[\"aria-label\"] !== undefined ||\n props[\"aria-labelledby\"] !== undefined;\n\n return (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none\">\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={hasOwnLabel ? undefined : titleId}\n className={cn(\n dialogVariants({ variant, size, animation }),\n \"pointer-events-auto p-4 sm:p-6 sm:rounded-lg\",\n className,\n )}\n {...props}\n >\n {children}\n <button\n type=\"button\"\n className=\"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none\"\n onClick={onClose ?? (() => setOpen(false))}\n >\n <span className=\"sr-only\">Close</span>\n <svg\n className=\"h-4 w-4\"\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n </div>\n </div>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nconst DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n \"flex flex-col space-y-1.5 text-center sm:text-left\",\n className,\n )}\n {...props}\n />\n ),\n);\nDialogHeader.displayName = \"DialogHeader\";\n\nconst DialogTitle = React.forwardRef<HTMLHeadingElement, DialogTitleProps>(\n ({ className, id, ...props }, ref) => {\n const { titleId } = useDialogContext(\"DialogTitle\");\n\n return (\n <h2\n ref={ref}\n // Falls back to the shared id so DialogContent's aria-labelledby resolves.\n id={id ?? titleId}\n className={cn(\n \"text-lg font-semibold leading-none tracking-tight\",\n className,\n )}\n {...props}\n />\n );\n },\n);\nDialogTitle.displayName = \"DialogTitle\";\n\nconst DialogDescription = React.forwardRef<\n HTMLParagraphElement,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\"text-sm text-muted-foreground\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport {\n Dialog,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n dialogVariants,\n backdropVariants,\n};\n"]}
|