@constructive-io/ui 0.4.1 → 0.6.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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/components/alert-dialog.cjs +333 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +32 -0
- package/dist/components/alert-dialog.d.ts +16 -15
- package/dist/components/alert-dialog.js +89 -102
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +119 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +10 -5
- package/dist/components/alert.js +62 -6
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +367 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +26 -0
- package/dist/components/app-bar.d.ts +26 -0
- package/dist/components/app-bar.js +344 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +1792 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +106 -0
- package/dist/components/app-shell.d.ts +106 -0
- package/dist/components/app-shell.js +1771 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +418 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +15 -15
- package/dist/components/autocomplete.js +9 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +51 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +12 -0
- package/dist/components/avatar.d.ts +3 -4
- package/dist/components/avatar.js +11 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +66 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +118 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +14 -0
- package/dist/components/breadcrumb.d.ts +9 -9
- package/dist/components/breadcrumb.js +19 -83
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +169 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +20 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +105 -21
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +85 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +3 -3
- package/dist/components/card.cjs +99 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +18 -0
- package/dist/components/card.d.ts +7 -8
- package/dist/components/card.js +23 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +18 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox.cjs +121 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +3 -3
- package/dist/components/checkbox.js +73 -41
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +127 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +44 -0
- package/dist/components/collapsible.d.ts +8 -18
- package/dist/components/collapsible.js +7 -27
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +551 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +43 -0
- package/dist/components/combobox.d.ts +17 -18
- package/dist/components/combobox.js +37 -48
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +236 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +23 -0
- package/dist/components/command.d.ts +14 -15
- package/dist/components/command.js +5 -38
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +431 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +30 -0
- package/dist/components/dialog.d.ts +13 -18
- package/dist/components/dialog.js +75 -119
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +121 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +1 -2
- package/dist/components/dock.js +7 -5
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +149 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +15 -0
- package/dist/components/drawer.d.ts +10 -11
- package/dist/components/drawer.js +11 -40
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +292 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +52 -0
- package/dist/components/dropdown-menu.d.ts +23 -21
- package/dist/components/dropdown-menu.js +67 -191
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +106 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +99 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +295 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +34 -39
- package/dist/components/field.js +220 -72
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +176 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +15 -0
- package/dist/components/flickering-grid.js +25 -2
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +194 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +173 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +193 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +14 -0
- package/dist/components/form-control.d.ts +1 -2
- package/dist/components/form-control.js +2 -4
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +208 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +36 -0
- package/dist/components/form.d.ts +7 -8
- package/dist/components/input-group.cjs +184 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +17 -0
- package/dist/components/input-group.d.ts +6 -7
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +62 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +10 -0
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +351 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +25 -0
- package/dist/components/json-input.d.ts +3 -3
- package/dist/components/json-input.js +89 -112
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +29 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +1 -2
- package/dist/components/motion-grid.cjs +108 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +19 -0
- package/dist/components/motion-grid.d.ts +1 -2
- package/dist/components/motion-grid.js +9 -4
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +796 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.js +54 -162
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +19 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/pagination.cjs +295 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +18 -0
- package/dist/components/pagination.d.ts +7 -8
- package/dist/components/pagination.js +152 -29
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +140 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +39 -0
- package/dist/components/popover.d.ts +13 -9
- package/dist/components/popover.js +56 -132
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +109 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +117 -0
- package/dist/components/portal.d.ts +16 -7
- package/dist/components/portal.js +13 -8
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +31 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +9 -0
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +144 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +2 -2
- package/dist/components/progressive-blur.cjs +70 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +16 -0
- package/dist/components/progressive-blur.d.ts +2 -2
- package/dist/components/radio-group.cjs +52 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +21 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +420 -0
- package/dist/components/record-picker.cjs.map +1 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +2 -2
- package/dist/components/record-picker.js +76 -43
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.cjs +76 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +10 -0
- package/dist/components/resizable.d.ts +3 -4
- package/dist/components/responsive-diagram.cjs +67 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +2 -2
- package/dist/components/scroll-area.cjs +92 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +11 -0
- package/dist/components/scroll-area.d.ts +5 -6
- package/dist/components/select.cjs +329 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +46 -0
- package/dist/components/select.d.ts +13 -14
- package/dist/components/select.js +76 -67
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +10 -0
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/sheet.cjs +489 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +14 -19
- package/dist/components/sheet.js +119 -264
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.cjs +1300 -0
- package/dist/components/sidebar.cjs.map +1 -0
- package/dist/components/sidebar.d.cts +70 -0
- package/dist/components/sidebar.d.ts +32 -39
- package/dist/components/sidebar.js +401 -362
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.cjs +36 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +10 -0
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +19 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +25 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/stack/index.cjs +1516 -0
- package/dist/components/stack/index.cjs.map +1 -0
- package/dist/components/stack/index.d.cts +672 -0
- package/dist/components/stack/index.d.ts +36 -38
- package/dist/components/stack/index.js +42 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.cjs +314 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +31 -0
- package/dist/components/stepper.d.ts +9 -8
- package/dist/components/stepper.js +22 -15
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +46 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +7 -0
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +9 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +133 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +22 -0
- package/dist/components/table.d.ts +19 -12
- package/dist/components/table.js +72 -13
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +53 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +4 -5
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +451 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +40 -0
- package/dist/components/tags.d.ts +10 -10
- package/dist/components/tags.js +129 -154
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +56 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +9 -0
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/toast/index.cjs +612 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +52 -0
- package/dist/components/toast/index.js +90 -127
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip.cjs +92 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +28 -0
- package/dist/components/tooltip.d.ts +5 -6
- package/dist/components/tooltip.js +23 -130
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +197 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +2 -2
- package/dist/components/unlink-button.js +105 -21
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/index.cjs +2074 -2723
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +492 -904
- package/dist/index.d.ts +492 -904
- package/dist/index.js +1897 -2569
- package/dist/index.js.map +1 -1
- package/package.json +286 -45
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
6
|
+
var sonner = require('sonner');
|
|
7
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var clsx = require('clsx');
|
|
10
|
+
var tailwindMerge = require('tailwind-merge');
|
|
11
|
+
var dialog = require('@base-ui/react/dialog');
|
|
12
|
+
var portal = require('@constructive-io/ui/portal');
|
|
13
|
+
var scrollArea = require('@base-ui/react/scroll-area');
|
|
14
|
+
|
|
15
|
+
function _interopNamespace(e) {
|
|
16
|
+
if (e && e.__esModule) return e;
|
|
17
|
+
var n = Object.create(null);
|
|
18
|
+
if (e) {
|
|
19
|
+
Object.keys(e).forEach(function (k) {
|
|
20
|
+
if (k !== 'default') {
|
|
21
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
22
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return e[k]; }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
n.default = e;
|
|
30
|
+
return Object.freeze(n);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
|
+
|
|
35
|
+
// src/components/toast/toast-error.tsx
|
|
36
|
+
function composeRefs(...refs) {
|
|
37
|
+
return (node) => {
|
|
38
|
+
refs.forEach((ref) => {
|
|
39
|
+
if (typeof ref === "function") {
|
|
40
|
+
ref(node);
|
|
41
|
+
} else if (ref != null) {
|
|
42
|
+
ref.current = node;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function mergeProps(slotProps, childProps) {
|
|
48
|
+
const overrideProps = { ...childProps };
|
|
49
|
+
for (const propName in childProps) {
|
|
50
|
+
if (propName === "ref") continue;
|
|
51
|
+
const slotPropValue = slotProps[propName];
|
|
52
|
+
const childPropValue = childProps[propName];
|
|
53
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
54
|
+
overrideProps[propName] = (...args) => {
|
|
55
|
+
childPropValue(...args);
|
|
56
|
+
slotPropValue(...args);
|
|
57
|
+
};
|
|
58
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
59
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
60
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
61
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { ...slotProps, ...overrideProps };
|
|
65
|
+
}
|
|
66
|
+
function isSlottable(child) {
|
|
67
|
+
return React__namespace.isValidElement(child);
|
|
68
|
+
}
|
|
69
|
+
var Slot = React__namespace.forwardRef((props, forwardedRef) => {
|
|
70
|
+
const { children, ...slotProps } = props;
|
|
71
|
+
if (isSlottable(children)) {
|
|
72
|
+
const childProps = children.props;
|
|
73
|
+
const childRef = childProps.ref;
|
|
74
|
+
return React__namespace.cloneElement(children, {
|
|
75
|
+
...mergeProps(slotProps, childProps),
|
|
76
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (React__namespace.Children.count(children) > 1) {
|
|
80
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
81
|
+
const slottableChild = childrenArray.find(
|
|
82
|
+
(child) => React__namespace.isValidElement(child) && child.type === Slottable
|
|
83
|
+
);
|
|
84
|
+
if (slottableChild) {
|
|
85
|
+
const newElement = slottableChild.props.children;
|
|
86
|
+
if (isSlottable(newElement)) {
|
|
87
|
+
const newElementProps = newElement.props;
|
|
88
|
+
const newChildren = childrenArray.map((child) => {
|
|
89
|
+
if (child === slottableChild) {
|
|
90
|
+
return React__namespace.Children.count(newElementProps.children) > 1 ? React__namespace.Children.only(null) : newElementProps.children;
|
|
91
|
+
}
|
|
92
|
+
return child;
|
|
93
|
+
});
|
|
94
|
+
const childRef = newElementProps.ref;
|
|
95
|
+
return React__namespace.cloneElement(newElement, {
|
|
96
|
+
...mergeProps(slotProps, newElementProps),
|
|
97
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
98
|
+
children: newChildren
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
104
|
+
});
|
|
105
|
+
Slot.displayName = "Slot";
|
|
106
|
+
function Slottable({ children }) {
|
|
107
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
108
|
+
}
|
|
109
|
+
function cn(...inputs) {
|
|
110
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
111
|
+
}
|
|
112
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
113
|
+
"[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-sm outline-none transition-[box-shadow,scale] duration-150 ease-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 motion-reduce:transition-shadow [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
114
|
+
{
|
|
115
|
+
defaultVariants: {
|
|
116
|
+
size: "default",
|
|
117
|
+
static: false,
|
|
118
|
+
variant: "default"
|
|
119
|
+
},
|
|
120
|
+
variants: {
|
|
121
|
+
static: {
|
|
122
|
+
false: "motion-safe:active:not-disabled:scale-[0.96]",
|
|
123
|
+
true: null
|
|
124
|
+
},
|
|
125
|
+
size: {
|
|
126
|
+
default: "h-10 min-w-10 px-[calc(--spacing(3)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
127
|
+
icon: "size-10 pointer-coarse:size-11",
|
|
128
|
+
"icon-lg": "size-11",
|
|
129
|
+
"icon-sm": "size-8 pointer-coarse:size-11",
|
|
130
|
+
"icon-xl": 'size-11 [&_svg:not([class*="size-"])]:size-5',
|
|
131
|
+
"icon-xs": 'size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:size-11 not-in-data-[slot=input-group]:[&_svg:not([class*="size-"])]:size-4',
|
|
132
|
+
lg: "h-11 min-w-11 px-[calc(--spacing(3.5)-1px)]",
|
|
133
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11",
|
|
134
|
+
xl: 'h-12 min-w-12 px-[calc(--spacing(4)-1px)] text-lg [&_svg:not([class*="size-"])]:size-5',
|
|
135
|
+
xs: 'h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-xs before:rounded-[calc(var(--radius-md)-1px)] pointer-coarse:min-h-11 pointer-coarse:min-w-11 [&_svg:not([class*="size-"])]:size-3.5'
|
|
136
|
+
},
|
|
137
|
+
variant: {
|
|
138
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 shadow-xs hover:bg-primary/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
139
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 shadow-xs hover:bg-destructive/90 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none",
|
|
140
|
+
"destructive-outline": "border-destructive/40 bg-transparent bg-clip-padding text-destructive shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/60 [:hover,[data-pressed]]:bg-destructive/8",
|
|
141
|
+
ghost: "border-transparent hover:bg-accent data-pressed:bg-accent",
|
|
142
|
+
link: "border-transparent underline-offset-4 hover:underline",
|
|
143
|
+
outline: "border-border bg-background bg-clip-padding shadow-xs not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-in-data-[slot=group]:bg-clip-border dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/4%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
144
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/90 [:active,[data-pressed]]:bg-secondary/80"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
var Button = React__namespace.forwardRef(
|
|
150
|
+
({ className, variant, size, static: isStatic, asChild, children, type = "button", ...props }, ref) => {
|
|
151
|
+
const buttonClasses = cn(buttonVariants({ className, size, static: isStatic, variant }));
|
|
152
|
+
const Comp = asChild ? Slot : "button";
|
|
153
|
+
if (asChild) {
|
|
154
|
+
const SlottedComp = Comp;
|
|
155
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
+
SlottedComp,
|
|
157
|
+
{
|
|
158
|
+
ref,
|
|
159
|
+
className: buttonClasses,
|
|
160
|
+
"data-slot": "button",
|
|
161
|
+
...props,
|
|
162
|
+
children
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { ref, type, className: buttonClasses, "data-slot": "button", ...props, children });
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
Button.displayName = "Button";
|
|
170
|
+
var ScrollArea = React__namespace.forwardRef(
|
|
171
|
+
({ className, children, scrollFade = false, scrollbarGutter = false, ...props }, ref) => {
|
|
172
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
173
|
+
scrollArea.ScrollArea.Root,
|
|
174
|
+
{
|
|
175
|
+
ref,
|
|
176
|
+
className: cn("size-full min-h-0", className),
|
|
177
|
+
...props,
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
scrollArea.ScrollArea.Viewport,
|
|
181
|
+
{
|
|
182
|
+
className: cn(
|
|
183
|
+
"h-full overscroll-contain rounded-[inherit] outline-none transition-shadows focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background",
|
|
184
|
+
scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] [--fade-size:1.5rem]",
|
|
185
|
+
scrollbarGutter && "data-has-overflow-y:pe-2.5 data-has-overflow-x:pb-2.5"
|
|
186
|
+
),
|
|
187
|
+
"data-slot": "scroll-area-viewport",
|
|
188
|
+
children
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "vertical" }),
|
|
192
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation: "horizontal" }),
|
|
193
|
+
/* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea.Corner, { "data-slot": "scroll-area-corner" })
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
ScrollArea.displayName = "ScrollArea";
|
|
200
|
+
function ScrollBar({
|
|
201
|
+
className,
|
|
202
|
+
orientation = "vertical",
|
|
203
|
+
...props
|
|
204
|
+
}) {
|
|
205
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
206
|
+
scrollArea.ScrollArea.Scrollbar,
|
|
207
|
+
{
|
|
208
|
+
className: cn(
|
|
209
|
+
"m-1 flex opacity-0 transition-opacity delay-300 data-[orientation=horizontal]:h-1.5 data-[orientation=vertical]:w-1.5 data-[orientation=horizontal]:flex-col data-hovering:opacity-100 data-scrolling:opacity-100 data-hovering:delay-0 data-scrolling:delay-0 data-hovering:duration-100 data-scrolling:duration-100",
|
|
210
|
+
className
|
|
211
|
+
),
|
|
212
|
+
"data-slot": "scroll-area-scrollbar",
|
|
213
|
+
orientation,
|
|
214
|
+
...props,
|
|
215
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
216
|
+
scrollArea.ScrollArea.Thumb,
|
|
217
|
+
{
|
|
218
|
+
className: "relative flex-1 rounded-full bg-foreground/20",
|
|
219
|
+
"data-slot": "scroll-area-thumb"
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
var Dialog = dialog.Dialog.Root;
|
|
226
|
+
function DialogPortal({ container: containerProp, ...props }) {
|
|
227
|
+
const rootContainer = portal.useRootPortalContainer();
|
|
228
|
+
const container = containerProp === void 0 ? rootContainer ?? void 0 : containerProp;
|
|
229
|
+
const style = {
|
|
230
|
+
...props.style ?? {},
|
|
231
|
+
// Ensure floating overlays inside dialogs (select/menu/popover/tooltip) stack above the dialog.
|
|
232
|
+
// Nested Base UI portals inherit this var via Base UI portal nesting.
|
|
233
|
+
["--z-layer-floating"]: "var(--z-layer-floating-elevated)"
|
|
234
|
+
};
|
|
235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dialog.Dialog.Portal, { container, ...props, style });
|
|
236
|
+
}
|
|
237
|
+
function DialogClose({ asChild, children, render, nativeButton, ...props }) {
|
|
238
|
+
const childRender = render === void 0 && asChild && React__namespace.isValidElement(children) ? children : void 0;
|
|
239
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
240
|
+
dialog.Dialog.Close,
|
|
241
|
+
{
|
|
242
|
+
"data-slot": "dialog-close",
|
|
243
|
+
nativeButton: nativeButton ?? (childRender ? true : void 0),
|
|
244
|
+
render: render ?? childRender,
|
|
245
|
+
...props,
|
|
246
|
+
children: childRender ? void 0 : children
|
|
247
|
+
}
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
function DialogBackdrop({
|
|
251
|
+
className,
|
|
252
|
+
...props
|
|
253
|
+
}) {
|
|
254
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
+
dialog.Dialog.Backdrop,
|
|
256
|
+
{
|
|
257
|
+
className: cn(
|
|
258
|
+
"fixed inset-0 z-[var(--z-layer-modal-backdrop)] bg-black/32 backdrop-blur-sm transition-opacity duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
259
|
+
className
|
|
260
|
+
),
|
|
261
|
+
"data-slot": "dialog-backdrop",
|
|
262
|
+
...props
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function DialogViewport({
|
|
267
|
+
className,
|
|
268
|
+
...props
|
|
269
|
+
}) {
|
|
270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
271
|
+
dialog.Dialog.Viewport,
|
|
272
|
+
{
|
|
273
|
+
className: cn(
|
|
274
|
+
"fixed inset-0 z-[var(--z-layer-modal-content)] grid grid-rows-[1fr_auto_3fr] justify-items-center p-4",
|
|
275
|
+
className
|
|
276
|
+
),
|
|
277
|
+
"data-slot": "dialog-viewport",
|
|
278
|
+
...props
|
|
279
|
+
}
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
function DialogPopup({
|
|
283
|
+
className,
|
|
284
|
+
children,
|
|
285
|
+
showCloseButton = true,
|
|
286
|
+
bottomStickOnMobile = true,
|
|
287
|
+
...props
|
|
288
|
+
}) {
|
|
289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
290
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogBackdrop, {}),
|
|
291
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
292
|
+
DialogViewport,
|
|
293
|
+
{
|
|
294
|
+
className: cn(
|
|
295
|
+
bottomStickOnMobile && "max-sm:grid-rows-[1fr_auto] max-sm:pt-12"
|
|
296
|
+
),
|
|
297
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
298
|
+
dialog.Dialog.Popup,
|
|
299
|
+
{
|
|
300
|
+
className: cn(
|
|
301
|
+
"-translate-y-[calc(1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg transition-[scale,opacity,translate] duration-200 ease-in-out before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:bg-clip-border dark:before:shadow-[0_-1px_--theme(--color-white/8%)]",
|
|
302
|
+
bottomStickOnMobile && "max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none",
|
|
303
|
+
className
|
|
304
|
+
),
|
|
305
|
+
"data-slot": "dialog-popup",
|
|
306
|
+
...props,
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsxRuntime.jsx(portal.ModalPortalScope, { children }),
|
|
309
|
+
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
dialog.Dialog.Close,
|
|
311
|
+
{
|
|
312
|
+
"aria-label": "Close",
|
|
313
|
+
nativeButton: true,
|
|
314
|
+
render: (closeProps) => {
|
|
315
|
+
const { nativeButton: _, ...rest } = closeProps;
|
|
316
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
317
|
+
Button,
|
|
318
|
+
{
|
|
319
|
+
...rest,
|
|
320
|
+
className: "absolute end-2 top-2",
|
|
321
|
+
size: "icon",
|
|
322
|
+
variant: "ghost",
|
|
323
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {})
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] });
|
|
335
|
+
}
|
|
336
|
+
function DialogHeader({ className, ...props }) {
|
|
337
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
className: cn(
|
|
341
|
+
"flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4",
|
|
342
|
+
className
|
|
343
|
+
),
|
|
344
|
+
"data-slot": "dialog-header",
|
|
345
|
+
...props
|
|
346
|
+
}
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
function DialogFooter({
|
|
350
|
+
className,
|
|
351
|
+
variant = "default",
|
|
352
|
+
...props
|
|
353
|
+
}) {
|
|
354
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
355
|
+
"div",
|
|
356
|
+
{
|
|
357
|
+
className: cn(
|
|
358
|
+
"flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]",
|
|
359
|
+
variant === "default" && "border-t bg-muted/50 py-4",
|
|
360
|
+
variant === "bare" && "in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3 pt-4 pb-6",
|
|
361
|
+
className
|
|
362
|
+
),
|
|
363
|
+
"data-slot": "dialog-footer",
|
|
364
|
+
...props
|
|
365
|
+
}
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
function DialogTitle({ className, ...props }) {
|
|
369
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
370
|
+
dialog.Dialog.Title,
|
|
371
|
+
{
|
|
372
|
+
className: cn("font-heading text-xl leading-none", className),
|
|
373
|
+
"data-slot": "dialog-title",
|
|
374
|
+
...props
|
|
375
|
+
}
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
function DialogPanel({ className, ...props }) {
|
|
379
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
380
|
+
"div",
|
|
381
|
+
{
|
|
382
|
+
className: cn(
|
|
383
|
+
"px-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-header]))]:pt-6 in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-footer]))]:pb-6! in-[[data-slot=dialog-popup]:not(:has([data-slot=dialog-footer].border-t))]:pb-1 pb-6",
|
|
384
|
+
className
|
|
385
|
+
),
|
|
386
|
+
"data-slot": "dialog-panel",
|
|
387
|
+
...props
|
|
388
|
+
}
|
|
389
|
+
) });
|
|
390
|
+
}
|
|
391
|
+
var LONG_DESCRIPTION_THRESHOLD = 140;
|
|
392
|
+
function isLongDescription(description) {
|
|
393
|
+
if (!description) return false;
|
|
394
|
+
return description.length > LONG_DESCRIPTION_THRESHOLD || description.includes("\n");
|
|
395
|
+
}
|
|
396
|
+
function ToastErrorContent({
|
|
397
|
+
toastId,
|
|
398
|
+
message,
|
|
399
|
+
description,
|
|
400
|
+
action,
|
|
401
|
+
onDismiss
|
|
402
|
+
}) {
|
|
403
|
+
const [detailsOpen, setDetailsOpen] = React.useState(false);
|
|
404
|
+
const [copied, setCopied] = React.useState(false);
|
|
405
|
+
const showDetails = isLongDescription(description);
|
|
406
|
+
const handleCopy = async () => {
|
|
407
|
+
if (!description) return;
|
|
408
|
+
try {
|
|
409
|
+
await navigator.clipboard.writeText(description);
|
|
410
|
+
setCopied(true);
|
|
411
|
+
setTimeout(() => setCopied(false), 1500);
|
|
412
|
+
} catch {
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
416
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
417
|
+
"div",
|
|
418
|
+
{
|
|
419
|
+
className: "bg-background text-foreground border-destructive/20 w-full rounded-md border px-4 py-3 shadow-lg\n sm:w-[var(--width)]",
|
|
420
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
421
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 grow gap-3", children: [
|
|
422
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircleIcon, { className: "text-destructive mt-0.5 shrink-0", size: 16, "aria-hidden": "true" }),
|
|
423
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 grow flex-col gap-1", children: [
|
|
424
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-destructive text-sm font-medium break-words", children: message }),
|
|
425
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground line-clamp-3 text-sm break-words", children: description }),
|
|
426
|
+
(showDetails || action) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
427
|
+
showDetails && /* @__PURE__ */ jsxRuntime.jsx(
|
|
428
|
+
"button",
|
|
429
|
+
{
|
|
430
|
+
className: "text-muted-foreground hover:text-foreground text-xs font-medium underline underline-offset-2 decoration-dotted",
|
|
431
|
+
onClick: () => setDetailsOpen(true),
|
|
432
|
+
children: "View details"
|
|
433
|
+
}
|
|
434
|
+
),
|
|
435
|
+
action && /* @__PURE__ */ jsxRuntime.jsx(
|
|
436
|
+
"button",
|
|
437
|
+
{
|
|
438
|
+
className: "text-destructive text-sm font-medium hover:underline",
|
|
439
|
+
onClick: action.onClick,
|
|
440
|
+
children: action.label
|
|
441
|
+
}
|
|
442
|
+
)
|
|
443
|
+
] })
|
|
444
|
+
] })
|
|
445
|
+
] }),
|
|
446
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
447
|
+
Button,
|
|
448
|
+
{
|
|
449
|
+
variant: "ghost",
|
|
450
|
+
className: "group -my-1.5 -me-2 size-8 shrink-0 p-0 hover:bg-transparent",
|
|
451
|
+
onClick: () => {
|
|
452
|
+
sonner.toast.dismiss(toastId);
|
|
453
|
+
onDismiss?.();
|
|
454
|
+
},
|
|
455
|
+
"aria-label": "Close error notification",
|
|
456
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: 16, className: "opacity-60 transition-opacity group-hover:opacity-100", "aria-hidden": "true" })
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] })
|
|
460
|
+
}
|
|
461
|
+
),
|
|
462
|
+
showDetails && description && /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: detailsOpen, onOpenChange: setDetailsOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogPopup, { className: "max-w-2xl", children: [
|
|
463
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: message }) }),
|
|
464
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogPanel, { children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "bg-muted text-foreground rounded-md p-3 text-xs break-words whitespace-pre-wrap", children: description }) }),
|
|
465
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DialogFooter, { children: [
|
|
466
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", size: "sm", onClick: handleCopy, children: [
|
|
467
|
+
copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CopyIcon, { size: 14, "aria-hidden": "true" }),
|
|
468
|
+
copied ? "Copied" : "Copy"
|
|
469
|
+
] }),
|
|
470
|
+
/* @__PURE__ */ jsxRuntime.jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", children: "Close" }) })
|
|
471
|
+
] })
|
|
472
|
+
] }) })
|
|
473
|
+
] });
|
|
474
|
+
}
|
|
475
|
+
function showErrorToast(props) {
|
|
476
|
+
return sonner.toast.custom((t) => /* @__PURE__ */ jsxRuntime.jsx(ToastErrorContent, { toastId: t, ...props }), {
|
|
477
|
+
duration: Infinity
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
function showInfoToast(props) {
|
|
481
|
+
const { message, description, action, onDismiss } = props;
|
|
482
|
+
return sonner.toast.custom((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
483
|
+
"div",
|
|
484
|
+
{
|
|
485
|
+
className: "bg-background text-foreground border-primary/20 w-full rounded-md border px-4 py-3 shadow-lg\n sm:w-[var(--width)]",
|
|
486
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
487
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow gap-3", children: [
|
|
488
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.InfoIcon, { className: "text-primary mt-0.5 shrink-0", size: 16, "aria-hidden": "true" }),
|
|
489
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-1", children: [
|
|
490
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-primary text-sm font-medium", children: message }),
|
|
491
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description }),
|
|
492
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-primary text-sm font-medium hover:underline", onClick: action.onClick, children: action.label }) })
|
|
493
|
+
] })
|
|
494
|
+
] }),
|
|
495
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
496
|
+
Button,
|
|
497
|
+
{
|
|
498
|
+
variant: "ghost",
|
|
499
|
+
className: "group -my-1.5 -me-2 size-8 shrink-0 p-0 hover:bg-transparent",
|
|
500
|
+
onClick: () => {
|
|
501
|
+
sonner.toast.dismiss(t);
|
|
502
|
+
onDismiss?.();
|
|
503
|
+
},
|
|
504
|
+
"aria-label": "Close info notification",
|
|
505
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: 16, className: "opacity-60 transition-opacity group-hover:opacity-100", "aria-hidden": "true" })
|
|
506
|
+
}
|
|
507
|
+
)
|
|
508
|
+
] })
|
|
509
|
+
}
|
|
510
|
+
));
|
|
511
|
+
}
|
|
512
|
+
function showSuccessToast(props) {
|
|
513
|
+
const { message, description, action, onDismiss } = props;
|
|
514
|
+
return sonner.toast.custom((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
515
|
+
"div",
|
|
516
|
+
{
|
|
517
|
+
className: "bg-background text-foreground w-full rounded-md border border-green-200/60 px-4 py-3 shadow-lg\n sm:w-[var(--width)] dark:border-green-800/50",
|
|
518
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
519
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow gap-3", children: [
|
|
520
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
521
|
+
lucideReact.CheckCircleIcon,
|
|
522
|
+
{
|
|
523
|
+
className: "mt-0.5 shrink-0 text-green-600 dark:text-green-500",
|
|
524
|
+
size: 16,
|
|
525
|
+
"aria-hidden": "true"
|
|
526
|
+
}
|
|
527
|
+
),
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-1", children: [
|
|
529
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-green-700 dark:text-green-400", children: message }),
|
|
530
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description }),
|
|
531
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
532
|
+
"button",
|
|
533
|
+
{
|
|
534
|
+
className: "text-sm font-medium text-green-700 hover:underline dark:text-green-400",
|
|
535
|
+
onClick: action.onClick,
|
|
536
|
+
children: action.label
|
|
537
|
+
}
|
|
538
|
+
) })
|
|
539
|
+
] })
|
|
540
|
+
] }),
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
+
Button,
|
|
543
|
+
{
|
|
544
|
+
variant: "ghost",
|
|
545
|
+
className: "group -my-1.5 -me-2 size-8 shrink-0 p-0 hover:bg-transparent",
|
|
546
|
+
onClick: () => {
|
|
547
|
+
sonner.toast.dismiss(t);
|
|
548
|
+
onDismiss?.();
|
|
549
|
+
},
|
|
550
|
+
"aria-label": "Close success notification",
|
|
551
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: 16, className: "opacity-60 transition-opacity group-hover:opacity-100", "aria-hidden": "true" })
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
] })
|
|
555
|
+
}
|
|
556
|
+
));
|
|
557
|
+
}
|
|
558
|
+
function showWarningToast(props) {
|
|
559
|
+
const { message, description, action, onDismiss } = props;
|
|
560
|
+
return sonner.toast.custom((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
561
|
+
"div",
|
|
562
|
+
{
|
|
563
|
+
className: "bg-background text-foreground w-full rounded-md border border-amber-200/60 px-4 py-3 shadow-lg\n sm:w-[var(--width)] dark:border-amber-800/50",
|
|
564
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
|
|
565
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow gap-3", children: [
|
|
566
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangleIcon, { className: "mt-0.5 shrink-0 text-amber-500", size: 16, "aria-hidden": "true" }),
|
|
567
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-1", children: [
|
|
568
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-amber-700 dark:text-amber-400", children: message }),
|
|
569
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-sm", children: description }),
|
|
570
|
+
action && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
571
|
+
"button",
|
|
572
|
+
{
|
|
573
|
+
className: "text-sm font-medium text-amber-700 hover:underline dark:text-amber-400",
|
|
574
|
+
onClick: action.onClick,
|
|
575
|
+
children: action.label
|
|
576
|
+
}
|
|
577
|
+
) })
|
|
578
|
+
] })
|
|
579
|
+
] }),
|
|
580
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
+
Button,
|
|
582
|
+
{
|
|
583
|
+
variant: "ghost",
|
|
584
|
+
className: "group -my-1.5 -me-2 size-8 shrink-0 p-0 hover:bg-transparent",
|
|
585
|
+
onClick: () => {
|
|
586
|
+
sonner.toast.dismiss(t);
|
|
587
|
+
onDismiss?.();
|
|
588
|
+
},
|
|
589
|
+
"aria-label": "Close warning notification",
|
|
590
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { size: 16, className: "opacity-60 transition-opacity group-hover:opacity-100", "aria-hidden": "true" })
|
|
591
|
+
}
|
|
592
|
+
)
|
|
593
|
+
] })
|
|
594
|
+
}
|
|
595
|
+
));
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// src/components/toast/index.ts
|
|
599
|
+
var toast5 = {
|
|
600
|
+
error: showErrorToast,
|
|
601
|
+
info: showInfoToast,
|
|
602
|
+
success: showSuccessToast,
|
|
603
|
+
warning: showWarningToast
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
exports.showErrorToast = showErrorToast;
|
|
607
|
+
exports.showInfoToast = showInfoToast;
|
|
608
|
+
exports.showSuccessToast = showSuccessToast;
|
|
609
|
+
exports.showWarningToast = showWarningToast;
|
|
610
|
+
exports.toast = toast5;
|
|
611
|
+
//# sourceMappingURL=index.cjs.map
|
|
612
|
+
//# sourceMappingURL=index.cjs.map
|