@appcorp/stellar-solutions-modules 0.1.53 → 0.1.55

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.
Files changed (93) hide show
  1. package/global-modules/bank/bank.js +4 -8
  2. package/global-modules/bank/context.js +15 -14
  3. package/global-modules/bank/drawer.js +2 -2
  4. package/global-modules/bank/form.js +2 -2
  5. package/global-modules/bank/types.d.ts +1 -1
  6. package/global-modules/branch/branch.js +3 -7
  7. package/global-modules/branch/constants.d.ts +0 -11
  8. package/global-modules/branch/constants.js +1 -15
  9. package/global-modules/branch/context.js +16 -15
  10. package/global-modules/branch/drawer.js +2 -2
  11. package/global-modules/branch/form.js +2 -2
  12. package/global-modules/branch/types.d.ts +1 -1
  13. package/global-modules/payment-mode/context.js +16 -15
  14. package/global-modules/payment-mode/drawer.js +2 -2
  15. package/global-modules/payment-mode/form.js +2 -2
  16. package/global-modules/payment-mode/payment-mode.js +16 -20
  17. package/global-modules/payment-mode/types.d.ts +1 -1
  18. package/global-modules/preferences/context.js +14 -13
  19. package/global-modules/preferences/currency.js +2 -2
  20. package/global-modules/tax/context.js +16 -15
  21. package/global-modules/tax/drawer.js +2 -2
  22. package/global-modules/tax/form.js +2 -2
  23. package/global-modules/tax/tax.js +4 -8
  24. package/global-modules/tax/types.d.ts +1 -1
  25. package/index.d.ts +0 -30
  26. package/index.js +0 -46
  27. package/lib/toast-utils.d.ts +0 -44
  28. package/lib/toast-utils.js +240 -212
  29. package/lib/utils.d.ts +0 -2
  30. package/lib/utils.js +5 -12
  31. package/package.json +6 -7
  32. package/components/theme-provider.d.ts +0 -9
  33. package/components/theme-provider.js +0 -122
  34. package/components/theme-switcher.d.ts +0 -4
  35. package/components/theme-switcher.js +0 -60
  36. package/components/ui/badge.d.ts +0 -9
  37. package/components/ui/badge.js +0 -82
  38. package/components/ui/button.d.ts +0 -10
  39. package/components/ui/button.js +0 -91
  40. package/components/ui/card.d.ts +0 -9
  41. package/components/ui/card.js +0 -94
  42. package/components/ui/carousel.d.ts +0 -19
  43. package/components/ui/carousel.js +0 -168
  44. package/components/ui/checkbox.d.ts +0 -9
  45. package/components/ui/checkbox.js +0 -87
  46. package/components/ui/combobox.d.ts +0 -70
  47. package/components/ui/combobox.js +0 -315
  48. package/components/ui/command.d.ts +0 -18
  49. package/components/ui/command.js +0 -115
  50. package/components/ui/dialog.d.ts +0 -15
  51. package/components/ui/dialog.js +0 -118
  52. package/components/ui/drawer.d.ts +0 -13
  53. package/components/ui/drawer.js +0 -115
  54. package/components/ui/dropdown-menu.d.ts +0 -25
  55. package/components/ui/dropdown-menu.js +0 -148
  56. package/components/ui/enhanced-dropzone.d.ts +0 -21
  57. package/components/ui/enhanced-dropzone.js +0 -187
  58. package/components/ui/enhanced-table-footer-action.d.ts +0 -34
  59. package/components/ui/enhanced-table-footer-action.js +0 -117
  60. package/components/ui/enhanced-table-footer-page.d.ts +0 -32
  61. package/components/ui/enhanced-table-footer-page.js +0 -140
  62. package/components/ui/enhanced-table-footer-pagination.d.ts +0 -36
  63. package/components/ui/enhanced-table-footer-pagination.js +0 -122
  64. package/components/ui/enhanced-table-header-action.d.ts +0 -7
  65. package/components/ui/enhanced-table-header-action.js +0 -21
  66. package/components/ui/enhanced-table-header-search.d.ts +0 -12
  67. package/components/ui/enhanced-table-header-search.js +0 -17
  68. package/components/ui/enhanced-table.d.ts +0 -75
  69. package/components/ui/enhanced-table.js +0 -196
  70. package/components/ui/form.d.ts +0 -24
  71. package/components/ui/form.js +0 -125
  72. package/components/ui/input.d.ts +0 -8
  73. package/components/ui/input.js +0 -86
  74. package/components/ui/label.d.ts +0 -7
  75. package/components/ui/label.js +0 -68
  76. package/components/ui/popover.d.ts +0 -7
  77. package/components/ui/popover.js +0 -82
  78. package/components/ui/select.d.ts +0 -15
  79. package/components/ui/select.js +0 -127
  80. package/components/ui/separator.d.ts +0 -4
  81. package/components/ui/separator.js +0 -66
  82. package/components/ui/shadcn-io/color-picker/index.d.ts +0 -43
  83. package/components/ui/shadcn-io/color-picker/index.js +0 -304
  84. package/components/ui/shadcn-io/dropzone/index.d.ts +0 -19
  85. package/components/ui/shadcn-io/dropzone/index.js +0 -131
  86. package/components/ui/sonner.d.ts +0 -4
  87. package/components/ui/sonner.js +0 -54
  88. package/components/ui/switch.d.ts +0 -9
  89. package/components/ui/switch.js +0 -89
  90. package/components/ui/table.d.ts +0 -10
  91. package/components/ui/table.js +0 -101
  92. package/components/ui/textarea.d.ts +0 -8
  93. package/components/ui/textarea.js +0 -86
