@goplusvn/core 0.1.1 → 0.1.3

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 (223) hide show
  1. package/package.json +31 -175
  2. package/dist/audit/index.d.mts +0 -115
  3. package/dist/audit/index.d.ts +0 -115
  4. package/dist/audit/index.js +0 -204
  5. package/dist/audit/index.js.map +0 -1
  6. package/dist/audit/index.mjs +0 -200
  7. package/dist/audit/index.mjs.map +0 -1
  8. package/dist/auth/index.d.mts +0 -86
  9. package/dist/auth/index.d.ts +0 -86
  10. package/dist/auth/index.js +0 -210
  11. package/dist/auth/index.js.map +0 -1
  12. package/dist/auth/index.mjs +0 -198
  13. package/dist/auth/index.mjs.map +0 -1
  14. package/dist/button-1dWvP9Ib.d.mts +0 -30
  15. package/dist/button-1dWvP9Ib.d.ts +0 -30
  16. package/dist/calendar-2QzdEo1z.d.mts +0 -20
  17. package/dist/calendar-2QzdEo1z.d.ts +0 -20
  18. package/dist/code-generation/index.d.mts +0 -30
  19. package/dist/code-generation/index.d.ts +0 -30
  20. package/dist/code-generation/index.js +0 -31
  21. package/dist/code-generation/index.js.map +0 -1
  22. package/dist/code-generation/index.mjs +0 -28
  23. package/dist/code-generation/index.mjs.map +0 -1
  24. package/dist/configs/index.d.mts +0 -175
  25. package/dist/configs/index.d.ts +0 -175
  26. package/dist/configs/index.js +0 -254
  27. package/dist/configs/index.js.map +0 -1
  28. package/dist/configs/index.mjs +0 -233
  29. package/dist/configs/index.mjs.map +0 -1
  30. package/dist/crud/index.d.mts +0 -646
  31. package/dist/crud/index.d.ts +0 -646
  32. package/dist/crud/index.js +0 -11772
  33. package/dist/crud/index.js.map +0 -1
  34. package/dist/crud/index.mjs +0 -11665
  35. package/dist/crud/index.mjs.map +0 -1
  36. package/dist/crud/server.d.mts +0 -20
  37. package/dist/crud/server.d.ts +0 -20
  38. package/dist/crud/server.js +0 -123
  39. package/dist/crud/server.js.map +0 -1
  40. package/dist/crud/server.mjs +0 -120
  41. package/dist/crud/server.mjs.map +0 -1
  42. package/dist/data-table-skeleton-12NA8Mjx.d.mts +0 -39
  43. package/dist/data-table-skeleton-12NA8Mjx.d.ts +0 -39
  44. package/dist/dialog-bKfjZMTd.d.mts +0 -22
  45. package/dist/dialog-bKfjZMTd.d.ts +0 -22
  46. package/dist/dynamic-icon-DrGIiu2N.d.mts +0 -10
  47. package/dist/dynamic-icon-DrGIiu2N.d.ts +0 -10
  48. package/dist/home/index.d.mts +0 -269
  49. package/dist/home/index.d.ts +0 -269
  50. package/dist/home/index.js +0 -1678
  51. package/dist/home/index.js.map +0 -1
  52. package/dist/home/index.mjs +0 -1635
  53. package/dist/home/index.mjs.map +0 -1
  54. package/dist/hooks/index.d.mts +0 -7
  55. package/dist/hooks/index.d.ts +0 -7
  56. package/dist/hooks/index.js +0 -8316
  57. package/dist/hooks/index.js.map +0 -1
  58. package/dist/hooks/index.mjs +0 -8255
  59. package/dist/hooks/index.mjs.map +0 -1
  60. package/dist/index-50hpiPrV.d.ts +0 -116
  61. package/dist/index-B9zQVEVi.d.mts +0 -116
  62. package/dist/index.d.mts +0 -5
  63. package/dist/index.d.ts +0 -5
  64. package/dist/index.js +0 -123
  65. package/dist/index.js.map +0 -1
  66. package/dist/index.mjs +0 -118
  67. package/dist/index.mjs.map +0 -1
  68. package/dist/infrastructure/index.d.mts +0 -423
  69. package/dist/infrastructure/index.d.ts +0 -423
  70. package/dist/infrastructure/index.js +0 -633
  71. package/dist/infrastructure/index.js.map +0 -1
  72. package/dist/infrastructure/index.mjs +0 -619
  73. package/dist/infrastructure/index.mjs.map +0 -1
  74. package/dist/label-DWTEkNPo.d.ts +0 -226
  75. package/dist/label-LPpdcoBx.d.mts +0 -226
  76. package/dist/layout/index.d.mts +0 -48
  77. package/dist/layout/index.d.ts +0 -48
  78. package/dist/layout/index.js +0 -117
  79. package/dist/layout/index.js.map +0 -1
  80. package/dist/layout/index.mjs +0 -90
  81. package/dist/layout/index.mjs.map +0 -1
  82. package/dist/navigation/index.d.mts +0 -16
  83. package/dist/navigation/index.d.ts +0 -16
  84. package/dist/navigation/index.js +0 -53
  85. package/dist/navigation/index.js.map +0 -1
  86. package/dist/navigation/index.mjs +0 -50
  87. package/dist/navigation/index.mjs.map +0 -1
  88. package/dist/notification/index.d.mts +0 -105
  89. package/dist/notification/index.d.ts +0 -105
  90. package/dist/notification/index.js +0 -278
  91. package/dist/notification/index.js.map +0 -1
  92. package/dist/notification/index.mjs +0 -274
  93. package/dist/notification/index.mjs.map +0 -1
  94. package/dist/organization/index.d.mts +0 -99
  95. package/dist/organization/index.d.ts +0 -99
  96. package/dist/organization/index.js +0 -360
  97. package/dist/organization/index.js.map +0 -1
  98. package/dist/organization/index.mjs +0 -352
  99. package/dist/organization/index.mjs.map +0 -1
  100. package/dist/plugin/index.d.mts +0 -83
  101. package/dist/plugin/index.d.ts +0 -83
  102. package/dist/plugin/index.js +0 -86
  103. package/dist/plugin/index.js.map +0 -1
  104. package/dist/plugin/index.mjs +0 -84
  105. package/dist/plugin/index.mjs.map +0 -1
  106. package/dist/providers/index.d.mts +0 -25
  107. package/dist/providers/index.d.ts +0 -25
  108. package/dist/providers/index.js +0 -84
  109. package/dist/providers/index.js.map +0 -1
  110. package/dist/providers/index.mjs +0 -77
  111. package/dist/providers/index.mjs.map +0 -1
  112. package/dist/rbac/index.d.mts +0 -226
  113. package/dist/rbac/index.d.ts +0 -226
  114. package/dist/rbac/index.js +0 -4784
  115. package/dist/rbac/index.js.map +0 -1
  116. package/dist/rbac/index.mjs +0 -4722
  117. package/dist/rbac/index.mjs.map +0 -1
  118. package/dist/rbac/permissions.d.mts +0 -26
  119. package/dist/rbac/permissions.d.ts +0 -26
  120. package/dist/rbac/permissions.js +0 -94
  121. package/dist/rbac/permissions.js.map +0 -1
  122. package/dist/rbac/permissions.mjs +0 -90
  123. package/dist/rbac/permissions.mjs.map +0 -1
  124. package/dist/rbac/server.d.mts +0 -1
  125. package/dist/rbac/server.d.ts +0 -1
  126. package/dist/rbac/server.js +0 -128
  127. package/dist/rbac/server.js.map +0 -1
  128. package/dist/rbac/server.mjs +0 -124
  129. package/dist/rbac/server.mjs.map +0 -1
  130. package/dist/schemas/index.d.mts +0 -1257
  131. package/dist/schemas/index.d.ts +0 -1257
  132. package/dist/schemas/index.js +0 -572
  133. package/dist/schemas/index.js.map +0 -1
  134. package/dist/schemas/index.mjs +0 -523
  135. package/dist/schemas/index.mjs.map +0 -1
  136. package/dist/server-QuYCTa89.d.mts +0 -83
  137. package/dist/server-QuYCTa89.d.ts +0 -83
  138. package/dist/sonner-C74GlRDQ.d.mts +0 -71
  139. package/dist/sonner-C74GlRDQ.d.ts +0 -71
  140. package/dist/status-BOXZgIqX.d.mts +0 -12
  141. package/dist/status-BOXZgIqX.d.ts +0 -12
  142. package/dist/system/index.d.mts +0 -77
  143. package/dist/system/index.d.ts +0 -77
  144. package/dist/system/index.js +0 -102
  145. package/dist/system/index.js.map +0 -1
  146. package/dist/system/index.mjs +0 -100
  147. package/dist/system/index.mjs.map +0 -1
  148. package/dist/tabs-C6FfBwPY.d.mts +0 -18
  149. package/dist/tabs-C6FfBwPY.d.ts +0 -18
  150. package/dist/tenant-provider-B8eC_Wpb.d.mts +0 -27
  151. package/dist/tenant-provider-B8eC_Wpb.d.ts +0 -27
  152. package/dist/types/index.d.mts +0 -469
  153. package/dist/types/index.d.ts +0 -469
  154. package/dist/types/index.js +0 -25
  155. package/dist/types/index.js.map +0 -1
  156. package/dist/types/index.mjs +0 -21
  157. package/dist/types/index.mjs.map +0 -1
  158. package/dist/ui/auth.d.mts +0 -39
  159. package/dist/ui/auth.d.ts +0 -39
  160. package/dist/ui/auth.js +0 -4941
  161. package/dist/ui/auth.js.map +0 -1
  162. package/dist/ui/auth.mjs +0 -4896
  163. package/dist/ui/auth.mjs.map +0 -1
  164. package/dist/ui/crud.d.mts +0 -2
  165. package/dist/ui/crud.d.ts +0 -2
  166. package/dist/ui/crud.js +0 -4
  167. package/dist/ui/crud.js.map +0 -1
  168. package/dist/ui/crud.mjs +0 -3
  169. package/dist/ui/crud.mjs.map +0 -1
  170. package/dist/ui/data-display.d.mts +0 -596
  171. package/dist/ui/data-display.d.ts +0 -596
  172. package/dist/ui/data-display.js +0 -5307
  173. package/dist/ui/data-display.js.map +0 -1
  174. package/dist/ui/data-display.mjs +0 -5212
  175. package/dist/ui/data-display.mjs.map +0 -1
  176. package/dist/ui/feedback.d.mts +0 -55
  177. package/dist/ui/feedback.d.ts +0 -55
  178. package/dist/ui/feedback.js +0 -2608
  179. package/dist/ui/feedback.js.map +0 -1
  180. package/dist/ui/feedback.mjs +0 -2526
  181. package/dist/ui/feedback.mjs.map +0 -1
  182. package/dist/ui/forms.d.mts +0 -309
  183. package/dist/ui/forms.d.ts +0 -309
  184. package/dist/ui/forms.js +0 -4656
  185. package/dist/ui/forms.js.map +0 -1
  186. package/dist/ui/forms.mjs +0 -4571
  187. package/dist/ui/forms.mjs.map +0 -1
  188. package/dist/ui/index.d.mts +0 -331
  189. package/dist/ui/index.d.ts +0 -331
  190. package/dist/ui/index.js +0 -16953
  191. package/dist/ui/index.js.map +0 -1
  192. package/dist/ui/index.mjs +0 -16598
  193. package/dist/ui/index.mjs.map +0 -1
  194. package/dist/ui/primitives/client.d.mts +0 -61
  195. package/dist/ui/primitives/client.d.ts +0 -61
  196. package/dist/ui/primitives/client.js +0 -3408
  197. package/dist/ui/primitives/client.js.map +0 -1
  198. package/dist/ui/primitives/client.mjs +0 -3256
  199. package/dist/ui/primitives/client.mjs.map +0 -1
  200. package/dist/ui/primitives.d.mts +0 -113
  201. package/dist/ui/primitives.d.ts +0 -113
  202. package/dist/ui/primitives.js +0 -3356
  203. package/dist/ui/primitives.js.map +0 -1
  204. package/dist/ui/primitives.mjs +0 -3227
  205. package/dist/ui/primitives.mjs.map +0 -1
  206. package/dist/user/index.d.mts +0 -228
  207. package/dist/user/index.d.ts +0 -228
  208. package/dist/user/index.js +0 -4306
  209. package/dist/user/index.js.map +0 -1
  210. package/dist/user/index.mjs +0 -4260
  211. package/dist/user/index.mjs.map +0 -1
  212. package/dist/utils/index.d.mts +0 -205
  213. package/dist/utils/index.d.ts +0 -205
  214. package/dist/utils/index.js +0 -574
  215. package/dist/utils/index.js.map +0 -1
  216. package/dist/utils/index.mjs +0 -514
  217. package/dist/utils/index.mjs.map +0 -1
  218. package/dist/workflow/index.d.mts +0 -40
  219. package/dist/workflow/index.d.ts +0 -40
  220. package/dist/workflow/index.js +0 -3710
  221. package/dist/workflow/index.js.map +0 -1
  222. package/dist/workflow/index.mjs +0 -3677
  223. package/dist/workflow/index.mjs.map +0 -1
package/dist/ui/forms.js DELETED
@@ -1,4656 +0,0 @@
1
- 'use strict';
2
-
3
- var clsx = require('clsx');
4
- var tailwindMerge = require('tailwind-merge');
5
- var React12 = require('react');
6
- var classVarianceAuthority = require('class-variance-authority');
7
- var reactSlot = require('@radix-ui/react-slot');
8
- var jsxRuntime = require('react/jsx-runtime');
9
- var lucideReact = require('lucide-react');
10
- var reactDayPicker = require('react-day-picker');
11
- var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
12
- require('@radix-ui/react-select');
13
- var PopoverPrimitive = require('@radix-ui/react-popover');
14
- require('@radix-ui/react-dropdown-menu');
15
- require('@radix-ui/react-switch');
16
- var CheckboxPrimitive = require('@radix-ui/react-checkbox');
17
- var LabelPrimitive = require('@radix-ui/react-label');
18
- var TooltipPrimitive = require('@radix-ui/react-tooltip');
19
- var reactUse = require('react-use');
20
- var reactDirection = require('@radix-ui/react-direction');
21
- var DialogPrimitive = require('@radix-ui/react-dialog');
22
- var TabsPrimitive = require('@radix-ui/react-tabs');
23
- require('next/link');
24
- require('react-resizable-panels');
25
- require('@radix-ui/react-slider');
26
- require('@radix-ui/react-menubar');
27
- require('@radix-ui/react-navigation-menu');
28
- var TogglePrimitive = require('@radix-ui/react-toggle');
29
- require('@radix-ui/react-toggle-group');
30
- require('@radix-ui/react-progress');
31
- require('@radix-ui/react-context-menu');
32
- require('vaul');
33
- require('sonner');
34
- require('@radix-ui/react-alert-dialog');
35
- require('next/navigation');
36
- var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
37
- var cmdk = require('cmdk');
38
- var dateFns = require('date-fns');
39
- var dynamic = require('next/dynamic');
40
- var emojiPickerReact = require('emoji-picker-react');
41
- var Image = require('next/image');
42
- var reactDropzone = require('react-dropzone');
43
- var inputOtp = require('input-otp');
44
- var RPNInputPrimitive = require('react-phone-number-input');
45
- var Color = require('@tiptap/extension-color');
46
- var Image3 = require('@tiptap/extension-image');
47
- var Link4 = require('@tiptap/extension-link');
48
- var Placeholder = require('@tiptap/extension-placeholder');
49
- var TextAlign = require('@tiptap/extension-text-align');
50
- var TextStyle = require('@tiptap/extension-text-style');
51
- var Typography = require('@tiptap/extension-typography');
52
- var Underline = require('@tiptap/extension-underline');
53
- var react = require('@tiptap/react');
54
- var StarterKit = require('@tiptap/starter-kit');
55
- var reactHookForm = require('react-hook-form');
56
-
57
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
58
-
59
- function _interopNamespace(e) {
60
- if (e && e.__esModule) return e;
61
- var n = Object.create(null);
62
- if (e) {
63
- Object.keys(e).forEach(function (k) {
64
- if (k !== 'default') {
65
- var d = Object.getOwnPropertyDescriptor(e, k);
66
- Object.defineProperty(n, k, d.get ? d : {
67
- enumerable: true,
68
- get: function () { return e[k]; }
69
- });
70
- }
71
- });
72
- }
73
- n.default = e;
74
- return Object.freeze(n);
75
- }
76
-
77
- var React12__namespace = /*#__PURE__*/_interopNamespace(React12);
78
- var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
79
- var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
80
- var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
81
- var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
82
- var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
83
- var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
84
- var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
85
- var TogglePrimitive__namespace = /*#__PURE__*/_interopNamespace(TogglePrimitive);
86
- var RadioGroupPrimitive__namespace = /*#__PURE__*/_interopNamespace(RadioGroupPrimitive);
87
- var dynamic__default = /*#__PURE__*/_interopDefault(dynamic);
88
- var Image__default = /*#__PURE__*/_interopDefault(Image);
89
- var RPNInputPrimitive__namespace = /*#__PURE__*/_interopNamespace(RPNInputPrimitive);
90
- var Color__default = /*#__PURE__*/_interopDefault(Color);
91
- var Image3__default = /*#__PURE__*/_interopDefault(Image3);
92
- var Link4__default = /*#__PURE__*/_interopDefault(Link4);
93
- var Placeholder__default = /*#__PURE__*/_interopDefault(Placeholder);
94
- var TextAlign__default = /*#__PURE__*/_interopDefault(TextAlign);
95
- var TextStyle__default = /*#__PURE__*/_interopDefault(TextStyle);
96
- var Typography__default = /*#__PURE__*/_interopDefault(Typography);
97
- var Underline__default = /*#__PURE__*/_interopDefault(Underline);
98
- var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
99
-
100
- var __getOwnPropNames = Object.getOwnPropertyNames;
101
- var __esm = (fn, res) => function __init() {
102
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
103
- };
104
- function cn(...inputs) {
105
- return tailwindMerge.twMerge(clsx.clsx(inputs));
106
- }
107
- function formatFileSize(bytes, decimals = 2) {
108
- if (bytes === 0) return "0 Bytes";
109
- const k = 1e3;
110
- const dm = decimals < 0 ? 0 : decimals;
111
- const sizes2 = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
112
- const i = Math.floor(Math.log(bytes) / Math.log(k));
113
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes2[i];
114
- }
115
- function wait(ms = 250) {
116
- return new Promise((resolve) => setTimeout(resolve, ms));
117
- }
118
- function timeToDate(timeString, baseDate = /* @__PURE__ */ new Date()) {
119
- if (!/^\d{2}:\d{2}$/.test(timeString)) {
120
- throw new Error("Invalid time format. Use 'HH:mm'.");
121
- }
122
- const [hours, minutes] = timeString.split(":").map(Number);
123
- const date = new Date(baseDate);
124
- date.setHours(hours, minutes, 0, 0);
125
- return date;
126
- }
127
- var Logger;
128
- var init_utils = __esm({
129
- "src/utils/index.ts"() {
130
- Logger = class {
131
- log(level, message, context, error) {
132
- const entry = {
133
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
134
- level,
135
- message,
136
- context
137
- };
138
- if (error instanceof Error) {
139
- entry.error = {
140
- name: error.name,
141
- message: error.message,
142
- stack: error.stack
143
- };
144
- } else if (error) {
145
- entry.error = error;
146
- }
147
- const logString = JSON.stringify(entry);
148
- switch (level) {
149
- case "error":
150
- console.error(logString);
151
- break;
152
- case "warn":
153
- console.warn(logString);
154
- break;
155
- case "debug":
156
- if (process.env.NODE_ENV === "development") console.debug(logString);
157
- break;
158
- default:
159
- console.log(logString);
160
- }
161
- }
162
- info(message, context) {
163
- this.log("info", message, context);
164
- }
165
- warn(message, context) {
166
- this.log("warn", message, context);
167
- }
168
- error(message, error, context) {
169
- this.log("error", message, context, error);
170
- }
171
- debug(message, context) {
172
- this.log("debug", message, context);
173
- }
174
- };
175
- new Logger();
176
- }
177
- });
178
- var buttonVariants, Button;
179
- var init_button = __esm({
180
- "src/ui/primitives/button.tsx"() {
181
- init_utils();
182
- buttonVariants = classVarianceAuthority.cva(
183
- "inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
184
- {
185
- variants: {
186
- variant: {
187
- // Existing variants (backwards-compatible)
188
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
189
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
190
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
191
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
192
- ghost: "hover:bg-accent hover:text-accent-foreground",
193
- link: "text-primary underline-offset-4 hover:underline",
194
- // New Plane-inspired variants using semantic tokens
195
- accent: "bg-accent-primary text-text-on-color hover:bg-accent-primary-hover active:bg-accent-primary-active disabled:bg-layer-disabled disabled:text-text-disabled",
196
- danger: "bg-danger text-text-on-color hover:bg-danger-hover active:bg-danger-hover disabled:bg-layer-disabled disabled:text-text-disabled",
197
- "danger-outline": "border border-danger bg-layer-2 text-danger-text hover:bg-danger-subtle active:bg-danger-subtle disabled:border-border-subtle disabled:bg-layer-2 disabled:text-text-disabled",
198
- success: "bg-success-semantic text-text-on-color hover:bg-success-semantic/90 active:bg-success-semantic/80 disabled:bg-layer-disabled disabled:text-text-disabled",
199
- tertiary: "bg-layer-3 text-text-secondary hover:bg-layer-3-hover active:bg-layer-3-hover disabled:bg-transparent disabled:text-text-disabled"
200
- },
201
- size: {
202
- // Existing sizes (backwards-compatible)
203
- default: "h-10 px-4 py-2",
204
- sm: "h-9 rounded-md px-3",
205
- lg: "h-11 rounded-md px-8",
206
- icon: "h-10 w-10",
207
- // New ERP-specific compact sizes
208
- xs: "h-7 rounded-sm px-2 text-xs",
209
- compact: "h-8 rounded-md px-3 text-xs",
210
- "icon-sm": "h-8 w-8",
211
- "icon-xs": "h-7 w-7"
212
- }
213
- },
214
- defaultVariants: {
215
- variant: "default",
216
- size: "default"
217
- }
218
- }
219
- );
220
- Button = React12__namespace.forwardRef(
221
- ({ className, variant, size, asChild = false, loading = false, prependIcon, appendIcon, children, disabled, ...props }, ref) => {
222
- if (asChild) {
223
- return /* @__PURE__ */ jsxRuntime.jsx(
224
- reactSlot.Slot,
225
- {
226
- className: cn(buttonVariants({ variant, size }), className),
227
- ref,
228
- ...{ disabled: disabled || loading },
229
- ...props,
230
- children: React12__namespace.isValidElement(children) && (prependIcon || appendIcon) ? React12__namespace.cloneElement(children, {}, /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
231
- prependIcon && React12__namespace.cloneElement(prependIcon, {
232
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
233
- }),
234
- children.props.children,
235
- appendIcon && React12__namespace.cloneElement(appendIcon, {
236
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
237
- })
238
- ] })) : children
239
- }
240
- );
241
- }
242
- return /* @__PURE__ */ jsxRuntime.jsxs(
243
- "button",
244
- {
245
- className: cn(buttonVariants({ variant, size }), className),
246
- ref,
247
- disabled: disabled || loading,
248
- ...props,
249
- children: [
250
- prependIcon && React12__namespace.cloneElement(prependIcon, {
251
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
252
- }),
253
- children,
254
- appendIcon && React12__namespace.cloneElement(appendIcon, {
255
- className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
256
- })
257
- ]
258
- }
259
- );
260
- }
261
- );
262
- Button.displayName = "Button";
263
- }
264
- });
265
- function Calendar({
266
- className,
267
- classNames,
268
- showOutsideDays = true,
269
- ...props
270
- }) {
271
- return /* @__PURE__ */ jsxRuntime.jsx(
272
- reactDayPicker.DayPicker,
273
- {
274
- showOutsideDays,
275
- className: cn("p-3", className),
276
- classNames: {
277
- month: "space-y-4",
278
- month_caption: "flex justify-center pt-1 items-center",
279
- caption_label: "text-sm font-medium",
280
- nav: "relative gap-x-1 flex items-center",
281
- button_previous: cn(
282
- buttonVariants({ variant: "outline" }),
283
- "absolute top-0 start-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
284
- ),
285
- button_next: cn(
286
- buttonVariants({ variant: "outline" }),
287
- "absolute top-0 end-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
288
- ),
289
- month_grid: "w-full border-collapse space-y-1",
290
- weekdays: "flex",
291
- weekday: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
292
- week: "flex w-full mt-2",
293
- day: cn(
294
- buttonVariants({ variant: "ghost" }),
295
- "relative h-8 w-8 p-0 font-normal text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-e-md"
296
- ),
297
- day_button: "cursor-pointer h-full w-full aria-selected:opacity-100",
298
- range_start: "rounded-md!",
299
- range_end: "rounded-md!",
300
- selected: cn(
301
- "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
302
- props.mode === "range" && "rounded-none"
303
- ),
304
- today: "bg-accent text-accent-foreground",
305
- outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
306
- disabled: "text-muted-foreground opacity-50",
307
- range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
308
- hidden: "invisible",
309
- ...classNames
310
- },
311
- components: {
312
- Chevron: (props2) => {
313
- if (props2.orientation === "left") {
314
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" });
315
- }
316
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" });
317
- }
318
- },
319
- ...props
320
- }
321
- );
322
- }
323
- var init_calendar = __esm({
324
- "src/ui/primitives/calendar.tsx"() {
325
- "use client";
326
- init_utils();
327
- init_button();
328
- Calendar.displayName = "Calendar";
329
- }
330
- });
331
- var Input;
332
- var init_input = __esm({
333
- "src/ui/primitives/input.tsx"() {
334
- init_utils();
335
- Input = React12__namespace.forwardRef(
336
- ({ className, type, ...props }, ref) => {
337
- return /* @__PURE__ */ jsxRuntime.jsx(
338
- "input",
339
- {
340
- type,
341
- className: cn(
342
- "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
343
- className
344
- ),
345
- ref,
346
- ...props
347
- }
348
- );
349
- }
350
- );
351
- Input.displayName = "Input";
352
- }
353
- });
354
- function ScrollArea({
355
- orientation,
356
- className,
357
- children,
358
- ...props
359
- }) {
360
- return /* @__PURE__ */ jsxRuntime.jsxs(
361
- ScrollAreaPrimitive__namespace.Root,
362
- {
363
- "data-slot": "scroll-area",
364
- className: cn("relative overflow-hidden", className),
365
- ...props,
366
- children: [
367
- /* @__PURE__ */ jsxRuntime.jsx(
368
- ScrollAreaPrimitive__namespace.Viewport,
369
- {
370
- "data-slot": "scroll-area-viewport",
371
- className: "h-full w-full rounded-[inherit]",
372
- children
373
- }
374
- ),
375
- /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, { orientation }),
376
- /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
377
- ]
378
- }
379
- );
380
- }
381
- function ScrollBar({
382
- className,
383
- orientation = "vertical",
384
- ...props
385
- }) {
386
- return /* @__PURE__ */ jsxRuntime.jsx(
387
- ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
388
- {
389
- "data-slot": "scroll-area-scrollbar",
390
- orientation,
391
- className: cn(
392
- "flex touch-none select-none transition-colors",
393
- orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
394
- orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
395
- className
396
- ),
397
- ...props,
398
- children: /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
399
- }
400
- );
401
- }
402
- var init_scroll_area = __esm({
403
- "src/ui/primitives/scroll-area.tsx"() {
404
- "use client";
405
- init_utils();
406
- }
407
- });
408
- var init_combobox = __esm({
409
- "src/ui/primitives/combobox.tsx"() {
410
- "use client";
411
- }
412
- });
413
- var init_select = __esm({
414
- "src/ui/primitives/select.tsx"() {
415
- "use client";
416
- }
417
- });
418
- function Popover({
419
- ...props
420
- }) {
421
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Root, { "data-slot": "popover", ...props });
422
- }
423
- function PopoverTrigger({
424
- className,
425
- ...props
426
- }) {
427
- return /* @__PURE__ */ jsxRuntime.jsx(
428
- PopoverPrimitive__namespace.Trigger,
429
- {
430
- "data-slot": "popover-trigger",
431
- className: cn("cursor-pointer", className),
432
- ...props
433
- }
434
- );
435
- }
436
- function PopoverContent({
437
- className,
438
- align = "center",
439
- sideOffset = 4,
440
- container,
441
- ...props
442
- }) {
443
- return /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { container, children: /* @__PURE__ */ jsxRuntime.jsx(
444
- PopoverPrimitive__namespace.Content,
445
- {
446
- "data-slot": "popover-content",
447
- align,
448
- sideOffset,
449
- className: cn(
450
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
451
- className
452
- ),
453
- ...props
454
- }
455
- ) });
456
- }
457
- var init_popover = __esm({
458
- "src/ui/primitives/popover.tsx"() {
459
- "use client";
460
- init_utils();
461
- }
462
- });
463
- var init_dropdown_menu = __esm({
464
- "src/ui/primitives/dropdown-menu.tsx"() {
465
- "use client";
466
- }
467
- });
468
- var init_switch = __esm({
469
- "src/ui/primitives/switch.tsx"() {
470
- "use client";
471
- }
472
- });
473
- var Checkbox;
474
- var init_checkbox = __esm({
475
- "src/ui/primitives/checkbox.tsx"() {
476
- "use client";
477
- init_utils();
478
- Checkbox = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
479
- CheckboxPrimitive__namespace.Root,
480
- {
481
- ref,
482
- className: cn(
483
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
484
- className
485
- ),
486
- ...props,
487
- children: /* @__PURE__ */ jsxRuntime.jsx(
488
- CheckboxPrimitive__namespace.Indicator,
489
- {
490
- className: cn("flex items-center justify-center text-current"),
491
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })
492
- }
493
- )
494
- }
495
- ));
496
- Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
497
- }
498
- });
499
- var Label3;
500
- var init_label = __esm({
501
- "src/ui/primitives/label.tsx"() {
502
- "use client";
503
- init_utils();
504
- Label3 = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
505
- LabelPrimitive__namespace.Root,
506
- {
507
- ref,
508
- className: cn(
509
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
510
- className
511
- ),
512
- ...props
513
- }
514
- ));
515
- Label3.displayName = LabelPrimitive__namespace.Root.displayName;
516
- }
517
- });
518
- function TooltipProvider({
519
- delayDuration = 0,
520
- ...props
521
- }) {
522
- return /* @__PURE__ */ jsxRuntime.jsx(
523
- TooltipPrimitive__namespace.Provider,
524
- {
525
- "data-slot": "tooltip-provider",
526
- delayDuration,
527
- ...props
528
- }
529
- );
530
- }
531
- function Tooltip({
532
- ...props
533
- }) {
534
- return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive__namespace.Root, { "data-slot": "tooltip", ...props }) });
535
- }
536
- function TooltipTrigger({
537
- className,
538
- ...props
539
- }) {
540
- return /* @__PURE__ */ jsxRuntime.jsx(
541
- TooltipPrimitive__namespace.Trigger,
542
- {
543
- "data-slot": "tooltip-trigger",
544
- className: cn("cursor-pointer", className),
545
- ...props
546
- }
547
- );
548
- }
549
- function TooltipContent({
550
- className,
551
- sideOffset = 0,
552
- ...props
553
- }) {
554
- return /* @__PURE__ */ jsxRuntime.jsx(
555
- TooltipPrimitive__namespace.Content,
556
- {
557
- "data-slot": "tooltip-content",
558
- sideOffset,
559
- className: cn(
560
- "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
561
- className
562
- ),
563
- ...props
564
- }
565
- );
566
- }
567
- var init_tooltip = __esm({
568
- "src/ui/primitives/tooltip.tsx"() {
569
- "use client";
570
- init_utils();
571
- }
572
- });
573
- var init_tenant_provider = __esm({
574
- "src/providers/tenant-provider.tsx"() {
575
- React12.createContext(void 0);
576
- }
577
- });
578
- var defaultSettings, SettingsContext;
579
- var init_providers = __esm({
580
- "src/providers/index.tsx"() {
581
- "use client";
582
- init_tenant_provider();
583
- defaultSettings = {
584
- theme: "blue",
585
- mode: "system",
586
- radius: 0.5,
587
- layout: "vertical",
588
- locale: "vi",
589
- sidebarVariant: "sidebar",
590
- sidebarCollapsible: "icon",
591
- density: "comfortable"
592
- };
593
- SettingsContext = React12.createContext(void 0);
594
- }
595
- });
596
- function Badge({ className, variant, size, ...props }) {
597
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
598
- }
599
- var badgeVariants;
600
- var init_badge = __esm({
601
- "src/ui/primitives/badge.tsx"() {
602
- init_utils();
603
- badgeVariants = classVarianceAuthority.cva(
604
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
605
- {
606
- variants: {
607
- variant: {
608
- // Existing variants (backwards-compatible)
609
- default: "border-transparent bg-primary text-primary-foreground",
610
- secondary: "border-transparent bg-secondary text-secondary-foreground",
611
- destructive: "border-transparent bg-destructive text-destructive-foreground",
612
- outline: "text-foreground",
613
- // Enhanced semantic variants (using Design Tokens)
614
- success: "border-transparent bg-success-subtle text-success-text",
615
- warning: "border-transparent bg-warning-subtle text-warning-text",
616
- danger: "border-transparent bg-danger-subtle text-danger-text",
617
- info: "border-transparent bg-info-subtle text-info-text",
618
- accent: "border-transparent bg-accent-primary-subtle text-accent-primary"
619
- },
620
- size: {
621
- default: "",
622
- sm: "px-1.5 py-0 text-[10px]",
623
- lg: "px-3 py-1 text-sm"
624
- }
625
- },
626
- defaultVariants: {
627
- variant: "default",
628
- size: "default"
629
- }
630
- }
631
- );
632
- }
633
- });
634
- var Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter;
635
- var init_card = __esm({
636
- "src/ui/primitives/card.tsx"() {
637
- init_utils();
638
- Card = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
639
- "div",
640
- {
641
- ref,
642
- className: cn(
643
- "rounded-lg border bg-card text-card-foreground shadow-sm",
644
- className
645
- ),
646
- ...props
647
- }
648
- ));
649
- Card.displayName = "Card";
650
- CardHeader = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
651
- "div",
652
- {
653
- ref,
654
- className: cn("flex flex-col space-y-1.5 p-6", className),
655
- ...props
656
- }
657
- ));
658
- CardHeader.displayName = "CardHeader";
659
- CardTitle = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
660
- "h3",
661
- {
662
- ref,
663
- className: cn(
664
- "text-2xl font-semibold leading-none tracking-tight",
665
- className
666
- ),
667
- ...props
668
- }
669
- ));
670
- CardTitle.displayName = "CardTitle";
671
- CardDescription = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
672
- "p",
673
- {
674
- ref,
675
- className: cn("text-sm text-muted-foreground", className),
676
- ...props
677
- }
678
- ));
679
- CardDescription.displayName = "CardDescription";
680
- CardContent = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
681
- CardContent.displayName = "CardContent";
682
- CardFooter = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
683
- "div",
684
- {
685
- ref,
686
- className: cn("flex items-center p-6 pt-0", className),
687
- ...props
688
- }
689
- ));
690
- CardFooter.displayName = "CardFooter";
691
- }
692
- });
693
- var Separator3;
694
- var init_separator = __esm({
695
- "src/ui/primitives/separator.tsx"() {
696
- init_utils();
697
- Separator3 = React12__namespace.forwardRef(
698
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
699
- "div",
700
- {
701
- ref,
702
- className: cn(
703
- "shrink-0 bg-border",
704
- orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
705
- className
706
- ),
707
- ...props
708
- }
709
- )
710
- );
711
- Separator3.displayName = "Separator";
712
- }
713
- });
714
- var Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption;
715
- var init_table = __esm({
716
- "src/ui/primitives/table.tsx"() {
717
- init_utils();
718
- Table = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
719
- "table",
720
- {
721
- ref,
722
- className: cn("w-max min-w-full caption-bottom text-xs", className),
723
- ...props
724
- }
725
- ) }));
726
- Table.displayName = "Table";
727
- TableHeader = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
728
- TableHeader.displayName = "TableHeader";
729
- TableBody = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
730
- "tbody",
731
- {
732
- ref,
733
- className: cn("[&_tr:last-child]:border-0", className),
734
- ...props
735
- }
736
- ));
737
- TableBody.displayName = "TableBody";
738
- TableFooter = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
739
- "tfoot",
740
- {
741
- ref,
742
- className: cn(
743
- "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
744
- className
745
- ),
746
- ...props
747
- }
748
- ));
749
- TableFooter.displayName = "TableFooter";
750
- TableRow = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
751
- "tr",
752
- {
753
- ref,
754
- className: cn(
755
- "border-b transition-colors even:bg-muted/30 data-[state=selected]:bg-muted",
756
- className
757
- ),
758
- ...props
759
- }
760
- ));
761
- TableRow.displayName = "TableRow";
762
- TableHead = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
763
- "th",
764
- {
765
- ref,
766
- className: cn(
767
- "h-9 px-3 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
768
- className
769
- ),
770
- ...props
771
- }
772
- ));
773
- TableHead.displayName = "TableHead";
774
- TableCell = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
775
- "td",
776
- {
777
- ref,
778
- className: cn("px-3 py-1.5 align-middle [&:has([role=checkbox])]:pr-0 text-xs", className),
779
- ...props
780
- }
781
- ));
782
- TableCell.displayName = "TableCell";
783
- TableCaption = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
784
- "caption",
785
- {
786
- ref,
787
- className: cn("mt-4 text-sm text-muted-foreground", className),
788
- ...props
789
- }
790
- ));
791
- TableCaption.displayName = "TableCaption";
792
- }
793
- });
794
- var Dialog, DialogPortal, DialogOverlay, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
795
- var init_dialog = __esm({
796
- "src/ui/primitives/dialog.tsx"() {
797
- "use client";
798
- init_utils();
799
- Dialog = DialogPrimitive__namespace.Root;
800
- DialogPortal = DialogPrimitive__namespace.Portal;
801
- DialogOverlay = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
802
- DialogPrimitive__namespace.Overlay,
803
- {
804
- ref,
805
- className: cn(
806
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
807
- className
808
- ),
809
- ...props
810
- }
811
- ));
812
- DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
813
- DialogContent = React12__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
814
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
815
- /* @__PURE__ */ jsxRuntime.jsxs(
816
- DialogPrimitive__namespace.Content,
817
- {
818
- ref,
819
- className: cn(
820
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
821
- className
822
- ),
823
- ...props,
824
- children: [
825
- children,
826
- /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { 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 data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
827
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
828
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
829
- ] })
830
- ]
831
- }
832
- )
833
- ] }));
834
- DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
835
- DialogHeader = ({
836
- className,
837
- ...props
838
- }) => /* @__PURE__ */ jsxRuntime.jsx(
839
- "div",
840
- {
841
- className: cn(
842
- "flex flex-col space-y-1.5 text-center sm:text-left",
843
- className
844
- ),
845
- ...props
846
- }
847
- );
848
- DialogHeader.displayName = "DialogHeader";
849
- DialogFooter = ({
850
- className,
851
- ...props
852
- }) => /* @__PURE__ */ jsxRuntime.jsx(
853
- "div",
854
- {
855
- className: cn(
856
- "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
857
- className
858
- ),
859
- ...props
860
- }
861
- );
862
- DialogFooter.displayName = "DialogFooter";
863
- DialogTitle = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
864
- DialogPrimitive__namespace.Title,
865
- {
866
- ref,
867
- className: cn(
868
- "text-lg font-semibold leading-none tracking-tight",
869
- className
870
- ),
871
- ...props
872
- }
873
- ));
874
- DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
875
- DialogDescription = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
876
- DialogPrimitive__namespace.Description,
877
- {
878
- ref,
879
- className: cn("text-sm text-muted-foreground", className),
880
- ...props
881
- }
882
- ));
883
- DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
884
- }
885
- });
886
- var TabsList, TabsTrigger, TabsContent;
887
- var init_tabs = __esm({
888
- "src/ui/primitives/tabs.tsx"() {
889
- "use client";
890
- init_utils();
891
- TabsList = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
892
- TabsPrimitive__namespace.List,
893
- {
894
- ref,
895
- className: cn(
896
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
897
- className
898
- ),
899
- ...props
900
- }
901
- ));
902
- TabsList.displayName = TabsPrimitive__namespace.List.displayName;
903
- TabsTrigger = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
904
- TabsPrimitive__namespace.Trigger,
905
- {
906
- ref,
907
- className: cn(
908
- "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
909
- className
910
- ),
911
- ...props
912
- }
913
- ));
914
- TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
915
- TabsContent = React12__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
916
- TabsPrimitive__namespace.Content,
917
- {
918
- ref,
919
- className: cn(
920
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
921
- className
922
- ),
923
- ...props
924
- }
925
- ));
926
- TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
927
- }
928
- });
929
- var init_breadcrumb = __esm({
930
- "src/ui/primitives/breadcrumb.tsx"() {
931
- }
932
- });
933
- var init_keyboard = __esm({
934
- "src/ui/primitives/keyboard.tsx"() {
935
- }
936
- });
937
- var init_pagination = __esm({
938
- "src/ui/primitives/pagination.tsx"() {
939
- }
940
- });
941
- var init_status_badge = __esm({
942
- "src/ui/primitives/status-badge.tsx"() {
943
- }
944
- });
945
- var init_resizable = __esm({
946
- "src/ui/primitives/resizable.tsx"() {
947
- "use client";
948
- }
949
- });
950
- var init_slider = __esm({
951
- "src/ui/primitives/slider.tsx"() {
952
- "use client";
953
- }
954
- });
955
- var init_menubar = __esm({
956
- "src/ui/primitives/menubar.tsx"() {
957
- "use client";
958
- }
959
- });
960
- var init_navigation_menu = __esm({
961
- "src/ui/primitives/navigation-menu.tsx"() {
962
- classVarianceAuthority.cva(
963
- "group cursor-pointer inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
964
- );
965
- }
966
- });
967
- function Toggle({
968
- className,
969
- variant,
970
- size,
971
- ...props
972
- }) {
973
- return /* @__PURE__ */ jsxRuntime.jsx(
974
- TogglePrimitive__namespace.Root,
975
- {
976
- "data-slot": "toggle",
977
- className: cn(toggleVariants({ variant, size, className })),
978
- ...props
979
- }
980
- );
981
- }
982
- var toggleVariants;
983
- var init_toggle = __esm({
984
- "src/ui/primitives/toggle.tsx"() {
985
- "use client";
986
- init_utils();
987
- toggleVariants = classVarianceAuthority.cva(
988
- "cursor-pointer inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
989
- {
990
- variants: {
991
- variant: {
992
- default: "bg-transparent",
993
- outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
994
- },
995
- size: {
996
- default: "h-9 px-3",
997
- sm: "h-8 px-2",
998
- lg: "h-10 px-3"
999
- }
1000
- },
1001
- defaultVariants: {
1002
- variant: "default",
1003
- size: "default"
1004
- }
1005
- }
1006
- );
1007
- }
1008
- });
1009
- var init_toggle_group = __esm({
1010
- "src/ui/primitives/toggle-group.tsx"() {
1011
- "use client";
1012
- React12.createContext({
1013
- size: "default",
1014
- variant: "default"
1015
- });
1016
- }
1017
- });
1018
- function Spinner({ size = "md", className }) {
1019
- const sizeClasses = {
1020
- sm: "h-4 w-4",
1021
- md: "h-6 w-6",
1022
- lg: "h-8 w-8"
1023
- };
1024
- return /* @__PURE__ */ jsxRuntime.jsx(
1025
- "div",
1026
- {
1027
- className: cn(
1028
- "animate-spin rounded-full border-2 border-current border-t-transparent",
1029
- sizeClasses[size],
1030
- className
1031
- )
1032
- }
1033
- );
1034
- }
1035
- var Textarea, ButtonLoading;
1036
- var init_primitives = __esm({
1037
- "src/ui/primitives/index.tsx"() {
1038
- init_utils();
1039
- init_button();
1040
- init_badge();
1041
- init_button();
1042
- init_input();
1043
- init_checkbox();
1044
- init_card();
1045
- init_separator();
1046
- init_card();
1047
- init_table();
1048
- init_dropdown_menu();
1049
- init_dialog();
1050
- init_tabs();
1051
- init_breadcrumb();
1052
- init_keyboard();
1053
- init_pagination();
1054
- init_status_badge();
1055
- init_sidebar();
1056
- init_popover();
1057
- init_scroll_area();
1058
- init_calendar();
1059
- init_resizable();
1060
- init_slider();
1061
- init_switch();
1062
- init_tooltip();
1063
- init_select();
1064
- init_menubar();
1065
- init_navigation_menu();
1066
- init_toggle();
1067
- init_toggle_group();
1068
- init_combobox();
1069
- init_label();
1070
- Textarea = React12__namespace.forwardRef(
1071
- ({ className, ...props }, ref) => {
1072
- return /* @__PURE__ */ jsxRuntime.jsx(
1073
- "textarea",
1074
- {
1075
- className: cn(
1076
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1077
- className
1078
- ),
1079
- ref,
1080
- ...props
1081
- }
1082
- );
1083
- }
1084
- );
1085
- Textarea.displayName = "Textarea";
1086
- ButtonLoading = React12__namespace.forwardRef(({ className, isLoading, children, disabled, ...props }, ref) => {
1087
- return /* @__PURE__ */ jsxRuntime.jsxs(
1088
- Button,
1089
- {
1090
- className: cn("gap-2", className),
1091
- disabled: isLoading || disabled,
1092
- ref,
1093
- ...props,
1094
- children: [
1095
- isLoading && /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: "sm" }),
1096
- children
1097
- ]
1098
- }
1099
- );
1100
- });
1101
- ButtonLoading.displayName = "ButtonLoading";
1102
- }
1103
- });
1104
- var init_progress = __esm({
1105
- "src/ui/feedback/progress.tsx"() {
1106
- "use client";
1107
- }
1108
- });
1109
- function Sheet({
1110
- ...props
1111
- }) {
1112
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "sheet", ...props });
1113
- }
1114
- function SheetPortal({
1115
- ...props
1116
- }) {
1117
- return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "sheet-portal", ...props });
1118
- }
1119
- function SheetOverlay({
1120
- className,
1121
- ...props
1122
- }) {
1123
- return /* @__PURE__ */ jsxRuntime.jsx(
1124
- DialogPrimitive__namespace.Overlay,
1125
- {
1126
- "data-slot": "sheet-overlay",
1127
- className: cn(
1128
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
1129
- className
1130
- ),
1131
- ...props
1132
- }
1133
- );
1134
- }
1135
- function SheetContent({
1136
- className,
1137
- children,
1138
- side = "right",
1139
- ...props
1140
- }) {
1141
- return /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
1142
- /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
1143
- /* @__PURE__ */ jsxRuntime.jsx(
1144
- DialogPrimitive__namespace.Content,
1145
- {
1146
- "data-slot": "sheet-content",
1147
- className: cn(sheetVariants({ side }), className),
1148
- ...props,
1149
- children
1150
- }
1151
- )
1152
- ] });
1153
- }
1154
- function SheetTitle({
1155
- className,
1156
- ...props
1157
- }) {
1158
- return /* @__PURE__ */ jsxRuntime.jsx(
1159
- DialogPrimitive__namespace.Title,
1160
- {
1161
- "data-slot": "sheet-title",
1162
- className: cn("text-lg font-semibold text-foreground", className),
1163
- ...props
1164
- }
1165
- );
1166
- }
1167
- var sheetVariants;
1168
- var init_sheet = __esm({
1169
- "src/ui/feedback/sheet.tsx"() {
1170
- "use client";
1171
- init_utils();
1172
- sheetVariants = classVarianceAuthority.cva(
1173
- "fixed z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
1174
- {
1175
- variants: {
1176
- side: {
1177
- top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
1178
- bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
1179
- left: "inset-y-0 left-0 h-full w-72 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1180
- right: "inset-y-0 right-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
1181
- start: "inset-y-0 start-0 h-full w-72 border-e data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left data-[state=closed]:rtl:slide-out-to-right data-[state=open]:rtl:slide-in-from-right sm:max-w-sm",
1182
- end: "inset-y-0 end-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:rtl:slide-out-to-left data-[state=open]:rtl:slide-in-from-left sm:max-w-sm"
1183
- }
1184
- },
1185
- defaultVariants: {
1186
- side: "right"
1187
- }
1188
- }
1189
- );
1190
- }
1191
- });
1192
- var init_alert = __esm({
1193
- "src/ui/feedback/alert.tsx"() {
1194
- classVarianceAuthority.cva(
1195
- "relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
1196
- {
1197
- variants: {
1198
- variant: {
1199
- default: "bg-background text-foreground",
1200
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
1201
- }
1202
- },
1203
- defaultVariants: {
1204
- variant: "default"
1205
- }
1206
- }
1207
- );
1208
- }
1209
- });
1210
- var init_context_menu = __esm({
1211
- "src/ui/feedback/context-menu.tsx"() {
1212
- "use client";
1213
- }
1214
- });
1215
- var init_drawer = __esm({
1216
- "src/ui/feedback/drawer.tsx"() {
1217
- "use client";
1218
- }
1219
- });
1220
- var init_sonner = __esm({
1221
- "src/ui/feedback/sonner.tsx"() {
1222
- "use client";
1223
- }
1224
- });
1225
- var GlobalErrorEmitter;
1226
- var init_error_dialog = __esm({
1227
- "src/ui/feedback/error-dialog.tsx"() {
1228
- "use client";
1229
- GlobalErrorEmitter = class {
1230
- constructor() {
1231
- this.listeners = [];
1232
- }
1233
- subscribe(listener) {
1234
- this.listeners.push(listener);
1235
- return () => {
1236
- this.listeners = this.listeners.filter((l) => l !== listener);
1237
- };
1238
- }
1239
- emit(data) {
1240
- this.listeners.forEach((listener) => listener(data));
1241
- }
1242
- };
1243
- new GlobalErrorEmitter();
1244
- React12.createContext(null);
1245
- }
1246
- });
1247
- var init_feedback = __esm({
1248
- "src/ui/feedback/index.tsx"() {
1249
- init_primitives();
1250
- init_progress();
1251
- init_sheet();
1252
- init_alert();
1253
- init_context_menu();
1254
- init_drawer();
1255
- init_sonner();
1256
- init_error_dialog();
1257
- }
1258
- });
1259
-
1260
- // src/hooks/use-tenant.ts
1261
- var init_use_tenant = __esm({
1262
- "src/hooks/use-tenant.ts"() {
1263
- }
1264
- });
1265
- function useMediaQuery(query) {
1266
- const [matches, setMatches] = React12.useState(false);
1267
- React12.useEffect(() => {
1268
- if (typeof window !== "undefined") {
1269
- const media = window.matchMedia(query);
1270
- setMatches(media.matches);
1271
- const listener = (event) => setMatches(event.matches);
1272
- media.addEventListener("change", listener);
1273
- return () => media.removeEventListener("change", listener);
1274
- }
1275
- }, [query]);
1276
- return matches;
1277
- }
1278
- function useMobile() {
1279
- return useMediaQuery("(max-width: 768px)");
1280
- }
1281
- function useSettings() {
1282
- const context = React12.useContext(SettingsContext);
1283
- if (!context) {
1284
- return defaultSettingsValue;
1285
- }
1286
- return context;
1287
- }
1288
- function useIsDarkMode() {
1289
- const { settings } = useSettings();
1290
- const isDarkModePreferred = reactUse.useMedia("(prefers-color-scheme: dark)");
1291
- let resolvedMode = settings.mode;
1292
- if (resolvedMode === "system") {
1293
- resolvedMode = isDarkModePreferred ? "dark" : "light";
1294
- }
1295
- return resolvedMode === "dark";
1296
- }
1297
- function useIsRtl() {
1298
- const direction = reactDirection.useDirection();
1299
- return direction === "rtl";
1300
- }
1301
- var defaultSettingsValue;
1302
- var init_hooks = __esm({
1303
- "src/hooks/index.tsx"() {
1304
- "use client";
1305
- init_providers();
1306
- init_use_tenant();
1307
- defaultSettingsValue = {
1308
- settings: defaultSettings,
1309
- updateSettings: () => {
1310
- },
1311
- resetSettings: () => {
1312
- }
1313
- };
1314
- React12.createContext(null);
1315
- }
1316
- });
1317
- function useSidebar() {
1318
- const context = React12__namespace.useContext(SidebarContext);
1319
- if (!context) {
1320
- throw new Error("useSidebar must be used within a SidebarProvider.");
1321
- }
1322
- return context;
1323
- }
1324
- var SIDEBAR_WIDTH, SIDEBAR_WIDTH_MOBILE, SIDEBAR_WIDTH_ICON, SIDEBAR_KEYBOARD_SHORTCUT, SidebarContext, SidebarProvider, Sidebar, SidebarTrigger, SidebarRail, SidebarInset, SidebarInput, SidebarHeader, SidebarFooter, SidebarSeparator, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuItem, sidebarMenuButtonVariants, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton;
1325
- var init_sidebar = __esm({
1326
- "src/ui/primitives/sidebar.tsx"() {
1327
- "use client";
1328
- init_hooks();
1329
- init_utils();
1330
- init_button();
1331
- init_feedback();
1332
- init_tooltip();
1333
- SIDEBAR_WIDTH = "16rem";
1334
- SIDEBAR_WIDTH_MOBILE = "18rem";
1335
- SIDEBAR_WIDTH_ICON = "3rem";
1336
- SIDEBAR_KEYBOARD_SHORTCUT = "b";
1337
- SidebarContext = React12__namespace.createContext(null);
1338
- SidebarProvider = React12__namespace.forwardRef(
1339
- ({
1340
- defaultOpen = false,
1341
- open: openProp,
1342
- onOpenChange: setOpenProp,
1343
- className,
1344
- style,
1345
- children,
1346
- ...props
1347
- }, ref) => {
1348
- const isMobile = useMobile();
1349
- const [openMobile, setOpenMobile] = React12__namespace.useState(false);
1350
- const [hoverOpen, setHoverOpen] = React12__namespace.useState(false);
1351
- const [_open, _setOpen] = React12__namespace.useState(defaultOpen);
1352
- const open = openProp ?? _open;
1353
- const setOpen = React12__namespace.useCallback(
1354
- (value) => {
1355
- if (setOpenProp) {
1356
- return setOpenProp(typeof value === "function" ? value(open) : value);
1357
- }
1358
- _setOpen(value);
1359
- },
1360
- [setOpenProp, open]
1361
- );
1362
- const toggleSidebar = React12__namespace.useCallback(() => {
1363
- return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
1364
- }, [isMobile, setOpen, setOpenMobile]);
1365
- React12__namespace.useEffect(() => {
1366
- const handleKeyDown = (event) => {
1367
- if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
1368
- event.preventDefault();
1369
- toggleSidebar();
1370
- }
1371
- };
1372
- window.addEventListener("keydown", handleKeyDown);
1373
- return () => window.removeEventListener("keydown", handleKeyDown);
1374
- }, [toggleSidebar]);
1375
- const state = open ? "expanded" : "collapsed";
1376
- const isHoverExpanded = !open && hoverOpen;
1377
- const contextValue = React12__namespace.useMemo(
1378
- () => ({
1379
- state,
1380
- open,
1381
- setOpen,
1382
- isMobile,
1383
- openMobile,
1384
- setOpenMobile,
1385
- toggleSidebar,
1386
- hoverOpen,
1387
- setHoverOpen,
1388
- isHoverExpanded
1389
- }),
1390
- [
1391
- state,
1392
- open,
1393
- setOpen,
1394
- isMobile,
1395
- openMobile,
1396
- setOpenMobile,
1397
- toggleSidebar,
1398
- hoverOpen,
1399
- setHoverOpen,
1400
- isHoverExpanded
1401
- ]
1402
- );
1403
- return /* @__PURE__ */ jsxRuntime.jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxRuntime.jsx(
1404
- "div",
1405
- {
1406
- style: {
1407
- "--sidebar-width": SIDEBAR_WIDTH,
1408
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
1409
- ...style
1410
- },
1411
- className: cn(
1412
- "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
1413
- className
1414
- ),
1415
- ref,
1416
- ...props,
1417
- children
1418
- }
1419
- ) }) });
1420
- }
1421
- );
1422
- SidebarProvider.displayName = "SidebarProvider";
1423
- Sidebar = React12__namespace.forwardRef(
1424
- ({
1425
- side = "left",
1426
- variant = "sidebar",
1427
- collapsible = "offcanvas",
1428
- hoverExpandEnabled = true,
1429
- className,
1430
- children,
1431
- ...props
1432
- }, ref) => {
1433
- const {
1434
- isMobile,
1435
- state,
1436
- openMobile,
1437
- setOpenMobile,
1438
- setHoverOpen,
1439
- isHoverExpanded
1440
- } = useSidebar();
1441
- const handleMouseEnter = React12__namespace.useCallback(() => {
1442
- if (hoverExpandEnabled && state === "collapsed" && collapsible === "icon") {
1443
- setHoverOpen(true);
1444
- }
1445
- }, [hoverExpandEnabled, state, collapsible, setHoverOpen]);
1446
- const handleMouseLeave = React12__namespace.useCallback(() => {
1447
- if (hoverExpandEnabled) {
1448
- setHoverOpen(false);
1449
- }
1450
- }, [hoverExpandEnabled, setHoverOpen]);
1451
- if (collapsible === "none") {
1452
- return /* @__PURE__ */ jsxRuntime.jsx(
1453
- "div",
1454
- {
1455
- className: cn(
1456
- "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
1457
- className
1458
- ),
1459
- ref,
1460
- ...props,
1461
- children
1462
- }
1463
- );
1464
- }
1465
- if (isMobile) {
1466
- return /* @__PURE__ */ jsxRuntime.jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs(
1467
- SheetContent,
1468
- {
1469
- "data-sidebar": "sidebar",
1470
- "data-mobile": "true",
1471
- className: "w-(--sidebar-width) bg-background p-0 text-foreground [&>button]:hidden",
1472
- style: {
1473
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE
1474
- },
1475
- side,
1476
- children: [
1477
- /* @__PURE__ */ jsxRuntime.jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }),
1478
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full w-full flex-col", children })
1479
- ]
1480
- }
1481
- ) });
1482
- }
1483
- return /* @__PURE__ */ jsxRuntime.jsxs(
1484
- "div",
1485
- {
1486
- ref,
1487
- className: cn(
1488
- "group peer hidden md:block transition-colors duration-200",
1489
- // Blue bg + white text when collapsed, white bg + dark text when expanded/hover
1490
- state === "collapsed" && !isHoverExpanded ? "text-sidebar-foreground" : "text-foreground"
1491
- ),
1492
- "data-state": state,
1493
- "data-hover-expanded": isHoverExpanded,
1494
- "data-collapsible": state === "collapsed" ? collapsible : "",
1495
- "data-variant": variant,
1496
- "data-side": side,
1497
- onMouseEnter: handleMouseEnter,
1498
- onMouseLeave: handleMouseLeave,
1499
- children: [
1500
- /* @__PURE__ */ jsxRuntime.jsx(
1501
- "div",
1502
- {
1503
- className: cn(
1504
- "duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear",
1505
- "group-data-[collapsible=offcanvas]:w-0",
1506
- "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
1507
- variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
1508
- )
1509
- }
1510
- ),
1511
- /* @__PURE__ */ jsxRuntime.jsx(
1512
- "div",
1513
- {
1514
- className: cn(
1515
- "duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
1516
- side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
1517
- // Adjustments for collapsible=icon
1518
- variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_8px)] group-data-[collapsible=icon]:px-2.5" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[collapsible=icon]:border-r group-data-[collapsible=icon]:px-0",
1519
- // Hover expand - override icon width to full width on hover
1520
- "group-data-[hover-expanded=true]:!w-(--sidebar-width) group-data-[hover-expanded=true]:shadow-xl group-data-[hover-expanded=true]:z-[100]",
1521
- className
1522
- ),
1523
- ...props,
1524
- children: /* @__PURE__ */ jsxRuntime.jsx(
1525
- "div",
1526
- {
1527
- "data-sidebar": "sidebar",
1528
- className: cn(
1529
- "flex h-full w-full flex-col border-r transition-colors duration-200",
1530
- // Blue background when collapsed, white when expanded/hover
1531
- "group-data-[state=collapsed]:bg-sidebar group-data-[state=collapsed]:border-sidebar-border",
1532
- "group-data-[state=expanded]:bg-background group-data-[state=expanded]:border-border",
1533
- "group-data-[hover-expanded=true]:!bg-background group-data-[hover-expanded=true]:!border-border",
1534
- "group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
1535
- ),
1536
- children
1537
- }
1538
- )
1539
- }
1540
- )
1541
- ]
1542
- }
1543
- );
1544
- }
1545
- );
1546
- Sidebar.displayName = "Sidebar";
1547
- SidebarTrigger = React12__namespace.forwardRef(({ className, onClick, ...props }, ref) => {
1548
- const { toggleSidebar } = useSidebar();
1549
- return /* @__PURE__ */ jsxRuntime.jsxs(
1550
- Button,
1551
- {
1552
- ref,
1553
- "data-sidebar": "trigger",
1554
- variant: "ghost",
1555
- size: "icon",
1556
- className: cn("h-7 w-7", className),
1557
- onClick: (event) => {
1558
- onClick?.(event);
1559
- toggleSidebar();
1560
- },
1561
- ...props,
1562
- children: [
1563
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PanelLeft, {}),
1564
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
1565
- ]
1566
- }
1567
- );
1568
- });
1569
- SidebarTrigger.displayName = "SidebarTrigger";
1570
- SidebarRail = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1571
- const { toggleSidebar } = useSidebar();
1572
- return /* @__PURE__ */ jsxRuntime.jsx(
1573
- "button",
1574
- {
1575
- ref,
1576
- "data-sidebar": "rail",
1577
- "aria-label": "Toggle Sidebar",
1578
- tabIndex: -1,
1579
- onClick: toggleSidebar,
1580
- title: "Toggle Sidebar",
1581
- className: cn(
1582
- "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
1583
- "[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
1584
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
1585
- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
1586
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
1587
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
1588
- className
1589
- ),
1590
- ...props
1591
- }
1592
- );
1593
- });
1594
- SidebarRail.displayName = "SidebarRail";
1595
- SidebarInset = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1596
- return /* @__PURE__ */ jsxRuntime.jsx(
1597
- "main",
1598
- {
1599
- ref,
1600
- className: cn(
1601
- "relative flex min-h-svh flex-1 flex-col bg-muted/40 transition-[margin] duration-200 ease-linear",
1602
- "peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
1603
- className
1604
- ),
1605
- ...props
1606
- }
1607
- );
1608
- });
1609
- SidebarInset.displayName = "SidebarInset";
1610
- SidebarInput = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1611
- return /* @__PURE__ */ jsxRuntime.jsx(
1612
- "input",
1613
- {
1614
- ref,
1615
- "data-sidebar": "input",
1616
- className: cn(
1617
- "flex h-8 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
1618
- className
1619
- ),
1620
- ...props
1621
- }
1622
- );
1623
- });
1624
- SidebarInput.displayName = "SidebarInput";
1625
- SidebarHeader = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1626
- return /* @__PURE__ */ jsxRuntime.jsx(
1627
- "div",
1628
- {
1629
- ref,
1630
- "data-sidebar": "header",
1631
- className: cn("flex flex-col gap-2 p-2", className),
1632
- ...props
1633
- }
1634
- );
1635
- });
1636
- SidebarHeader.displayName = "SidebarHeader";
1637
- SidebarFooter = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1638
- return /* @__PURE__ */ jsxRuntime.jsx(
1639
- "div",
1640
- {
1641
- ref,
1642
- "data-sidebar": "footer",
1643
- className: cn("flex flex-col gap-2 p-2", className),
1644
- ...props
1645
- }
1646
- );
1647
- });
1648
- SidebarFooter.displayName = "SidebarFooter";
1649
- SidebarSeparator = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1650
- return /* @__PURE__ */ jsxRuntime.jsx(
1651
- "div",
1652
- {
1653
- ref,
1654
- "data-sidebar": "separator",
1655
- className: cn("mx-2 h-[1px] w-auto bg-sidebar-border", className),
1656
- ...props
1657
- }
1658
- );
1659
- });
1660
- SidebarSeparator.displayName = "SidebarSeparator";
1661
- SidebarContent = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1662
- return /* @__PURE__ */ jsxRuntime.jsx(
1663
- "div",
1664
- {
1665
- ref,
1666
- "data-sidebar": "content",
1667
- className: cn(
1668
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
1669
- // Hide overflow when collapsed, but show when hover-expanded
1670
- "group-data-[collapsible=icon]:overflow-hidden group-data-[hover-expanded=true]:!overflow-auto",
1671
- className
1672
- ),
1673
- ...props
1674
- }
1675
- );
1676
- });
1677
- SidebarContent.displayName = "SidebarContent";
1678
- SidebarGroup = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1679
- return /* @__PURE__ */ jsxRuntime.jsx(
1680
- "div",
1681
- {
1682
- ref,
1683
- "data-sidebar": "group",
1684
- className: cn("relative flex w-full min-w-0 flex-col p-2", className),
1685
- ...props
1686
- }
1687
- );
1688
- });
1689
- SidebarGroup.displayName = "SidebarGroup";
1690
- SidebarGroupLabel = React12__namespace.forwardRef(({ className, asChild = false, ...props }, ref) => {
1691
- const Comp = asChild ? reactSlot.Slot : "div";
1692
- return /* @__PURE__ */ jsxRuntime.jsx(
1693
- Comp,
1694
- {
1695
- ref,
1696
- "data-sidebar": "group-label",
1697
- className: cn(
1698
- "duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-bold text-primary uppercase tracking-wider outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1699
- // Hide when collapsed, show when hover-expanded
1700
- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
1701
- "group-data-[hover-expanded=true]:!mt-0 group-data-[hover-expanded=true]:!opacity-100",
1702
- className
1703
- ),
1704
- ...props
1705
- }
1706
- );
1707
- });
1708
- SidebarGroupLabel.displayName = "SidebarGroupLabel";
1709
- SidebarGroupAction = React12__namespace.forwardRef(({ className, asChild = false, ...props }, ref) => {
1710
- const Comp = asChild ? reactSlot.Slot : "button";
1711
- return /* @__PURE__ */ jsxRuntime.jsx(
1712
- Comp,
1713
- {
1714
- ref,
1715
- "data-sidebar": "group-action",
1716
- className: cn(
1717
- "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1718
- // Increases the hit area of the button on mobile.
1719
- "after:absolute after:-inset-2 after:md:hidden",
1720
- "group-data-[collapsible=icon]:hidden",
1721
- className
1722
- ),
1723
- ...props
1724
- }
1725
- );
1726
- });
1727
- SidebarGroupAction.displayName = "SidebarGroupAction";
1728
- SidebarGroupContent = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1729
- return /* @__PURE__ */ jsxRuntime.jsx(
1730
- "div",
1731
- {
1732
- ref,
1733
- "data-sidebar": "group-content",
1734
- className: cn("w-full text-sm", className),
1735
- ...props
1736
- }
1737
- );
1738
- });
1739
- SidebarGroupContent.displayName = "SidebarGroupContent";
1740
- SidebarMenu = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1741
- return /* @__PURE__ */ jsxRuntime.jsx(
1742
- "ul",
1743
- {
1744
- ref,
1745
- "data-sidebar": "menu",
1746
- className: cn("flex w-full min-w-0 flex-col gap-1", className),
1747
- ...props
1748
- }
1749
- );
1750
- });
1751
- SidebarMenu.displayName = "SidebarMenu";
1752
- SidebarMenuItem = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1753
- return /* @__PURE__ */ jsxRuntime.jsx(
1754
- "li",
1755
- {
1756
- ref,
1757
- "data-sidebar": "menu-item",
1758
- className: cn("group/menu-item relative", className),
1759
- ...props
1760
- }
1761
- );
1762
- });
1763
- SidebarMenuItem.displayName = "SidebarMenuItem";
1764
- sidebarMenuButtonVariants = classVarianceAuthority.cva(
1765
- // Base styles + hover-expand overrides
1766
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[hover-expanded=true]:!size-auto group-data-[hover-expanded=true]:!w-full group-data-[hover-expanded=true]:!p-2",
1767
- {
1768
- variants: {
1769
- variant: {
1770
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
1771
- outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
1772
- },
1773
- size: {
1774
- default: "h-8 text-sm",
1775
- sm: "h-7 text-xs",
1776
- lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0"
1777
- },
1778
- isActive: {
1779
- true: "bg-primary/10 text-primary font-bold"
1780
- }
1781
- },
1782
- defaultVariants: {
1783
- variant: "default",
1784
- size: "default"
1785
- }
1786
- }
1787
- );
1788
- SidebarMenuButton = React12__namespace.forwardRef(
1789
- ({
1790
- asChild = false,
1791
- isActive = false,
1792
- variant = "default",
1793
- size = "default",
1794
- tooltip,
1795
- className,
1796
- ...props
1797
- }, ref) => {
1798
- const Comp = asChild ? reactSlot.Slot : "button";
1799
- const { isMobile, state } = useSidebar();
1800
- const button = /* @__PURE__ */ jsxRuntime.jsx(
1801
- Comp,
1802
- {
1803
- ref,
1804
- "data-sidebar": "menu-button",
1805
- "data-size": size,
1806
- "data-active": isActive,
1807
- className: cn(
1808
- sidebarMenuButtonVariants({ variant, size, isActive }),
1809
- className
1810
- ),
1811
- ...props
1812
- }
1813
- );
1814
- if (!tooltip) {
1815
- return button;
1816
- }
1817
- if (typeof tooltip === "string") {
1818
- tooltip = {
1819
- children: tooltip
1820
- };
1821
- }
1822
- return /* @__PURE__ */ jsxRuntime.jsxs(Tooltip, { children: [
1823
- /* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: button }),
1824
- /* @__PURE__ */ jsxRuntime.jsx(
1825
- TooltipContent,
1826
- {
1827
- side: "right",
1828
- align: "center",
1829
- hidden: state !== "collapsed" || isMobile,
1830
- ...tooltip
1831
- }
1832
- )
1833
- ] });
1834
- }
1835
- );
1836
- SidebarMenuButton.displayName = "SidebarMenuButton";
1837
- SidebarMenuAction = React12__namespace.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
1838
- const Comp = asChild ? reactSlot.Slot : "button";
1839
- return /* @__PURE__ */ jsxRuntime.jsx(
1840
- Comp,
1841
- {
1842
- ref,
1843
- "data-sidebar": "menu-action",
1844
- className: cn(
1845
- "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
1846
- // Increases the hit area of the button on mobile.
1847
- "after:absolute after:-inset-2 after:md:hidden",
1848
- "peer-data-[size=sm]/menu-button:top-1",
1849
- "peer-data-[size=default]/menu-button:top-1.5",
1850
- "peer-data-[size=lg]/menu-button:top-2.5",
1851
- "group-data-[collapsible=icon]:hidden",
1852
- showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
1853
- className
1854
- ),
1855
- ...props
1856
- }
1857
- );
1858
- });
1859
- SidebarMenuAction.displayName = "SidebarMenuAction";
1860
- SidebarMenuBadge = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1861
- return /* @__PURE__ */ jsxRuntime.jsx(
1862
- "div",
1863
- {
1864
- ref,
1865
- "data-sidebar": "menu-badge",
1866
- className: cn(
1867
- "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none",
1868
- "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
1869
- "peer-data-[size=sm]/menu-button:top-1",
1870
- "peer-data-[size=default]/menu-button:top-1.5",
1871
- "peer-data-[size=lg]/menu-button:top-2.5",
1872
- "group-data-[collapsible=icon]:hidden",
1873
- className
1874
- ),
1875
- ...props
1876
- }
1877
- );
1878
- });
1879
- SidebarMenuBadge.displayName = "SidebarMenuBadge";
1880
- SidebarMenuSkeleton = React12__namespace.forwardRef(({ className, showIcon = false, ...props }, ref) => {
1881
- const width = React12__namespace.useMemo(() => {
1882
- return `${Math.floor(Math.random() * 40) + 50}%`;
1883
- }, []);
1884
- return /* @__PURE__ */ jsxRuntime.jsxs(
1885
- "div",
1886
- {
1887
- ref,
1888
- "data-sidebar": "menu-skeleton",
1889
- className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
1890
- ...props,
1891
- children: [
1892
- showIcon && /* @__PURE__ */ jsxRuntime.jsx(
1893
- "div",
1894
- {
1895
- className: "size-4 rounded-md animate-pulse bg-muted",
1896
- "data-sidebar": "menu-skeleton-icon"
1897
- }
1898
- ),
1899
- /* @__PURE__ */ jsxRuntime.jsx(
1900
- "div",
1901
- {
1902
- className: "h-4 flex-1 max-w-[--skeleton-width] animate-pulse bg-muted rounded-full",
1903
- "data-sidebar": "menu-skeleton-text",
1904
- style: {
1905
- "--skeleton-width": width
1906
- }
1907
- }
1908
- )
1909
- ]
1910
- }
1911
- );
1912
- });
1913
- SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
1914
- SidebarMenuSub = React12__namespace.forwardRef(({ className, ...props }, ref) => {
1915
- return /* @__PURE__ */ jsxRuntime.jsx(
1916
- "ul",
1917
- {
1918
- ref,
1919
- "data-sidebar": "menu-sub",
1920
- className: cn(
1921
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
1922
- // Hide when collapsed, show when hover-expanded
1923
- "group-data-[collapsible=icon]:hidden group-data-[hover-expanded=true]:!flex",
1924
- className
1925
- ),
1926
- ...props
1927
- }
1928
- );
1929
- });
1930
- SidebarMenuSub.displayName = "SidebarMenuSub";
1931
- SidebarMenuSubItem = React12__namespace.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("li", { ref, ...props }));
1932
- SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
1933
- SidebarMenuSubButton = React12__namespace.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
1934
- const Comp = asChild ? reactSlot.Slot : "a";
1935
- return /* @__PURE__ */ jsxRuntime.jsx(
1936
- Comp,
1937
- {
1938
- ref,
1939
- "data-sidebar": "menu-sub-button",
1940
- "data-size": size,
1941
- "data-active": isActive,
1942
- className: cn(
1943
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 text-xs",
1944
- "data-[active=true]:bg-primary/15 data-[active=true]:!text-primary data-[active=true]:font-bold",
1945
- size === "sm" && "text-xs",
1946
- size === "md" && "text-sm",
1947
- className
1948
- ),
1949
- ...props
1950
- }
1951
- );
1952
- });
1953
- SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
1954
- }
1955
- });
1956
- var init_sticky_layout = __esm({
1957
- "src/ui/primitives/sticky-layout.tsx"() {
1958
- }
1959
- });
1960
- var init_prefetch_link = __esm({
1961
- "src/ui/primitives/prefetch-link.tsx"() {
1962
- "use client";
1963
- }
1964
- });
1965
- function DynamicIcon({ name, ...props }) {
1966
- if (!name) return null;
1967
- const LucideIcon = lucideReact.icons[name];
1968
- if (!LucideIcon) return null;
1969
- return /* @__PURE__ */ jsxRuntime.jsx(LucideIcon, { ...props });
1970
- }
1971
- var init_dynamic_icon = __esm({
1972
- "src/ui/primitives/dynamic-icon.tsx"() {
1973
- "use client";
1974
- }
1975
- });
1976
- var InputNumber;
1977
- var init_input_number = __esm({
1978
- "src/ui/primitives/input-number.tsx"() {
1979
- "use client";
1980
- init_utils();
1981
- init_input();
1982
- InputNumber = React12__namespace.forwardRef(
1983
- ({ value, onChange, className, decimalScale = 0, suffix, ...props }, ref) => {
1984
- const [displayValue, setDisplayValue] = React12__namespace.useState("");
1985
- const parseDisplayValue = (val) => {
1986
- const clean = val.replace(/\./g, "").replace(",", ".");
1987
- return Number(clean);
1988
- };
1989
- const formatNumber = React12__namespace.useCallback(
1990
- (num) => {
1991
- return new Intl.NumberFormat("vi-VN", {
1992
- maximumFractionDigits: decimalScale,
1993
- minimumFractionDigits: 0
1994
- }).format(num);
1995
- },
1996
- [decimalScale]
1997
- );
1998
- React12__namespace.useEffect(() => {
1999
- if (value === null || value === void 0 || value === "") {
2000
- setDisplayValue("");
2001
- return;
2002
- }
2003
- const numValue = Number(value);
2004
- if (isNaN(numValue)) return;
2005
- const currentNum = parseDisplayValue(displayValue);
2006
- if (currentNum !== numValue) {
2007
- setDisplayValue(formatNumber(numValue));
2008
- }
2009
- }, [value, decimalScale, displayValue, formatNumber]);
2010
- const handleChange = (e) => {
2011
- const rawValue = e.target.value;
2012
- let cleanVal = rawValue.replace(/[^0-9,]/g, "");
2013
- const parts = cleanVal.split(",");
2014
- if (parts.length > 2) {
2015
- cleanVal = parts[0] + "," + parts.slice(1).join("");
2016
- }
2017
- if (cleanVal === "") {
2018
- setDisplayValue("");
2019
- onChange?.(null);
2020
- return;
2021
- }
2022
- const [integerPart, decimalPart] = cleanVal.split(",");
2023
- let formattedInteger = integerPart;
2024
- if (integerPart) {
2025
- formattedInteger = new Intl.NumberFormat("vi-VN").format(
2026
- Number(integerPart)
2027
- );
2028
- }
2029
- let newDisplayValue = formattedInteger;
2030
- let finalDecimalPart = decimalPart;
2031
- if (decimalPart !== void 0) {
2032
- if (decimalScale !== void 0 && decimalPart.length > decimalScale) {
2033
- finalDecimalPart = decimalPart.substring(0, decimalScale);
2034
- }
2035
- newDisplayValue += "," + finalDecimalPart;
2036
- }
2037
- setDisplayValue(newDisplayValue);
2038
- let numStr = integerPart;
2039
- if (finalDecimalPart !== void 0) {
2040
- numStr += "." + finalDecimalPart;
2041
- }
2042
- const numValue = Number(numStr.replace(/\./g, ""));
2043
- onChange?.(numValue);
2044
- };
2045
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
2046
- /* @__PURE__ */ jsxRuntime.jsx(
2047
- Input,
2048
- {
2049
- ...props,
2050
- ref,
2051
- type: "text",
2052
- inputMode: "numeric",
2053
- value: displayValue,
2054
- onChange: handleChange,
2055
- className: cn("pr-8", className)
2056
- }
2057
- ),
2058
- suffix && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-muted-foreground text-sm", children: suffix })
2059
- ] });
2060
- }
2061
- );
2062
- InputNumber.displayName = "InputNumber";
2063
- }
2064
- });
2065
-
2066
- // src/ui/primitives/client.ts
2067
- var init_client = __esm({
2068
- "src/ui/primitives/client.ts"() {
2069
- "use client";
2070
- init_calendar();
2071
- init_combobox();
2072
- init_scroll_area();
2073
- init_select();
2074
- init_popover();
2075
- init_dropdown_menu();
2076
- init_switch();
2077
- init_checkbox();
2078
- init_label();
2079
- init_tooltip();
2080
- init_sidebar();
2081
- init_resizable();
2082
- init_slider();
2083
- init_toggle();
2084
- init_toggle_group();
2085
- init_menubar();
2086
- init_navigation_menu();
2087
- init_sticky_layout();
2088
- init_prefetch_link();
2089
- init_dynamic_icon();
2090
- init_input_number();
2091
- init_sheet();
2092
- init_context_menu();
2093
- init_drawer();
2094
- init_progress();
2095
- init_sonner();
2096
- }
2097
- });
2098
- function RadioGroup4({
2099
- className,
2100
- ...props
2101
- }) {
2102
- return /* @__PURE__ */ jsxRuntime.jsx(
2103
- RadioGroupPrimitive__namespace.Root,
2104
- {
2105
- "data-slot": "radio-group",
2106
- className: cn("grid gap-2", className),
2107
- ...props
2108
- }
2109
- );
2110
- }
2111
- function RadioGroupItem({
2112
- className,
2113
- ...props
2114
- }) {
2115
- return /* @__PURE__ */ jsxRuntime.jsx(
2116
- RadioGroupPrimitive__namespace.Item,
2117
- {
2118
- "data-slot": "radio-group-item",
2119
- className: cn(
2120
- "cursor-pointer aspect-square h-current w-4 rounded-full border-[1.5px] border-primary text-primary focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
2121
- className
2122
- ),
2123
- ...props,
2124
- children: /* @__PURE__ */ jsxRuntime.jsx(
2125
- RadioGroupPrimitive__namespace.Indicator,
2126
- {
2127
- "data-slot": "radio-group-indicator",
2128
- className: "flex items-center justify-center",
2129
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Circle, { className: "h-2.5 w-2.5 fill-current text-current" })
2130
- }
2131
- )
2132
- }
2133
- );
2134
- }
2135
- var init_radio_group = __esm({
2136
- "src/ui/forms/radio-group.tsx"() {
2137
- "use client";
2138
- init_utils();
2139
- }
2140
- });
2141
- function Rating({
2142
- className,
2143
- length = 5,
2144
- size,
2145
- variant = "default",
2146
- orientation = "horizontal",
2147
- readOnly = false,
2148
- iconName = "Star",
2149
- ...props
2150
- }) {
2151
- const currentValue = props.value || "0";
2152
- const [hoverValue, onHoverValue] = React12.useState(currentValue);
2153
- if (readOnly) {
2154
- return /* @__PURE__ */ jsxRuntime.jsx(
2155
- "div",
2156
- {
2157
- "data-slot": "rating",
2158
- role: "img",
2159
- className: cn(
2160
- "flex",
2161
- orientation === "horizontal" ? "gap-x-1.5" : "flex-col space-y-1.5",
2162
- className
2163
- ),
2164
- "aria-label": `Rating: ${currentValue} out of ${length}`,
2165
- ...props,
2166
- children: Array.from({ length }, (_, index) => {
2167
- const starValue = (index + 1).toString();
2168
- const filled = Number(starValue) <= Number(currentValue);
2169
- return /* @__PURE__ */ jsxRuntime.jsx(
2170
- DynamicIcon,
2171
- {
2172
- name: iconName,
2173
- className: cn(
2174
- exports.starVariants({ size, variant, filled }),
2175
- "fill-current"
2176
- ),
2177
- "aria-hidden": true
2178
- },
2179
- starValue
2180
- );
2181
- })
2182
- }
2183
- );
2184
- }
2185
- return /* @__PURE__ */ jsxRuntime.jsx(
2186
- RadioGroupPrimitive__namespace.Root,
2187
- {
2188
- "data-slot": "rating",
2189
- className: cn(
2190
- "flex",
2191
- orientation === "horizontal" ? "gap-x-1.5" : "flex-col space-y-1.5",
2192
- className
2193
- ),
2194
- orientation,
2195
- onMouseLeave: () => onHoverValue("0"),
2196
- "aria-label": "Rating",
2197
- ...props,
2198
- children: Array.from({ length }).map((_, index) => {
2199
- const starValue = (index + 1).toString();
2200
- const filled = Number(starValue) <= (Number(hoverValue) || Number(currentValue));
2201
- return /* @__PURE__ */ jsxRuntime.jsx(
2202
- RatingStar,
2203
- {
2204
- variant,
2205
- size,
2206
- filled,
2207
- value: starValue,
2208
- onHoverValue,
2209
- iconName
2210
- },
2211
- starValue
2212
- );
2213
- })
2214
- }
2215
- );
2216
- }
2217
- function RatingStar({
2218
- value,
2219
- size,
2220
- variant,
2221
- filled,
2222
- onHoverValue,
2223
- iconName,
2224
- ...props
2225
- }) {
2226
- return /* @__PURE__ */ jsxRuntime.jsx(
2227
- RadioGroupPrimitive__namespace.Item,
2228
- {
2229
- "data-slot": "rating-star",
2230
- value,
2231
- className: cn(
2232
- exports.starVariants({ size, variant, filled }),
2233
- "cursor-pointer focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
2234
- ),
2235
- onMouseEnter: () => onHoverValue(value),
2236
- "aria-label": `Rate ${value} star${value === "1" ? "" : "s"}`,
2237
- ...props,
2238
- children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: iconName, className: "h-full w-full fill-current" })
2239
- }
2240
- );
2241
- }
2242
- exports.starVariants = void 0;
2243
- var init_rating = __esm({
2244
- "src/ui/forms/rating.tsx"() {
2245
- "use client";
2246
- init_utils();
2247
- init_dynamic_icon();
2248
- exports.starVariants = classVarianceAuthority.cva(
2249
- "transition-all duration-100 ease-in-out hover:scale-110",
2250
- {
2251
- variants: {
2252
- size: {
2253
- sm: "w-4 h-4",
2254
- default: "w-6 h-6",
2255
- lg: "w-8 h-8"
2256
- },
2257
- variant: {
2258
- default: "text-yellow-400",
2259
- primary: "text-primary",
2260
- muted: "text-muted-foreground"
2261
- },
2262
- filled: {
2263
- true: "",
2264
- false: "text-gray-200"
2265
- }
2266
- },
2267
- defaultVariants: {
2268
- size: "default",
2269
- variant: "default",
2270
- filled: false
2271
- }
2272
- }
2273
- );
2274
- }
2275
- });
2276
- function Command({
2277
- className,
2278
- ...props
2279
- }) {
2280
- return /* @__PURE__ */ jsxRuntime.jsx(
2281
- cmdk.Command,
2282
- {
2283
- "data-slot": "command",
2284
- className: cn(
2285
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
2286
- className
2287
- ),
2288
- ...props
2289
- }
2290
- );
2291
- }
2292
- function CommandDialog({
2293
- children,
2294
- commandProps,
2295
- ...props
2296
- }) {
2297
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { ...props, children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
2298
- Command,
2299
- {
2300
- className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
2301
- ...commandProps,
2302
- children
2303
- }
2304
- ) }) });
2305
- }
2306
- function CommandInput({
2307
- className,
2308
- ...props
2309
- }) {
2310
- return /* @__PURE__ */ jsxRuntime.jsxs(
2311
- "div",
2312
- {
2313
- "data-slot": "command-input-wrapper",
2314
- className: "flex items-center border-b px-3",
2315
- children: [
2316
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "me-2 size-4 shrink-0 opacity-50" }),
2317
- /* @__PURE__ */ jsxRuntime.jsx(
2318
- cmdk.Command.Input,
2319
- {
2320
- "data-slot": "command-input",
2321
- className: cn(
2322
- "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
2323
- className
2324
- ),
2325
- ...props
2326
- }
2327
- )
2328
- ]
2329
- }
2330
- );
2331
- }
2332
- function CommandList({
2333
- className,
2334
- ...props
2335
- }) {
2336
- return /* @__PURE__ */ jsxRuntime.jsx(
2337
- cmdk.Command.List,
2338
- {
2339
- "data-slot": "command-list",
2340
- className: cn(
2341
- "max-h-[300px] overflow-y-auto overflow-x-hidden",
2342
- className
2343
- ),
2344
- ...props
2345
- }
2346
- );
2347
- }
2348
- function CommandEmpty({
2349
- ...props
2350
- }) {
2351
- return /* @__PURE__ */ jsxRuntime.jsx(
2352
- cmdk.Command.Empty,
2353
- {
2354
- "data-slot": "command-empty",
2355
- className: "py-6 text-center text-sm",
2356
- ...props
2357
- }
2358
- );
2359
- }
2360
- function CommandGroup({
2361
- className,
2362
- ...props
2363
- }) {
2364
- return /* @__PURE__ */ jsxRuntime.jsx(
2365
- cmdk.Command.Group,
2366
- {
2367
- "data-slot": "command-group",
2368
- className: cn(
2369
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
2370
- className
2371
- ),
2372
- ...props
2373
- }
2374
- );
2375
- }
2376
- function CommandSeparator({
2377
- className,
2378
- ...props
2379
- }) {
2380
- return /* @__PURE__ */ jsxRuntime.jsx(
2381
- cmdk.Command.Separator,
2382
- {
2383
- "data-slot": "command-separator",
2384
- className: cn("-mx-1 h-px bg-border", className),
2385
- ...props
2386
- }
2387
- );
2388
- }
2389
- function CommandItem({
2390
- className,
2391
- ...props
2392
- }) {
2393
- return /* @__PURE__ */ jsxRuntime.jsx(
2394
- cmdk.Command.Item,
2395
- {
2396
- "data-slot": "command-item",
2397
- className: cn(
2398
- "cursor-pointer relative flex gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
2399
- className
2400
- ),
2401
- ...props
2402
- }
2403
- );
2404
- }
2405
- function CommandShortcut({
2406
- className,
2407
- ...props
2408
- }) {
2409
- return /* @__PURE__ */ jsxRuntime.jsx(
2410
- "span",
2411
- {
2412
- "data-slot": "command-shortcut",
2413
- className: cn(
2414
- "ms-auto text-sm tracking-widest text-muted-foreground",
2415
- className
2416
- ),
2417
- ...props
2418
- }
2419
- );
2420
- }
2421
- var init_command = __esm({
2422
- "src/ui/forms/command.tsx"() {
2423
- "use client";
2424
- init_utils();
2425
- init_feedback();
2426
- }
2427
- });
2428
- exports.MultiSelect = void 0;
2429
- var init_multi_select = __esm({
2430
- "src/ui/forms/multi-select.tsx"() {
2431
- "use client";
2432
- init_utils();
2433
- init_primitives();
2434
- init_client();
2435
- exports.MultiSelect = React12__namespace.forwardRef(
2436
- ({
2437
- options,
2438
- value: controlledValue,
2439
- onValueChange,
2440
- defaultValue = [],
2441
- placeholder = "Select options...",
2442
- searchPlaceholder = "Search...",
2443
- emptyText = "No option found.",
2444
- maxCount = 3,
2445
- disabled = false,
2446
- responsive = false,
2447
- className,
2448
- id
2449
- }, ref) => {
2450
- const [internalValue, setInternalValue] = React12.useState(defaultValue);
2451
- const [open, setOpen] = React12.useState(false);
2452
- const [searchValue, setSearchValue] = React12.useState("");
2453
- const isControlled = controlledValue !== void 0;
2454
- const value = isControlled ? controlledValue : internalValue;
2455
- const containerRef = React12.useRef(null);
2456
- const searchInputRef = React12.useRef(null);
2457
- const dropdownRef = React12.useRef(null);
2458
- const buttonRef = React12.useRef(null);
2459
- const [politeMessage, setPoliteMessage] = React12.useState("");
2460
- const [assertiveMessage, setAssertiveMessage] = React12.useState("");
2461
- const prevSelectedCount = React12.useRef(value.length);
2462
- const announce = React12.useCallback(
2463
- (message, priority = "polite") => {
2464
- if (priority === "assertive") {
2465
- setAssertiveMessage(message);
2466
- setTimeout(() => setAssertiveMessage(""), 100);
2467
- } else {
2468
- setPoliteMessage(message);
2469
- setTimeout(() => setPoliteMessage(""), 100);
2470
- }
2471
- },
2472
- []
2473
- );
2474
- const [screenSize, setScreenSize] = React12.useState("desktop");
2475
- React12.useEffect(() => {
2476
- if (typeof window === "undefined") return;
2477
- const handleResize = () => {
2478
- const width = window.innerWidth;
2479
- if (width < 640) {
2480
- setScreenSize("mobile");
2481
- } else if (width < 1024) {
2482
- setScreenSize("tablet");
2483
- } else {
2484
- setScreenSize("desktop");
2485
- }
2486
- };
2487
- handleResize();
2488
- window.addEventListener("resize", handleResize);
2489
- return () => window.removeEventListener("resize", handleResize);
2490
- }, []);
2491
- const getResponsiveSettings = React12.useCallback(() => {
2492
- if (!responsive) {
2493
- return {
2494
- maxCount,
2495
- compactMode: false
2496
- };
2497
- }
2498
- if (responsive === true) {
2499
- const defaultResponsive = {
2500
- mobile: { maxCount: 2, compactMode: true },
2501
- tablet: { maxCount: 4, compactMode: false },
2502
- desktop: { maxCount: 6, compactMode: false }
2503
- };
2504
- const currentSettings2 = defaultResponsive[screenSize];
2505
- return {
2506
- maxCount: currentSettings2?.maxCount ?? maxCount,
2507
- compactMode: currentSettings2?.compactMode ?? false
2508
- };
2509
- }
2510
- const currentSettings = responsive[screenSize];
2511
- return {
2512
- maxCount: currentSettings?.maxCount ?? maxCount,
2513
- compactMode: currentSettings?.compactMode ?? false
2514
- };
2515
- }, [responsive, screenSize, maxCount]);
2516
- const responsiveSettings = getResponsiveSettings();
2517
- const filteredOptions = React12.useMemo(() => {
2518
- if (!searchValue.trim()) {
2519
- return options;
2520
- }
2521
- const searchLower = searchValue.toLowerCase();
2522
- return options.filter(
2523
- (option) => option.label.toLowerCase().includes(searchLower) || String(option.value).toLowerCase().includes(searchLower)
2524
- );
2525
- }, [options, searchValue]);
2526
- React12.useEffect(() => {
2527
- if (!open) {
2528
- setSearchValue("");
2529
- }
2530
- }, [open]);
2531
- React12.useEffect(() => {
2532
- if (open && searchInputRef.current) {
2533
- setTimeout(() => {
2534
- searchInputRef.current?.focus();
2535
- }, 50);
2536
- }
2537
- }, [open]);
2538
- React12.useEffect(() => {
2539
- if (!open) return;
2540
- const handleClickOutside = (event) => {
2541
- const target = event.target;
2542
- if (containerRef.current && !containerRef.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
2543
- if (target.closest('[data-slot="dialog-content"]')) {
2544
- return;
2545
- }
2546
- setOpen(false);
2547
- }
2548
- };
2549
- const handleEscape = (event) => {
2550
- if (event.key === "Escape" && open) {
2551
- event.stopPropagation();
2552
- setOpen(false);
2553
- }
2554
- };
2555
- document.addEventListener("mousedown", handleClickOutside, true);
2556
- document.addEventListener("keydown", handleEscape, true);
2557
- return () => {
2558
- document.removeEventListener("mousedown", handleClickOutside, true);
2559
- document.removeEventListener("keydown", handleEscape, true);
2560
- };
2561
- }, [open]);
2562
- React12.useEffect(() => {
2563
- const selectedCount = value.length;
2564
- const totalOptions = options.filter((opt) => !opt.disabled).length;
2565
- if (selectedCount !== prevSelectedCount.current) {
2566
- const diff = selectedCount - prevSelectedCount.current;
2567
- if (diff > 0) {
2568
- announce(`${selectedCount} of ${totalOptions} options selected.`);
2569
- } else if (diff < 0) {
2570
- announce(
2571
- `Option removed. ${selectedCount} of ${totalOptions} options selected.`
2572
- );
2573
- }
2574
- prevSelectedCount.current = selectedCount;
2575
- }
2576
- }, [value, announce, options]);
2577
- const updateValue = React12.useCallback(
2578
- (newValue) => {
2579
- if (!isControlled) {
2580
- setInternalValue(newValue);
2581
- }
2582
- onValueChange?.(newValue);
2583
- },
2584
- [isControlled, onValueChange]
2585
- );
2586
- const handleSelect = React12.useCallback(
2587
- (optionValue) => {
2588
- const option = options.find((opt) => opt.value === optionValue);
2589
- if (option?.disabled) {
2590
- return;
2591
- }
2592
- const newValue = value.includes(optionValue) ? value.filter((v) => v !== optionValue) : [...value, optionValue];
2593
- updateValue(newValue);
2594
- },
2595
- [value, options, updateValue]
2596
- );
2597
- const handleSelectAll = React12.useCallback(() => {
2598
- updateValue(
2599
- filteredOptions.filter((opt) => !opt.disabled).map((opt) => opt.value)
2600
- );
2601
- }, [updateValue, filteredOptions]);
2602
- const handleClearAll = React12.useCallback(() => {
2603
- updateValue([]);
2604
- }, [updateValue]);
2605
- const handleRemove = React12.useCallback(
2606
- (optionValue, e) => {
2607
- e.stopPropagation();
2608
- updateValue(value.filter((v) => v !== optionValue));
2609
- },
2610
- [updateValue, value]
2611
- );
2612
- const clearExtraOptions = React12.useCallback(() => {
2613
- const newSelectedValues = value.slice(0, responsiveSettings.maxCount);
2614
- updateValue(newSelectedValues);
2615
- }, [value, responsiveSettings.maxCount, updateValue]);
2616
- React12__namespace.useImperativeHandle(
2617
- ref,
2618
- () => ({
2619
- reset: () => {
2620
- updateValue(defaultValue);
2621
- setOpen(false);
2622
- setSearchValue("");
2623
- },
2624
- getSelectedValues: () => value,
2625
- setSelectedValues: (values) => {
2626
- updateValue(values);
2627
- },
2628
- clear: () => {
2629
- updateValue([]);
2630
- },
2631
- focus: () => {
2632
- buttonRef.current?.focus();
2633
- }
2634
- }),
2635
- [value, defaultValue, updateValue]
2636
- );
2637
- const selectedOptions = options.filter(
2638
- (option) => value.includes(option.value)
2639
- );
2640
- const getBadgeColor = (index) => {
2641
- const colors = [
2642
- "bg-blue-100 text-blue-700 hover:bg-blue-200",
2643
- "bg-green-100 text-green-700 hover:bg-green-200",
2644
- "bg-purple-100 text-purple-700 hover:bg-purple-200",
2645
- "bg-orange-100 text-orange-700 hover:bg-orange-200",
2646
- "bg-pink-100 text-pink-700 hover:bg-pink-200",
2647
- "bg-cyan-100 text-cyan-700 hover:bg-cyan-200"
2648
- ];
2649
- return colors[index % colors.length];
2650
- };
2651
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: "relative w-full", children: [
2652
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sr-only", children: [
2653
- /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", children: politeMessage }),
2654
- /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-live": "assertive", "aria-atomic": "true", role: "alert", children: assertiveMessage })
2655
- ] }),
2656
- /* @__PURE__ */ jsxRuntime.jsxs(
2657
- Button,
2658
- {
2659
- ref: buttonRef,
2660
- type: "button",
2661
- variant: "outline",
2662
- role: "combobox",
2663
- "aria-expanded": open,
2664
- disabled,
2665
- className: cn(
2666
- "w-full justify-between h-auto min-h-10 px-3 py-2",
2667
- responsiveSettings.compactMode && "min-h-8 text-sm",
2668
- className
2669
- ),
2670
- id,
2671
- onClick: (e) => {
2672
- e.stopPropagation();
2673
- setOpen(!open);
2674
- },
2675
- children: [
2676
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: selectedOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2677
- selectedOptions.slice(0, responsiveSettings.maxCount).map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs(
2678
- Badge,
2679
- {
2680
- className: cn(
2681
- "mr-1 mb-1",
2682
- getBadgeColor(index),
2683
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2684
- ),
2685
- onClick: (e) => handleRemove(option.value, e),
2686
- children: [
2687
- option.icon && !responsiveSettings.compactMode && /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "mr-2 h-4 w-4" }),
2688
- option.label,
2689
- /* @__PURE__ */ jsxRuntime.jsx(
2690
- "div",
2691
- {
2692
- role: "button",
2693
- tabIndex: 0,
2694
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2695
- onKeyDown: (e) => {
2696
- if (e.key === "Enter") {
2697
- handleRemove(option.value, e);
2698
- }
2699
- },
2700
- onMouseDown: (e) => {
2701
- e.preventDefault();
2702
- e.stopPropagation();
2703
- },
2704
- onClick: (e) => handleRemove(option.value, e),
2705
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
2706
- }
2707
- )
2708
- ]
2709
- },
2710
- String(option.value)
2711
- )),
2712
- value.length > responsiveSettings.maxCount && /* @__PURE__ */ jsxRuntime.jsxs(
2713
- Badge,
2714
- {
2715
- className: cn(
2716
- "mr-1 mb-1 bg-muted text-muted-foreground hover:bg-muted",
2717
- responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
2718
- ),
2719
- children: [
2720
- "+",
2721
- value.length - responsiveSettings.maxCount,
2722
- " more",
2723
- /* @__PURE__ */ jsxRuntime.jsx(
2724
- "div",
2725
- {
2726
- role: "button",
2727
- tabIndex: 0,
2728
- className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
2729
- onClick: (e) => {
2730
- e.stopPropagation();
2731
- clearExtraOptions();
2732
- },
2733
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
2734
- }
2735
- )
2736
- ]
2737
- }
2738
- )
2739
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
2740
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
2741
- ]
2742
- }
2743
- ),
2744
- open && /* @__PURE__ */ jsxRuntime.jsx(
2745
- "div",
2746
- {
2747
- ref: dropdownRef,
2748
- className: "absolute z-[100] mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md",
2749
- style: {
2750
- top: "100%",
2751
- left: 0
2752
- },
2753
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
2754
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
2755
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
2756
- /* @__PURE__ */ jsxRuntime.jsx(
2757
- Input,
2758
- {
2759
- ref: searchInputRef,
2760
- placeholder: searchPlaceholder,
2761
- value: searchValue,
2762
- onChange: (e) => {
2763
- e.stopPropagation();
2764
- setSearchValue(e.target.value);
2765
- },
2766
- onKeyDown: (e) => {
2767
- e.stopPropagation();
2768
- if (e.key === "Escape") {
2769
- e.preventDefault();
2770
- setOpen(false);
2771
- }
2772
- },
2773
- onClick: (e) => {
2774
- e.stopPropagation();
2775
- },
2776
- onFocus: (e) => {
2777
- e.stopPropagation();
2778
- },
2779
- className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0 h-9 bg-transparent px-0"
2780
- }
2781
- ),
2782
- searchValue && /* @__PURE__ */ jsxRuntime.jsx(
2783
- Button,
2784
- {
2785
- type: "button",
2786
- variant: "ghost",
2787
- size: "sm",
2788
- className: "h-6 w-6 p-0",
2789
- onClick: (e) => {
2790
- e.stopPropagation();
2791
- setSearchValue("");
2792
- searchInputRef.current?.focus();
2793
- },
2794
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
2795
- }
2796
- )
2797
- ] }),
2798
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-b p-1", children: [
2799
- /* @__PURE__ */ jsxRuntime.jsx(
2800
- Button,
2801
- {
2802
- type: "button",
2803
- variant: "ghost",
2804
- size: "sm",
2805
- className: "h-8 px-2 text-xs",
2806
- onClick: (e) => {
2807
- e.stopPropagation();
2808
- handleSelectAll();
2809
- },
2810
- children: "Select All"
2811
- }
2812
- ),
2813
- /* @__PURE__ */ jsxRuntime.jsx(
2814
- Button,
2815
- {
2816
- type: "button",
2817
- variant: "ghost",
2818
- size: "sm",
2819
- className: "h-8 px-2 text-xs",
2820
- onClick: (e) => {
2821
- e.stopPropagation();
2822
- handleClearAll();
2823
- },
2824
- children: "Clear All"
2825
- }
2826
- )
2827
- ] }),
2828
- /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "max-h-[300px]", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-1", children: filteredOptions.map((option) => {
2829
- const isSelected = value.includes(option.value);
2830
- const isDisabled = option.disabled || false;
2831
- return /* @__PURE__ */ jsxRuntime.jsxs(
2832
- "div",
2833
- {
2834
- role: "option",
2835
- "aria-selected": isSelected,
2836
- "aria-disabled": isDisabled,
2837
- className: cn(
2838
- "relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
2839
- isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent hover:text-accent-foreground",
2840
- isSelected && !isDisabled && "bg-accent text-accent-foreground"
2841
- ),
2842
- onMouseDown: (e) => {
2843
- e.preventDefault();
2844
- e.stopPropagation();
2845
- },
2846
- onClick: (e) => {
2847
- e.preventDefault();
2848
- e.stopPropagation();
2849
- if (!isDisabled) {
2850
- handleSelect(option.value);
2851
- }
2852
- },
2853
- children: [
2854
- /* @__PURE__ */ jsxRuntime.jsx(
2855
- "div",
2856
- {
2857
- className: cn(
2858
- "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
2859
- isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
2860
- ),
2861
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: cn("h-4 w-4") })
2862
- }
2863
- ),
2864
- option.icon && /* @__PURE__ */ jsxRuntime.jsx(option.icon, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
2865
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: option.label })
2866
- ]
2867
- },
2868
- String(option.value)
2869
- );
2870
- }) }) }),
2871
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
2872
- Button,
2873
- {
2874
- type: "button",
2875
- variant: "outline",
2876
- size: "sm",
2877
- className: "w-full h-8 text-xs",
2878
- onClick: (e) => {
2879
- e.stopPropagation();
2880
- setOpen(false);
2881
- },
2882
- children: "Close"
2883
- }
2884
- ) })
2885
- ] })
2886
- }
2887
- )
2888
- ] });
2889
- }
2890
- );
2891
- exports.MultiSelect.displayName = "MultiSelect";
2892
- }
2893
- });
2894
- function DatePicker({
2895
- value,
2896
- onValueChange,
2897
- formatStr = "yyyy-MM-dd",
2898
- popoverContentClassName,
2899
- popoverContentOptions,
2900
- buttonClassName,
2901
- buttonOptions,
2902
- placeholder = "Pick date",
2903
- ...props
2904
- }) {
2905
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { modal: true, children: [
2906
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2907
- Button,
2908
- {
2909
- variant: "outline",
2910
- className: cn("w-full px-3 text-start font-normal", buttonClassName),
2911
- ...buttonOptions,
2912
- children: [
2913
- value ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: dateFns.format(value, formatStr) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
2914
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "shrink-0 h-4 w-4 ms-auto text-muted-foreground" })
2915
- ]
2916
- }
2917
- ) }),
2918
- /* @__PURE__ */ jsxRuntime.jsx(
2919
- PopoverContent,
2920
- {
2921
- className: cn("w-auto p-0", popoverContentClassName),
2922
- align: "start",
2923
- ...popoverContentOptions,
2924
- children: /* @__PURE__ */ jsxRuntime.jsx(
2925
- Calendar,
2926
- {
2927
- mode: "single",
2928
- selected: value,
2929
- onSelect: onValueChange,
2930
- ...props
2931
- }
2932
- )
2933
- }
2934
- )
2935
- ] });
2936
- }
2937
- var init_date_picker = __esm({
2938
- "src/ui/forms/date-picker.tsx"() {
2939
- "use client";
2940
- init_utils();
2941
- init_primitives();
2942
- init_client();
2943
- }
2944
- });
2945
- function DateRangePicker({
2946
- value,
2947
- onValueChange,
2948
- formatStr = "yyyy-MM-dd",
2949
- popoverContentClassName,
2950
- popoverContentOptions,
2951
- buttonClassName,
2952
- buttonOptions,
2953
- placeholder = "Pick date",
2954
- ...props
2955
- }) {
2956
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { modal: true, children: [
2957
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
2958
- Button,
2959
- {
2960
- variant: "outline",
2961
- className: cn("w-full px-3 text-start font-normal", buttonClassName),
2962
- ...buttonOptions,
2963
- children: [
2964
- value?.from ? value.to ? /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
2965
- dateFns.format(value.from, formatStr),
2966
- " to ",
2967
- dateFns.format(value.to, formatStr)
2968
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: dateFns.format(value.from, formatStr) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
2969
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "ms-auto h-4 w-4 text-muted-foreground" })
2970
- ]
2971
- }
2972
- ) }),
2973
- /* @__PURE__ */ jsxRuntime.jsx(
2974
- PopoverContent,
2975
- {
2976
- className: cn("w-auto p-0", popoverContentClassName),
2977
- align: "start",
2978
- ...popoverContentOptions,
2979
- children: /* @__PURE__ */ jsxRuntime.jsx(
2980
- Calendar,
2981
- {
2982
- mode: "range",
2983
- selected: value,
2984
- onSelect: onValueChange,
2985
- ...props
2986
- }
2987
- )
2988
- }
2989
- )
2990
- ] });
2991
- }
2992
- var init_date_range_picker = __esm({
2993
- "src/ui/forms/date-range-picker.tsx"() {
2994
- "use client";
2995
- init_utils();
2996
- init_primitives();
2997
- init_client();
2998
- init_client();
2999
- }
3000
- });
3001
- function InputTime({
3002
- className,
3003
- onValueChange,
3004
- ...props
3005
- }) {
3006
- const [isEmpty, setIsEmpty] = React12.useState(!props.defaultValue && !props.value);
3007
- const handleChange = (e) => {
3008
- const value = e.target.value;
3009
- setIsEmpty(!value);
3010
- onValueChange?.(value);
3011
- };
3012
- return /* @__PURE__ */ jsxRuntime.jsx(
3013
- Input,
3014
- {
3015
- "data-slot": "input-time",
3016
- className: cn(
3017
- "block [&::-webkit-calendar-picker-indicator]:hidden rtl:text-right",
3018
- isEmpty && "text-muted-foreground",
3019
- className
3020
- ),
3021
- ...props,
3022
- type: "time",
3023
- onChange: handleChange
3024
- }
3025
- );
3026
- }
3027
- var init_input_time = __esm({
3028
- "src/ui/forms/input-time.tsx"() {
3029
- "use client";
3030
- init_utils();
3031
- init_primitives();
3032
- }
3033
- });
3034
- function DateTimePicker({
3035
- value,
3036
- onValueChange,
3037
- formatStr = "yyyy-MM-dd p",
3038
- popoverContentClassName,
3039
- popoverContentOptions,
3040
- buttonClassName,
3041
- buttonOptions,
3042
- placeholder = "Pick date and time",
3043
- ...props
3044
- }) {
3045
- const [selectedDate, setSelectedDate] = React12.useState(value);
3046
- const handleDateSelect = (selected) => {
3047
- if (!selected) return;
3048
- const newDateTime = new Date(selected);
3049
- if (selectedDate) {
3050
- newDateTime.setHours(selectedDate.getHours());
3051
- newDateTime.setMinutes(selectedDate.getMinutes());
3052
- }
3053
- setSelectedDate(newDateTime);
3054
- onValueChange?.(newDateTime);
3055
- };
3056
- const handleTimeChange = (timeString) => {
3057
- if (!timeString) return;
3058
- const [hours, minutes] = timeString.split(":").map(Number);
3059
- if (selectedDate) {
3060
- const newDateTime = new Date(selectedDate);
3061
- newDateTime.setHours(hours);
3062
- newDateTime.setMinutes(minutes);
3063
- setSelectedDate(newDateTime);
3064
- onValueChange?.(newDateTime);
3065
- }
3066
- };
3067
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { modal: true, children: [
3068
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3069
- Button,
3070
- {
3071
- variant: "outline",
3072
- className: cn("w-full px-3 text-start font-normal", buttonClassName),
3073
- ...buttonOptions,
3074
- children: [
3075
- selectedDate ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: dateFns.format(selectedDate, formatStr) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
3076
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "ms-auto h-4 w-4 text-muted-foreground" })
3077
- ]
3078
- }
3079
- ) }),
3080
- /* @__PURE__ */ jsxRuntime.jsxs(
3081
- PopoverContent,
3082
- {
3083
- className: cn("w-auto p-0", popoverContentClassName),
3084
- align: "start",
3085
- ...popoverContentOptions,
3086
- children: [
3087
- /* @__PURE__ */ jsxRuntime.jsx(
3088
- Calendar,
3089
- {
3090
- mode: "single",
3091
- selected: selectedDate,
3092
- onSelect: handleDateSelect,
3093
- ...props
3094
- }
3095
- ),
3096
- /* @__PURE__ */ jsxRuntime.jsx(Separator3, {}),
3097
- /* @__PURE__ */ jsxRuntime.jsx(
3098
- InputTime,
3099
- {
3100
- className: "rounded-t-none border-0",
3101
- onValueChange: handleTimeChange,
3102
- value: selectedDate ? dateFns.format(selectedDate, "p") : void 0
3103
- }
3104
- )
3105
- ]
3106
- }
3107
- )
3108
- ] });
3109
- }
3110
- var init_date_time_picker = __esm({
3111
- "src/ui/forms/date-time-picker.tsx"() {
3112
- "use client";
3113
- init_utils();
3114
- init_primitives();
3115
- init_client();
3116
- init_input_time();
3117
- init_client();
3118
- init_primitives();
3119
- }
3120
- });
3121
- function EmojiPicker({
3122
- popoverContentClassName,
3123
- popoverContentOptions,
3124
- buttonClassName,
3125
- buttonOptions,
3126
- ...props
3127
- }) {
3128
- const isDarkMode = useIsDarkMode();
3129
- const theme = isDarkMode ? emojiPickerReact.Theme.DARK : emojiPickerReact.Theme.LIGHT;
3130
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
3131
- /* @__PURE__ */ jsxRuntime.jsx(
3132
- PopoverTrigger,
3133
- {
3134
- className: cn(
3135
- buttonVariants({ variant: "ghost", size: "icon" }),
3136
- buttonClassName
3137
- ),
3138
- ...buttonOptions,
3139
- "aria-label": "Emoji",
3140
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "h-4 w-4" })
3141
- }
3142
- ),
3143
- /* @__PURE__ */ jsxRuntime.jsx(
3144
- PopoverContent,
3145
- {
3146
- className: cn("w-auto p-0", popoverContentClassName),
3147
- align: "start",
3148
- ...popoverContentOptions,
3149
- children: /* @__PURE__ */ jsxRuntime.jsx(Picker, { theme, searchPlaceholder: "Search...", ...props })
3150
- }
3151
- )
3152
- ] });
3153
- }
3154
- function ReactionPicker({
3155
- popoverContentClassName,
3156
- popoverContentOptions,
3157
- buttonClassName,
3158
- buttonOptions,
3159
- ...props
3160
- }) {
3161
- const isDarkMode = useIsDarkMode();
3162
- const theme = isDarkMode ? emojiPickerReact.Theme.DARK : emojiPickerReact.Theme.LIGHT;
3163
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
3164
- /* @__PURE__ */ jsxRuntime.jsx(
3165
- PopoverTrigger,
3166
- {
3167
- className: cn(
3168
- buttonVariants({ variant: "ghost", size: "icon" }),
3169
- buttonClassName
3170
- ),
3171
- ...buttonOptions,
3172
- "aria-label": "Emoji",
3173
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Smile, { className: "h-4 w-4" })
3174
- }
3175
- ),
3176
- /* @__PURE__ */ jsxRuntime.jsx(
3177
- PopoverContent,
3178
- {
3179
- className: cn("w-auto p-0", popoverContentClassName),
3180
- align: "start",
3181
- ...popoverContentOptions,
3182
- children: /* @__PURE__ */ jsxRuntime.jsx(
3183
- Picker,
3184
- {
3185
- theme,
3186
- searchPlaceholder: "Search...",
3187
- lazyLoadEmojis: true,
3188
- allowExpandReactions: false,
3189
- ...props,
3190
- reactionsDefaultOpen: true
3191
- }
3192
- )
3193
- }
3194
- )
3195
- ] });
3196
- }
3197
- var Picker;
3198
- var init_emoji_picker = __esm({
3199
- "src/ui/forms/emoji-picker.tsx"() {
3200
- "use client";
3201
- init_utils();
3202
- init_hooks();
3203
- init_primitives();
3204
- init_client();
3205
- Picker = dynamic__default.default(
3206
- () => {
3207
- return import('emoji-picker-react');
3208
- },
3209
- { ssr: false }
3210
- );
3211
- }
3212
- });
3213
- function FileThumbnail({ fileName, className }) {
3214
- const fileExtension = fileName.slice(fileName.lastIndexOf(".") + 1).toUpperCase();
3215
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative size-8 text-[6px] font-black", className), children: [
3216
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileIcon, { className: "size-full stroke-1", "aria-labelledby": "file-name" }),
3217
- /* @__PURE__ */ jsxRuntime.jsxs(
3218
- "div",
3219
- {
3220
- className: "absolute inset-0 flex justify-center items-center",
3221
- id: "file-name",
3222
- "aria-hidden": true,
3223
- children: [
3224
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "select-none", children: fileExtension }),
3225
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "File" })
3226
- ]
3227
- }
3228
- )
3229
- ] });
3230
- }
3231
- var init_file_thumbnail = __esm({
3232
- "src/ui/forms/file-thumbnail.tsx"() {
3233
- init_utils();
3234
- }
3235
- });
3236
- function FileDropzone({
3237
- className,
3238
- value,
3239
- onFilesChange,
3240
- ...props
3241
- }) {
3242
- const [files, setFiles] = React12.useState(value || []);
3243
- const [loadingFiles, setLoadingFiles] = React12.useState(/* @__PURE__ */ new Set());
3244
- const maxFiles = props.multiple ? props.maxFiles : 1;
3245
- const isDisabled = maxFiles === files.length;
3246
- const onDrop = React12.useCallback(
3247
- async (acceptedFiles) => {
3248
- const newFiles = acceptedFiles.map((file) => ({
3249
- id: crypto.randomUUID(),
3250
- name: file.name,
3251
- size: file.size,
3252
- type: file.type,
3253
- url: URL.createObjectURL(file)
3254
- }));
3255
- const updatedFiles = [...files, ...newFiles];
3256
- setFiles(updatedFiles);
3257
- onFilesChange?.(updatedFiles);
3258
- setLoadingFiles(new Set(newFiles.map((file) => file.id)));
3259
- for (const file of newFiles) {
3260
- await wait(2e3);
3261
- setLoadingFiles((prev) => {
3262
- const newLoadingFiles = new Set(prev);
3263
- newLoadingFiles.delete(file.id);
3264
- return newLoadingFiles;
3265
- });
3266
- }
3267
- },
3268
- [files, onFilesChange]
3269
- );
3270
- React12.useEffect(() => {
3271
- if (value) {
3272
- setFiles(value);
3273
- }
3274
- }, [value]);
3275
- const { getRootProps, getInputProps, isDragActive } = reactDropzone.useDropzone({
3276
- onDrop,
3277
- disabled: isDisabled,
3278
- ...props,
3279
- maxFiles
3280
- });
3281
- const removeFile = (fileId) => {
3282
- const updatedFiles = files.filter((file) => {
3283
- if (file.id === fileId) {
3284
- URL.revokeObjectURL(file.url);
3285
- return false;
3286
- }
3287
- return true;
3288
- });
3289
- setFiles(updatedFiles);
3290
- onFilesChange?.(updatedFiles);
3291
- };
3292
- return /* @__PURE__ */ jsxRuntime.jsxs(
3293
- "div",
3294
- {
3295
- "data-slot": "file-dropzone",
3296
- ...(() => {
3297
- const { popover, ...rest } = getRootProps();
3298
- return rest;
3299
- })(),
3300
- className: cn(
3301
- "h-[17.75rem] w-full relative flex rounded-lg border-2 border-dashed border-muted-foreground cursor-pointer transition-colors hover:border-primary hover:bg-muted/50",
3302
- isDragActive && "border-primary bg-muted/50",
3303
- isDisabled && "cursor-not-allowed",
3304
- className
3305
- ),
3306
- children: [
3307
- /* @__PURE__ */ jsxRuntime.jsx(
3308
- "input",
3309
- {
3310
- ...(() => {
3311
- const { popover, ...rest } = getInputProps();
3312
- return rest;
3313
- })()
3314
- }
3315
- ),
3316
- /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "w-0 flex-1 p-6", children: files.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid gap-4 grid-cols-2", children: files.map((file) => /* @__PURE__ */ jsxRuntime.jsxs(
3317
- "div",
3318
- {
3319
- className: "relative flex flex-col gap-2 rounded-lg border bg-background p-2 cursor-auto",
3320
- children: [
3321
- file.type.startsWith("image/") ? /* @__PURE__ */ jsxRuntime.jsx(
3322
- Image__default.default,
3323
- {
3324
- src: file.url,
3325
- alt: file.name,
3326
- width: 165,
3327
- height: 165,
3328
- className: "self-center aspect-square rounded object-contain pointer-events-none"
3329
- }
3330
- ) : /* @__PURE__ */ jsxRuntime.jsx(
3331
- FileThumbnail,
3332
- {
3333
- fileName: file.name,
3334
- className: "self-center aspect-square size-full text-sm"
3335
- }
3336
- ),
3337
- loadingFiles.has(file.id) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/50 rounded", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-8 w-8 text-primary animate-spin" }) }),
3338
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
3339
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: file.name }),
3340
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground font-semibold", children: formatFileSize(file.size) })
3341
- ] }),
3342
- /* @__PURE__ */ jsxRuntime.jsx(
3343
- Button,
3344
- {
3345
- variant: "secondary",
3346
- size: "icon",
3347
- className: "absolute end-1 top-1 h-4 w-4",
3348
- onClick: (e) => {
3349
- e.stopPropagation();
3350
- removeFile(file.id);
3351
- },
3352
- "aria-label": "Remove",
3353
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
3354
- }
3355
- )
3356
- ]
3357
- },
3358
- file.id
3359
- )) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-56 flex flex-col justify-center items-center gap-2 text-center p-4", children: [
3360
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.UploadCloud, { className: "h-8 w-8 text-muted-foreground" }),
3361
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Drag and drop some files here, or click to select files" })
3362
- ] }) })
3363
- ]
3364
- }
3365
- );
3366
- }
3367
- var init_file_dropzone = __esm({
3368
- "src/ui/forms/file-dropzone.tsx"() {
3369
- "use client";
3370
- init_utils();
3371
- init_primitives();
3372
- init_file_thumbnail();
3373
- init_client();
3374
- }
3375
- });
3376
- function InputFile({
3377
- className,
3378
- containerClassName,
3379
- buttonVariant,
3380
- buttonLabel,
3381
- placeholder = "No file chosen",
3382
- value,
3383
- onValueChange,
3384
- ...props
3385
- }) {
3386
- const [fileName, setFileName] = React12.useState(placeholder);
3387
- const inputRef = React12.useRef(null);
3388
- React12.useImperativeHandle(props.ref, () => inputRef.current);
3389
- const handleFileChange = (event) => {
3390
- const files = event.target.files;
3391
- if (files) {
3392
- if (files.length > 1) {
3393
- setFileName(`${files.length} Files`);
3394
- } else if (files.length === 1) {
3395
- setFileName(files[0].name);
3396
- } else {
3397
- setFileName(placeholder);
3398
- }
3399
- onValueChange?.(files);
3400
- }
3401
- };
3402
- const handleClick = () => {
3403
- inputRef.current?.click();
3404
- };
3405
- React12.useEffect(() => {
3406
- if (value) {
3407
- if (value.length > 1) {
3408
- setFileName(`${value.length} Files`);
3409
- } else {
3410
- setFileName(value[0].name);
3411
- }
3412
- } else {
3413
- setFileName(placeholder);
3414
- }
3415
- }, [value, placeholder]);
3416
- return /* @__PURE__ */ jsxRuntime.jsxs(
3417
- "div",
3418
- {
3419
- "data-slot": "input-file",
3420
- className: cn(
3421
- "h-9 w-full flex rounded-md border border-input bg-transparent text-sm transition-colors",
3422
- props.disabled && "cursor-not-allowed opacity-50",
3423
- containerClassName
3424
- ),
3425
- children: [
3426
- /* @__PURE__ */ jsxRuntime.jsx(
3427
- Button,
3428
- {
3429
- type: "button",
3430
- variant: buttonVariant,
3431
- className: "h-full w-28 rounded-e-none border-0 border-e border-input",
3432
- onClick: handleClick,
3433
- disabled: props.disabled,
3434
- children: buttonLabel ?? `Choose File${props.multiple ? "s" : ""}`
3435
- }
3436
- ),
3437
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center text-muted-foreground px-3 break-all", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-0 flex-1 truncate", children: fileName }) }),
3438
- /* @__PURE__ */ jsxRuntime.jsx(
3439
- "input",
3440
- {
3441
- ...props,
3442
- ref: inputRef,
3443
- type: "file",
3444
- className: cn("hidden", className),
3445
- onChange: handleFileChange
3446
- }
3447
- )
3448
- ]
3449
- }
3450
- );
3451
- }
3452
- var init_input_file = __esm({
3453
- "src/ui/forms/input-file.tsx"() {
3454
- "use client";
3455
- init_utils();
3456
- init_primitives();
3457
- }
3458
- });
3459
- function InputGroup({ className, children, ...props }) {
3460
- return /* @__PURE__ */ jsxRuntime.jsx(
3461
- "div",
3462
- {
3463
- "data-slot": "input-group",
3464
- className: cn(
3465
- "flex min-h-9 w-full rounded-md border border-input bg-transparent text-sm transition-colors [&>*:not(.input-group-text)]:border-0 [&>input]:z-10 [&>input]:first:rounded-e-none [&>input]:last:rounded-s-none [&>input:not(:first-child):not(:last-child)]:rounded-none [&>textarea]:z-10 [&>textarea]:first:rounded-e-none [&>textarea]:last:rounded-s-none [&>textarea:not(:first-child):not(:last-child)]:rounded-none [&>button]:first:rounded-e-none [&>button]:last:rounded-s-none [&>button]:[&:not(:first-child):not(:last-child)]:rounded-none",
3466
- className
3467
- ),
3468
- ...props,
3469
- children
3470
- }
3471
- );
3472
- }
3473
- function InputGroupText({
3474
- className,
3475
- merged = false,
3476
- ...props
3477
- }) {
3478
- return /* @__PURE__ */ jsxRuntime.jsx(
3479
- "div",
3480
- {
3481
- "data-slot": "input-group-text",
3482
- className: cn(
3483
- "input-group-text",
3484
- "flex items-center justify-center border-input px-3 py-1 text-sm text-muted-foreground",
3485
- !merged && "first:rounded-s-md last:rounded-e-md first:border-e last:border-s [&:not(:first-child):not(:last-child)]:border-x",
3486
- className
3487
- ),
3488
- ...props
3489
- }
3490
- );
3491
- }
3492
- var init_input_group = __esm({
3493
- "src/ui/forms/input-group.tsx"() {
3494
- "use client";
3495
- init_utils();
3496
- }
3497
- });
3498
- function InputOTP({
3499
- className,
3500
- containerClassName,
3501
- ...props
3502
- }) {
3503
- return /* @__PURE__ */ jsxRuntime.jsx(
3504
- inputOtp.OTPInput,
3505
- {
3506
- "data-slot": "input-otp",
3507
- containerClassName: cn(
3508
- "flex items-center gap-2 has-disabled:opacity-50",
3509
- containerClassName
3510
- ),
3511
- className: cn("disabled:cursor-not-allowed", className),
3512
- ...props
3513
- }
3514
- );
3515
- }
3516
- function InputOTPGroup({ className, ...props }) {
3517
- return /* @__PURE__ */ jsxRuntime.jsx(
3518
- "div",
3519
- {
3520
- "data-slot": "input-otp-group",
3521
- className: cn("flex items-center", className),
3522
- ...props
3523
- }
3524
- );
3525
- }
3526
- function InputOTPSlot({
3527
- index,
3528
- className,
3529
- ...props
3530
- }) {
3531
- const inputOTPContext = React12.useContext(inputOtp.OTPInputContext);
3532
- const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
3533
- return /* @__PURE__ */ jsxRuntime.jsxs(
3534
- "div",
3535
- {
3536
- "data-slot": "input-otp-slot",
3537
- className: cn(
3538
- "relative flex h-9 w-9 items-center justify-center border-y border-e border-input text-sm transition-all first:rounded-s-md first:border-s last:rounded-e-md",
3539
- isActive && "z-10 ring-1 ring-ring",
3540
- className
3541
- ),
3542
- ...props,
3543
- children: [
3544
- char,
3545
- hasFakeCaret && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) })
3546
- ]
3547
- }
3548
- );
3549
- }
3550
- function InputOTPSeparator({ ...props }) {
3551
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, {}) });
3552
- }
3553
- var init_input_otp = __esm({
3554
- "src/ui/forms/input-otp.tsx"() {
3555
- "use client";
3556
- init_utils();
3557
- }
3558
- });
3559
- function InputPhone({ className, onChange, ...props }) {
3560
- const direction = reactDirection.useDirection();
3561
- return /* @__PURE__ */ jsxRuntime.jsx(
3562
- RPNInputPrimitive__namespace.default,
3563
- {
3564
- "data-slot": "input-phone",
3565
- dir: direction,
3566
- className: cn("w-full flex", className),
3567
- flagComponent: FlagComponent,
3568
- countrySelectComponent: CountrySelect,
3569
- inputComponent: InputComponent,
3570
- onChange: (value) => onChange?.(value),
3571
- ...props
3572
- }
3573
- );
3574
- }
3575
- function InputComponent({ className, ...props }) {
3576
- return /* @__PURE__ */ jsxRuntime.jsx(
3577
- Input,
3578
- {
3579
- className: cn("rounded-e-md rounded-s-none", className),
3580
- ...props
3581
- }
3582
- );
3583
- }
3584
- function CountrySelect({
3585
- disabled,
3586
- value,
3587
- onChange,
3588
- options
3589
- }) {
3590
- const handleSelect = React12.useCallback(
3591
- (country) => onChange(country),
3592
- [onChange]
3593
- );
3594
- const memoizedOptions = React12.useMemo(
3595
- () => options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
3596
- CommandItem,
3597
- {
3598
- className: "flex gap-2 w-full",
3599
- onSelect: () => handleSelect(option.value),
3600
- children: [
3601
- /* @__PURE__ */ jsxRuntime.jsx(FlagComponent, { country: option.value, countryName: option.label }),
3602
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 text-sm", children: option.label }),
3603
- option.value && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground/50 text-sm", children: `+${RPNInputPrimitive__namespace.getCountryCallingCode(option.value)}` }),
3604
- /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-label": option.value === value ? "Selected" : void 0, children: /* @__PURE__ */ jsxRuntime.jsx(
3605
- lucideReact.Check,
3606
- {
3607
- className: cn(
3608
- "ms-auto size-4",
3609
- option.value === value ? "opacity-100" : "opacity-0"
3610
- )
3611
- }
3612
- ) })
3613
- ]
3614
- },
3615
- option.value || "ZZ"
3616
- )),
3617
- [options, handleSelect, value]
3618
- );
3619
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
3620
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3621
- Button,
3622
- {
3623
- type: "button",
3624
- variant: "outline",
3625
- className: cn("flex gap-1 rounded-e-none rounded-s-lg px-3"),
3626
- disabled,
3627
- children: [
3628
- /* @__PURE__ */ jsxRuntime.jsx(FlagComponent, { country: value, countryName: value }),
3629
- /* @__PURE__ */ jsxRuntime.jsx(
3630
- lucideReact.ChevronsUpDown,
3631
- {
3632
- className: cn(
3633
- "-me-2 size-4 opacity-50",
3634
- disabled ? "hidden" : "opacity-100"
3635
- ),
3636
- "aria-hidden": true
3637
- }
3638
- )
3639
- ]
3640
- }
3641
- ) }),
3642
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
3643
- /* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: "Search country..." }),
3644
- /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { children: [
3645
- /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No country found." }),
3646
- /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[300px] max-h-[300px]", children: /* @__PURE__ */ jsxRuntime.jsx(CommandGroup, { children: memoizedOptions }) })
3647
- ] })
3648
- ] }) })
3649
- ] });
3650
- }
3651
- function FlagComponent({ country, countryName }) {
3652
- const flagUrl = `https://purecatamphetamine.github.io/country-flag-icons/3x2/${country}.svg`;
3653
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative h-4 w-6 bg-foreground/20 rounded-sm", children: country && /* @__PURE__ */ jsxRuntime.jsx(
3654
- Image__default.default,
3655
- {
3656
- src: flagUrl,
3657
- alt: countryName,
3658
- fill: true,
3659
- className: "rounded-sm object-cover"
3660
- }
3661
- ) });
3662
- }
3663
- var init_input_phone = __esm({
3664
- "src/ui/forms/input-phone.tsx"() {
3665
- "use client";
3666
- init_utils();
3667
- init_primitives();
3668
- init_command();
3669
- init_primitives();
3670
- init_client();
3671
- init_client();
3672
- }
3673
- });
3674
- function InputSpin({
3675
- value,
3676
- onChange,
3677
- min = -Infinity,
3678
- max = Infinity,
3679
- step = 1,
3680
- disabled = false,
3681
- className,
3682
- buttonVariant = "default",
3683
- ...props
3684
- }) {
3685
- const [internalValue, setInternalValue] = React12.useState(value ?? 0);
3686
- function handleIncrement() {
3687
- const newValue = internalValue + step;
3688
- if (newValue <= max) {
3689
- setInternalValue(newValue);
3690
- onChange?.(newValue);
3691
- }
3692
- }
3693
- function handleDecrement() {
3694
- const newValue = internalValue - step;
3695
- if (newValue >= min) {
3696
- setInternalValue(newValue);
3697
- onChange?.(newValue);
3698
- }
3699
- }
3700
- const handleOnChange = (e) => {
3701
- const newValue = parseFloat(e.target.value);
3702
- if (!isNaN(newValue) && newValue >= min && newValue <= max) {
3703
- setInternalValue(newValue);
3704
- onChange?.(newValue);
3705
- }
3706
- };
3707
- React12.useEffect(() => {
3708
- if (value !== void 0) {
3709
- setInternalValue(value);
3710
- }
3711
- }, [value]);
3712
- return /* @__PURE__ */ jsxRuntime.jsxs(
3713
- "div",
3714
- {
3715
- "data-slot": "input-spin",
3716
- className: cn(
3717
- "h-9 w-fit flex justify-between items-center p-0.5 rounded-md border border-input bg-transparent text-sm transition-colors",
3718
- disabled && "cursor-not-allowed opacity-50",
3719
- className
3720
- ),
3721
- children: [
3722
- /* @__PURE__ */ jsxRuntime.jsx(
3723
- Button,
3724
- {
3725
- type: "button",
3726
- variant: buttonVariant,
3727
- size: "icon",
3728
- className: "h-full w-auto aspect-square",
3729
- onClick: handleDecrement,
3730
- disabled: disabled || internalValue <= min,
3731
- "aria-label": "Decrease value",
3732
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Minus, { className: "h-4 w-4" })
3733
- }
3734
- ),
3735
- /* @__PURE__ */ jsxRuntime.jsx(
3736
- "input",
3737
- {
3738
- type: "number",
3739
- value: internalValue,
3740
- className: cn(
3741
- "h-full w-10 border-0 bg-transparent text-sm text-center focus:outline-hidden focus:ring-0",
3742
- "[-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
3743
- ),
3744
- onChange: handleOnChange,
3745
- disabled,
3746
- min,
3747
- max,
3748
- step,
3749
- readOnly: true,
3750
- ...props
3751
- }
3752
- ),
3753
- /* @__PURE__ */ jsxRuntime.jsx(
3754
- Button,
3755
- {
3756
- type: "button",
3757
- variant: buttonVariant,
3758
- size: "icon",
3759
- className: "h-full w-auto aspect-square",
3760
- onClick: handleIncrement,
3761
- disabled: disabled || internalValue >= max,
3762
- "aria-label": "Increase value",
3763
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-4 w-4" })
3764
- }
3765
- )
3766
- ]
3767
- }
3768
- );
3769
- }
3770
- var init_input_spin = __esm({
3771
- "src/ui/forms/input-spin.tsx"() {
3772
- "use client";
3773
- init_utils();
3774
- init_primitives();
3775
- }
3776
- });
3777
- function InputTags({
3778
- placeholder,
3779
- tags,
3780
- onTagsChange,
3781
- className,
3782
- ...props
3783
- }) {
3784
- const [inputValue, setInputValue] = React12.useState("");
3785
- const inputRef = React12.useRef(null);
3786
- React12.useImperativeHandle(props.ref, () => inputRef.current);
3787
- const addTag = (tag) => {
3788
- const trimmedTag = tag.trim();
3789
- if (trimmedTag && !tags.includes(trimmedTag)) {
3790
- onTagsChange([...tags, trimmedTag]);
3791
- }
3792
- setInputValue("");
3793
- };
3794
- const removeTag = (indexToRemove) => {
3795
- onTagsChange(tags.filter((_, index) => index !== indexToRemove));
3796
- };
3797
- const handleKeyDown = (e) => {
3798
- if (e.key === "Enter") {
3799
- e.preventDefault();
3800
- addTag(inputValue);
3801
- } else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
3802
- removeTag(tags.length - 1);
3803
- }
3804
- };
3805
- return /* @__PURE__ */ jsxRuntime.jsxs(
3806
- "div",
3807
- {
3808
- "data-slot": "input-tags",
3809
- className: cn(
3810
- "min-h-9 w-full flex flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
3811
- className
3812
- ),
3813
- onClick: () => inputRef.current?.focus(),
3814
- children: [
3815
- tags.map((tag, index) => /* @__PURE__ */ jsxRuntime.jsxs(
3816
- "span",
3817
- {
3818
- className: "inline-flex items-center rounded-full bg-secondary px-3 py-0.5 text-sm font-medium text-secondary-foreground",
3819
- children: [
3820
- tag,
3821
- /* @__PURE__ */ jsxRuntime.jsx(
3822
- Button,
3823
- {
3824
- variant: "ghost",
3825
- onClick: (e) => {
3826
- e.preventDefault();
3827
- removeTag(index);
3828
- },
3829
- className: "size-auto p-0.5 ms-0.5 -me-1 rounded-full hover:bg-secondary-foreground/20",
3830
- "aria-label": "Remove",
3831
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
3832
- }
3833
- )
3834
- ]
3835
- },
3836
- index
3837
- )),
3838
- /* @__PURE__ */ jsxRuntime.jsx(
3839
- "input",
3840
- {
3841
- ref: inputRef,
3842
- type: "text",
3843
- className: "w-0 flex-1 bg-transparent outline-hidden placeholder:text-muted-foreground",
3844
- value: inputValue,
3845
- onChange: (e) => setInputValue(e.target.value),
3846
- onKeyDown: handleKeyDown,
3847
- onBlur: () => addTag(inputValue),
3848
- placeholder: tags.length === 0 ? placeholder : "",
3849
- ...props
3850
- }
3851
- )
3852
- ]
3853
- }
3854
- );
3855
- }
3856
- function InputTagsWithSuggestions({
3857
- placeholder,
3858
- tags,
3859
- suggestions,
3860
- onTagsChange,
3861
- className,
3862
- ...props
3863
- }) {
3864
- const [inputValue, setInputValue] = React12.useState("");
3865
- const [open, setOpen] = React12.useState(false);
3866
- const containerRef = React12.useRef(null);
3867
- const [popoverWidth, setPopoverWidth] = React12.useState(
3868
- void 0
3869
- );
3870
- React12.useEffect(() => {
3871
- if (containerRef.current) {
3872
- setPopoverWidth(containerRef.current.offsetWidth);
3873
- }
3874
- }, [open]);
3875
- const filteredSuggestions = suggestions.filter(
3876
- (suggestion) => suggestion.toLowerCase().includes(inputValue.toLowerCase()) && !tags.includes(suggestion)
3877
- );
3878
- const addTag = (tag) => {
3879
- const trimmedTag = tag.trim();
3880
- if (trimmedTag && !tags.includes(trimmedTag)) {
3881
- onTagsChange([...tags, trimmedTag]);
3882
- }
3883
- setInputValue("");
3884
- };
3885
- const removeTag = (indexToRemove) => {
3886
- onTagsChange(tags.filter((_, index) => index !== indexToRemove));
3887
- };
3888
- const handleKeyDown = (e) => {
3889
- if (e.key === "Enter" && !open) {
3890
- e.preventDefault();
3891
- addTag(inputValue);
3892
- } else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
3893
- removeTag(tags.length - 1);
3894
- }
3895
- };
3896
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { modal: true, open, onOpenChange: setOpen, children: [
3897
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3898
- "div",
3899
- {
3900
- "data-slot": "input-tags-with-suggestions",
3901
- ref: containerRef,
3902
- className: cn(
3903
- "min-h-9 w-full flex flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
3904
- className
3905
- ),
3906
- children: [
3907
- tags.map((tag, index) => /* @__PURE__ */ jsxRuntime.jsxs(
3908
- "span",
3909
- {
3910
- className: "inline-flex items-center rounded-full bg-secondary px-3 py-0.5 text-sm font-medium text-secondary-foreground",
3911
- children: [
3912
- tag,
3913
- /* @__PURE__ */ jsxRuntime.jsx(
3914
- Button,
3915
- {
3916
- variant: "ghost",
3917
- onClick: (e) => {
3918
- e.preventDefault();
3919
- removeTag(index);
3920
- },
3921
- className: "size-auto p-0.5 ms-0.5 -me-1 rounded-full hover:bg-secondary-foreground/20",
3922
- "aria-label": "Remove",
3923
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
3924
- }
3925
- )
3926
- ]
3927
- },
3928
- index
3929
- )),
3930
- /* @__PURE__ */ jsxRuntime.jsx(
3931
- "input",
3932
- {
3933
- ref: props.ref,
3934
- type: "text",
3935
- value: inputValue,
3936
- onChange: (e) => setInputValue(e.target.value),
3937
- onKeyDown: handleKeyDown,
3938
- className: "w-0 flex-1 bg-transparent outline-hidden placeholder:text-muted-foreground",
3939
- placeholder: tags.length === 0 ? placeholder : "",
3940
- ...props
3941
- }
3942
- )
3943
- ]
3944
- }
3945
- ) }),
3946
- /* @__PURE__ */ jsxRuntime.jsx(
3947
- PopoverContent,
3948
- {
3949
- style: { width: popoverWidth ? `${popoverWidth}px` : "auto" },
3950
- onOpenAutoFocus: (e) => e.preventDefault(),
3951
- children: /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "flex flex-col max-h-[300px]", children: /* @__PURE__ */ jsxRuntime.jsx(Command, { children: /* @__PURE__ */ jsxRuntime.jsxs(CommandList, { className: "max-h-full", children: [
3952
- /* @__PURE__ */ jsxRuntime.jsx(CommandEmpty, { children: "No results found." }),
3953
- filteredSuggestions.map((suggestion) => /* @__PURE__ */ jsxRuntime.jsx(
3954
- CommandItem,
3955
- {
3956
- onSelect: () => addTag(suggestion),
3957
- children: suggestion
3958
- },
3959
- suggestion
3960
- ))
3961
- ] }) }) })
3962
- }
3963
- )
3964
- ] });
3965
- }
3966
- var init_input_tags = __esm({
3967
- "src/ui/forms/input-tags.tsx"() {
3968
- "use client";
3969
- init_utils();
3970
- init_command();
3971
- init_client();
3972
- init_primitives();
3973
- init_client();
3974
- }
3975
- });
3976
- function MultipleDatesPicker({
3977
- value,
3978
- onValueChange,
3979
- formatStr = "yyyy-MM-dd p",
3980
- popoverContentClassName,
3981
- popoverContentOptions,
3982
- buttonClassName,
3983
- buttonOptions,
3984
- placeholder = "Pick dates",
3985
- ...props
3986
- }) {
3987
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { modal: true, children: [
3988
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
3989
- Button,
3990
- {
3991
- variant: "outline",
3992
- className: cn(
3993
- "w-full px-3 text-start font-normal overflow-hidden",
3994
- buttonClassName
3995
- ),
3996
- ...buttonOptions,
3997
- children: [
3998
- value && value.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate me-1", children: value.map((date) => dateFns.format(date, formatStr)).join(", ") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
3999
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CalendarIcon, { className: "shrink-0 ms-auto h-4 w-4 text-muted-foreground" })
4000
- ]
4001
- }
4002
- ) }),
4003
- /* @__PURE__ */ jsxRuntime.jsx(
4004
- PopoverContent,
4005
- {
4006
- className: cn("w-auto p-0", popoverContentClassName),
4007
- align: "start",
4008
- ...popoverContentOptions,
4009
- children: /* @__PURE__ */ jsxRuntime.jsx(
4010
- Calendar,
4011
- {
4012
- mode: "multiple",
4013
- selected: value,
4014
- onSelect: onValueChange,
4015
- ...props
4016
- }
4017
- )
4018
- }
4019
- )
4020
- ] });
4021
- }
4022
- var init_multiple_date_picker = __esm({
4023
- "src/ui/forms/multiple-date-picker.tsx"() {
4024
- "use client";
4025
- init_utils();
4026
- init_primitives();
4027
- init_client();
4028
- init_client();
4029
- }
4030
- });
4031
- function TimePicker({
4032
- value,
4033
- popoverContentClassName,
4034
- popoverContentOptions,
4035
- buttonClassName,
4036
- buttonOptions,
4037
- placeholder = "Pick time",
4038
- ...props
4039
- }) {
4040
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
4041
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
4042
- Button,
4043
- {
4044
- variant: "outline",
4045
- className: cn("w-full px-3 text-start font-normal", buttonClassName),
4046
- ...buttonOptions,
4047
- children: [
4048
- value ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: dateFns.format(timeToDate(value), "p") }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder }),
4049
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "ms-auto h-4 w-4 text-muted-foreground" })
4050
- ]
4051
- }
4052
- ) }),
4053
- /* @__PURE__ */ jsxRuntime.jsx(
4054
- PopoverContent,
4055
- {
4056
- className: cn("w-auto p-0", popoverContentClassName),
4057
- align: "start",
4058
- ...popoverContentOptions,
4059
- children: /* @__PURE__ */ jsxRuntime.jsx(InputTime, { className: "border-0", value, ...props })
4060
- }
4061
- )
4062
- ] });
4063
- }
4064
- var init_time_picker = __esm({
4065
- "src/ui/forms/time-picker.tsx"() {
4066
- "use client";
4067
- init_utils();
4068
- init_primitives();
4069
- init_input_time();
4070
- init_client();
4071
- }
4072
- });
4073
- function SizeHandler({ editor }) {
4074
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
4075
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4076
- Button,
4077
- {
4078
- variant: "ghost",
4079
- size: "icon",
4080
- className: "h-8 w-8",
4081
- "aria-label": "Select text style",
4082
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Type, { className: "h-4 w-4" })
4083
- }
4084
- ) }),
4085
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { align: "start", className: "min-w-[8rem] w-auto p-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
4086
- /* @__PURE__ */ jsxRuntime.jsx(
4087
- Button,
4088
- {
4089
- variant: "ghost",
4090
- onClick: () => editor.chain().focus().setParagraph().run(),
4091
- className: cn(
4092
- "justify-start px-3 py-2 text-left text-base",
4093
- editor.isActive("paragraph") && "bg-muted"
4094
- ),
4095
- children: "Small"
4096
- }
4097
- ),
4098
- sizes.map((size) => /* @__PURE__ */ jsxRuntime.jsx(
4099
- Button,
4100
- {
4101
- variant: "ghost",
4102
- onClick: () => editor.chain().focus().toggleHeading({ level: size.level }).run(),
4103
- className: cn(
4104
- "justify-start px-3 py-2 text-left",
4105
- size.textSize,
4106
- editor.isActive("heading", { level: size.level }) && "bg-muted"
4107
- ),
4108
- children: size.label
4109
- },
4110
- size.level
4111
- ))
4112
- ] }) })
4113
- ] });
4114
- }
4115
- function FormatHandler({
4116
- editor,
4117
- format: format6,
4118
- iconName
4119
- }) {
4120
- const toggleCommands = {
4121
- bold: () => editor.chain().focus().toggleBold(),
4122
- italic: () => editor.chain().focus().toggleItalic(),
4123
- underline: () => editor.chain().focus().toggleUnderline(),
4124
- strike: () => editor.chain().focus().toggleStrike()
4125
- };
4126
- function handlePressChange() {
4127
- const command = toggleCommands[format6];
4128
- if (command) {
4129
- command().run();
4130
- }
4131
- }
4132
- return /* @__PURE__ */ jsxRuntime.jsx(
4133
- Toggle,
4134
- {
4135
- size: "sm",
4136
- pressed: editor.isActive(format6),
4137
- onPressedChange: handlePressChange,
4138
- "aria-label": `Toggle ${format6} format`,
4139
- children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: iconName, className: "h-4 w-4" })
4140
- }
4141
- );
4142
- }
4143
- function AlignmentHandler({
4144
- editor,
4145
- alignment,
4146
- iconName
4147
- }) {
4148
- return /* @__PURE__ */ jsxRuntime.jsx(
4149
- Toggle,
4150
- {
4151
- size: "sm",
4152
- pressed: editor.isActive({ textAlign: alignment }),
4153
- onPressedChange: () => editor.chain().focus().setTextAlign(alignment).run(),
4154
- "aria-label": `Switch ${alignment} alignment`,
4155
- children: /* @__PURE__ */ jsxRuntime.jsx(DynamicIcon, { name: iconName, className: "h-4 w-4" })
4156
- }
4157
- );
4158
- }
4159
- function ImageHandler({ editor }) {
4160
- const [imageSrc, setImageSrc] = React12.useState(null);
4161
- function handleFileChange(files) {
4162
- if (files.length < 1) return;
4163
- const objectURL = URL.createObjectURL(files[0]);
4164
- setImageSrc(objectURL);
4165
- }
4166
- function handleSubmit(e) {
4167
- e.preventDefault();
4168
- if (editor && imageSrc) {
4169
- editor.chain().focus().setImage({ src: imageSrc }).run();
4170
- setImageSrc(null);
4171
- }
4172
- }
4173
- return /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
4174
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4175
- Button,
4176
- {
4177
- type: "button",
4178
- variant: "ghost",
4179
- size: "icon",
4180
- className: "h-8 w-8",
4181
- "aria-label": "Insert image",
4182
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "h-4 w-4" })
4183
- }
4184
- ) }),
4185
- /* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4186
- "form",
4187
- {
4188
- onSubmit: (e) => {
4189
- e.stopPropagation();
4190
- handleSubmit(e);
4191
- },
4192
- className: "flex justify-center items-center gap-2",
4193
- children: [
4194
- /* @__PURE__ */ jsxRuntime.jsx(InputFile, { onValueChange: handleFileChange }),
4195
- /* @__PURE__ */ jsxRuntime.jsx(
4196
- Button,
4197
- {
4198
- type: "submit",
4199
- variant: "ghost",
4200
- size: "icon",
4201
- className: "shrink-0 h-8 w-8",
4202
- "aria-label": "Submit",
4203
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })
4204
- }
4205
- )
4206
- ]
4207
- }
4208
- ) })
4209
- ] });
4210
- }
4211
- function LinkHandler({ editor }) {
4212
- const isLinkActive = editor.isActive("link");
4213
- return isLinkActive ? /* @__PURE__ */ jsxRuntime.jsx(
4214
- Button,
4215
- {
4216
- type: "button",
4217
- variant: "ghost",
4218
- size: "icon",
4219
- className: "h-8 w-8",
4220
- onClick: () => editor.chain().focus().unsetLink().run(),
4221
- "aria-label": "Remove link",
4222
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Unlink, { className: "h-4 w-4" })
4223
- }
4224
- ) : /* @__PURE__ */ jsxRuntime.jsxs(Popover, { children: [
4225
- /* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
4226
- Button,
4227
- {
4228
- type: "button",
4229
- variant: "ghost",
4230
- size: "icon",
4231
- className: "h-8 w-8",
4232
- "aria-label": "Insert link",
4233
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link, { className: "h-4 w-4" })
4234
- }
4235
- ) }),
4236
- /* @__PURE__ */ jsxRuntime.jsxs(PopoverContent, { className: "flex justify-center items-center gap-2", children: [
4237
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0", children: "Insert link" }),
4238
- /* @__PURE__ */ jsxRuntime.jsx(
4239
- Input,
4240
- {
4241
- autoFocus: true,
4242
- type: "text",
4243
- placeholder: "https://www.example.com",
4244
- onKeyDown: (e) => {
4245
- if (e.key === "Enter") {
4246
- editor.chain().focus().setLink({
4247
- href: e.target.value
4248
- }).run();
4249
- }
4250
- }
4251
- }
4252
- ),
4253
- /* @__PURE__ */ jsxRuntime.jsx(
4254
- Button,
4255
- {
4256
- type: "button",
4257
- variant: "ghost",
4258
- size: "icon",
4259
- className: "shrink-0 h-8 w-8",
4260
- onClick: (e) => {
4261
- editor.chain().focus().setLink({
4262
- href: e.target.value
4263
- }).run();
4264
- },
4265
- "aria-label": "Submit",
4266
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" })
4267
- }
4268
- )
4269
- ] })
4270
- ] });
4271
- }
4272
- function ColorHandler({ editor }) {
4273
- const selectedColor = editor.getAttributes("textStyle").color;
4274
- const inputRef = React12.useRef(null);
4275
- return /* @__PURE__ */ jsxRuntime.jsxs(
4276
- Button,
4277
- {
4278
- type: "button",
4279
- variant: "ghost",
4280
- size: "icon",
4281
- className: "relative overflow-hidden",
4282
- onClick: () => inputRef.current?.click(),
4283
- "aria-label": "Select text color",
4284
- children: [
4285
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Palette, { style: { color: selectedColor }, className: "size-4" }),
4286
- /* @__PURE__ */ jsxRuntime.jsx(
4287
- Input,
4288
- {
4289
- ref: inputRef,
4290
- type: "color",
4291
- value: selectedColor,
4292
- onChange: (e) => editor.chain().focus().setColor(e.target.value).run(),
4293
- className: "sr-only",
4294
- tabIndex: -1
4295
- }
4296
- )
4297
- ]
4298
- }
4299
- );
4300
- }
4301
- function EditorMenuBar({ editor }) {
4302
- return /* @__PURE__ */ jsxRuntime.jsxs(
4303
- "div",
4304
- {
4305
- className: "flex flex-wrap items-center gap-1.5 p-1.5",
4306
- "aria-label": "Editor Menu Bar",
4307
- children: [
4308
- /* @__PURE__ */ jsxRuntime.jsx(SizeHandler, { editor }),
4309
- /* @__PURE__ */ jsxRuntime.jsx(ColorHandler, { editor }),
4310
- /* @__PURE__ */ jsxRuntime.jsx(Separator3, { orientation: "vertical", className: "h-4" }),
4311
- formats.map(({ format: format6, iconName }) => /* @__PURE__ */ jsxRuntime.jsx(
4312
- FormatHandler,
4313
- {
4314
- editor,
4315
- format: format6,
4316
- iconName
4317
- },
4318
- format6
4319
- )),
4320
- /* @__PURE__ */ jsxRuntime.jsx(Separator3, { orientation: "vertical", className: "h-4" }),
4321
- alignments.map(({ alignment, iconName }) => /* @__PURE__ */ jsxRuntime.jsx(
4322
- AlignmentHandler,
4323
- {
4324
- editor,
4325
- alignment,
4326
- iconName
4327
- },
4328
- alignment
4329
- )),
4330
- /* @__PURE__ */ jsxRuntime.jsx(Separator3, { orientation: "vertical", className: "h-4" }),
4331
- /* @__PURE__ */ jsxRuntime.jsx(ImageHandler, { editor }),
4332
- /* @__PURE__ */ jsxRuntime.jsx(LinkHandler, { editor })
4333
- ]
4334
- }
4335
- );
4336
- }
4337
- var sizes, formats, alignments;
4338
- var init_editor_menu_bar = __esm({
4339
- "src/ui/forms/editor/editor-menu-bar.tsx"() {
4340
- "use client";
4341
- init_utils();
4342
- init_primitives();
4343
- init_primitives();
4344
- init_input_file();
4345
- init_client();
4346
- init_primitives();
4347
- init_client();
4348
- init_client();
4349
- sizes = [
4350
- { label: "Normal", level: 3, textSize: "text-lg" },
4351
- { label: "Large", level: 2, textSize: "text-xl" },
4352
- { label: "Extra Large", level: 1, textSize: "text-2xl" }
4353
- ];
4354
- formats = [
4355
- {
4356
- format: "bold",
4357
- iconName: "Bold"
4358
- },
4359
- {
4360
- format: "italic",
4361
- iconName: "Italic"
4362
- },
4363
- {
4364
- format: "underline",
4365
- iconName: "Underline"
4366
- },
4367
- {
4368
- format: "strike",
4369
- iconName: "Strikethrough"
4370
- }
4371
- ];
4372
- alignments = [
4373
- { alignment: "left", iconName: "AlignLeft" },
4374
- { alignment: "center", iconName: "AlignCenter" },
4375
- { alignment: "right", iconName: "AlignRight" },
4376
- { alignment: "justify", iconName: "AlignJustify" }
4377
- ];
4378
- }
4379
- });
4380
- function Editor({
4381
- value,
4382
- onValueChange,
4383
- bubbleMenu = false,
4384
- placeholder,
4385
- className,
4386
- ...props
4387
- }) {
4388
- const direction = reactDirection.useDirection();
4389
- const isRtl = useIsRtl();
4390
- const editor = react.useEditor({
4391
- immediatelyRender: false,
4392
- editorProps: {
4393
- attributes: {
4394
- class: cn(
4395
- "px-3 py-2 break-all [&_p]:m-0 [&_.is-editor-empty]:before:absolute [&_.is-editor-empty]:before:top-2 [&_.is-editor-empty]:before:cursor-text [&_.is-editor-empty]:before:text-muted-foreground [&_.is-editor-empty]:before:content-[attr(data-placeholder)] prose prose-headings:font-normal prose-headings:text-foreground prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg dark:prose-invert focus:outline-hidden",
4396
- className
4397
- )
4398
- }
4399
- },
4400
- extensions: [
4401
- StarterKit__default.default,
4402
- Underline__default.default,
4403
- TextAlign__default.default.configure({
4404
- types: ["heading", "paragraph"],
4405
- defaultAlignment: isRtl ? "right" : "left"
4406
- }),
4407
- Color__default.default,
4408
- TextStyle__default.default,
4409
- Image3__default.default,
4410
- Link4__default.default.configure({
4411
- openOnClick: true,
4412
- HTMLAttributes: {
4413
- rel: "noopener noreferrer",
4414
- target: "_blank"
4415
- }
4416
- }),
4417
- Placeholder__default.default.configure({
4418
- placeholder,
4419
- showOnlyCurrent: true
4420
- }),
4421
- Typography__default.default
4422
- ],
4423
- content: value,
4424
- onUpdate: ({ editor: editor2 }) => {
4425
- onValueChange?.(editor2.getHTML());
4426
- },
4427
- ...props
4428
- });
4429
- if (!editor) {
4430
- return null;
4431
- }
4432
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
4433
- bubbleMenu ? /* @__PURE__ */ jsxRuntime.jsx(
4434
- react.BubbleMenu,
4435
- {
4436
- className: "z-50 h-auto rounded-md border bg-popover text-popover-foreground shadow-md outline-hidden",
4437
- editor,
4438
- tippyOptions: {
4439
- duration: 100,
4440
- maxWidth: "98vw",
4441
- appendTo: document.body,
4442
- zIndex: 50
4443
- },
4444
- children: /* @__PURE__ */ jsxRuntime.jsx(EditorMenuBar, { editor })
4445
- }
4446
- ) : /* @__PURE__ */ jsxRuntime.jsx(EditorMenuBar, { editor }),
4447
- /* @__PURE__ */ jsxRuntime.jsx(
4448
- ScrollArea,
4449
- {
4450
- className: cn(
4451
- "flex flex-col min-h-9 rounded-md cursor-text",
4452
- !bubbleMenu && "border-t border-border",
4453
- editor.isFocused && "outline-hidden ring-1 ring-ring"
4454
- ),
4455
- children: /* @__PURE__ */ jsxRuntime.jsx(
4456
- react.EditorContent,
4457
- {
4458
- editor,
4459
- dir: direction,
4460
- className: cn(
4461
- editor.isActive({ textAlign: "left" }) && "[&_.is-editor-empty]:before:left-3",
4462
- editor.isActive({ textAlign: "right" }) && "[&_.is-editor-empty]:before:right-3",
4463
- editor.isActive({ textAlign: "center" }) && "[&_.is-editor-empty]:before:left-1/2 [&_.is-editor-empty]:before:absolute [&_.is-editor-empty]:before:-translate-x-1/2",
4464
- editor.isActive({ textAlign: "justify" }) && "[&_.is-editor-empty]:before:left-3"
4465
- ),
4466
- onClick: () => editor.commands.focus()
4467
- }
4468
- )
4469
- }
4470
- )
4471
- ] });
4472
- }
4473
- var init_editor = __esm({
4474
- "src/ui/forms/editor/index.tsx"() {
4475
- "use client";
4476
- init_utils();
4477
- init_hooks();
4478
- init_primitives();
4479
- init_client();
4480
- init_editor_menu_bar();
4481
- }
4482
- });
4483
- function FormField(props) {
4484
- return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
4485
- }
4486
- function useFormField() {
4487
- const fieldContext = React12.useContext(FormFieldContext);
4488
- const itemContext = React12.useContext(FormItemContext);
4489
- const { getFieldState, formState } = reactHookForm.useFormContext();
4490
- const fieldState = getFieldState(fieldContext.name, formState);
4491
- if (!fieldContext) {
4492
- throw new Error("useFormField should be used within <FormField>");
4493
- }
4494
- const { id } = itemContext;
4495
- return {
4496
- id,
4497
- name: fieldContext.name,
4498
- formItemId: `${id}-form-item`,
4499
- formDescriptionId: `${id}-form-item-description`,
4500
- formMessageId: `${id}-form-item-message`,
4501
- ...fieldState
4502
- };
4503
- }
4504
- function FormItem({ className, ...props }) {
4505
- const id = React12.useId();
4506
- return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx(
4507
- "div",
4508
- {
4509
- "data-slot": "form-item",
4510
- className: cn("grid gap-2", className),
4511
- ...props
4512
- }
4513
- ) });
4514
- }
4515
- function FormLabel({
4516
- className,
4517
- ...props
4518
- }) {
4519
- const { error, formItemId } = useFormField();
4520
- return /* @__PURE__ */ jsxRuntime.jsx(
4521
- Label3,
4522
- {
4523
- "data-slot": "form-label",
4524
- "data-error": !!error,
4525
- className: cn("data-[error=true]:text-destructive", className),
4526
- htmlFor: formItemId,
4527
- ...props
4528
- }
4529
- );
4530
- }
4531
- function FormControl({ ...props }) {
4532
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
4533
- return /* @__PURE__ */ jsxRuntime.jsx(
4534
- reactSlot.Slot,
4535
- {
4536
- "data-slot": "form-control",
4537
- id: formItemId,
4538
- "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
4539
- "aria-invalid": !!error,
4540
- ...props
4541
- }
4542
- );
4543
- }
4544
- function FormDescription({ className, ...props }) {
4545
- const { formDescriptionId } = useFormField();
4546
- return /* @__PURE__ */ jsxRuntime.jsx(
4547
- "p",
4548
- {
4549
- "data-slot": "form-description",
4550
- id: formDescriptionId,
4551
- className: cn("text-[0.8rem] text-muted-foreground", className),
4552
- ...props
4553
- }
4554
- );
4555
- }
4556
- function FormMessage({
4557
- className,
4558
- children,
4559
- ...props
4560
- }) {
4561
- const { error, formMessageId } = useFormField();
4562
- const body = error ? String(error?.message) : children;
4563
- if (!body) {
4564
- return null;
4565
- }
4566
- return /* @__PURE__ */ jsxRuntime.jsx(
4567
- "p",
4568
- {
4569
- "data-slot": "form-message",
4570
- id: formMessageId,
4571
- className: cn("text-[0.8rem] font-medium text-destructive", className),
4572
- ...props,
4573
- children: body
4574
- }
4575
- );
4576
- }
4577
- exports.Form = void 0; var FormFieldContext, FormItemContext;
4578
- var init_forms = __esm({
4579
- "src/ui/forms/index.tsx"() {
4580
- init_utils();
4581
- init_client();
4582
- init_radio_group();
4583
- init_rating();
4584
- init_command();
4585
- init_multi_select();
4586
- init_date_picker();
4587
- init_date_range_picker();
4588
- init_date_time_picker();
4589
- init_emoji_picker();
4590
- init_file_dropzone();
4591
- init_file_thumbnail();
4592
- init_input_file();
4593
- init_input_group();
4594
- init_input_otp();
4595
- init_input_phone();
4596
- init_input_spin();
4597
- init_input_tags();
4598
- init_input_time();
4599
- init_multiple_date_picker();
4600
- init_time_picker();
4601
- init_editor();
4602
- exports.Form = reactHookForm.FormProvider;
4603
- FormFieldContext = React12.createContext(
4604
- {}
4605
- );
4606
- FormItemContext = React12.createContext(
4607
- {}
4608
- );
4609
- }
4610
- });
4611
- init_forms();
4612
-
4613
- exports.Command = Command;
4614
- exports.CommandDialog = CommandDialog;
4615
- exports.CommandEmpty = CommandEmpty;
4616
- exports.CommandGroup = CommandGroup;
4617
- exports.CommandInput = CommandInput;
4618
- exports.CommandItem = CommandItem;
4619
- exports.CommandList = CommandList;
4620
- exports.CommandSeparator = CommandSeparator;
4621
- exports.CommandShortcut = CommandShortcut;
4622
- exports.DatePicker = DatePicker;
4623
- exports.DateRangePicker = DateRangePicker;
4624
- exports.DateTimePicker = DateTimePicker;
4625
- exports.Editor = Editor;
4626
- exports.EmojiPicker = EmojiPicker;
4627
- exports.FileDropzone = FileDropzone;
4628
- exports.FileThumbnail = FileThumbnail;
4629
- exports.FormControl = FormControl;
4630
- exports.FormDescription = FormDescription;
4631
- exports.FormField = FormField;
4632
- exports.FormItem = FormItem;
4633
- exports.FormLabel = FormLabel;
4634
- exports.FormMessage = FormMessage;
4635
- exports.InputFile = InputFile;
4636
- exports.InputGroup = InputGroup;
4637
- exports.InputGroupText = InputGroupText;
4638
- exports.InputOTP = InputOTP;
4639
- exports.InputOTPGroup = InputOTPGroup;
4640
- exports.InputOTPSeparator = InputOTPSeparator;
4641
- exports.InputOTPSlot = InputOTPSlot;
4642
- exports.InputPhone = InputPhone;
4643
- exports.InputSpin = InputSpin;
4644
- exports.InputTags = InputTags;
4645
- exports.InputTagsWithSuggestions = InputTagsWithSuggestions;
4646
- exports.InputTime = InputTime;
4647
- exports.MultipleDatesPicker = MultipleDatesPicker;
4648
- exports.RadioGroup = RadioGroup4;
4649
- exports.RadioGroupItem = RadioGroupItem;
4650
- exports.Rating = Rating;
4651
- exports.RatingStar = RatingStar;
4652
- exports.ReactionPicker = ReactionPicker;
4653
- exports.TimePicker = TimePicker;
4654
- exports.useFormField = useFormField;
4655
- //# sourceMappingURL=forms.js.map
4656
- //# sourceMappingURL=forms.js.map