@vlrc-fe/components 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MultiSelect/type.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +64 -41
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +46 -80
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +22 -60
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +1147 -43
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +30 -64
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +31 -147
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +93 -19
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +80 -25
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +9 -50
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +30 -156
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +350 -14
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +11 -0
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +55 -60
- package/dist/index110.cjs +1 -0
- package/dist/index110.js +430 -0
- package/dist/index111.cjs +1 -0
- package/dist/index111.js +36 -0
- package/dist/index112.cjs +1 -0
- package/dist/index112.js +28 -0
- package/dist/index113.cjs +1 -0
- package/dist/index113.js +14 -0
- package/dist/index114.cjs +1 -0
- package/dist/index114.js +156 -0
- package/dist/index115.cjs +1 -0
- package/dist/index115.js +19 -0
- package/dist/index116.cjs +1 -0
- package/dist/index116.js +67 -0
- package/dist/index117.cjs +1 -0
- package/dist/index117.js +118 -0
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +36 -0
- package/dist/index119.cjs +1 -0
- package/dist/index119.js +13 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +44 -121
- package/dist/index120.cjs +1 -0
- package/dist/index120.js +31 -0
- package/dist/index121.cjs +1 -0
- package/dist/index121.js +37 -0
- package/dist/index122.cjs +1 -0
- package/dist/index122.js +123 -0
- package/dist/index123.cjs +1 -0
- package/dist/index123.js +44 -0
- package/dist/index124.cjs +1 -0
- package/dist/index124.js +43 -0
- package/dist/index125.cjs +1 -0
- package/dist/index125.js +14 -0
- package/dist/index126.cjs +1 -0
- package/dist/index126.js +64 -0
- package/dist/index127.cjs +1 -0
- package/dist/index127.js +23 -0
- package/dist/index128.cjs +1 -0
- package/dist/index128.js +34 -0
- package/dist/index129.cjs +1 -0
- package/dist/index129.js +27 -0
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +30 -12
- package/dist/index130.cjs +1 -0
- package/dist/index130.js +26 -0
- package/dist/index131.cjs +1 -0
- package/dist/index131.js +157 -0
- package/dist/index132.cjs +1 -0
- package/dist/index132.js +34 -0
- package/dist/index133.cjs +1 -0
- package/dist/index133.js +46 -0
- package/dist/index134.cjs +1 -0
- package/dist/index134.js +142 -0
- package/dist/index135.cjs +1 -0
- package/dist/index135.js +125 -0
- package/dist/index136.cjs +1 -0
- package/dist/index136.js +26 -0
- package/dist/index137.cjs +1 -0
- package/dist/index137.js +88 -0
- package/dist/index138.cjs +1 -0
- package/dist/index138.js +221 -0
- package/dist/index139.cjs +1 -0
- package/dist/index139.js +166 -0
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +8 -12
- package/dist/index140.cjs +1 -0
- package/dist/index140.js +126 -0
- package/dist/index141.cjs +1 -0
- package/dist/index141.js +15 -0
- package/dist/index142.cjs +1 -0
- package/dist/index142.js +9 -0
- package/dist/index143.cjs +1 -0
- package/dist/index143.js +17 -0
- package/dist/index144.cjs +1 -0
- package/dist/index144.js +22 -0
- package/dist/index145.cjs +1 -0
- package/dist/index145.js +18 -0
- package/dist/index146.cjs +1 -0
- package/dist/index146.js +6 -0
- package/dist/index147.cjs +1 -0
- package/dist/index147.js +7 -0
- package/dist/index148.cjs +1 -0
- package/dist/index148.js +8 -0
- package/dist/index149.cjs +1 -0
- package/dist/index149.js +7 -0
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +12 -112
- package/dist/index150.cjs +1 -0
- package/dist/index150.js +7 -0
- package/dist/index151.cjs +1 -0
- package/dist/index151.js +9 -0
- package/dist/index152.cjs +1 -0
- package/dist/index152.js +69 -0
- package/dist/index153.cjs +1 -0
- package/dist/index153.js +11 -0
- package/dist/index154.cjs +1 -0
- package/dist/index154.js +202 -0
- package/dist/index155.cjs +1 -0
- package/dist/index155.js +124 -0
- package/dist/index156.cjs +1 -0
- package/dist/index156.js +32 -0
- package/dist/index157.cjs +1 -0
- package/dist/index157.js +20 -0
- package/dist/index158.cjs +1 -0
- package/dist/index158.js +69 -0
- package/dist/index159.cjs +1 -0
- package/dist/index159.js +32 -0
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +4 -726
- package/dist/index160.cjs +1 -0
- package/dist/index160.js +11 -0
- package/dist/index161.cjs +1 -0
- package/dist/index161.js +280 -0
- package/dist/index162.cjs +1 -0
- package/dist/index162.js +157 -0
- package/dist/index163.cjs +1 -0
- package/dist/index163.js +20 -0
- package/dist/index164.cjs +1 -0
- package/dist/index164.js +10 -0
- package/dist/index165.cjs +1 -0
- package/dist/index165.js +14 -0
- package/dist/index166.cjs +1 -0
- package/dist/index166.js +8 -0
- package/dist/index167.cjs +1 -0
- package/dist/index167.js +8 -0
- package/dist/index168.cjs +1 -0
- package/dist/index168.js +11 -0
- package/dist/index169.cjs +1 -0
- package/dist/index169.js +10 -0
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +79 -339
- package/dist/index170.cjs +1 -0
- package/dist/index170.js +6 -0
- package/dist/index171.cjs +1 -0
- package/dist/index171.js +8 -0
- package/dist/index172.cjs +1 -0
- package/dist/index172.js +8 -0
- package/dist/index173.cjs +1 -0
- package/dist/index173.js +10 -0
- package/dist/index174.cjs +1 -0
- package/dist/index174.js +11 -0
- package/dist/index175.cjs +1 -0
- package/dist/index175.js +15 -0
- package/dist/index176.cjs +1 -0
- package/dist/index176.js +11 -0
- package/dist/index177.cjs +1 -0
- package/dist/index177.js +11 -0
- package/dist/index178.cjs +1 -0
- package/dist/index178.js +6 -0
- package/dist/index179.cjs +1 -0
- package/dist/index179.js +43 -0
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +19 -66
- package/dist/index180.cjs +1 -0
- package/dist/index180.js +382 -0
- package/dist/index181.cjs +1 -0
- package/dist/index181.js +40 -0
- package/dist/index182.cjs +1 -0
- package/dist/index182.js +23 -0
- package/dist/index183.cjs +1 -0
- package/dist/index183.js +59 -0
- package/dist/index184.cjs +1 -0
- package/dist/index184.js +55 -0
- package/dist/index185.cjs +1 -0
- package/dist/index185.js +54 -0
- package/dist/index186.cjs +1 -0
- package/dist/index186.js +57 -0
- package/dist/index187.cjs +1 -0
- package/dist/index187.js +57 -0
- package/dist/index188.cjs +1 -0
- package/dist/index188.js +88 -0
- package/dist/index189.cjs +1 -0
- package/dist/index189.js +66 -0
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +18 -8
- package/dist/index190.cjs +1 -0
- package/dist/index190.js +594 -0
- package/dist/index191.cjs +9 -0
- package/dist/index191.js +30 -0
- package/dist/index192.cjs +1 -0
- package/dist/index192.js +50 -0
- package/dist/index193.cjs +1 -0
- package/dist/index193.js +65 -0
- package/dist/index194.cjs +1 -0
- package/dist/index194.js +48 -0
- package/dist/index195.cjs +1 -0
- package/dist/index195.js +67 -0
- package/dist/index196.cjs +1 -0
- package/dist/index196.js +151 -0
- package/dist/index197.cjs +1 -0
- package/dist/index197.js +23 -0
- package/dist/index198.cjs +1 -0
- package/dist/index198.js +27 -0
- package/dist/index199.cjs +1 -0
- package/dist/index199.js +53 -0
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +51 -98
- package/dist/index200.cjs +1 -0
- package/dist/index200.js +161 -0
- package/dist/index201.cjs +1 -0
- package/dist/index201.js +16 -0
- package/dist/index202.cjs +1 -0
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +81 -28
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +64 -14
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +25 -22
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +1014 -33
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +22 -96
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +108 -25
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +15 -9
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +20 -66
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +81 -11
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +91 -29
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +14 -41
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +93 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +22 -62
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +84 -22
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +85 -33
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +407 -25
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +170 -25
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +28 -154
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +158 -33
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +104 -45
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +337 -140
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +96 -124
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +319 -23
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +205 -81
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +33 -220
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +161 -163
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +20 -125
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +24 -14
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +167 -7
- package/dist/index5.js +26 -14
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +44 -15
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +15 -18
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +3 -17
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +5 -5
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +19 -4
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +24 -6
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +66 -4
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +14 -5
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +4 -8
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +50 -67
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +85 -46
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +6 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +25 -199
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +13 -122
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +9 -30
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +3 -20
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +24 -66
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +68 -30
- package/dist/index67.cjs +38 -1
- package/dist/index67.js +3 -11
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +12 -279
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +50 -155
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +29 -85
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +115 -19
- package/dist/index71.cjs +4 -1
- package/dist/index71.js +6 -9
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +12 -12
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +539 -6
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +197 -6
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +120 -9
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +912 -8
- package/dist/index77.cjs +3 -1
- package/dist/index77.js +76 -4
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +120 -6
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +12 -6
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +35 -62
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +14 -8
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +113 -9
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +725 -13
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +346 -9
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +74 -9
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +148 -4
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +31 -42
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +12 -380
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +345 -37
- package/dist/index89.cjs +20 -1
- package/dist/index89.js +40 -18
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +85 -17
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +113 -56
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +272 -51
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +129 -50
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +13 -54
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +28 -55
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +525 -80
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +75 -61
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +67 -583
- package/dist/index98.cjs +1 -9
- package/dist/index98.js +32 -27
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +17 -49
- package/dist/ui/alert-dialog.d.ts +15 -0
- package/dist/ui/alert-dialog.d.ts.map +1 -0
- package/dist/ui/alert.d.ts +10 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/aspect-ratio.d.ts +4 -0
- package/dist/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/ui/avatar.d.ts +7 -0
- package/dist/ui/avatar.d.ts.map +1 -0
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/breadcrumb.d.ts +12 -0
- package/dist/ui/breadcrumb.d.ts.map +1 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/carousel.d.ts +20 -0
- package/dist/ui/carousel.d.ts.map +1 -0
- package/dist/ui/collapsible.d.ts +6 -0
- package/dist/ui/collapsible.d.ts.map +1 -0
- package/dist/ui/context-menu.d.ts +26 -0
- package/dist/ui/context-menu.d.ts.map +1 -0
- package/dist/ui/drawer.d.ts +14 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/hover-card.d.ts +7 -0
- package/dist/ui/hover-card.d.ts.map +1 -0
- package/dist/ui/index.d.ts +23 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/input-otp.d.ts +12 -0
- package/dist/ui/input-otp.d.ts.map +1 -0
- package/dist/ui/menubar.d.ts +27 -0
- package/dist/ui/menubar.d.ts.map +1 -0
- package/dist/ui/navigation-menu.d.ts +15 -0
- package/dist/ui/navigation-menu.d.ts.map +1 -0
- package/dist/ui/pagination.d.ts +14 -0
- package/dist/ui/pagination.d.ts.map +1 -0
- package/dist/ui/resizable.d.ts +9 -0
- package/dist/ui/resizable.d.ts.map +1 -0
- package/dist/ui/sheet.d.ts +14 -0
- package/dist/ui/sheet.d.ts.map +1 -0
- package/dist/ui/sidebar.d.ts +70 -0
- package/dist/ui/sidebar.d.ts.map +1 -0
- package/dist/ui/skeleton.d.ts +3 -0
- package/dist/ui/skeleton.d.ts.map +1 -0
- package/dist/ui/slider.d.ts +5 -0
- package/dist/ui/slider.d.ts.map +1 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.d.ts.map +1 -0
- package/dist/ui/tabs.d.ts +8 -0
- package/dist/ui/tabs.d.ts.map +1 -0
- package/dist/ui/toggle-group.d.ts +8 -0
- package/dist/ui/toggle-group.d.ts.map +1 -0
- package/dist/ui/toggle.d.ts +10 -0
- package/dist/ui/toggle.d.ts.map +1 -0
- package/package.json +23 -5
package/dist/index192.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { cn as e } from "./index3.js";
|
|
2
|
+
//#region src/Form/FormNumberInput/useFormNumberInput.ts
|
|
3
|
+
var t = [
|
|
4
|
+
"[appearance:textfield]",
|
|
5
|
+
"[&::-webkit-outer-spin-button]:appearance-none",
|
|
6
|
+
"[&::-webkit-inner-spin-button]:appearance-none",
|
|
7
|
+
"rounded-r-none",
|
|
8
|
+
"relative"
|
|
9
|
+
];
|
|
10
|
+
function n({ rules: n, inputClassName: r, stepper: i, min: a, max: o, onChange: s, passthroughProps: c }) {
|
|
11
|
+
let l = n?.required !== void 0 && n.required !== !1;
|
|
12
|
+
return {
|
|
13
|
+
isRequired: l,
|
|
14
|
+
enhancedRules: (() => {
|
|
15
|
+
if (!n) return n;
|
|
16
|
+
let e = { ...n };
|
|
17
|
+
return l && typeof e.required != "string" && typeof e.required != "object" ? e.required = "Trường này là bắt buộc" : typeof e.required == "object" && !e.required.message && (e.required = {
|
|
18
|
+
...e.required,
|
|
19
|
+
message: "Trường này là bắt buộc"
|
|
20
|
+
}), e;
|
|
21
|
+
})(),
|
|
22
|
+
numericClass: e(t, r),
|
|
23
|
+
getHandlers: ({ currentValue: e, field: t }) => {
|
|
24
|
+
let n = () => {
|
|
25
|
+
let n = Math.min((e ?? 0) + i, o);
|
|
26
|
+
t.onChange(n), s?.(n);
|
|
27
|
+
}, r = () => {
|
|
28
|
+
let n = Math.max((e ?? 0) - i, a);
|
|
29
|
+
t.onChange(n), s?.(n);
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
handleIncrement: n,
|
|
33
|
+
handleDecrement: r,
|
|
34
|
+
handleKeyDown: (e) => {
|
|
35
|
+
e.key === "ArrowUp" ? (e.preventDefault(), n()) : e.key === "ArrowDown" && (e.preventDefault(), r()), c.onKeyDown && c.onKeyDown(e);
|
|
36
|
+
},
|
|
37
|
+
handleBlur: () => {
|
|
38
|
+
let n = e;
|
|
39
|
+
n !== void 0 && (n < a ? (t.onChange(a), s?.(a)) : n > o && (t.onChange(o), s?.(o))), t.onBlur(), c.onBlur && c.onBlur();
|
|
40
|
+
},
|
|
41
|
+
numericOnValueChange: (e) => {
|
|
42
|
+
let n = e.floatValue === void 0 ? void 0 : e.floatValue;
|
|
43
|
+
t.onChange(n), s?.(n);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { n as useFormNumberInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index4.cjs");var t=[`[appearance:textfield]`,`[&::-webkit-outer-spin-button]:appearance-none`,`[&::-webkit-inner-spin-button]:appearance-none`,`rounded-r-none`,`relative`];function n({rules:n,inputClassName:r,stepper:i,min:a,max:o,onChange:s,passthroughProps:c}){let l=n?.required!==void 0&&n.required!==!1;return{isRequired:l,enhancedRules:(()=>{if(!n)return n;let e={...n};return l&&typeof e.required!=`string`&&typeof e.required!=`object`?e.required=`Trường này là bắt buộc`:typeof e.required==`object`&&!e.required.message&&(e.required={...e.required,message:`Trường này là bắt buộc`}),e})(),numericClass:e.cn(t,r),getHandlers:({currentValue:e,field:t})=>{let n=()=>{let n=Math.min((e??0)+i,o);t.onChange(n),s?.(n)},r=()=>{let n=Math.max((e??0)-i,a);t.onChange(n),s?.(n)};return{handleIncrement:n,handleDecrement:r,handleKeyDown:e=>{e.key===`ArrowUp`?(e.preventDefault(),n()):e.key===`ArrowDown`&&(e.preventDefault(),r()),c.onKeyDown&&c.onKeyDown(e)},handleBlur:()=>{let n=e;n!==void 0&&(n<a?(t.onChange(a),s?.(a)):n>o&&(t.onChange(o),s?.(o))),t.onBlur(),c.onBlur&&c.onBlur()},numericOnValueChange:e=>{let n=e.floatValue===void 0?void 0:e.floatValue;t.onChange(n),s?.(n)}}}}}exports.useFormNumberInput=n;
|
package/dist/index193.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { cn as e } from "./index3.js";
|
|
2
|
+
import { FormBase as t } from "./index135.js";
|
|
3
|
+
import { NumericFormat as n } from "./index190.js";
|
|
4
|
+
import { StepperControls as r } from "./index191.js";
|
|
5
|
+
import { useFormNumberInput as i } from "./index192.js";
|
|
6
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
|
+
//#region src/Form/FormNumberInput/FormNumberInput.tsx
|
|
8
|
+
function s({ control: s, name: c, label: l, stepper: u = 1, min: d = "0", max: f = "100", minValue: p = -Infinity, maxValue: m = Infinity, thousandSeparator: h, placeholder: g, fixedDecimalScale: _ = !1, decimalScale: v = 0, suffix: y, prefix: b, inputClassName: x, onChange: S, rules: C, description: w, horizontal: T, controlFirst: E, ...D }) {
|
|
9
|
+
let { enhancedRules: O, numericClass: k, getHandlers: A } = i({
|
|
10
|
+
min: p,
|
|
11
|
+
max: m,
|
|
12
|
+
rules: C,
|
|
13
|
+
inputClassName: x,
|
|
14
|
+
stepper: u,
|
|
15
|
+
onChange: S,
|
|
16
|
+
passthroughProps: D
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ a(t, {
|
|
19
|
+
control: s,
|
|
20
|
+
name: c,
|
|
21
|
+
label: l,
|
|
22
|
+
description: w,
|
|
23
|
+
rules: O,
|
|
24
|
+
horizontal: T,
|
|
25
|
+
controlFirst: E,
|
|
26
|
+
children: ({ id: t, "aria-invalid": i, ...s }) => {
|
|
27
|
+
let c = s.value, { handleIncrement: l, handleDecrement: u, handleKeyDown: x, handleBlur: S, numericOnValueChange: C } = A({
|
|
28
|
+
currentValue: c,
|
|
29
|
+
field: s
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ o("div", {
|
|
32
|
+
className: "flex items-center",
|
|
33
|
+
children: [/* @__PURE__ */ a(n, {
|
|
34
|
+
min: d,
|
|
35
|
+
max: f,
|
|
36
|
+
"aria-invalid": i,
|
|
37
|
+
value: c ?? "",
|
|
38
|
+
onValueChange: C,
|
|
39
|
+
thousandSeparator: h,
|
|
40
|
+
decimalScale: v,
|
|
41
|
+
fixedDecimalScale: _,
|
|
42
|
+
allowNegative: p < 0,
|
|
43
|
+
valueIsNumericString: !1,
|
|
44
|
+
onBlur: S,
|
|
45
|
+
suffix: y,
|
|
46
|
+
prefix: b,
|
|
47
|
+
placeholder: g || "0",
|
|
48
|
+
getInputRef: s.ref,
|
|
49
|
+
onKeyDown: x,
|
|
50
|
+
name: s.name,
|
|
51
|
+
...D,
|
|
52
|
+
id: t,
|
|
53
|
+
className: e(k, D.className)
|
|
54
|
+
}), /* @__PURE__ */ a(r, {
|
|
55
|
+
onIncrement: l,
|
|
56
|
+
onDecrement: u,
|
|
57
|
+
disableIncrement: c !== void 0 && c >= m,
|
|
58
|
+
disableDecrement: c !== void 0 && c <= p
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { s as FormNumberInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index4.cjs"),t=require("./index136.cjs"),n=require("./index191.cjs"),r=require("./index192.cjs"),i=require("./index193.cjs");let a=require("react/jsx-runtime");function o({control:o,name:s,label:c,stepper:l=1,min:u=`0`,max:d=`100`,minValue:f=-1/0,maxValue:p=1/0,thousandSeparator:m,placeholder:h,fixedDecimalScale:g=!1,decimalScale:_=0,suffix:v,prefix:y,inputClassName:b,onChange:x,rules:S,description:C,horizontal:w,controlFirst:T,...E}){let{enhancedRules:D,numericClass:O,getHandlers:k}=i.useFormNumberInput({min:f,max:p,rules:S,inputClassName:b,stepper:l,onChange:x,passthroughProps:E});return(0,a.jsx)(t.FormBase,{control:o,name:s,label:c,description:C,rules:D,horizontal:w,controlFirst:T,children:({id:t,"aria-invalid":i,...o})=>{let s=o.value,{handleIncrement:c,handleDecrement:l,handleKeyDown:b,handleBlur:x,numericOnValueChange:S}=k({currentValue:s,field:o});return(0,a.jsxs)(`div`,{className:`flex items-center`,children:[(0,a.jsx)(n.NumericFormat,{min:u,max:d,"aria-invalid":i,value:s??``,onValueChange:S,thousandSeparator:m,decimalScale:_,fixedDecimalScale:g,allowNegative:f<0,valueIsNumericString:!1,onBlur:x,suffix:v,prefix:y,placeholder:h||`0`,getInputRef:o.ref,onKeyDown:b,name:o.name,...E,id:t,className:e.cn(O,E.className)}),(0,a.jsx)(r.StepperControls,{onIncrement:c,onDecrement:l,disableIncrement:s!==void 0&&s>=p,disableDecrement:s!==void 0&&s<=f})]})}})}exports.FormNumberInput=o;
|
package/dist/index194.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { get as e, isNil as t } from "lodash-es";
|
|
2
|
+
//#region src/Form/FormSelect/useFormSelect.ts
|
|
3
|
+
function n(e) {
|
|
4
|
+
return e.isMulti === !0;
|
|
5
|
+
}
|
|
6
|
+
function r(r) {
|
|
7
|
+
let { options: i, injectOptions: a, placeholder: o = "Chọn...", description: s, disabled: c, isClearable: l = !0, isSearchable: u = !0, isLoading: d = !1, className: f, rules: p, onSearchTextChange: m, hasNextPage: h, isFetchingNextPage: g, fetchNextPage: _, maxTagCount: v = "responsive", tagRender: y, showSelectAll: b = !1 } = r, x = e(p, "required"), S = !t(x) && x !== !1, C = {
|
|
8
|
+
options: i,
|
|
9
|
+
injectOptions: a,
|
|
10
|
+
placeholder: o,
|
|
11
|
+
isClearable: l,
|
|
12
|
+
isSearchable: u,
|
|
13
|
+
isLoading: d,
|
|
14
|
+
className: f,
|
|
15
|
+
disabled: c,
|
|
16
|
+
onSearchTextChange: m,
|
|
17
|
+
hasNextPage: h,
|
|
18
|
+
isFetchingNextPage: g,
|
|
19
|
+
fetchNextPage: _,
|
|
20
|
+
maxTagCount: v,
|
|
21
|
+
tagRender: y,
|
|
22
|
+
showSelectAll: b
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
isRequired: S,
|
|
26
|
+
description: s,
|
|
27
|
+
enhancedRules: (() => {
|
|
28
|
+
if (!p) return p;
|
|
29
|
+
let e = { ...p };
|
|
30
|
+
return S && typeof e.required != "string" && typeof e.required != "object" ? e.required = "Trường này là bắt buộc" : typeof e.required == "object" && !e.required.message && (e.required = {
|
|
31
|
+
...e.required,
|
|
32
|
+
message: "Trường này là bắt buộc"
|
|
33
|
+
}), e;
|
|
34
|
+
})(),
|
|
35
|
+
baseSelectProps: C,
|
|
36
|
+
isMulti: n(r),
|
|
37
|
+
createChangeHandlers: (e) => ({
|
|
38
|
+
onChangeMulti: (t) => {
|
|
39
|
+
e.onChange(t), n(r) && r.onChange && r.onChange(t);
|
|
40
|
+
},
|
|
41
|
+
onChangeSingle: (t) => {
|
|
42
|
+
e.onChange(t), !n(r) && r.onChange && r.onChange(t);
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { r as useFormSelect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("lodash-es");function t(e){return e.isMulti===!0}function n(n){let{options:r,injectOptions:i,placeholder:a=`Chọn...`,description:o,disabled:s,isClearable:c=!0,isSearchable:l=!0,isLoading:u=!1,className:d,rules:f,onSearchTextChange:p,hasNextPage:m,isFetchingNextPage:h,fetchNextPage:g,maxTagCount:_=`responsive`,tagRender:v,showSelectAll:y=!1}=n,b=(0,e.get)(f,`required`),x=!(0,e.isNil)(b)&&b!==!1,S={options:r,injectOptions:i,placeholder:a,isClearable:c,isSearchable:l,isLoading:u,className:d,disabled:s,onSearchTextChange:p,hasNextPage:m,isFetchingNextPage:h,fetchNextPage:g,maxTagCount:_,tagRender:v,showSelectAll:y};return{isRequired:x,description:o,enhancedRules:(()=>{if(!f)return f;let e={...f};return x&&typeof e.required!=`string`&&typeof e.required!=`object`?e.required=`Trường này là bắt buộc`:typeof e.required==`object`&&!e.required.message&&(e.required={...e.required,message:`Trường này là bắt buộc`}),e})(),baseSelectProps:S,isMulti:t(n),createChangeHandlers:e=>({onChangeMulti:r=>{e.onChange(r),t(n)&&n.onChange&&n.onChange(r)},onChangeSingle:r=>{e.onChange(r),!t(n)&&n.onChange&&n.onChange(r)}})}}exports.useFormSelect=n;
|
package/dist/index195.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Badge as e } from "./index19.js";
|
|
2
|
+
import { Tooltip as t, TooltipContent as n, TooltipProvider as r, TooltipTrigger as i } from "./index107.js";
|
|
3
|
+
import { Icons as a } from "./index134.js";
|
|
4
|
+
import { useEffect as o, useRef as s, useState as c } from "react";
|
|
5
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
6
|
+
//#region src/Select/MultiSelectTags.tsx
|
|
7
|
+
function d({ selectedOptions: d, maxTagCount: f = "responsive", onRemove: p, disabled: m, tagRender: h }) {
|
|
8
|
+
let g = s(null), [_, v] = c(d.length), [y, b] = c([]);
|
|
9
|
+
o(() => {
|
|
10
|
+
if (f === "responsive" && g.current) {
|
|
11
|
+
let e = g.current, t = e.offsetWidth - 60, n = 0, r = 0, i = Array.from(e.children);
|
|
12
|
+
for (let e = 0; e < i.length; e++) {
|
|
13
|
+
let a = i[e];
|
|
14
|
+
if (a.classList.contains("select-tag")) {
|
|
15
|
+
let e = a.offsetWidth + 4;
|
|
16
|
+
if (n + e <= t) n += e, r++;
|
|
17
|
+
else break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
r < d.length ? (v(Math.max(1, r - 1)), b(d.slice(Math.max(1, r - 1)))) : (v(d.length), b([]));
|
|
21
|
+
} else typeof f == "number" ? (v(Math.min(f, d.length)), b(d.slice(f))) : (v(d.length), b([]));
|
|
22
|
+
}, [d, f]);
|
|
23
|
+
let x = h || ((t, n) => /* @__PURE__ */ u(e, {
|
|
24
|
+
variant: "secondary",
|
|
25
|
+
className: "select-tag flex items-center gap-1 px-2 py-0.5 text-xs whitespace-nowrap",
|
|
26
|
+
children: [
|
|
27
|
+
t.icon && /* @__PURE__ */ l("span", {
|
|
28
|
+
className: "text-xs",
|
|
29
|
+
children: t.icon
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ l("span", {
|
|
32
|
+
className: "truncate max-w-[100px]",
|
|
33
|
+
children: t.label
|
|
34
|
+
}),
|
|
35
|
+
!m && /* @__PURE__ */ l(a.XIcon, {
|
|
36
|
+
className: "w-3 h-3 cursor-pointer hover:text-destructive",
|
|
37
|
+
onClick: (e) => {
|
|
38
|
+
e.stopPropagation(), n();
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}, t.value));
|
|
43
|
+
return /* @__PURE__ */ u("div", {
|
|
44
|
+
ref: g,
|
|
45
|
+
className: "flex items-center gap-1 flex-wrap flex-1 min-w-0",
|
|
46
|
+
children: [d.slice(0, _).map((e) => x(e, () => p(e.value))), y.length > 0 && /* @__PURE__ */ l(r, { children: /* @__PURE__ */ u(t, { children: [/* @__PURE__ */ l(i, {
|
|
47
|
+
asChild: !0,
|
|
48
|
+
children: /* @__PURE__ */ u(e, {
|
|
49
|
+
variant: "outline",
|
|
50
|
+
className: "cursor-help text-xs px-2 py-0.5",
|
|
51
|
+
children: ["+", y.length]
|
|
52
|
+
})
|
|
53
|
+
}), /* @__PURE__ */ l(n, {
|
|
54
|
+
side: "bottom",
|
|
55
|
+
className: "max-w-xs",
|
|
56
|
+
children: /* @__PURE__ */ l("div", {
|
|
57
|
+
className: "flex flex-col gap-1",
|
|
58
|
+
children: y.map((e) => /* @__PURE__ */ u("div", {
|
|
59
|
+
className: "flex items-center gap-2 text-xs",
|
|
60
|
+
children: [e.icon && /* @__PURE__ */ l("span", { children: e.icon }), /* @__PURE__ */ l("span", { children: e.label })]
|
|
61
|
+
}, e.value))
|
|
62
|
+
})
|
|
63
|
+
})] }) })]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { d as MultiSelectTags };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index20.cjs"),t=require("./index108.cjs"),n=require("./index135.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({selectedOptions:a,maxTagCount:o=`responsive`,onRemove:s,disabled:c,tagRender:l}){let u=(0,r.useRef)(null),[d,f]=(0,r.useState)(a.length),[p,m]=(0,r.useState)([]);(0,r.useEffect)(()=>{if(o===`responsive`&&u.current){let e=u.current,t=e.offsetWidth-60,n=0,r=0,i=Array.from(e.children);for(let e=0;e<i.length;e++){let a=i[e];if(a.classList.contains(`select-tag`)){let e=a.offsetWidth+4;if(n+e<=t)n+=e,r++;else break}}r<a.length?(f(Math.max(1,r-1)),m(a.slice(Math.max(1,r-1)))):(f(a.length),m([]))}else typeof o==`number`?(f(Math.min(o,a.length)),m(a.slice(o))):(f(a.length),m([]))},[a,o]);let h=l||((t,r)=>(0,i.jsxs)(e.Badge,{variant:`secondary`,className:`select-tag flex items-center gap-1 px-2 py-0.5 text-xs whitespace-nowrap`,children:[t.icon&&(0,i.jsx)(`span`,{className:`text-xs`,children:t.icon}),(0,i.jsx)(`span`,{className:`truncate max-w-[100px]`,children:t.label}),!c&&(0,i.jsx)(n.Icons.XIcon,{className:`w-3 h-3 cursor-pointer hover:text-destructive`,onClick:e=>{e.stopPropagation(),r()}})]},t.value));return(0,i.jsxs)(`div`,{ref:u,className:`flex items-center gap-1 flex-wrap flex-1 min-w-0`,children:[a.slice(0,d).map(e=>h(e,()=>s(e.value))),p.length>0&&(0,i.jsx)(t.TooltipProvider,{children:(0,i.jsxs)(t.Tooltip,{children:[(0,i.jsx)(t.TooltipTrigger,{asChild:!0,children:(0,i.jsxs)(e.Badge,{variant:`outline`,className:`cursor-help text-xs px-2 py-0.5`,children:[`+`,p.length]})}),(0,i.jsx)(t.TooltipContent,{side:`bottom`,className:`max-w-xs`,children:(0,i.jsx)(`div`,{className:`flex flex-col gap-1`,children:p.map(e=>(0,i.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[e.icon&&(0,i.jsx)(`span`,{children:e.icon}),(0,i.jsx)(`span`,{children:e.label})]},e.value))})})]})})]})}exports.MultiSelectTags=a;
|
package/dist/index196.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Popover as e, PopoverContent as t, PopoverTrigger as n } from "./index98.js";
|
|
2
|
+
import { Icons as r } from "./index134.js";
|
|
3
|
+
import { MultiSelectTags as i } from "./index195.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("./index99.cjs"),n=require("./index135.cjs"),r=require("./index196.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;
|
package/dist/index197.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormBase as e } from "./index135.js";
|
|
2
|
+
import { useFormSelect as t } from "./index194.js";
|
|
3
|
+
import { BaseSelect as n } from "./index196.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("./index136.cjs"),n=require("./index195.cjs"),r=require("./index197.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;
|
package/dist/index198.js
ADDED
|
@@ -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;
|
package/dist/index199.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Label as e } from "./index79.js";
|
|
2
|
+
import { FormControl as t, FormField as n, FormItem as r, FormLabel as i, FormMessage as a } from "./index84.js";
|
|
3
|
+
import { RadioGroup as o, RadioGroupItem as s } from "./index100.js";
|
|
4
|
+
import { useFormRadio as c } from "./index198.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 };
|
package/dist/index20.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index2.cjs"),t=require("./index4.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime")
|
|
1
|
+
const e=require("./index2.cjs"),t=require("./index4.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime"),i=require("class-variance-authority"),a=require("@radix-ui/react-slot");var o=(0,i.cva)(`inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60`,outline:`text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function s({className:e,variant:n,asChild:i=!1,...s}){return(0,r.jsx)(i?a.Slot:`span`,{"data-slot":`badge`,className:t.cn(o({variant:n}),e),...s})}exports.Badge=s,exports.badgeVariants=o;
|