@@ -1,304 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- var __generator = (this && this.__generator) || function (thisArg, body) {
24
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
25
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26
- function verb(n) { return function (v) { return step([n, v]); }; }
27
- function step(op) {
28
- if (f) throw new TypeError("Generator is already executing.");
29
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
30
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31
- if (y = 0, t) op = [op[0] & 2, t.value];
32
- switch (op[0]) {
33
- case 0: case 1: t = op; break;
34
- case 4: _.label++; return { value: op[1], done: false };
35
- case 5: _.label++; y = op[1]; op = [0]; continue;
36
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
37
- default:
38
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42
- if (t[2]) _.ops.pop();
43
- _.trys.pop(); continue;
44
- }
45
- op = body.call(thisArg, _);
46
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48
- }
49
- };
50
- var __rest = (this && this.__rest) || function (s, e) {
51
- var t = {};
52
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
53
- t[p] = s[p];
54
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
55
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
56
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
57
- t[p[i]] = s[p[i]];
58
- }
59
- return t;
60
- };
61
- var __importDefault = (this && this.__importDefault) || function (mod) {
62
- return (mod && mod.__esModule) ? mod : { "default": mod };
63
- };
64
- Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.ColorPickerFormat = exports.ColorPickerOutput = exports.ColorPickerEyeDropper = exports.ColorPickerAlpha = exports.ColorPickerHue = exports.ColorPickerSelection = exports.ColorPicker = exports.useColorPicker = void 0;
66
- var react_1 = __importDefault(require("react"));
67
- var color_1 = __importDefault(require("color"));
68
- var lucide_react_1 = require("lucide-react");
69
- var radix_ui_1 = require("radix-ui");
70
- var react_2 = require("react");
71
- var button_1 = require("../../button");
72
- var input_1 = require("../../input");
73
- var label_1 = require("../../label");
74
- var select_1 = require("../../select");
75
- var utils_1 = require("../../../../lib/utils");
76
- var ColorPickerContext = (0, react_2.createContext)(undefined);
77
- var useColorPicker = function () {
78
- var context = (0, react_2.useContext)(ColorPickerContext);
79
- if (!context) {
80
- throw new Error("useColorPicker must be used within a ColorPickerProvider");
81
- }
82
- return context;
83
- };
84
- exports.useColorPicker = useColorPicker;
85
- var ColorPicker = function (_a) {
86
- var value = _a.value, _b = _a.defaultValue, defaultValue = _b === void 0 ? "#000000" : _b, onChange = _a.onChange, className = _a.className, error = _a.error, info = _a.info, label = _a.label, required = _a.required, id = _a.id, props = __rest(_a, ["value", "defaultValue", "onChange", "className", "error", "info", "label", "required", "id"]);
87
- var selectedColor = (0, color_1.default)(value);
88
- var defaultColor = (0, color_1.default)(defaultValue);
89
- var _c = (0, react_2.useState)(selectedColor.hue() || defaultColor.hue() || 0), hue = _c[0], setHue = _c[1];
90
- var _d = (0, react_2.useState)(selectedColor.saturationl() || defaultColor.saturationl() || 100), saturation = _d[0], setSaturation = _d[1];
91
- var _e = (0, react_2.useState)(selectedColor.lightness() || defaultColor.lightness() || 50), lightness = _e[0], setLightness = _e[1];
92
- var _f = (0, react_2.useState)(selectedColor.alpha() * 100 || defaultColor.alpha() * 100), alpha = _f[0], setAlpha = _f[1];
93
- var _g = (0, react_2.useState)("hex"), mode = _g[0], setMode = _g[1];
94
- // Determine if there's an error (for styling)
95
- var hasError = Boolean(error);
96
- // Update color when controlled value changes
97
- (0, react_2.useEffect)(function () {
98
- if (value) {
99
- var color = color_1.default.rgb(value).rgb().object();
100
- setHue(color.r);
101
- setSaturation(color.g);
102
- setLightness(color.b);
103
- setAlpha(color.a);
104
- }
105
- }, [value]);
106
- // Notify parent of changes
107
- (0, react_2.useEffect)(function () {
108
- if (onChange) {
109
- var color = color_1.default.hsl(hue, saturation, lightness).alpha(alpha / 100);
110
- var rgba = color.rgb().array();
111
- onChange([rgba[0], rgba[1], rgba[2], alpha / 100]);
112
- }
113
- }, [hue, saturation, lightness, alpha, onChange]);
114
- var colorPickerElement = (react_1.default.createElement(ColorPickerContext.Provider, { value: {
115
- hue: hue,
116
- saturation: saturation,
117
- lightness: lightness,
118
- alpha: alpha,
119
- mode: mode,
120
- setHue: setHue,
121
- setSaturation: setSaturation,
122
- setLightness: setLightness,
123
- setAlpha: setAlpha,
124
- setMode: setMode,
125
- } },
126
- react_1.default.createElement("div", __assign({ id: id, className: (0, utils_1.cn)("flex size-full flex-col gap-4",
127
- // Error state styling
128
- hasError && "border-destructive", className), "aria-invalid": hasError }, props))));
129
- // If label is provided, render the complete color picker with label structure
130
- if (label) {
131
- return (react_1.default.createElement("div", { className: "w-full space-y-2" },
132
- react_1.default.createElement(label_1.Label, { htmlFor: id, required: required }, label),
133
- colorPickerElement,
134
- (error || info) && (react_1.default.createElement("div", null, error ? (react_1.default.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (react_1.default.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
135
- }
136
- // If no label, render just the color picker with messages (backward compatibility)
137
- return (react_1.default.createElement("div", { className: "w-full" },
138
- colorPickerElement,
139
- (error || info) && (react_1.default.createElement("div", null, error ? (react_1.default.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (react_1.default.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
140
- };
141
- exports.ColorPicker = ColorPicker;
142
- exports.ColorPickerSelection = (0, react_2.memo)(function (_a) {
143
- var className = _a.className, props = __rest(_a, ["className"]);
144
- var containerRef = (0, react_2.useRef)(null);
145
- var _b = (0, react_2.useState)(false), isDragging = _b[0], setIsDragging = _b[1];
146
- var _c = (0, react_2.useState)(0), positionX = _c[0], setPositionX = _c[1];
147
- var _d = (0, react_2.useState)(0), positionY = _d[0], setPositionY = _d[1];
148
- var _e = (0, exports.useColorPicker)(), hue = _e.hue, setSaturation = _e.setSaturation, setLightness = _e.setLightness;
149
- var backgroundGradient = (0, react_2.useMemo)(function () {
150
- return "linear-gradient(0deg, rgba(0,0,0,1), rgba(0,0,0,0)),\n linear-gradient(90deg, rgba(255,255,255,1), rgba(255,255,255,0)),\n hsl(".concat(hue, ", 100%, 50%)");
151
- }, [hue]);
152
- var handlePointerMove = (0, react_2.useCallback)(function (event) {
153
- if (!(isDragging && containerRef.current)) {
154
- return;
155
- }
156
- var rect = containerRef.current.getBoundingClientRect();
157
- var x = Math.max(0, Math.min(1, (event.clientX - rect.left) / rect.width));
158
- var y = Math.max(0, Math.min(1, (event.clientY - rect.top) / rect.height));
159
- setPositionX(x);
160
- setPositionY(y);
161
- setSaturation(x * 100);
162
- var topLightness = x < 0.01 ? 100 : 50 + 50 * (1 - x);
163
- var lightness = topLightness * (1 - y);
164
- setLightness(lightness);
165
- }, [isDragging, setSaturation, setLightness]);
166
- (0, react_2.useEffect)(function () {
167
- var handlePointerUp = function () { return setIsDragging(false); };
168
- if (isDragging) {
169
- window.addEventListener("pointermove", handlePointerMove);
170
- window.addEventListener("pointerup", handlePointerUp);
171
- }
172
- return function () {
173
- window.removeEventListener("pointermove", handlePointerMove);
174
- window.removeEventListener("pointerup", handlePointerUp);
175
- };
176
- }, [isDragging, handlePointerMove]);
177
- return (react_1.default.createElement("div", __assign({ className: (0, utils_1.cn)("relative size-full cursor-crosshair rounded", className), onPointerDown: function (e) {
178
- e.preventDefault();
179
- setIsDragging(true);
180
- handlePointerMove(e.nativeEvent);
181
- }, ref: containerRef, style: {
182
- background: backgroundGradient,
183
- } }, props),
184
- react_1.default.createElement("div", { className: "-translate-x-1/2 -translate-y-1/2 pointer-events-none absolute h-4 w-4 rounded-full border-2 border-white", style: {
185
- left: "".concat(positionX * 100, "%"),
186
- top: "".concat(positionY * 100, "%"),
187
- boxShadow: "0 0 0 1px rgba(0,0,0,0.5)",
188
- } })));
189
- });
190
- exports.ColorPickerSelection.displayName = "ColorPickerSelection";
191
- var ColorPickerHue = function (_a) {
192
- var className = _a.className, props = __rest(_a, ["className"]);
193
- var _b = (0, exports.useColorPicker)(), hue = _b.hue, setHue = _b.setHue;
194
- return (react_1.default.createElement(radix_ui_1.Slider.Root, __assign({ className: (0, utils_1.cn)("relative flex h-4 w-full touch-none", className), max: 360, onValueChange: function (_a) {
195
- var hue = _a[0];
196
- return setHue(hue);
197
- }, step: 1, value: [hue] }, props),
198
- react_1.default.createElement(radix_ui_1.Slider.Track, { className: "relative my-0.5 h-3 w-full grow rounded-full bg-[linear-gradient(90deg,#FF0000,#FFFF00,#00FF00,#00FFFF,#0000FF,#FF00FF,#FF0000)]" },
199
- react_1.default.createElement(radix_ui_1.Slider.Range, { className: "absolute h-full" })),
200
- react_1.default.createElement(radix_ui_1.Slider.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })));
201
- };
202
- exports.ColorPickerHue = ColorPickerHue;
203
- var ColorPickerAlpha = function (_a) {
204
- var className = _a.className, props = __rest(_a, ["className"]);
205
- var _b = (0, exports.useColorPicker)(), alpha = _b.alpha, setAlpha = _b.setAlpha;
206
- return (react_1.default.createElement(radix_ui_1.Slider.Root, __assign({ className: (0, utils_1.cn)("relative flex h-4 w-full touch-none", className), max: 100, onValueChange: function (_a) {
207
- var alpha = _a[0];
208
- return setAlpha(alpha);
209
- }, step: 1, value: [alpha] }, props),
210
- react_1.default.createElement(radix_ui_1.Slider.Track, { className: "relative my-0.5 h-3 w-full grow rounded-full", style: {
211
- background: 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==") left center',
212
- } },
213
- react_1.default.createElement("div", { className: "absolute inset-0 rounded-full bg-gradient-to-r from-transparent to-black/50" }),
214
- react_1.default.createElement(radix_ui_1.Slider.Range, { className: "absolute h-full rounded-full bg-transparent" })),
215
- react_1.default.createElement(radix_ui_1.Slider.Thumb, { className: "block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50" })));
216
- };
217
- exports.ColorPickerAlpha = ColorPickerAlpha;
218
- var ColorPickerEyeDropper = function (_a) {
219
- var className = _a.className, props = __rest(_a, ["className"]);
220
- var _b = (0, exports.useColorPicker)(), setHue = _b.setHue, setSaturation = _b.setSaturation, setLightness = _b.setLightness, setAlpha = _b.setAlpha;
221
- var handleEyeDropper = function () { return __awaiter(void 0, void 0, void 0, function () {
222
- var eyeDropper, result, color, _a, h, s, l, error_1;
223
- return __generator(this, function (_b) {
224
- switch (_b.label) {
225
- case 0:
226
- _b.trys.push([0, 2, , 3]);
227
- eyeDropper = new EyeDropper();
228
- return [4 /*yield*/, eyeDropper.open()];
229
- case 1:
230
- result = _b.sent();
231
- color = (0, color_1.default)(result.sRGBHex);
232
- _a = color.hsl().array(), h = _a[0], s = _a[1], l = _a[2];
233
- setHue(h);
234
- setSaturation(s);
235
- setLightness(l);
236
- setAlpha(100);
237
- return [3 /*break*/, 3];
238
- case 2:
239
- error_1 = _b.sent();
240
- console.error("EyeDropper failed:", error_1);
241
- return [3 /*break*/, 3];
242
- case 3: return [2 /*return*/];
243
- }
244
- });
245
- }); };
246
- return (react_1.default.createElement(button_1.Button, __assign({ className: (0, utils_1.cn)("shrink-0 text-muted-foreground", className), onClick: handleEyeDropper, size: "icon", variant: "outline", type: "button" }, props),
247
- react_1.default.createElement(lucide_react_1.PipetteIcon, { size: 16 })));
248
- };
249
- exports.ColorPickerEyeDropper = ColorPickerEyeDropper;
250
- var formats = ["hex", "rgb", "css", "hsl"];
251
- var ColorPickerOutput = function (_a) {
252
- var className = _a.className, props = __rest(_a, ["className"]);
253
- var _b = (0, exports.useColorPicker)(), mode = _b.mode, setMode = _b.setMode;
254
- return (react_1.default.createElement(select_1.Select, { onValueChange: setMode, value: mode },
255
- react_1.default.createElement(select_1.SelectTrigger, __assign({ className: (0, utils_1.cn)("h-8 w-20 shrink-0 text-xs", className) }, props),
256
- react_1.default.createElement(select_1.SelectValue, { placeholder: "Mode" })),
257
- react_1.default.createElement(select_1.SelectContent, null, formats.map(function (format) { return (react_1.default.createElement(select_1.SelectItem, { className: "text-xs", key: format, value: format }, format.toUpperCase())); }))));
258
- };
259
- exports.ColorPickerOutput = ColorPickerOutput;
260
- var PercentageInput = function (_a) {
261
- var className = _a.className, props = __rest(_a, ["className"]);
262
- return (react_1.default.createElement("div", { className: "relative" },
263
- react_1.default.createElement(input_1.Input, __assign({ readOnly: true, type: "text" }, props, { className: (0, utils_1.cn)("h-8 w-[3.25rem] rounded-l-none bg-secondary px-2 text-xs shadow-none", className) })),
264
- react_1.default.createElement("span", { className: "-translate-y-1/2 absolute top-1/2 right-2 text-muted-foreground text-xs" }, "%")));
265
- };
266
- var ColorPickerFormat = function (_a) {
267
- var className = _a.className, props = __rest(_a, ["className"]);
268
- var _b = (0, exports.useColorPicker)(), hue = _b.hue, saturation = _b.saturation, lightness = _b.lightness, alpha = _b.alpha, mode = _b.mode;
269
- var color = color_1.default.hsl(hue, saturation, lightness, alpha / 100);
270
- if (mode === "hex") {
271
- var hex = color.hex();
272
- return (react_1.default.createElement("div", __assign({ className: (0, utils_1.cn)("-space-x-px relative flex w-full items-center rounded-md shadow-sm", className) }, props),
273
- react_1.default.createElement(input_1.Input, { className: "h-8 rounded-r-none bg-secondary px-2 text-xs shadow-none", readOnly: true, type: "text", value: hex }),
274
- react_1.default.createElement(PercentageInput, { value: alpha })));
275
- }
276
- if (mode === "rgb") {
277
- var rgb = color
278
- .rgb()
279
- .array()
280
- .map(function (value) { return Math.round(value); });
281
- return (react_1.default.createElement("div", __assign({ className: (0, utils_1.cn)("-space-x-px flex items-center rounded-md shadow-sm", className) }, props),
282
- rgb.map(function (value, index) { return (react_1.default.createElement(input_1.Input, { className: (0, utils_1.cn)("h-8 rounded-r-none bg-secondary px-2 text-xs shadow-none", index && "rounded-l-none", className), key: index, readOnly: true, type: "text", value: value })); }),
283
- react_1.default.createElement(PercentageInput, { value: alpha })));
284
- }
285
- if (mode === "css") {
286
- var rgb = color
287
- .rgb()
288
- .array()
289
- .map(function (value) { return Math.round(value); });
290
- return (react_1.default.createElement("div", __assign({ className: (0, utils_1.cn)("w-full rounded-md shadow-sm", className) }, props),
291
- react_1.default.createElement(input_1.Input, __assign({ className: "h-8 w-full bg-secondary px-2 text-xs shadow-none", readOnly: true, type: "text", value: "rgba(".concat(rgb.join(", "), ", ").concat(alpha, "%)") }, props))));
292
- }
293
- if (mode === "hsl") {
294
- var hsl = color
295
- .hsl()
296
- .array()
297
- .map(function (value) { return Math.round(value); });
298
- return (react_1.default.createElement("div", __assign({ className: (0, utils_1.cn)("-space-x-px flex items-center rounded-md shadow-sm", className) }, props),
299
- hsl.map(function (value, index) { return (react_1.default.createElement(input_1.Input, { className: (0, utils_1.cn)("h-8 rounded-r-none bg-secondary px-2 text-xs shadow-none", index && "rounded-l-none", className), key: index, readOnly: true, type: "text", value: value })); }),
300
- react_1.default.createElement(PercentageInput, { value: alpha })));
301
- }
302
- return null;
303
- };
304
- exports.ColorPickerFormat = ColorPickerFormat;
@@ -1,19 +0,0 @@
1
- import React, { ReactNode } from "react";
2
- import type { DropEvent, DropzoneOptions, FileRejection } from "react-dropzone";
3
- export type DropzoneProps = Omit<DropzoneOptions, "onDrop"> & {
4
- src?: File[];
5
- className?: string;
6
- onDrop?: (acceptedFiles: File[], fileRejections: FileRejection[], event: DropEvent) => void;
7
- children?: ReactNode;
8
- };
9
- export declare const Dropzone: ({ accept, maxFiles, maxSize, minSize, onDrop, onError, disabled, src, className, children, ...props }: DropzoneProps) => React.JSX.Element;
10
- export type DropzoneContentProps = {
11
- children?: ReactNode;
12
- className?: string;
13
- };
14
- export declare const DropzoneContent: ({ children, className, }: DropzoneContentProps) => string | number | bigint | true | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
15
- export type DropzoneEmptyStateProps = {
16
- children?: ReactNode;
17
- className?: string;
18
- };
19
- export declare const DropzoneEmptyState: ({ children, className, }: DropzoneEmptyStateProps) => string | number | bigint | true | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null;
@@ -1,131 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __rest = (this && this.__rest) || function (s, e) {
15
- var t = {};
16
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
- t[p] = s[p];
18
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
21
- t[p[i]] = s[p[i]];
22
- }
23
- return t;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DropzoneEmptyState = exports.DropzoneContent = exports.Dropzone = void 0;
30
- var lucide_react_1 = require("lucide-react");
31
- var react_1 = __importDefault(require("react"));
32
- var react_2 = require("react");
33
- var react_dropzone_1 = require("react-dropzone");
34
- var button_1 = require("../../button");
35
- var utils_1 = require("../../../../lib/utils");
36
- var renderBytes = function (bytes) {
37
- var units = ["B", "KB", "MB", "GB", "TB", "PB"];
38
- var size = bytes;
39
- var unitIndex = 0;
40
- while (size >= 1024 && unitIndex < units.length - 1) {
41
- size /= 1024;
42
- unitIndex++;
43
- }
44
- return "".concat(size.toFixed(2)).concat(units[unitIndex]);
45
- };
46
- var DropzoneContext = (0, react_2.createContext)(undefined);
47
- var Dropzone = function (_a) {
48
- var accept = _a.accept, _b = _a.maxFiles, maxFiles = _b === void 0 ? 1 : _b, maxSize = _a.maxSize, minSize = _a.minSize, onDrop = _a.onDrop, onError = _a.onError, disabled = _a.disabled, src = _a.src, className = _a.className, children = _a.children, props = __rest(_a, ["accept", "maxFiles", "maxSize", "minSize", "onDrop", "onError", "disabled", "src", "className", "children"]);
49
- var _c = (0, react_dropzone_1.useDropzone)(__assign({ accept: accept, maxFiles: maxFiles, maxSize: maxSize, minSize: minSize, onError: onError, disabled: disabled, onDrop: function (acceptedFiles, fileRejections, event) {
50
- var _a, _b;
51
- if (fileRejections.length > 0) {
52
- var message = (_b = (_a = fileRejections.at(0)) === null || _a === void 0 ? void 0 : _a.errors.at(0)) === null || _b === void 0 ? void 0 : _b.message;
53
- onError === null || onError === void 0 ? void 0 : onError(new Error(message));
54
- return;
55
- }
56
- onDrop === null || onDrop === void 0 ? void 0 : onDrop(acceptedFiles, fileRejections, event);
57
- } }, props)), getRootProps = _c.getRootProps, getInputProps = _c.getInputProps, isDragActive = _c.isDragActive;
58
- return (react_1.default.createElement(DropzoneContext.Provider, { key: JSON.stringify(src), value: { src: src, accept: accept, maxSize: maxSize, minSize: minSize, maxFiles: maxFiles } },
59
- react_1.default.createElement(button_1.Button, __assign({ className: (0, utils_1.cn)("relative h-auto w-full flex-col overflow-hidden p-8", isDragActive && "outline-none ring-1 ring-ring", className), disabled: disabled, type: "button", variant: "outline" }, getRootProps()),
60
- react_1.default.createElement("input", __assign({}, getInputProps(), { disabled: disabled })),
61
- children)));
62
- };
63
- exports.Dropzone = Dropzone;
64
- var maxLabelItems = 3;
65
- var DropzoneContent = function (_a) {
66
- var children = _a.children, className = _a.className;
67
- // Use useContext directly here so the component is safe to render even when
68
- // there is no surrounding <Dropzone /> provider (avoids an exception during
69
- // SSR or when a consumer imports DropzoneContent standalone).
70
- var context = (0, react_2.useContext)(DropzoneContext);
71
- if (!context) {
72
- return null;
73
- }
74
- var src = context.src;
75
- if (!src) {
76
- return null;
77
- }
78
- if (children) {
79
- return children;
80
- }
81
- return (react_1.default.createElement("div", { className: (0, utils_1.cn)("flex flex-col items-center justify-center", className) },
82
- react_1.default.createElement("div", { className: "flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground" },
83
- react_1.default.createElement(lucide_react_1.UploadIcon, { size: 16 })),
84
- react_1.default.createElement("p", { className: "my-2 w-full truncate font-medium text-sm" }, src.length > maxLabelItems
85
- ? "".concat(new Intl.ListFormat("en").format(src.slice(0, maxLabelItems).map(function (file) { return file.name; })), " and ").concat(src.length - maxLabelItems, " more")
86
- : new Intl.ListFormat("en").format(src.map(function (file) { return file.name; }))),
87
- react_1.default.createElement("p", { className: "w-full text-wrap text-muted-foreground text-xs" }, "Drag and drop or click to replace")));
88
- };
89
- exports.DropzoneContent = DropzoneContent;
90
- var DropzoneEmptyState = function (_a) {
91
- var children = _a.children, className = _a.className;
92
- // Read context directly and return null when a Dropzone provider isn't
93
- // present. This keeps the empty state component safe to import and render
94
- // without requiring the wrapping Dropzone component.
95
- var context = (0, react_2.useContext)(DropzoneContext);
96
- if (!context) {
97
- return null;
98
- }
99
- var src = context.src, accept = context.accept, maxSize = context.maxSize, minSize = context.minSize, maxFiles = context.maxFiles;
100
- if (src) {
101
- return null;
102
- }
103
- if (children) {
104
- return children;
105
- }
106
- var caption = "";
107
- if (accept) {
108
- caption += "Accepts ";
109
- caption += new Intl.ListFormat("en").format(Object.keys(accept));
110
- }
111
- if (minSize && maxSize) {
112
- caption += " between ".concat(renderBytes(minSize), " and ").concat(renderBytes(maxSize));
113
- }
114
- else if (minSize) {
115
- caption += " at least ".concat(renderBytes(minSize));
116
- }
117
- else if (maxSize) {
118
- caption += " less than ".concat(renderBytes(maxSize));
119
- }
120
- return (react_1.default.createElement("div", { className: (0, utils_1.cn)("flex flex-col items-center justify-center", className) },
121
- react_1.default.createElement("div", { className: "flex size-8 items-center justify-center rounded-md bg-muted text-muted-foreground" },
122
- react_1.default.createElement(lucide_react_1.UploadIcon, { size: 16 })),
123
- react_1.default.createElement("p", { className: "my-2 w-full truncate text-wrap font-medium text-sm" },
124
- "Upload ",
125
- maxFiles === 1 ? "a file" : "files"),
126
- react_1.default.createElement("p", { className: "w-full truncate text-wrap text-muted-foreground text-xs" }, "Drag and drop or click to upload"),
127
- caption && (react_1.default.createElement("p", { className: "text-wrap text-muted-foreground text-xs" },
128
- caption,
129
- "."))));
130
- };
131
- exports.DropzoneEmptyState = DropzoneEmptyState;
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import { ToasterProps } from "sonner";
3
- declare const Toaster: ({ ...props }: ToasterProps) => React.JSX.Element;
4
- export { Toaster };
@@ -1,54 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __rest = (this && this.__rest) || function (s, e) {
15
- var t = {};
16
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
17
- t[p] = s[p];
18
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
19
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
20
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
21
- t[p[i]] = s[p[i]];
22
- }
23
- return t;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Toaster = void 0;
30
- var react_1 = __importDefault(require("react"));
31
- var next_themes_1 = require("next-themes");
32
- var sonner_1 = require("sonner");
33
- var Toaster = function (_a) {
34
- var props = __rest(_a, []);
35
- var _b = (0, next_themes_1.useTheme)().theme, theme = _b === void 0 ? "system" : _b;
36
- return (react_1.default.createElement(sonner_1.Toaster, __assign({ theme: theme, position: "bottom-right", expand: true, richColors: true, closeButton: true, className: "toaster group", style: {
37
- "--normal-bg": "var(--popover)",
38
- "--normal-text": "var(--popover-foreground)",
39
- "--normal-border": "var(--border)",
40
- }, toastOptions: {
41
- classNames: {
42
- toast: "group toast group-[.toaster]:bg-popover group-[.toaster]:text-popover-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:rounded-lg group-[.toaster]:backdrop-blur-md group-[.toaster]:bg-opacity-95",
43
- description: "group-[.toast]:text-muted-foreground group-[.toast]:text-sm",
44
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground group-[.toast]:hover:bg-primary/90",
45
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground group-[.toast]:hover:bg-muted/90",
46
- closeButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground group-[.toast]:border-border group-[.toast]:hover:bg-destructive group-[.toast]:hover:text-destructive-foreground group-[.toast]:hover:border-destructive group-[.toast]:focus:bg-destructive group-[.toast]:focus:text-destructive-foreground group-[.toast]:focus:border-destructive group-[.toast]:focus:outline-none group-[.toast]:focus:ring-2 group-[.toast]:focus:ring-destructive group-[.toast]:focus:ring-offset-2 group-[.toast]:focus:ring-offset-popover group-[.toast]:transition-all group-[.toast]:duration-200 group-[.toast]:ease-in-out group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:shadow-md group-[.toast]:active:scale-95 group-[.toast]:hover:shadow-lg group-[.toast]:backdrop-blur-sm",
47
- },
48
- style: {
49
- minWidth: "320px",
50
- maxWidth: "420px",
51
- },
52
- } }, props)));
53
- };
54
- exports.Toaster = Toaster;
@@ -1,9 +0,0 @@
1
- import * as React from "react";
2
- import * as SwitchPrimitive from "@radix-ui/react-switch";
3
- interface SwitchProps extends React.ComponentProps<typeof SwitchPrimitive.Root> {
4
- error?: string;
5
- info?: string;
6
- label?: string;
7
- }
8
- declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
9
- export { Switch };
@@ -1,89 +0,0 @@
1
- "use client";
2
- "use strict";
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
- var __rest = (this && this.__rest) || function (s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- };
58
- Object.defineProperty(exports, "__esModule", { value: true });
59
- exports.Switch = void 0;
60
- var React = __importStar(require("react"));
61
- var SwitchPrimitive = __importStar(require("@radix-ui/react-switch"));
62
- var utils_1 = require("../../lib/utils");
63
- var label_1 = require("./label");
64
- var Switch = React.forwardRef(function (_a, ref) {
65
- var className = _a.className, error = _a.error, info = _a.info, label = _a.label, required = _a.required, id = _a.id, props = __rest(_a, ["className", "error", "info", "label", "required", "id"]);
66
- // Determine if there's an error (for aria-invalid and styling)
67
- var hasError = Boolean(error);
68
- var switchElement = (React.createElement(SwitchPrimitive.Root, __assign({ ref: ref, id: id, "data-slot": "switch", "aria-invalid": hasError, required: required, className: (0, utils_1.cn)("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
69
- // Error state styling
70
- hasError &&
71
- "data-[state=checked]:bg-destructive data-[state=unchecked]:bg-destructive/20 border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20", className) }, props),
72
- React.createElement(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: (0, utils_1.cn)("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
73
- // Error state thumb styling
74
- hasError && "dark:data-[state=checked]:bg-destructive-foreground") })));
75
- // If label is provided, render the complete switch with label structure
76
- if (label) {
77
- return (React.createElement("div", { className: "w-full space-y-2" },
78
- React.createElement("div", { className: "flex items-center justify-between space-x-2" },
79
- React.createElement(label_1.Label, { htmlFor: id, required: required }, label),
80
- switchElement),
81
- (error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
82
- }
83
- // If no label, render just the switch with messages (backward compatibility)
84
- return (React.createElement("div", { className: "w-full" },
85
- switchElement,
86
- (error || info) && (React.createElement("div", null, error ? (React.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (React.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
87
- });
88
- exports.Switch = Switch;
89
- Switch.displayName = SwitchPrimitive.Root.displayName;
@@ -1,10 +0,0 @@
1
- import * as React from "react";
2
- declare function Table({ className, ...props }: React.ComponentProps<"table">): React.JSX.Element;
3
- declare function TableHeader({ className, ...props }: React.ComponentProps<"thead">): React.JSX.Element;
4
- declare function TableBody({ className, ...props }: React.ComponentProps<"tbody">): React.JSX.Element;
5
- declare function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">): React.JSX.Element;
6
- declare function TableRow({ className, ...props }: React.ComponentProps<"tr">): React.JSX.Element;
7
- declare function TableHead({ className, ...props }: React.ComponentProps<"th">): React.JSX.Element;
8
- declare function TableCell({ className, ...props }: React.ComponentProps<"td">): React.JSX.Element;
9
- declare function TableCaption({ className, ...props }: React.ComponentProps<"caption">): React.JSX.Element;
10
- export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };