@vlrc-fe/components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/README.md +193 -0
  2. package/dist/index.cjs +1 -0
  3. package/dist/index.js +42 -0
  4. package/dist/index10.cjs +1 -0
  5. package/dist/index10.js +85 -0
  6. package/dist/index100.cjs +1 -0
  7. package/dist/index100.js +65 -0
  8. package/dist/index101.cjs +1 -0
  9. package/dist/index101.js +48 -0
  10. package/dist/index102.cjs +1 -0
  11. package/dist/index102.js +67 -0
  12. package/dist/index103.cjs +1 -0
  13. package/dist/index103.js +151 -0
  14. package/dist/index104.cjs +1 -0
  15. package/dist/index104.js +23 -0
  16. package/dist/index105.cjs +1 -0
  17. package/dist/index105.js +27 -0
  18. package/dist/index106.cjs +1 -0
  19. package/dist/index106.js +53 -0
  20. package/dist/index107.cjs +1 -0
  21. package/dist/index107.js +161 -0
  22. package/dist/index108.cjs +1 -0
  23. package/dist/index108.js +16 -0
  24. package/dist/index109.cjs +1 -0
  25. package/dist/index11.cjs +1 -0
  26. package/dist/index11.js +86 -0
  27. package/dist/index12.cjs +1 -0
  28. package/dist/index12.js +122 -0
  29. package/dist/index13.cjs +1 -0
  30. package/dist/index13.js +14 -0
  31. package/dist/index14.cjs +1 -0
  32. package/dist/index14.js +16 -0
  33. package/dist/index15.cjs +1 -0
  34. package/dist/index15.js +115 -0
  35. package/dist/index16.cjs +1 -0
  36. package/dist/index16.js +727 -0
  37. package/dist/index17.cjs +1 -0
  38. package/dist/index17.js +348 -0
  39. package/dist/index18.cjs +1 -0
  40. package/dist/index18.js +76 -0
  41. package/dist/index19.cjs +1 -0
  42. package/dist/index19.js +14 -0
  43. package/dist/index2.cjs +1 -0
  44. package/dist/index2.js +122 -0
  45. package/dist/index20.cjs +1 -0
  46. package/dist/index20.js +116 -0
  47. package/dist/index21.cjs +1 -0
  48. package/dist/index21.js +35 -0
  49. package/dist/index22.cjs +1 -0
  50. package/dist/index22.js +18 -0
  51. package/dist/index23.cjs +1 -0
  52. package/dist/index23.js +27 -0
  53. package/dist/index24.cjs +1 -0
  54. package/dist/index24.js +35 -0
  55. package/dist/index25.cjs +1 -0
  56. package/dist/index25.js +97 -0
  57. package/dist/index26.cjs +1 -0
  58. package/dist/index26.js +28 -0
  59. package/dist/index27.cjs +1 -0
  60. package/dist/index27.js +14 -0
  61. package/dist/index28.cjs +1 -0
  62. package/dist/index28.js +67 -0
  63. package/dist/index29.cjs +1 -0
  64. package/dist/index29.js +13 -0
  65. package/dist/index3.cjs +1 -0
  66. package/dist/index3.js +8 -0
  67. package/dist/index30.cjs +1 -0
  68. package/dist/index30.js +35 -0
  69. package/dist/index31.cjs +1 -0
  70. package/dist/index31.js +43 -0
  71. package/dist/index32.cjs +1 -0
  72. package/dist/index32.js +14 -0
  73. package/dist/index33.cjs +1 -0
  74. package/dist/index33.js +64 -0
  75. package/dist/index34.cjs +1 -0
  76. package/dist/index34.js +23 -0
  77. package/dist/index35.cjs +1 -0
  78. package/dist/index35.js +34 -0
  79. package/dist/index36.cjs +1 -0
  80. package/dist/index36.js +27 -0
  81. package/dist/index37.cjs +1 -0
  82. package/dist/index37.js +26 -0
  83. package/dist/index38.cjs +1 -0
  84. package/dist/index38.js +157 -0
  85. package/dist/index39.cjs +1 -0
  86. package/dist/index39.js +34 -0
  87. package/dist/index4.cjs +1 -0
  88. package/dist/index4.js +43 -0
  89. package/dist/index40.cjs +1 -0
  90. package/dist/index40.js +46 -0
  91. package/dist/index41.cjs +1 -0
  92. package/dist/index41.js +118 -0
  93. package/dist/index42.cjs +1 -0
  94. package/dist/index42.js +125 -0
  95. package/dist/index43.cjs +1 -0
  96. package/dist/index43.js +26 -0
  97. package/dist/index44.cjs +1 -0
  98. package/dist/index44.js +88 -0
  99. package/dist/index45.cjs +1 -0
  100. package/dist/index45.js +221 -0
  101. package/dist/index46.cjs +1 -0
  102. package/dist/index46.js +166 -0
  103. package/dist/index47.cjs +1 -0
  104. package/dist/index47.js +126 -0
  105. package/dist/index48.cjs +1 -0
  106. package/dist/index48.js +15 -0
  107. package/dist/index49.cjs +1 -0
  108. package/dist/index49.js +9 -0
  109. package/dist/index5.cjs +1 -0
  110. package/dist/index5.js +24 -0
  111. package/dist/index50.cjs +1 -0
  112. package/dist/index50.js +17 -0
  113. package/dist/index51.cjs +1 -0
  114. package/dist/index51.js +22 -0
  115. package/dist/index52.cjs +1 -0
  116. package/dist/index52.js +18 -0
  117. package/dist/index53.cjs +1 -0
  118. package/dist/index53.js +6 -0
  119. package/dist/index54.cjs +1 -0
  120. package/dist/index54.js +7 -0
  121. package/dist/index55.cjs +1 -0
  122. package/dist/index55.js +8 -0
  123. package/dist/index56.cjs +1 -0
  124. package/dist/index56.js +7 -0
  125. package/dist/index57.cjs +1 -0
  126. package/dist/index57.js +7 -0
  127. package/dist/index58.cjs +1 -0
  128. package/dist/index58.js +9 -0
  129. package/dist/index59.cjs +1 -0
  130. package/dist/index59.js +69 -0
  131. package/dist/index6.cjs +1 -0
  132. package/dist/index6.js +51 -0
  133. package/dist/index60.cjs +1 -0
  134. package/dist/index60.js +11 -0
  135. package/dist/index61.cjs +1 -0
  136. package/dist/index61.js +202 -0
  137. package/dist/index62.cjs +1 -0
  138. package/dist/index62.js +124 -0
  139. package/dist/index63.cjs +1 -0
  140. package/dist/index63.js +32 -0
  141. package/dist/index64.cjs +1 -0
  142. package/dist/index64.js +20 -0
  143. package/dist/index65.cjs +1 -0
  144. package/dist/index65.js +69 -0
  145. package/dist/index66.cjs +1 -0
  146. package/dist/index66.js +32 -0
  147. package/dist/index67.cjs +1 -0
  148. package/dist/index67.js +11 -0
  149. package/dist/index68.cjs +1 -0
  150. package/dist/index68.js +280 -0
  151. package/dist/index69.cjs +1 -0
  152. package/dist/index69.js +157 -0
  153. package/dist/index7.cjs +1 -0
  154. package/dist/index7.js +88 -0
  155. package/dist/index70.cjs +1 -0
  156. package/dist/index70.js +20 -0
  157. package/dist/index71.cjs +1 -0
  158. package/dist/index71.js +10 -0
  159. package/dist/index72.cjs +1 -0
  160. package/dist/index72.js +14 -0
  161. package/dist/index73.cjs +1 -0
  162. package/dist/index73.js +8 -0
  163. package/dist/index74.cjs +1 -0
  164. package/dist/index74.js +8 -0
  165. package/dist/index75.cjs +1 -0
  166. package/dist/index75.js +11 -0
  167. package/dist/index76.cjs +1 -0
  168. package/dist/index76.js +10 -0
  169. package/dist/index77.cjs +1 -0
  170. package/dist/index77.js +6 -0
  171. package/dist/index78.cjs +1 -0
  172. package/dist/index78.js +8 -0
  173. package/dist/index79.cjs +1 -0
  174. package/dist/index79.js +8 -0
  175. package/dist/index8.cjs +1 -0
  176. package/dist/index8.js +68 -0
  177. package/dist/index80.cjs +1 -0
  178. package/dist/index80.js +10 -0
  179. package/dist/index81.cjs +1 -0
  180. package/dist/index81.js +11 -0
  181. package/dist/index82.cjs +1 -0
  182. package/dist/index82.js +15 -0
  183. package/dist/index83.cjs +1 -0
  184. package/dist/index83.js +11 -0
  185. package/dist/index84.cjs +1 -0
  186. package/dist/index84.js +11 -0
  187. package/dist/index85.cjs +1 -0
  188. package/dist/index85.js +6 -0
  189. package/dist/index86.cjs +1 -0
  190. package/dist/index86.js +43 -0
  191. package/dist/index87.cjs +1 -0
  192. package/dist/index87.js +382 -0
  193. package/dist/index88.cjs +1 -0
  194. package/dist/index88.js +40 -0
  195. package/dist/index89.cjs +1 -0
  196. package/dist/index89.js +23 -0
  197. package/dist/index9.cjs +1 -0
  198. package/dist/index9.js +20 -0
  199. package/dist/index90.cjs +1 -0
  200. package/dist/index90.js +59 -0
  201. package/dist/index91.cjs +1 -0
  202. package/dist/index91.js +55 -0
  203. package/dist/index92.cjs +1 -0
  204. package/dist/index92.js +54 -0
  205. package/dist/index93.cjs +1 -0
  206. package/dist/index93.js +57 -0
  207. package/dist/index94.cjs +1 -0
  208. package/dist/index94.js +57 -0
  209. package/dist/index95.cjs +1 -0
  210. package/dist/index95.js +88 -0
  211. package/dist/index96.cjs +1 -0
  212. package/dist/index96.js +66 -0
  213. package/dist/index97.cjs +1 -0
  214. package/dist/index97.js +594 -0
  215. package/dist/index98.cjs +9 -0
  216. package/dist/index98.js +30 -0
  217. package/dist/index99.cjs +1 -0
  218. package/dist/index99.js +50 -0
  219. package/package.json +82 -0
@@ -0,0 +1,151 @@
1
+ import { Popover as e, PopoverContent as t, PopoverTrigger as n } from "./index21.js";
2
+ import { Icons as r } from "./index41.js";
3
+ import { MultiSelectTags as i } from "./index102.js";
4
+ import { useMemo as a, useRef as o, useState as s } from "react";
5
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ import { isNil as d } from "lodash-es";
7
+ //#region src/Select/BaseSelect.tsx
8
+ function f(e) {
9
+ return e.isMulti === !0;
10
+ }
11
+ function p(p) {
12
+ let { options: m, injectOptions: h = [], placeholder: g = "Chọn...", isClearable: _ = !0, isSearchable: v = !0, isLoading: y = !1, className: b = "", disabled: x = !1, onSearchTextChange: S, hasNextPage: C = !1, isFetchingNextPage: w = !1, fetchNextPage: T, maxTagCount: E = "responsive", tagRender: D, showSelectAll: O = !1 } = p, k = f(p), { value: A } = p, [j, M] = s(!1), [N, P] = s(""), F = o(null), I = a(() => {
13
+ let e = /* @__PURE__ */ new Map();
14
+ for (let t of h) e.set(t.value, t);
15
+ for (let t of m) e.set(t.value, t);
16
+ return Array.from(e.values());
17
+ }, [m, h]), L = (e) => {
18
+ let { scrollTop: t, scrollHeight: n, clientHeight: r } = e.currentTarget;
19
+ n - t <= r + 50 && C && !w && T && T();
20
+ }, R = a(() => !v || !N || S ? I : I.filter((e) => e.label.toLowerCase().includes(N.toLowerCase())), [
21
+ I,
22
+ v,
23
+ N,
24
+ S
25
+ ]), z = a(() => k && Array.isArray(A) ? A : d(A) ? [] : [A], [A, k]), B = (e) => {
26
+ if (!x) if (f(p)) {
27
+ let t = z.includes(e) ? z.filter((t) => t !== e) : [...z, e];
28
+ p.onChange && p.onChange(t);
29
+ } else p.onChange && p.onChange(e), M(!1);
30
+ }, V = (e) => {
31
+ x || (e.stopPropagation(), f(p) ? p.onChange && p.onChange([]) : p.onChange && p.onChange(null), P(""), S && S(""));
32
+ }, H = (e) => {
33
+ let t = e.target.value;
34
+ P(t), S && S(t);
35
+ }, U = a(() => I.filter((e) => z.includes(e.value)), [z, I]), W = a(() => z.length ? k ? I.filter((e) => z.includes(e.value)).map((e) => e.label).join(", ") : I.find((e) => e.value === z[0])?.label || "" : "", [
36
+ z,
37
+ I,
38
+ k
39
+ ]);
40
+ return /* @__PURE__ */ u(e, {
41
+ open: j,
42
+ onOpenChange: x ? void 0 : M,
43
+ children: [/* @__PURE__ */ l(n, {
44
+ asChild: !0,
45
+ children: /* @__PURE__ */ u("button", {
46
+ type: "button",
47
+ className: `flex items-center w-full min-w-60 border rounded-md px-3 py-1.5 text-xs bg-white dark:bg-input/30 ${b} ${j ? "ring-2 ring-primary" : ""} ${x ? "bg-muted cursor-not-allowed opacity-60" : ""}`,
48
+ onClick: () => !x && M((e) => !e),
49
+ disabled: x,
50
+ children: [
51
+ k && z.length > 0 ? /* @__PURE__ */ l(i, {
52
+ selectedOptions: U,
53
+ maxTagCount: E,
54
+ onRemove: (e) => {
55
+ if (x || !f(p)) return;
56
+ let t = z.filter((t) => t !== e);
57
+ p.onChange && p.onChange(t);
58
+ },
59
+ disabled: x,
60
+ tagRender: D
61
+ }) : /* @__PURE__ */ l("span", {
62
+ className: "flex-1 truncate text-left text-xs",
63
+ children: W || /* @__PURE__ */ l("span", {
64
+ className: "text-muted-foreground",
65
+ children: g
66
+ })
67
+ }),
68
+ _ && z.length > 0 && !x && /* @__PURE__ */ l(r.XIcon, {
69
+ className: "w-3.5 h-3.5 ml-2 text-muted-foreground hover:text-destructive flex-shrink-0",
70
+ onClick: V
71
+ }),
72
+ /* @__PURE__ */ l(r.ChevronDownIcon, { className: "w-3.5 h-3.5 ml-2 text-muted-foreground flex-shrink-0" })
73
+ ]
74
+ })
75
+ }), /* @__PURE__ */ u(t, {
76
+ className: "p-0 w-60",
77
+ align: "start",
78
+ children: [
79
+ v && !x && /* @__PURE__ */ u("div", {
80
+ className: "flex items-center px-2 py-1.5 border-b",
81
+ children: [/* @__PURE__ */ l(r.SearchIcon, { className: "w-4 h-4 mr-2 text-muted-foreground" }), /* @__PURE__ */ l("input", {
82
+ ref: F,
83
+ className: "w-full outline-none bg-transparent text-xs",
84
+ placeholder: "Tìm kiếm...",
85
+ value: N,
86
+ onChange: H,
87
+ autoFocus: !0,
88
+ disabled: x
89
+ })]
90
+ }),
91
+ k && O && !x && R.length > 0 && /* @__PURE__ */ u("div", {
92
+ className: "flex items-center px-3 py-2 border-b cursor-pointer hover:bg-accent text-xs font-medium",
93
+ onClick: () => {
94
+ if (!(x || !f(p))) if (z.length === R.length) p.onChange && p.onChange([]);
95
+ else {
96
+ let e = R.map((e) => e.value);
97
+ p.onChange && p.onChange(e);
98
+ }
99
+ },
100
+ children: [/* @__PURE__ */ l("span", {
101
+ className: "flex-1",
102
+ children: z.length === R.length ? "Bỏ chọn tất cả" : "Chọn tất cả"
103
+ }), /* @__PURE__ */ u("span", {
104
+ className: "text-muted-foreground text-xs",
105
+ children: [
106
+ "(",
107
+ z.length,
108
+ "/",
109
+ R.length,
110
+ ")"
111
+ ]
112
+ })]
113
+ }),
114
+ /* @__PURE__ */ l("div", {
115
+ className: "max-h-56 overflow-y-auto",
116
+ onScroll: L,
117
+ children: y && I.length === 0 ? /* @__PURE__ */ l("div", {
118
+ className: "p-3 text-center text-muted-foreground text-xs",
119
+ children: "Đang tải..."
120
+ }) : R.length === 0 ? /* @__PURE__ */ l("div", {
121
+ className: "p-3 text-center text-muted-foreground text-xs",
122
+ children: "Không có dữ liệu"
123
+ }) : /* @__PURE__ */ u(c, { children: [R.map((e) => /* @__PURE__ */ u("div", {
124
+ className: `flex items-center px-3 py-1.5 cursor-pointer hover:bg-accent text-xs ${z.includes(e.value) ? "bg-accent/50" : ""} ${x ? "pointer-events-none opacity-60" : ""}`,
125
+ onClick: () => B(e.value),
126
+ children: [
127
+ e.icon && /* @__PURE__ */ l("span", {
128
+ className: "mr-2",
129
+ children: e.icon
130
+ }),
131
+ /* @__PURE__ */ l("span", {
132
+ className: "truncate flex-1 text-xs",
133
+ children: e.label
134
+ }),
135
+ k && /* @__PURE__ */ l("span", {
136
+ className: `ml-2 w-4 h-4 border rounded flex items-center justify-center ${z.includes(e.value) ? "bg-primary text-white" : "bg-white"}`,
137
+ children: z.includes(e.value) && /* @__PURE__ */ l(r.CheckIcon, { className: "w-3 h-3" })
138
+ }),
139
+ !k && z.includes(e.value) && /* @__PURE__ */ l(r.CheckIcon, { className: "w-3.5 h-3.5 ml-2 text-primary" })
140
+ ]
141
+ }, e.value)), (w || C && R.length > 0) && /* @__PURE__ */ l("div", {
142
+ className: "p-3 text-center text-muted-foreground text-xs",
143
+ children: w ? "Đang tải thêm..." : ""
144
+ })] })
145
+ })
146
+ ]
147
+ })]
148
+ });
149
+ }
150
+ //#endregion
151
+ export { p as BaseSelect };
@@ -0,0 +1 @@
1
+ const e=require("./index2.cjs"),t=require("./index22.cjs"),n=require("./index42.cjs"),r=require("./index103.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("lodash-es");function s(e){return e.isMulti===!0}function c(e){let{options:c,injectOptions:l=[],placeholder:u=`Chọn...`,isClearable:d=!0,isSearchable:f=!0,isLoading:p=!1,className:m=``,disabled:h=!1,onSearchTextChange:g,hasNextPage:_=!1,isFetchingNextPage:v=!1,fetchNextPage:y,maxTagCount:b=`responsive`,tagRender:x,showSelectAll:S=!1}=e,C=s(e),{value:w}=e,[T,E]=(0,i.useState)(!1),[D,O]=(0,i.useState)(``),k=(0,i.useRef)(null),A=(0,i.useMemo)(()=>{let e=new Map;for(let t of l)e.set(t.value,t);for(let t of c)e.set(t.value,t);return Array.from(e.values())},[c,l]),j=e=>{let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.currentTarget;n-t<=r+50&&_&&!v&&y&&y()},M=(0,i.useMemo)(()=>!f||!D||g?A:A.filter(e=>e.label.toLowerCase().includes(D.toLowerCase())),[A,f,D,g]),N=(0,i.useMemo)(()=>C&&Array.isArray(w)?w:(0,o.isNil)(w)?[]:[w],[w,C]),P=t=>{if(!h)if(s(e)){let n=N.includes(t)?N.filter(e=>e!==t):[...N,t];e.onChange&&e.onChange(n)}else e.onChange&&e.onChange(t),E(!1)},F=t=>{h||(t.stopPropagation(),s(e)?e.onChange&&e.onChange([]):e.onChange&&e.onChange(null),O(``),g&&g(``))},I=e=>{let t=e.target.value;O(t),g&&g(t)},L=(0,i.useMemo)(()=>A.filter(e=>N.includes(e.value)),[N,A]),R=(0,i.useMemo)(()=>N.length?C?A.filter(e=>N.includes(e.value)).map(e=>e.label).join(`, `):A.find(e=>e.value===N[0])?.label||``:``,[N,A,C]);return(0,a.jsxs)(t.Popover,{open:T,onOpenChange:h?void 0:E,children:[(0,a.jsx)(t.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{type:`button`,className:`flex items-center w-full min-w-60 border rounded-md px-3 py-1.5 text-xs bg-white dark:bg-input/30 ${m} ${T?`ring-2 ring-primary`:``} ${h?`bg-muted cursor-not-allowed opacity-60`:``}`,onClick:()=>!h&&E(e=>!e),disabled:h,children:[C&&N.length>0?(0,a.jsx)(r.MultiSelectTags,{selectedOptions:L,maxTagCount:b,onRemove:t=>{if(h||!s(e))return;let n=N.filter(e=>e!==t);e.onChange&&e.onChange(n)},disabled:h,tagRender:x}):(0,a.jsx)(`span`,{className:`flex-1 truncate text-left text-xs`,children:R||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:u})}),d&&N.length>0&&!h&&(0,a.jsx)(n.Icons.XIcon,{className:`w-3.5 h-3.5 ml-2 text-muted-foreground hover:text-destructive flex-shrink-0`,onClick:F}),(0,a.jsx)(n.Icons.ChevronDownIcon,{className:`w-3.5 h-3.5 ml-2 text-muted-foreground flex-shrink-0`})]})}),(0,a.jsxs)(t.PopoverContent,{className:`p-0 w-60`,align:`start`,children:[f&&!h&&(0,a.jsxs)(`div`,{className:`flex items-center px-2 py-1.5 border-b`,children:[(0,a.jsx)(n.Icons.SearchIcon,{className:`w-4 h-4 mr-2 text-muted-foreground`}),(0,a.jsx)(`input`,{ref:k,className:`w-full outline-none bg-transparent text-xs`,placeholder:`Tìm kiếm...`,value:D,onChange:I,autoFocus:!0,disabled:h})]}),C&&S&&!h&&M.length>0&&(0,a.jsxs)(`div`,{className:`flex items-center px-3 py-2 border-b cursor-pointer hover:bg-accent text-xs font-medium`,onClick:()=>{if(!(h||!s(e)))if(N.length===M.length)e.onChange&&e.onChange([]);else{let t=M.map(e=>e.value);e.onChange&&e.onChange(t)}},children:[(0,a.jsx)(`span`,{className:`flex-1`,children:N.length===M.length?`Bỏ chọn tất cả`:`Chọn tất cả`}),(0,a.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`(`,N.length,`/`,M.length,`)`]})]}),(0,a.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,onScroll:j,children:p&&A.length===0?(0,a.jsx)(`div`,{className:`p-3 text-center text-muted-foreground text-xs`,children:`Đang tải...`}):M.length===0?(0,a.jsx)(`div`,{className:`p-3 text-center text-muted-foreground text-xs`,children:`Không có dữ liệu`}):(0,a.jsxs)(a.Fragment,{children:[M.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center px-3 py-1.5 cursor-pointer hover:bg-accent text-xs ${N.includes(e.value)?`bg-accent/50`:``} ${h?`pointer-events-none opacity-60`:``}`,onClick:()=>P(e.value),children:[e.icon&&(0,a.jsx)(`span`,{className:`mr-2`,children:e.icon}),(0,a.jsx)(`span`,{className:`truncate flex-1 text-xs`,children:e.label}),C&&(0,a.jsx)(`span`,{className:`ml-2 w-4 h-4 border rounded flex items-center justify-center ${N.includes(e.value)?`bg-primary text-white`:`bg-white`}`,children:N.includes(e.value)&&(0,a.jsx)(n.Icons.CheckIcon,{className:`w-3 h-3`})}),!C&&N.includes(e.value)&&(0,a.jsx)(n.Icons.CheckIcon,{className:`w-3.5 h-3.5 ml-2 text-primary`})]},e.value)),(v||_&&M.length>0)&&(0,a.jsx)(`div`,{className:`p-3 text-center text-muted-foreground text-xs`,children:v?`Đang tải thêm...`:``})]})})]})]})}exports.BaseSelect=c;
@@ -0,0 +1,23 @@
1
+ import { FormBase as e } from "./index42.js";
2
+ import { useFormSelect as t } from "./index101.js";
3
+ import { BaseSelect as n } from "./index103.js";
4
+ import "react";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ //#region src/Form/FormSelect/FormSelect.tsx
7
+ function i(i) {
8
+ let { baseSelectProps: a, isMulti: o, createChangeHandlers: s } = t(i);
9
+ return /* @__PURE__ */ r(e, {
10
+ ...i,
11
+ children: (e) => {
12
+ let { onChangeMulti: t, onChangeSingle: i } = s(e);
13
+ return /* @__PURE__ */ r(n, {
14
+ ...a,
15
+ isMulti: o,
16
+ value: e.value,
17
+ onChange: o ? t : i
18
+ });
19
+ }
20
+ });
21
+ }
22
+ //#endregion
23
+ export { i as FormSelect };
@@ -0,0 +1 @@
1
+ const e=require("./index2.cjs"),t=require("./index43.cjs"),n=require("./index102.cjs"),r=require("./index104.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime");function o(e){let{baseSelectProps:i,isMulti:o,createChangeHandlers:s}=n.useFormSelect(e);return(0,a.jsx)(t.FormBase,{...e,children:e=>{let{onChangeMulti:t,onChangeSingle:n}=s(e);return(0,a.jsx)(r.BaseSelect,{...i,isMulti:o,value:e.value,onChange:o?t:n})}})}exports.FormSelect=o;
@@ -0,0 +1,27 @@
1
+ //#region src/Form/FormRadioGroup/useFormRadio.ts
2
+ function e(e) {
3
+ let { rules: r = {}, value: i, onChange: a, showEmpty: o } = e, s = r.required !== void 0 && r.required !== !1;
4
+ return {
5
+ isRequired: s,
6
+ processedRules: n(r, s),
7
+ parseValue: (e) => i === void 0 ? o ? "" : String(e ?? "") : String(i),
8
+ emitChange: (e, t) => {
9
+ e(t), a?.(t);
10
+ },
11
+ sizeClasses: t
12
+ };
13
+ }
14
+ var t = {
15
+ large: "size-5",
16
+ middle: "size-4",
17
+ small: "size-3.5"
18
+ };
19
+ function n(e = {}, t) {
20
+ let n = { ...e };
21
+ return t && typeof n.required != "string" && typeof n.required != "object" ? n.required = "Trường này là bắt buộc" : typeof n.required == "object" && !n.required.message && (n.required = {
22
+ ...n.required,
23
+ message: "Trường này là bắt buộc"
24
+ }), n;
25
+ }
26
+ //#endregion
27
+ export { e as useFormRadio };
@@ -0,0 +1 @@
1
+ function e(e){let{rules:r={},value:i,onChange:a,showEmpty:o}=e,s=r.required!==void 0&&r.required!==!1;return{isRequired:s,processedRules:n(r,s),parseValue:e=>i===void 0?o?``:String(e??``):String(i),emitChange:(e,t)=>{e(t),a?.(t)},sizeClasses:t}}var t={large:`size-5`,middle:`size-4`,small:`size-3.5`};function n(e={},t){let n={...e};return t&&typeof n.required!=`string`&&typeof n.required!=`object`?n.required=`Trường này là bắt buộc`:typeof n.required==`object`&&!n.required.message&&(n.required={...n.required,message:`Trường này là bắt buộc`}),n}exports.useFormRadio=e;
@@ -0,0 +1,53 @@
1
+ import { Label as e } from "./index13.js";
2
+ import { FormControl as t, FormField as n, FormItem as r, FormLabel as i, FormMessage as a } from "./index18.js";
3
+ import { RadioGroup as o, RadioGroupItem as s } from "./index23.js";
4
+ import { useFormRadio as c } from "./index105.js";
5
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ //#region src/Form/FormRadioGroup/FormRadio.tsx
7
+ function d({ name: d, control: f, label: p = "", size: m = "middle", options: h = [], onChange: g, value: _, rules: v = {}, disabled: y = !1, optionType: b = "default", buttonStyle: x, autoHeightMax: S, showEmpty: C = !1, hideErrorMessage: w = !1, className: T }) {
8
+ let { isRequired: E, processedRules: D, parseValue: O, emitChange: k, sizeClasses: A } = c({
9
+ rules: v,
10
+ value: _,
11
+ onChange: g,
12
+ showEmpty: C
13
+ }), j = (t, n, r) => /* @__PURE__ */ l(o, {
14
+ value: O(n),
15
+ onValueChange: (e) => k(r, e),
16
+ disabled: y,
17
+ style: S ? {
18
+ maxHeight: `${S}px`,
19
+ overflowY: "auto"
20
+ } : void 0,
21
+ children: h.map((n) => /* @__PURE__ */ u("div", {
22
+ className: "flex items-center space-x-2",
23
+ children: [/* @__PURE__ */ l(s, {
24
+ value: String(n.value),
25
+ id: `${t}-${n.value}`,
26
+ disabled: y || n.disabled,
27
+ className: A[m]
28
+ }), /* @__PURE__ */ l(e, {
29
+ htmlFor: `${t}-${n.value}`,
30
+ className: "cursor-pointer font-normal",
31
+ children: n.label
32
+ })]
33
+ }, String(n.value)))
34
+ });
35
+ return /* @__PURE__ */ l(n, {
36
+ control: f,
37
+ name: d,
38
+ rules: D,
39
+ render: ({ field: e }) => /* @__PURE__ */ u(r, {
40
+ className: T,
41
+ children: [
42
+ p && /* @__PURE__ */ u(i, { children: [p, E && /* @__PURE__ */ l("span", {
43
+ className: "text-destructive ml-1",
44
+ children: "*"
45
+ })] }),
46
+ /* @__PURE__ */ l(t, { children: j(d, _ ?? e.value, e.onChange) }),
47
+ !w && /* @__PURE__ */ l(a, {})
48
+ ]
49
+ })
50
+ });
51
+ }
52
+ //#endregion
53
+ export { d as FormRadio };
@@ -0,0 +1 @@
1
+ const e=require("./index14.cjs"),t=require("./index19.cjs"),n=require("./index24.cjs"),r=require("./index106.cjs");let i=require("react/jsx-runtime");function a({name:a,control:o,label:s=``,size:c=`middle`,options:l=[],onChange:u,value:d,rules:f={},disabled:p=!1,optionType:m=`default`,buttonStyle:h,autoHeightMax:g,showEmpty:_=!1,hideErrorMessage:v=!1,className:y}){let{isRequired:b,processedRules:x,parseValue:S,emitChange:C,sizeClasses:w}=r.useFormRadio({rules:f,value:d,onChange:u,showEmpty:_}),T=(t,r,a)=>(0,i.jsx)(n.RadioGroup,{value:S(r),onValueChange:e=>C(a,e),disabled:p,style:g?{maxHeight:`${g}px`,overflowY:`auto`}:void 0,children:l.map(r=>(0,i.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,i.jsx)(n.RadioGroupItem,{value:String(r.value),id:`${t}-${r.value}`,disabled:p||r.disabled,className:w[c]}),(0,i.jsx)(e.Label,{htmlFor:`${t}-${r.value}`,className:`cursor-pointer font-normal`,children:r.label})]},String(r.value)))});return(0,i.jsx)(t.FormField,{control:o,name:a,rules:x,render:({field:e})=>(0,i.jsxs)(t.FormItem,{className:y,children:[s&&(0,i.jsxs)(t.FormLabel,{children:[s,b&&(0,i.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,i.jsx)(t.FormControl,{children:T(a,d??e.value,e.onChange)}),!v&&(0,i.jsx)(t.FormMessage,{})]})})}exports.FormRadio=a;
@@ -0,0 +1,161 @@
1
+ import { Button as e } from "./index6.js";
2
+ import { FileUploadDropzone as t, FileUploadItem as n, FileUploadItemDelete as r, FileUploadItemMetadata as i, FileUploadItemPreview as a, FileUploadItemProgress as o, FileUploadList as s, FileUploadRoot as c, useStore as l } from "./index16.js";
3
+ import { CameraIcon as u, CloudUploadIcon as d, Trash2Icon as f } from "lucide-react";
4
+ import { useEffect as p, useRef as m } from "react";
5
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
6
+ //#region src/Form/FormFileUpload/FileUpload.tsx
7
+ function v({ onChange: e, autoUpload: t, maxFiles: n }) {
8
+ let r = l((e) => e), i = m(null);
9
+ return p(() => {
10
+ if (!e) return;
11
+ let a = Array.from(r.files.values()), o = (() => {
12
+ if (t) {
13
+ let e = a.filter((e) => e.status === "success").map((e) => e.file.uploadedUrl).filter((e) => !!e);
14
+ return n === 1 ? e.length > 0 ? e[e.length - 1] : null : e;
15
+ }
16
+ let e = a.map((e) => e.file);
17
+ return n === 1 ? e.length > 0 ? e[e.length - 1] : null : e;
18
+ })(), s = i.current;
19
+ (t ? JSON.stringify(s) === JSON.stringify(o) : Array.isArray(o) && Array.isArray(s) ? o.length === s.length && o.every((e, t) => e === s[t]) : o === s) || (i.current = o, e(o));
20
+ }, [
21
+ r,
22
+ t,
23
+ n,
24
+ e
25
+ ]), null;
26
+ }
27
+ function y(e, t = "") {
28
+ let n = e.split("/").pop()?.split("?")[0] || "file", r = n.split(".").pop()?.toLowerCase(), i = r && {
29
+ jpg: "image/jpeg",
30
+ jpeg: "image/jpeg",
31
+ png: "image/png",
32
+ gif: "image/gif",
33
+ webp: "image/webp"
34
+ }[r];
35
+ i ||= t.includes("image") ? "image/jpeg" : "application/octet-stream";
36
+ let a = new File([""], n, { type: i });
37
+ return a.isUploadedUrl = !0, a.uploadedUrl = e, a;
38
+ }
39
+ function b({ value: l, onChange: p, autoUpload: m = !1, uploadFile: b, maxFiles: x = 1, maxSize: S = 1024 * 1024 * 5, accept: C = "image/*", disabled: w, className: T, variant: E = "default" }) {
40
+ let D = (Array.isArray(l) ? l : l ? [l] : []).map((e) => e instanceof File ? e : typeof e == "string" ? y(e, C) : e);
41
+ return /* @__PURE__ */ _(c, {
42
+ value: D,
43
+ maxFiles: E === "avatar" ? 1 : x,
44
+ maxSize: S,
45
+ accept: C,
46
+ disabled: w,
47
+ onUpload: async (e, t) => {
48
+ if (!m) {
49
+ e.forEach((e) => t.onSuccess(e));
50
+ return;
51
+ }
52
+ if (!b) {
53
+ console.warn("uploadFile prop is required when autoUpload is true"), e.forEach((e) => t.onError(e, /* @__PURE__ */ Error("Missing uploadFile function")));
54
+ return;
55
+ }
56
+ await Promise.all(e.map(async (e) => {
57
+ let n = e;
58
+ if (n.isUploadedUrl) {
59
+ t.onSuccess(e);
60
+ return;
61
+ }
62
+ try {
63
+ t.onProgress(e, 20), n.uploadedUrl = await b(e), t.onProgress(e, 100), t.onSuccess(e);
64
+ } catch (n) {
65
+ t.onError(e, n instanceof Error ? n : /* @__PURE__ */ Error("Upload failed"));
66
+ }
67
+ }));
68
+ },
69
+ className: T,
70
+ children: [/* @__PURE__ */ g(v, {
71
+ onChange: p,
72
+ autoUpload: m,
73
+ maxFiles: E === "avatar" ? 1 : x
74
+ }), E === "avatar" ? /* @__PURE__ */ _("div", {
75
+ className: "flex flex-col items-center gap-2",
76
+ children: [/* @__PURE__ */ g(t, {
77
+ className: "group relative size-32 cursor-pointer overflow-hidden rounded-full border-2 border-dashed border-border p-0 hover:border-primary",
78
+ children: D[0] ? /* @__PURE__ */ _(n, {
79
+ value: D[0],
80
+ className: "relative flex size-full flex-col rounded-none border-none p-0",
81
+ children: [
82
+ /* @__PURE__ */ g(a, {
83
+ className: "size-full rounded-none border-none bg-transparent",
84
+ render: (e) => {
85
+ let t = e.uploadedUrl;
86
+ return t ? /* @__PURE__ */ g("img", {
87
+ src: t,
88
+ alt: "Avatar",
89
+ className: "size-full object-cover"
90
+ }) : /* @__PURE__ */ g("img", {
91
+ src: URL.createObjectURL(e),
92
+ alt: "Avatar",
93
+ className: "size-full object-cover"
94
+ });
95
+ }
96
+ }),
97
+ /* @__PURE__ */ _("div", {
98
+ className: "absolute inset-0 flex flex-col items-center justify-center gap-1 bg-black/40 opacity-0 transition-opacity group-hover:opacity-100",
99
+ children: [/* @__PURE__ */ g(u, { className: "size-6 text-white" }), /* @__PURE__ */ g("span", {
100
+ className: "text-[10px] text-white",
101
+ children: "Đổi ảnh"
102
+ })]
103
+ }),
104
+ /* @__PURE__ */ g(o, {
105
+ variant: "fill",
106
+ className: "opacity-50"
107
+ })
108
+ ]
109
+ }) : /* @__PURE__ */ _("div", {
110
+ className: "flex size-full flex-col items-center justify-center gap-1 bg-accent text-muted-foreground transition-colors group-hover:bg-accent/80",
111
+ children: [/* @__PURE__ */ g(u, { className: "size-6" }), /* @__PURE__ */ g("span", {
112
+ className: "text-[10px]",
113
+ children: "Tải lên"
114
+ })]
115
+ })
116
+ }), /* @__PURE__ */ g("div", {
117
+ className: "text-xs text-muted-foreground",
118
+ children: S ? `Max ${Math.round(S / (1024 * 1024))}MB` : ""
119
+ })]
120
+ }) : /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _(t, { children: [
121
+ /* @__PURE__ */ g(d, { className: "h-10 w-10 text-muted-foreground" }),
122
+ /* @__PURE__ */ g("p", {
123
+ className: "text-sm font-medium",
124
+ children: "Drag & drop files here, or click to select"
125
+ }),
126
+ /* @__PURE__ */ _("p", {
127
+ className: "text-xs text-muted-foreground",
128
+ children: [
129
+ x > 1 ? `Up to ${x} files` : "1 file max",
130
+ " ",
131
+ S ? `(Max ${Math.round(S / (1024 * 1024))}MB)` : ""
132
+ ]
133
+ })
134
+ ] }), /* @__PURE__ */ g(s, { children: D.map((t, s) => /* @__PURE__ */ _(n, {
135
+ value: t,
136
+ children: [
137
+ /* @__PURE__ */ g(a, { render: (e, t) => {
138
+ let n = e.uploadedUrl;
139
+ return n && e.type.startsWith("image/") ? /* @__PURE__ */ g("img", {
140
+ src: n,
141
+ alt: e.name,
142
+ className: "size-full object-cover"
143
+ }) : t();
144
+ } }),
145
+ /* @__PURE__ */ g(i, {}),
146
+ /* @__PURE__ */ g(o, { className: "absolute bottom-0 left-0 right-0 h-1 w-auto rounded-none" }),
147
+ /* @__PURE__ */ g(r, {
148
+ asChild: !0,
149
+ children: /* @__PURE__ */ g(e, {
150
+ variant: "ghost",
151
+ size: "icon",
152
+ className: "h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive",
153
+ children: /* @__PURE__ */ g(f, { className: "h-4 w-4" })
154
+ })
155
+ })
156
+ ]
157
+ }, s)) })] })]
158
+ });
159
+ }
160
+ //#endregion
161
+ export { b as FileUpload };
@@ -0,0 +1 @@
1
+ const e=require("./index7.cjs"),t=require("./index17.cjs");let n=require("lucide-react"),r=require("react"),i=require("react/jsx-runtime");function a({onChange:e,autoUpload:n,maxFiles:i}){let a=t.useStore(e=>e),o=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!e)return;let t=Array.from(a.files.values()),r=(()=>{if(n){let e=t.filter(e=>e.status===`success`).map(e=>e.file.uploadedUrl).filter(e=>!!e);return i===1?e.length>0?e[e.length-1]:null:e}let e=t.map(e=>e.file);return i===1?e.length>0?e[e.length-1]:null:e})(),s=o.current;(n?JSON.stringify(s)===JSON.stringify(r):Array.isArray(r)&&Array.isArray(s)?r.length===s.length&&r.every((e,t)=>e===s[t]):r===s)||(o.current=r,e(r))},[a,n,i,e]),null}function o(e,t=``){let n=e.split(`/`).pop()?.split(`?`)[0]||`file`,r=n.split(`.`).pop()?.toLowerCase(),i=r&&{jpg:`image/jpeg`,jpeg:`image/jpeg`,png:`image/png`,gif:`image/gif`,webp:`image/webp`}[r];i||=t.includes(`image`)?`image/jpeg`:`application/octet-stream`;let a=new File([``],n,{type:i});return a.isUploadedUrl=!0,a.uploadedUrl=e,a}function s({value:r,onChange:s,autoUpload:c=!1,uploadFile:l,maxFiles:u=1,maxSize:d=1024*1024*5,accept:f=`image/*`,disabled:p,className:m,variant:h=`default`}){let g=(Array.isArray(r)?r:r?[r]:[]).map(e=>e instanceof File?e:typeof e==`string`?o(e,f):e);return(0,i.jsxs)(t.FileUploadRoot,{value:g,maxFiles:h===`avatar`?1:u,maxSize:d,accept:f,disabled:p,onUpload:async(e,t)=>{if(!c){e.forEach(e=>t.onSuccess(e));return}if(!l){console.warn(`uploadFile prop is required when autoUpload is true`),e.forEach(e=>t.onError(e,Error(`Missing uploadFile function`)));return}await Promise.all(e.map(async e=>{let n=e;if(n.isUploadedUrl){t.onSuccess(e);return}try{t.onProgress(e,20),n.uploadedUrl=await l(e),t.onProgress(e,100),t.onSuccess(e)}catch(n){t.onError(e,n instanceof Error?n:Error(`Upload failed`))}}))},className:m,children:[(0,i.jsx)(a,{onChange:s,autoUpload:c,maxFiles:h===`avatar`?1:u}),h===`avatar`?(0,i.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,i.jsx)(t.FileUploadDropzone,{className:`group relative size-32 cursor-pointer overflow-hidden rounded-full border-2 border-dashed border-border p-0 hover:border-primary`,children:g[0]?(0,i.jsxs)(t.FileUploadItem,{value:g[0],className:`relative flex size-full flex-col rounded-none border-none p-0`,children:[(0,i.jsx)(t.FileUploadItemPreview,{className:`size-full rounded-none border-none bg-transparent`,render:e=>{let t=e.uploadedUrl;return t?(0,i.jsx)(`img`,{src:t,alt:`Avatar`,className:`size-full object-cover`}):(0,i.jsx)(`img`,{src:URL.createObjectURL(e),alt:`Avatar`,className:`size-full object-cover`})}}),(0,i.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-1 bg-black/40 opacity-0 transition-opacity group-hover:opacity-100`,children:[(0,i.jsx)(n.CameraIcon,{className:`size-6 text-white`}),(0,i.jsx)(`span`,{className:`text-[10px] text-white`,children:`Đổi ảnh`})]}),(0,i.jsx)(t.FileUploadItemProgress,{variant:`fill`,className:`opacity-50`})]}):(0,i.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-1 bg-accent text-muted-foreground transition-colors group-hover:bg-accent/80`,children:[(0,i.jsx)(n.CameraIcon,{className:`size-6`}),(0,i.jsx)(`span`,{className:`text-[10px]`,children:`Tải lên`})]})}),(0,i.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:d?`Max ${Math.round(d/(1024*1024))}MB`:``})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.FileUploadDropzone,{children:[(0,i.jsx)(n.CloudUploadIcon,{className:`h-10 w-10 text-muted-foreground`}),(0,i.jsx)(`p`,{className:`text-sm font-medium`,children:`Drag & drop files here, or click to select`}),(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[u>1?`Up to ${u} files`:`1 file max`,` `,d?`(Max ${Math.round(d/(1024*1024))}MB)`:``]})]}),(0,i.jsx)(t.FileUploadList,{children:g.map((r,a)=>(0,i.jsxs)(t.FileUploadItem,{value:r,children:[(0,i.jsx)(t.FileUploadItemPreview,{render:(e,t)=>{let n=e.uploadedUrl;return n&&e.type.startsWith(`image/`)?(0,i.jsx)(`img`,{src:n,alt:e.name,className:`size-full object-cover`}):t()}}),(0,i.jsx)(t.FileUploadItemMetadata,{}),(0,i.jsx)(t.FileUploadItemProgress,{className:`absolute bottom-0 left-0 right-0 h-1 w-auto rounded-none`}),(0,i.jsx)(t.FileUploadItemDelete,{asChild:!0,children:(0,i.jsx)(e.Button,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive`,children:(0,i.jsx)(n.Trash2Icon,{className:`h-4 w-4`})})})]},a))})]})]})}exports.FileUpload=s;
@@ -0,0 +1,16 @@
1
+ import { FormBase as e } from "./index42.js";
2
+ import { FileUpload as t } from "./index107.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/Form/FormFileUpload/index.tsx
5
+ var r = (r) => /* @__PURE__ */ n(e, {
6
+ ...r,
7
+ children: ({ onChange: e, value: i, disabled: a }) => /* @__PURE__ */ n(t, {
8
+ ...r,
9
+ value: i,
10
+ onChange: e,
11
+ disabled: a || r.disabled,
12
+ className: r.className
13
+ })
14
+ });
15
+ //#endregion
16
+ export { r as default };
@@ -0,0 +1 @@
1
+ const e=require("./index43.cjs"),t=require("./index108.cjs");let n=require("react/jsx-runtime");var r=r=>(0,n.jsx)(e.FormBase,{...r,children:({onChange:e,value:i,disabled:a})=>(0,n.jsx)(t.FileUpload,{...r,value:i,onChange:e,disabled:a||r.disabled,className:r.className})});exports.default=r;
@@ -0,0 +1 @@
1
+ const e=require("./index2.cjs"),t=require("./index4.cjs");let n=require("lucide-react"),r=require("react");r=e.__toESM(r,1);let i=require("react/jsx-runtime"),a=require("@radix-ui/react-dialog");a=e.__toESM(a,1);function o({...e}){return(0,i.jsx)(a.Root,{"data-slot":`dialog`,...e})}function s({...e}){return(0,i.jsx)(a.Trigger,{"data-slot":`dialog-trigger`,...e})}function c({...e}){return(0,i.jsx)(a.Portal,{"data-slot":`dialog-portal`,...e})}function l({...e}){return(0,i.jsx)(a.Close,{"data-slot":`dialog-close`,...e})}function u({className:e,...n}){return(0,i.jsx)(a.Overlay,{"data-slot":`dialog-overlay`,className:t.cn(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50`,e),...n})}function d({className:e,children:r,showCloseButton:o=!0,...s}){return(0,i.jsxs)(c,{"data-slot":`dialog-portal`,children:[(0,i.jsx)(u,{}),(0,i.jsxs)(a.Content,{"data-slot":`dialog-content`,className:t.cn(`bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg`,e),...s,children:[r,o&&(0,i.jsxs)(a.Close,{"data-slot":`dialog-close`,className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,i.jsx)(n.XIcon,{}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function f({className:e,...n}){return(0,i.jsx)(`div`,{"data-slot":`dialog-header`,className:t.cn(`flex flex-col gap-2 text-center sm:text-left`,e),...n})}function p({className:e,...n}){return(0,i.jsx)(`div`,{"data-slot":`dialog-footer`,className:t.cn(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...n})}function m({className:e,...n}){return(0,i.jsx)(a.Title,{"data-slot":`dialog-title`,className:t.cn(`text-lg leading-none font-semibold`,e),...n})}function h({className:e,...n}){return(0,i.jsx)(a.Description,{"data-slot":`dialog-description`,className:t.cn(`text-muted-foreground text-sm`,e),...n})}exports.Dialog=o,exports.DialogClose=l,exports.DialogContent=d,exports.DialogDescription=h,exports.DialogFooter=p,exports.DialogHeader=f,exports.DialogOverlay=u,exports.DialogPortal=c,exports.DialogTitle=m,exports.DialogTrigger=s;
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { cn as e } from "./index3.js";
3
+ import { Dialog as t, DialogContent as n, DialogDescription as r, DialogHeader as i, DialogTitle as a } from "./index10.js";
4
+ import { SearchIcon as o } from "lucide-react";
5
+ import "react";
6
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
+ import { Command as l } from "cmdk";
8
+ //#region src/ui/command.tsx
9
+ function u({ className: t, ...n }) {
10
+ return /* @__PURE__ */ s(l, {
11
+ "data-slot": "command",
12
+ className: e("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md", t),
13
+ ...n
14
+ });
15
+ }
16
+ function d({ title: o = "Command Palette", description: l = "Search for a command to run...", children: d, className: f, showCloseButton: p = !0, ...m }) {
17
+ return /* @__PURE__ */ c(t, {
18
+ ...m,
19
+ children: [/* @__PURE__ */ c(i, {
20
+ className: "sr-only",
21
+ children: [/* @__PURE__ */ s(a, { children: o }), /* @__PURE__ */ s(r, { children: l })]
22
+ }), /* @__PURE__ */ s(n, {
23
+ className: e("overflow-hidden p-0", f),
24
+ showCloseButton: p,
25
+ children: /* @__PURE__ */ s(u, {
26
+ className: "[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[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",
27
+ children: d
28
+ })
29
+ })]
30
+ });
31
+ }
32
+ function f({ className: t, ...n }) {
33
+ return /* @__PURE__ */ c("div", {
34
+ "data-slot": "command-input-wrapper",
35
+ className: "flex h-9 items-center gap-2 border-b px-3",
36
+ children: [/* @__PURE__ */ s(o, { className: "size-4 shrink-0 opacity-50" }), /* @__PURE__ */ s(l.Input, {
37
+ "data-slot": "command-input",
38
+ className: e("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50", t),
39
+ ...n
40
+ })]
41
+ });
42
+ }
43
+ function p({ className: t, ...n }) {
44
+ return /* @__PURE__ */ s(l.List, {
45
+ "data-slot": "command-list",
46
+ className: e("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", t),
47
+ ...n
48
+ });
49
+ }
50
+ function m({ ...e }) {
51
+ return /* @__PURE__ */ s(l.Empty, {
52
+ "data-slot": "command-empty",
53
+ className: "py-6 text-center text-sm",
54
+ ...e
55
+ });
56
+ }
57
+ function h({ className: t, ...n }) {
58
+ return /* @__PURE__ */ s(l.Group, {
59
+ "data-slot": "command-group",
60
+ className: e("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium", t),
61
+ ...n
62
+ });
63
+ }
64
+ function g({ className: t, ...n }) {
65
+ return /* @__PURE__ */ s(l.Separator, {
66
+ "data-slot": "command-separator",
67
+ className: e("bg-border -mx-1 h-px", t),
68
+ ...n
69
+ });
70
+ }
71
+ function _({ className: t, ...n }) {
72
+ return /* @__PURE__ */ s(l.Item, {
73
+ "data-slot": "command-item",
74
+ className: e("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
75
+ ...n
76
+ });
77
+ }
78
+ function v({ className: t, ...n }) {
79
+ return /* @__PURE__ */ s("span", {
80
+ "data-slot": "command-shortcut",
81
+ className: e("text-muted-foreground ml-auto text-xs tracking-widest", t),
82
+ ...n
83
+ });
84
+ }
85
+ //#endregion
86
+ export { u as Command, d as CommandDialog, m as CommandEmpty, h as CommandGroup, f as CommandInput, _ as CommandItem, p as CommandList, g as CommandSeparator, v as CommandShortcut };
@@ -0,0 +1 @@
1
+ "use client";const e=require("./index2.cjs"),t=require("./index4.cjs"),n=require("./index11.cjs");let r=require("lucide-react"),i=require("react");i=e.__toESM(i,1);let a=require("react/jsx-runtime"),o=require("cmdk");function s({className:e,...n}){return(0,a.jsx)(o.Command,{"data-slot":`command`,className:t.cn(`bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md`,e),...n})}function c({title:e=`Command Palette`,description:r=`Search for a command to run...`,children:i,className:o,showCloseButton:c=!0,...l}){return(0,a.jsxs)(n.Dialog,{...l,children:[(0,a.jsxs)(n.DialogHeader,{className:`sr-only`,children:[(0,a.jsx)(n.DialogTitle,{children:e}),(0,a.jsx)(n.DialogDescription,{children:r})]}),(0,a.jsx)(n.DialogContent,{className:t.cn(`overflow-hidden p-0`,o),showCloseButton:c,children:(0,a.jsx)(s,{className:`[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[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`,children:i})})]})}function l({className:e,...n}){return(0,a.jsxs)(`div`,{"data-slot":`command-input-wrapper`,className:`flex h-9 items-center gap-2 border-b px-3`,children:[(0,a.jsx)(r.SearchIcon,{className:`size-4 shrink-0 opacity-50`}),(0,a.jsx)(o.Command.Input,{"data-slot":`command-input`,className:t.cn(`placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,e),...n})]})}function u({className:e,...n}){return(0,a.jsx)(o.Command.List,{"data-slot":`command-list`,className:t.cn(`max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto`,e),...n})}function d({...e}){return(0,a.jsx)(o.Command.Empty,{"data-slot":`command-empty`,className:`py-6 text-center text-sm`,...e})}function f({className:e,...n}){return(0,a.jsx)(o.Command.Group,{"data-slot":`command-group`,className:t.cn(`text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium`,e),...n})}function p({className:e,...n}){return(0,a.jsx)(o.Command.Separator,{"data-slot":`command-separator`,className:t.cn(`bg-border -mx-1 h-px`,e),...n})}function m({className:e,...n}){return(0,a.jsx)(o.Command.Item,{"data-slot":`command-item`,className:t.cn(`data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n})}function h({className:e,...n}){return(0,a.jsx)(`span`,{"data-slot":`command-shortcut`,className:t.cn(`text-muted-foreground ml-auto text-xs tracking-widest`,e),...n})}exports.Command=s,exports.CommandDialog=c,exports.CommandEmpty=d,exports.CommandGroup=f,exports.CommandInput=l,exports.CommandItem=m,exports.CommandList=u,exports.CommandSeparator=p,exports.CommandShortcut=h;