@vlrc-fe/components 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/DataTable/DataTable.d.ts.map +1 -1
- package/dist/DataTable/components/DataTableTable.d.ts.map +1 -1
- package/dist/Form/Form.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/FormDatePicker.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/RangeDatePicker.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/SingleDatePicker.d.ts +4 -3
- package/dist/Form/FormDatePicker/SingleDatePicker.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/TimeInput.d.ts +3 -4
- package/dist/Form/FormDatePicker/TimeInput.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/TimePicker.d.ts +3 -3
- package/dist/Form/FormDatePicker/TimePicker.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/types.d.ts +1 -0
- package/dist/Form/FormDatePicker/types.d.ts.map +1 -1
- package/dist/Form/FormDatePicker/useFormDatePicker.d.ts +2 -2
- package/dist/Form/FormDatePicker/useFormDatePicker.d.ts.map +1 -1
- package/dist/Form/FormNumberInput/FormNumberInput.d.ts.map +1 -1
- package/dist/Form/FormNumberInput/StepperControls.d.ts.map +1 -1
- package/dist/Form/FormNumberInput/useFormNumberInput.d.ts.map +1 -1
- package/dist/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/MultiSelect/renderers.d.ts +2 -2
- package/dist/MultiSelect/renderers.d.ts.map +1 -1
- package/dist/assets/stylex.css +450 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -25
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +120 -91
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +32 -15
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +245 -132
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +319 -138
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +230 -95
- package/dist/index119.cjs +1 -1
- package/dist/index119.js +62 -35
- package/dist/index120.cjs +1 -1
- package/dist/index120.js +71 -32
- package/dist/index121.cjs +1 -1
- package/dist/index121.js +201 -79
- package/dist/index125.cjs +1 -1
- package/dist/index125.js +661 -288
- package/dist/index129.cjs +1 -1
- package/dist/index129.js +6 -5
- package/dist/index144.cjs +1 -1
- package/dist/index144.js +33 -22
- package/dist/index148.cjs +1 -1
- package/dist/index148.js +95 -92
- package/dist/index151.cjs +1 -1
- package/dist/index151.js +56 -56
- package/dist/index152.cjs +1 -1
- package/dist/index152.js +87 -3
- package/dist/index153.cjs +1 -1
- package/dist/index153.js +321 -85
- package/dist/index154.cjs +1 -1
- package/dist/index154.js +160 -287
- package/dist/index155.cjs +1 -1
- package/dist/index155.js +198 -162
- package/dist/index156.cjs +1 -1
- package/dist/index156.js +24 -125
- package/dist/index157.cjs +1 -1
- package/dist/index157.js +8 -25
- package/dist/index158.cjs +1 -1
- package/dist/index158.js +13 -5
- package/dist/index159.cjs +1 -1
- package/dist/index159.js +18 -13
- package/dist/index160.cjs +1 -1
- package/dist/index160.js +12 -16
- package/dist/index161.cjs +1 -1
- package/dist/index161.js +5 -17
- package/dist/index162.cjs +1 -1
- package/dist/index162.js +6 -5
- package/dist/index163.cjs +1 -1
- package/dist/index163.js +6 -5
- package/dist/index164.cjs +1 -1
- package/dist/index164.js +5 -6
- package/dist/index165.cjs +1 -1
- package/dist/index165.js +5 -5
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +7 -5
- package/dist/index167.cjs +1 -1
- package/dist/index167.js +68 -8
- package/dist/index168.cjs +1 -1
- package/dist/index168.js +9 -67
- package/dist/index169.cjs +1 -1
- package/dist/index169.js +201 -10
- package/dist/index170.cjs +1 -1
- package/dist/index170.js +101 -179
- package/dist/index171.cjs +1 -1
- package/dist/index171.js +24 -116
- package/dist/index172.cjs +1 -1
- package/dist/index172.js +18 -30
- package/dist/index173.cjs +1 -1
- package/dist/index173.js +66 -17
- package/dist/index174.cjs +1 -1
- package/dist/index174.js +30 -67
- package/dist/index175.cjs +1 -1
- package/dist/index175.js +10 -31
- package/dist/index176.cjs +1 -1
- package/dist/index176.js +279 -10
- package/dist/index177.cjs +1 -1
- package/dist/index177.js +125 -248
- package/dist/index178.cjs +1 -1
- package/dist/index178.js +18 -155
- package/dist/index179.cjs +1 -1
- package/dist/index179.js +9 -19
- package/dist/index180.cjs +1 -1
- package/dist/index180.js +12 -8
- package/dist/index181.cjs +1 -1
- package/dist/index181.js +6 -12
- package/dist/index182.cjs +1 -1
- package/dist/index182.js +6 -6
- package/dist/index183.cjs +1 -1
- package/dist/index183.js +9 -6
- package/dist/index184.cjs +1 -1
- package/dist/index184.js +8 -9
- package/dist/index185.cjs +1 -1
- package/dist/index185.js +4 -8
- package/dist/index186.cjs +1 -1
- package/dist/index186.js +6 -4
- package/dist/index187.cjs +1 -1
- package/dist/index187.js +6 -6
- package/dist/index188.cjs +1 -1
- package/dist/index188.js +8 -6
- package/dist/index189.cjs +1 -1
- package/dist/index189.js +9 -8
- package/dist/index190.cjs +1 -1
- package/dist/index190.js +12 -8
- package/dist/index191.cjs +1 -1
- package/dist/index191.js +7 -11
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +7 -7
- package/dist/index193.cjs +1 -1
- package/dist/index193.js +4 -9
- package/dist/index194.cjs +1 -1
- package/dist/index194.js +42 -5
- package/dist/index195.cjs +1 -1
- package/dist/index195.js +375 -29
- package/dist/index196.cjs +1 -1
- package/dist/index196.js +35 -386
- package/dist/index197.cjs +1 -1
- package/dist/index197.js +22 -37
- package/dist/index198.cjs +1 -1
- package/dist/index198.js +56 -20
- package/dist/index199.cjs +1 -1
- package/dist/index199.js +36 -54
- package/dist/index200.cjs +1 -1
- package/dist/index200.js +102 -54
- package/dist/index201.cjs +1 -1
- package/dist/index201.js +76 -54
- package/dist/index202.cjs +1 -1
- package/dist/index202.js +68 -66
- package/dist/index203.cjs +1 -1
- package/dist/index203.js +147 -63
- package/dist/index204.cjs +1 -1
- package/dist/index204.js +69 -91
- package/dist/index205.cjs +9 -1
- package/dist/index205.js +585 -62
- package/dist/index206.cjs +1 -9
- package/dist/index206.js +65 -586
- package/dist/index207.cjs +1 -1
- package/dist/index207.js +42 -41
- package/dist/index208.cjs +1 -1
- package/dist/index208.js +64 -46
- package/dist/index209.cjs +1 -1
- package/dist/index209.js +48 -64
- package/dist/index210.cjs +1 -1
- package/dist/index210.js +75 -47
- package/dist/index211.cjs +1 -1
- package/dist/index211.js +173 -69
- package/dist/index212.cjs +1 -1
- package/dist/index212.js +24 -180
- package/dist/index213.cjs +1 -1
- package/dist/index213.js +25 -24
- package/dist/index214.cjs +1 -1
- package/dist/index214.js +61 -24
- package/dist/index215.cjs +1 -1
- package/dist/index215.js +408 -49
- package/dist/index216.cjs +1 -1
- package/dist/index216.js +25 -422
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +123 -65
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +175 -88
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +252 -124
- package/dist/ui/calendar.d.ts +5 -2
- package/dist/ui/calendar.d.ts.map +1 -1
- package/dist/ui/carousel.d.ts +19 -5
- package/dist/ui/carousel.d.ts.map +1 -1
- package/dist/ui/context-menu.d.ts +37 -12
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/form.d.ts +15 -4
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/hover-card.d.ts +5 -1
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/item.d.ts +43 -18
- package/dist/ui/item.d.ts.map +1 -1
- package/dist/ui/menubar.d.ts +45 -14
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/navigation-menu.d.ts +34 -10
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/resizable.d.ts +9 -3
- package/dist/ui/resizable.d.ts.map +1 -1
- package/dist/ui/scroll-area.d.ts +9 -2
- package/dist/ui/scroll-area.d.ts.map +1 -1
- package/dist/ui/select.d.ts +19 -5
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/sidebar.d.ts +99 -37
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sonner.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index217.cjs +0 -1
- package/dist/index217.js +0 -25
package/dist/index203.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./
|
|
1
|
+
const e=require("./index2.cjs"),t=require("./index23.cjs"),n=require("./index25.cjs"),r=require("./index37.cjs"),i=require("./index115.cjs"),a=require("./index178.cjs"),o=require("./index199.cjs"),s=require("./index201.cjs"),c=require("./index202.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("@stylexjs/stylex");u=e.__toESM(u,1);let d=require("lucide-react"),f=require("react/jsx-runtime");var p={triggerButton:{kjj79g:`x1qughib`,k63SB2:`xo1l8bm`,$$css:!0},sizeSmall:{kZKoxP:`xettwda`,kGuDYH:`xboafo0`,$$css:!0},sizeMedium:{kZKoxP:`xwaiz5r`,kGuDYH:`xkpwil5`,$$css:!0},sizeLarge:{kZKoxP:`x1pizb70`,kGuDYH:`x1jchvi3`,$$css:!0},statusError:{kVAM5u:`x1uwefn5`,$$css:!0},statusWarning:{kVAM5u:`x6j094l`,$$css:!0},mutedText:{kMwMTN:`xw3nh4a`,$$css:!0},fullWidth:{kzqmXN:`xh8yej3`,$$css:!0},popoverContent:{kzqmXN:`x14atkfc`,kmVPX3:`x1717udv`,$$css:!0}};function m({value:e,onChange:u,placeholder:m=`Select Date`,dateFormat:h,pickerType:g=`date`,showTime:_,size:v=`large`,status:y,width:b=`auto`,disabled:x,allowClear:S,hideValue:C,suffixIcon:w,className:T,disabledDate:E,disabledTime:D,timeConfig:O}){let[k,A]=(0,l.useState)(!1),[j,M]=(0,l.useState)(e||new Date),N=o.formatDateValue(e,h),P=t=>{if(!t){u(void 0);return}let n=t;_&&e&&(n=new Date(t),n.setHours(e.getHours()),n.setMinutes(e.getMinutes()),n.setSeconds(e.getSeconds())),u(n),M(n),_||A(!1)},F=e=>{u(e)},I=e=>{e.stopPropagation(),u(void 0)},L=()=>w||(g===`time`?(0,f.jsx)(d.Clock,{className:`xcdlrvm x1l36t39 xbyyjgo`}):(0,f.jsx)(d.CalendarIcon,{className:`xcdlrvm x1l36t39 xbyyjgo`})),R=()=>g===`time`?(0,f.jsxs)(`div`,{className:`x7gbtqy`,children:[(0,f.jsx)(c.TimePicker,{value:e,onChange:F,timeConfig:O,disabledTime:z(e,D)}),(0,f.jsx)(`div`,{className:`x1mjqqkp x1b58sdr x178xt8z x13fuv20 xh5ekmr`,children:(0,f.jsx)(s.TimeInput,{value:e,onChange:F,timeConfig:O})})]}):(0,f.jsxs)(`div`,{className:`x78zum5`,children:[(0,f.jsx)(r.Calendar,{mode:`single`,selected:e,onSelect:P,disabled:E,captionLayout:`dropdown`,locale:a.default,month:j,hidden:{after:new Date(new Date().getFullYear()+50,11,31)},onMonthChange:M}),_&&(0,f.jsx)(`div`,{className:`x7gbtqy`,children:(0,f.jsx)(c.TimePicker,{value:e,onChange:F,timeConfig:O,disabledTime:z(e,D)})})]}),z=(e,t)=>{if(!t)return{};let n=typeof t==`function`&&e?t(e):typeof t==`function`?{}:t;return{disabledHours:()=>n.disabledHours?.()||[],disabledMinutes:e=>n.disabledMinutes?.(e)||[],disabledSeconds:(e,t)=>n.disabledSeconds?.(e,t)||[]}},B=v===`small`?p.sizeSmall:v===`medium`?p.sizeMedium:p.sizeLarge,V=y===`error`?p.statusError:y===`warning`?p.statusWarning:void 0;return(0,f.jsxs)(i.Popover,{open:k,onOpenChange:A,children:[(0,f.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,f.jsxs)(n.Button,{variant:`outline`,disabled:x,width:b,sx:[p.triggerButton,B,V,e?void 0:p.mutedText,b===`auto`?p.fullWidth:void 0],className:T,style:b===`auto`?void 0:{width:t.resolveWidth(b)},children:[!C&&N?N:(0,f.jsx)(`span`,{children:m}),(0,f.jsxs)(`div`,{className:`x8x9d4c x78zum5 x6s0dn4 xvh977a`,children:[S&&e&&(0,f.jsx)(`span`,{onClick:I,className:`x1ypdohk x1mqvv6a`,children:`×`}),L()]})]})}),(0,f.jsx)(i.PopoverContent,{sx:p.popoverContent,align:`start`,children:R()})]})}exports.SingleDatePicker=m,exports.default=m;
|
package/dist/index203.js
CHANGED
|
@@ -1,64 +1,148 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
1
|
+
import { resolveWidth as e } from "./index23.js";
|
|
2
|
+
import { Button as t } from "./index25.js";
|
|
3
|
+
import { Calendar as n } from "./index37.js";
|
|
4
|
+
import { Popover as r, PopoverContent as i, PopoverTrigger as a } from "./index115.js";
|
|
5
|
+
import o from "./index178.js";
|
|
6
|
+
import { formatDateValue as s } from "./index199.js";
|
|
7
|
+
import { TimeInput as c } from "./index201.js";
|
|
8
|
+
import { TimePicker as l } from "./index202.js";
|
|
9
|
+
import { useState as u } from "react";
|
|
10
|
+
import "@stylexjs/stylex";
|
|
11
|
+
import { CalendarIcon as d, Clock as f } from "lucide-react";
|
|
12
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
13
|
+
// src/Form/FormDatePicker/SingleDatePicker.tsx
|
|
14
|
+
var h = {
|
|
15
|
+
triggerButton: {
|
|
16
|
+
kjj79g: "x1qughib",
|
|
17
|
+
k63SB2: "xo1l8bm",
|
|
18
|
+
$$css: !0
|
|
19
|
+
},
|
|
20
|
+
sizeSmall: {
|
|
21
|
+
kZKoxP: "xettwda",
|
|
22
|
+
kGuDYH: "xboafo0",
|
|
23
|
+
$$css: !0
|
|
24
|
+
},
|
|
25
|
+
sizeMedium: {
|
|
26
|
+
kZKoxP: "xwaiz5r",
|
|
27
|
+
kGuDYH: "xkpwil5",
|
|
28
|
+
$$css: !0
|
|
29
|
+
},
|
|
30
|
+
sizeLarge: {
|
|
31
|
+
kZKoxP: "x1pizb70",
|
|
32
|
+
kGuDYH: "x1jchvi3",
|
|
33
|
+
$$css: !0
|
|
34
|
+
},
|
|
35
|
+
statusError: {
|
|
36
|
+
kVAM5u: "x1uwefn5",
|
|
37
|
+
$$css: !0
|
|
38
|
+
},
|
|
39
|
+
statusWarning: {
|
|
40
|
+
kVAM5u: "x6j094l",
|
|
41
|
+
$$css: !0
|
|
42
|
+
},
|
|
43
|
+
mutedText: {
|
|
44
|
+
kMwMTN: "xw3nh4a",
|
|
45
|
+
$$css: !0
|
|
46
|
+
},
|
|
47
|
+
fullWidth: {
|
|
48
|
+
kzqmXN: "xh8yej3",
|
|
49
|
+
$$css: !0
|
|
50
|
+
},
|
|
51
|
+
popoverContent: {
|
|
52
|
+
kzqmXN: "x14atkfc",
|
|
53
|
+
kmVPX3: "x1717udv",
|
|
54
|
+
$$css: !0
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function g({ value: g, onChange: _, placeholder: v = "Select Date", dateFormat: y, pickerType: b = "date", showTime: x, size: S = "large", status: C, width: w = "auto", disabled: T, allowClear: E, hideValue: D, suffixIcon: O, className: k, disabledDate: A, disabledTime: j, timeConfig: M }) {
|
|
58
|
+
let [N, P] = u(!1), [F, I] = u(g || /* @__PURE__ */ new Date()), L = s(g, y), R = (e) => {
|
|
59
|
+
if (!e) {
|
|
60
|
+
_(void 0);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
let t = e;
|
|
64
|
+
x && g && (t = new Date(e), t.setHours(g.getHours()), t.setMinutes(g.getMinutes()), t.setSeconds(g.getSeconds())), _(t), I(t), x || P(!1);
|
|
65
|
+
}, z = (e) => {
|
|
66
|
+
_(e);
|
|
67
|
+
}, B = (e) => {
|
|
68
|
+
e.stopPropagation(), _(void 0);
|
|
69
|
+
}, V = () => O || p(b === "time" ? f : d, { className: "xcdlrvm x1l36t39 xbyyjgo" }), H = () => b === "time" ? /* @__PURE__ */ m("div", {
|
|
70
|
+
className: "x7gbtqy",
|
|
71
|
+
children: [/* @__PURE__ */ p(l, {
|
|
72
|
+
value: g,
|
|
73
|
+
onChange: z,
|
|
74
|
+
timeConfig: M,
|
|
75
|
+
disabledTime: U(g, j)
|
|
76
|
+
}), /* @__PURE__ */ p("div", {
|
|
77
|
+
className: "x1mjqqkp x1b58sdr x178xt8z x13fuv20 xh5ekmr",
|
|
78
|
+
children: /* @__PURE__ */ p(c, {
|
|
79
|
+
value: g,
|
|
80
|
+
onChange: z,
|
|
81
|
+
timeConfig: M
|
|
82
|
+
})
|
|
83
|
+
})]
|
|
84
|
+
}) : /* @__PURE__ */ m("div", {
|
|
85
|
+
className: "x78zum5",
|
|
86
|
+
children: [/* @__PURE__ */ p(n, {
|
|
87
|
+
mode: "single",
|
|
88
|
+
selected: g,
|
|
89
|
+
onSelect: R,
|
|
90
|
+
disabled: A,
|
|
91
|
+
captionLayout: "dropdown",
|
|
92
|
+
locale: o,
|
|
93
|
+
month: F,
|
|
94
|
+
hidden: { after: new Date((/* @__PURE__ */ new Date()).getFullYear() + 50, 11, 31) },
|
|
95
|
+
onMonthChange: I
|
|
96
|
+
}), x && /* @__PURE__ */ p("div", {
|
|
97
|
+
className: "x7gbtqy",
|
|
98
|
+
children: /* @__PURE__ */ p(l, {
|
|
99
|
+
value: g,
|
|
100
|
+
onChange: z,
|
|
101
|
+
timeConfig: M,
|
|
102
|
+
disabledTime: U(g, j)
|
|
103
|
+
})
|
|
104
|
+
})]
|
|
105
|
+
}), U = (e, t) => {
|
|
106
|
+
if (!t) return {};
|
|
107
|
+
let n = typeof t == "function" && e ? t(e) : typeof t == "function" ? {} : t;
|
|
108
|
+
return {
|
|
109
|
+
disabledHours: () => n.disabledHours?.() || [],
|
|
110
|
+
disabledMinutes: (e) => n.disabledMinutes?.(e) || [],
|
|
111
|
+
disabledSeconds: (e, t) => n.disabledSeconds?.(e, t) || []
|
|
112
|
+
};
|
|
113
|
+
}, W = S === "small" ? h.sizeSmall : S === "medium" ? h.sizeMedium : h.sizeLarge, G = C === "error" ? h.statusError : C === "warning" ? h.statusWarning : void 0;
|
|
114
|
+
return /* @__PURE__ */ m(r, {
|
|
115
|
+
open: N,
|
|
116
|
+
onOpenChange: P,
|
|
117
|
+
children: [/* @__PURE__ */ p(a, {
|
|
118
|
+
asChild: !0,
|
|
119
|
+
children: /* @__PURE__ */ m(t, {
|
|
120
|
+
variant: "outline",
|
|
121
|
+
disabled: T,
|
|
122
|
+
width: w,
|
|
123
|
+
sx: [
|
|
124
|
+
h.triggerButton,
|
|
125
|
+
W,
|
|
126
|
+
G,
|
|
127
|
+
g ? void 0 : h.mutedText,
|
|
128
|
+
w === "auto" ? h.fullWidth : void 0
|
|
129
|
+
],
|
|
130
|
+
className: k,
|
|
131
|
+
style: w === "auto" ? void 0 : { width: e(w) },
|
|
132
|
+
children: [!D && L ? L : /* @__PURE__ */ p("span", { children: v }), /* @__PURE__ */ m("div", {
|
|
133
|
+
className: "x8x9d4c x78zum5 x6s0dn4 xvh977a",
|
|
134
|
+
children: [E && g && /* @__PURE__ */ p("span", {
|
|
135
|
+
onClick: B,
|
|
136
|
+
className: "x1ypdohk x1mqvv6a",
|
|
137
|
+
children: "×"
|
|
138
|
+
}), V()]
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
}), /* @__PURE__ */ p(i, {
|
|
142
|
+
sx: h.popoverContent,
|
|
143
|
+
align: "start",
|
|
144
|
+
children: H()
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
63
147
|
}
|
|
64
|
-
export {
|
|
148
|
+
export { g as SingleDatePicker, g as default };
|
package/dist/index204.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index2.cjs"),t=require("./
|
|
1
|
+
const e=require("./index2.cjs"),t=require("./index101.cjs"),n=require("./index199.cjs"),r=require("./index200.cjs"),i=require("./index203.cjs");let a=require("@stylexjs/stylex");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s={formItem:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,$$css:!0}};function c(e){let{control:a,name:c,label:l,placeholder:u,status:d,size:f=`large`,width:p=`auto`,pickerType:m=`date`,dateFormat:h,showTime:g,disabled:_=!1,hideValue:v=!1,allowClear:y=!1,isRangePicker:b=!1,onChangeDate:x,onChangeRange:S,rules:C={},hideErrorMessage:w=!1,suffixIcon:T,className:E,disabledDate:D,disabledTime:O}=e,{dateFormat:k,isRequired:A,processedRules:j,handleRangeChange:M,handleSingleChange:N}=n.useFormDatePicker({pickerType:m,showTime:g,dateFormat:h,rules:C,onChangeDate:x,onChangeRange:S}),P=e=>(0,o.jsx)(r.RangeDatePicker,{value:e.value||[void 0,void 0],onChange:t=>M(e,t),placeholder:u,dateFormat:k,showTime:g,size:f,status:d,width:p,disabled:_,allowClear:y,hideValue:v,suffixIcon:T,className:E,disabledDate:D}),F=e=>(0,o.jsx)(i.SingleDatePicker,{value:e.value,onChange:t=>N(e,t),placeholder:u,pickerType:m,dateFormat:k,showTime:g,size:f,status:d,width:p,disabled:_,allowClear:y,hideValue:v,suffixIcon:T,className:E,disabledDate:D,disabledTime:O});return(0,o.jsx)(t.FormField,{control:a,name:c,rules:j,render:({field:e})=>(0,o.jsxs)(t.FormItem,{sx:s.formItem,children:[l&&(0,o.jsxs)(t.FormLabel,{children:[l,A&&(0,o.jsx)(`span`,{className:`xuuroe4 x4aigyd`,children:`*`})]}),(0,o.jsx)(t.FormControl,{children:b?P(e):F(e)}),!w&&(0,o.jsx)(t.FormMessage,{})]})})}exports.default=c;
|
package/dist/index204.js
CHANGED
|
@@ -1,93 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
className: "
|
|
63
|
-
children:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}) : /* @__PURE__ */ y("div", {
|
|
70
|
-
className: "flex",
|
|
71
|
-
children: [/* @__PURE__ */ v(r, {
|
|
72
|
-
mode: "single",
|
|
73
|
-
selected: b,
|
|
74
|
-
onSelect: H,
|
|
75
|
-
disabled: P,
|
|
76
|
-
captionLayout: "dropdown",
|
|
77
|
-
locale: s,
|
|
78
|
-
month: R,
|
|
79
|
-
hidden: { after: new Date((/* @__PURE__ */ new Date()).getFullYear() + 50, 11, 31) },
|
|
80
|
-
onMonthChange: (e) => {
|
|
81
|
-
z(e), C === "month" && (x(e), L(!1));
|
|
82
|
-
}
|
|
83
|
-
}), T && /* @__PURE__ */ v(m, {
|
|
84
|
-
value: b,
|
|
85
|
-
onChange: U,
|
|
86
|
-
timeConfig: B,
|
|
87
|
-
disabledTime: c(b, F)
|
|
88
|
-
})]
|
|
89
|
-
})
|
|
90
|
-
})]
|
|
1
|
+
import { FormControl as e, FormField as t, FormItem as n, FormLabel as r, FormMessage as i } from "./index101.js";
|
|
2
|
+
import { useFormDatePicker as a } from "./index199.js";
|
|
3
|
+
import { RangeDatePicker as o } from "./index200.js";
|
|
4
|
+
import { SingleDatePicker as s } from "./index203.js";
|
|
5
|
+
import "@stylexjs/stylex";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
// src/Form/FormDatePicker/FormDatePicker.tsx
|
|
8
|
+
var u = { formItem: {
|
|
9
|
+
k1xSpc: "x78zum5",
|
|
10
|
+
kXwgrk: "xdt5ytf",
|
|
11
|
+
$$css: !0
|
|
12
|
+
} };
|
|
13
|
+
function d(d) {
|
|
14
|
+
let { control: f, name: p, label: m, placeholder: h, status: g, size: _ = "large", width: v = "auto", pickerType: y = "date", dateFormat: b, showTime: x, disabled: S = !1, hideValue: C = !1, allowClear: w = !1, isRangePicker: T = !1, onChangeDate: E, onChangeRange: D, rules: O = {}, hideErrorMessage: k = !1, suffixIcon: A, className: j, disabledDate: M, disabledTime: N } = d, { dateFormat: P, isRequired: F, processedRules: I, handleRangeChange: L, handleSingleChange: R } = a({
|
|
15
|
+
pickerType: y,
|
|
16
|
+
showTime: x,
|
|
17
|
+
dateFormat: b,
|
|
18
|
+
rules: O,
|
|
19
|
+
onChangeDate: E,
|
|
20
|
+
onChangeRange: D
|
|
21
|
+
}), z = (e) => /* @__PURE__ */ c(o, {
|
|
22
|
+
value: e.value || [void 0, void 0],
|
|
23
|
+
onChange: (t) => L(e, t),
|
|
24
|
+
placeholder: h,
|
|
25
|
+
dateFormat: P,
|
|
26
|
+
showTime: x,
|
|
27
|
+
size: _,
|
|
28
|
+
status: g,
|
|
29
|
+
width: v,
|
|
30
|
+
disabled: S,
|
|
31
|
+
allowClear: w,
|
|
32
|
+
hideValue: C,
|
|
33
|
+
suffixIcon: A,
|
|
34
|
+
className: j,
|
|
35
|
+
disabledDate: M
|
|
36
|
+
}), B = (e) => /* @__PURE__ */ c(s, {
|
|
37
|
+
value: e.value,
|
|
38
|
+
onChange: (t) => R(e, t),
|
|
39
|
+
placeholder: h,
|
|
40
|
+
pickerType: y,
|
|
41
|
+
dateFormat: P,
|
|
42
|
+
showTime: x,
|
|
43
|
+
size: _,
|
|
44
|
+
status: g,
|
|
45
|
+
width: v,
|
|
46
|
+
disabled: S,
|
|
47
|
+
allowClear: w,
|
|
48
|
+
hideValue: C,
|
|
49
|
+
suffixIcon: A,
|
|
50
|
+
className: j,
|
|
51
|
+
disabledDate: M,
|
|
52
|
+
disabledTime: N
|
|
53
|
+
});
|
|
54
|
+
return /* @__PURE__ */ c(t, {
|
|
55
|
+
control: f,
|
|
56
|
+
name: p,
|
|
57
|
+
rules: I,
|
|
58
|
+
render: ({ field: t }) => /* @__PURE__ */ l(n, {
|
|
59
|
+
sx: u.formItem,
|
|
60
|
+
children: [
|
|
61
|
+
m && /* @__PURE__ */ l(r, { children: [m, F && /* @__PURE__ */ c("span", {
|
|
62
|
+
className: "xuuroe4 x4aigyd",
|
|
63
|
+
children: "*"
|
|
64
|
+
})] }),
|
|
65
|
+
/* @__PURE__ */ c(e, { children: T ? z(t) : B(t) }),
|
|
66
|
+
!k && /* @__PURE__ */ c(i, {})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
91
69
|
});
|
|
92
70
|
}
|
|
93
|
-
export {
|
|
71
|
+
export { d as default };
|
package/dist/index205.cjs
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
const e=require("./index101.cjs"),t=require("./index200.cjs"),n=require("./index201.cjs"),r=require("./index204.cjs");let i=require("react/jsx-runtime");function a(a){let{control:o,name:s,label:c,placeholder:l,status:u,size:d=`large`,width:f=`auto`,pickerType:p=`date`,dateFormat:m,showTime:h,disabled:g=!1,hideValue:_=!1,allowClear:v=!1,isRangePicker:y=!1,onChangeDate:b,onChangeRange:x,rules:S={},hideErrorMessage:C=!1,suffixIcon:w,className:T,disabledDate:E,disabledTime:D}=a,{dateFormat:O,isRequired:k,processedRules:A,handleRangeChange:j,handleSingleChange:M}=t.useFormDatePicker({pickerType:p,showTime:h,dateFormat:m,rules:S,onChangeDate:b,onChangeRange:x}),N=e=>(0,i.jsx)(n.RangeDatePicker,{value:e.value||[void 0,void 0],onChange:t=>j(e,t),placeholder:l,dateFormat:O,showTime:h,size:d,status:u,width:f,disabled:g,allowClear:v,hideValue:_,suffixIcon:w,className:T,disabledDate:E}),P=e=>(0,i.jsx)(r.SingleDatePicker,{value:e.value,onChange:t=>M(e,t),placeholder:l,pickerType:p,dateFormat:O,showTime:h,size:d,status:u,width:f,disabled:g,allowClear:v,hideValue:_,suffixIcon:w,className:T,disabledDate:E,disabledTime:D});return(0,i.jsx)(e.FormField,{control:o,name:s,rules:A,render:({field:t})=>(0,i.jsxs)(e.FormItem,{className:`flex flex-col`,children:[c&&(0,i.jsxs)(e.FormLabel,{children:[c,k&&(0,i.jsx)(`span`,{className:`text-destructive ml-1`,children:`*`})]}),(0,i.jsx)(e.FormControl,{children:y?N(t):P(t)}),!C&&(0,i.jsx)(e.FormMessage,{})]})})}exports.default=a;
|
|
1
|
+
const e=require("./index2.cjs");let t=require("react");t=e.__toESM(t);function n(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}var r;(function(e){e.event=`event`,e.props=`prop`})(r||={});function i(){}function a(e){var t,n=void 0;return function(){for(var r=[],i=arguments.length;i--;)r[i]=arguments[i];return t&&r.length===t.length&&r.every(function(e,n){return e===t[n]})||(t=r,n=e.apply(void 0,r)),n}}function o(e){return!!(e||``).match(/\d/)}function s(e){return e==null}function c(e){return typeof e==`number`&&isNaN(e)}function l(e){return s(e)||c(e)||typeof e==`number`&&!isFinite(e)}function u(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,`\\$&`)}function d(e){switch(e){case`lakh`:return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case`wan`:return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}function f(e,t,n){var r=d(n),i=e.search(/[1-9]/);return i=i===-1?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(r,`$1`+t)}function p(e){var n=(0,t.useRef)(e);return n.current=e,(0,t.useRef)(function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return n.current.apply(n,e)}).current}function m(e,t){t===void 0&&(t=!0);var n=e[0]===`-`,r=n&&t;e=e.replace(`-`,``);var i=e.split(`.`);return{beforeDecimal:i[0],afterDecimal:i[1]||``,hasNegation:n,addNegation:r}}function h(e){if(!e)return e;var t=e[0]===`-`;t&&(e=e.substring(1,e.length));var n=e.split(`.`),r=n[0].replace(/^0+/,``)||`0`,i=n[1]||``;return(t?`-`:``)+r+(i?`.`+i:``)}function g(e,t,n){for(var r=``,i=n?`0`:``,a=0;a<=t-1;a++)r+=e[a]||i;return r}function _(e,t){return Array(t+1).join(e)}function v(e){var t=e+``,n=t[0]===`-`?`-`:``;n&&(t=t.substring(1));var r=t.split(/[eE]/g),i=r[0],a=r[1];if(a=Number(a),!a)return n+i;i=i.replace(`.`,``);var o=1+a,s=i.length;return o<0?i=`0.`+_(`0`,Math.abs(o))+i:o>=s?i+=_(`0`,o-s):i=(i.substring(0,o)||`0`)+`.`+i.substring(o),n+i}function y(e,t,n){if([``,`-`].indexOf(e)!==-1)return e;var r=(e.indexOf(`.`)!==-1||n)&&t,i=m(e),a=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,c=parseFloat(`0.`+(o||`0`)),l=(o.length<=t?`0.`+o:c.toFixed(t)).split(`.`),u=a;a&&Number(l[0])&&(u=a.split(``).reverse().reduce(function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e},l[0]));var d=g(l[1]||``,t,n),f=s?`-`:``,p=r?`.`:``;return``+f+u+p+d}function b(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move(`character`,t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var x=a(function(e,t){for(var n=0,r=0,i=e.length,a=t.length;e[n]===t[n]&&n<i;)n++;for(;e[i-1-r]===t[a-1-r]&&a-r>n&&i-r>n;)r++;return{from:{start:n,end:i-r},to:{start:n,end:a-r}}}),S=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function C(e,t,n){return Math.min(Math.max(e,t),n)}function w(e){return Math.max(e.selectionStart,e.selectionEnd)}function T(){return typeof navigator<`u`&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function E(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:``}}function D(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,i=e.formattedValueIndex;return t[r]===n[i]}function O(e,t,n,r,i,a,o){o===void 0&&(o=D);var s=i.findIndex(function(e){return e}),c=e.slice(0,s);!t&&!n.startsWith(c)&&(t=c,n=c+n,r+=c.length);for(var l=n.length,u=e.length,d={},f=Array(l),p=0;p<l;p++){f[p]=-1;for(var m=0,h=u;m<h;m++)if(o({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:p,formattedValueIndex:m})&&d[m]!==!0){f[p]=m,d[m]=!0;break}}for(var g=r;g<l&&(f[g]===-1||!a(n[g]));)g++;var _=g===l||f[g]===-1?u:f[g];for(g=r-1;g>0&&f[g]===-1;)g--;var v=g===-1||f[g]===-1?0:f[g]+1;return v>_?_:r-v<_-r?v:_}function k(e,t,n,r){var i=e.length;if(t=C(t,0,i),r===`left`){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=i&&!n[t];)t++;t>i&&(t=n.lastIndexOf(!0))}return t===-1&&(t=i),t}function A(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(o(e[n])||o(e[n-1]));return t}function j(e,n,a,o,c,u){u===void 0&&(u=i);var d=p(function(e,t){var n,r;return l(e)?(r=``,n=``):typeof e==`number`||t?(r=typeof e==`number`?v(e):e,n=o(r)):(r=c(e,void 0),n=o(r)),{formattedValue:n,numAsString:r}}),f=(0,t.useState)(function(){return d(s(e)?n:e,a)}),m=f[0],h=f[1],g=p(function(e,t){e.formattedValue!==m.formattedValue&&h({formattedValue:e.formattedValue,numAsString:e.value}),u(e,t)}),_=e,y=a;s(e)&&(_=m.numAsString,y=!0);var b=d(_,y);return(0,t.useMemo)(function(){h(b)},[b.formattedValue]),(0,t.useEffect)(function(){if(!s(n)&&s(e)&&m.formattedValue!==``){var t=parseFloat(m.numAsString);g({formattedValue:m.formattedValue,value:m.numAsString,floatValue:isNaN(t)?void 0:t},{event:void 0,source:r.props})}},[]),[m,g]}function M(e){return e.replace(/[^0-9]/g,``)}function N(e){return e}function P(e){var a=e.type;a===void 0&&(a=`text`);var s=e.displayType;s===void 0&&(s=`input`);var c=e.customInput,l=e.renderText,u=e.getInputRef,d=e.format;d===void 0&&(d=N);var f=e.removeFormatting;f===void 0&&(f=M);var p=e.defaultValue,m=e.valueIsNumericString,h=e.onValueChange,g=e.isAllowed,_=e.onChange;_===void 0&&(_=i);var v=e.onKeyDown;v===void 0&&(v=i);var y=e.onMouseUp;y===void 0&&(y=i);var C=e.onFocus;C===void 0&&(C=i);var E=e.onBlur;E===void 0&&(E=i);var D=e.value,P=e.getCaretBoundary;P===void 0&&(P=A);var F=e.isValidInputCharacter;F===void 0&&(F=o);var I=e.isCharacterSame,L=n(e,[`type`,`displayType`,`customInput`,`renderText`,`getInputRef`,`format`,`removeFormatting`,`defaultValue`,`valueIsNumericString`,`onValueChange`,`isAllowed`,`onChange`,`onKeyDown`,`onMouseUp`,`onFocus`,`onBlur`,`value`,`getCaretBoundary`,`isValidInputCharacter`,`isCharacterSame`]),R=j(D,p,!!m,d,f,h),z=R[0],B=z.formattedValue,V=z.numAsString,H=R[1],U=(0,t.useRef)(),W=(0,t.useRef)({formattedValue:B,numAsString:V}),G=function(e,t){W.current={formattedValue:e.formattedValue,numAsString:e.value},H(e,t)},K=(0,t.useState)(!1),ee=K[0],te=K[1],q=(0,t.useRef)(null),J=(0,t.useRef)({setCaretTimeout:null,focusTimeout:null});(0,t.useEffect)(function(){return te(!0),function(){clearTimeout(J.current.setCaretTimeout),clearTimeout(J.current.focusTimeout)}},[]);var ne=d,Y=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},X=function(e,t,n){(e.selectionStart!==0||e.selectionEnd!==e.value.length)&&(b(e,t),J.current.setCaretTimeout=setTimeout(function(){e.value===n&&e.selectionStart!==t&&b(e,t)},0))},Z=function(e,t,n){return k(e,t,P(e),n)},Q=function(e,t,n){var r=P(t),i=O(t,B,e,n,r,F,I);return i=k(t,i,r),i},re=function(e){var t=e.formattedValue;t===void 0&&(t=``);var n=e.input,r=e.source,i=e.event,a=e.numAsString,o;if(n){var s=e.inputValue||n.value,c=w(n);n.value=t,o=Q(s,t,c),o!==void 0&&X(n,o,t)}t!==B&&G(Y(t,a),{event:i,source:r})};(0,t.useEffect)(function(){var e=W.current,t=e.formattedValue,n=e.numAsString;(B!==t||V!==n)&&G(Y(B,V),{event:void 0,source:r.props})},[B,V]);var ie=q.current?w(q.current):void 0;(typeof window<`u`?t.useLayoutEffect:t.useEffect)(function(){var e=q.current;if(B!==W.current.formattedValue&&e){var t=Q(W.current.formattedValue,B,ie);e.value=B,X(e,t,B)}},[B]);var ae=function(e,t,n){var r=t.target,i=U.current?S(U.current,r.selectionEnd):x(B,e),a=Object.assign(Object.assign({},i),{lastValue:B}),o=f(e,a),s=ne(o);if(o=f(s,void 0),g&&!g(Y(s,o))){var c=t.target,l=Q(e,B,w(c));return c.value=B,X(c,l,B),!1}return re({formattedValue:s,numAsString:o,inputValue:e,event:t,source:n,input:t.target}),!0},$=function(e,t){t===void 0&&(t=0),U.current={selectionStart:e.selectionStart,selectionEnd:e.selectionEnd+t}},oe=function(e){var t=e.target.value;ae(t,e,r.event)&&_(e),U.current=void 0},se=function(e){var t=e.target,n=e.key,r=t.selectionStart,i=t.selectionEnd,a=t.value;a===void 0&&(a=``);var o;n===`ArrowLeft`||n===`Backspace`?o=Math.max(r-1,0):n===`ArrowRight`?o=Math.min(r+1,a.length):n===`Delete`&&(o=r);var s=0;n===`Delete`&&r===i&&(s=1);var c=n===`ArrowLeft`||n===`ArrowRight`;if(o===void 0||r!==i&&!c)v(e),$(t,s);else{var l=o;c?(l=Z(a,o,n===`ArrowLeft`?`left`:`right`),l!==o&&e.preventDefault()):n===`Delete`&&!F(a[o])?l=Z(a,o,`right`):n===`Backspace`&&!F(a[o])&&(l=Z(a,o,`left`)),l!==o&&X(t,l,a),v(e),$(t,s)}},ce=function(e){var t=e.target,n=function(){var e=t.selectionStart,n=t.selectionEnd,r=t.value;if(r===void 0&&(r=``),e===n){var i=Z(r,e);i!==e&&X(t,i,r)}};n(),requestAnimationFrame(function(){n()}),y(e),$(t)},le=function(e){e.persist&&e.persist();var t=e.target,n=e.currentTarget;q.current=t,J.current.focusTimeout=setTimeout(function(){var r=t.selectionStart,i=t.selectionEnd,a=t.value;a===void 0&&(a=``);var o=Z(a,r);o!==r&&(r!==0||i!==a.length)&&X(t,o,a),C(Object.assign(Object.assign({},e),{currentTarget:n}))},0)},ue=function(e){q.current=null,clearTimeout(J.current.focusTimeout),clearTimeout(J.current.setCaretTimeout),E(e)},de=ee&&T()?`numeric`:void 0,fe=Object.assign({inputMode:de},L,{type:a,value:B,onChange:oe,onKeyDown:se,onMouseUp:ce,onFocus:le,onBlur:ue});if(s===`text`)return l?t.default.createElement(t.default.Fragment,null,l(B,L)||null):t.default.createElement(`span`,Object.assign({},L,{ref:u}),B);if(c){var pe=c;return t.default.createElement(pe,Object.assign({},fe,{ref:u}))}return t.default.createElement(`input`,Object.assign({},fe,{ref:u}))}function F(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,i=t.prefix;i===void 0&&(i=``);var a=t.suffix;a===void 0&&(a=``);var o=t.allowNegative,s=t.thousandsGroupStyle;if(s===void 0&&(s=`thousand`),e===``||e===`-`)return e;var c=I(t),l=c.thousandSeparator,u=c.decimalSeparator,d=n!==0&&e.indexOf(`.`)!==-1||n&&r,p=m(e,o),h=p.beforeDecimal,_=p.afterDecimal,v=p.addNegation;return n!==void 0&&(_=g(_,n,!!r)),l&&(h=f(h,l,s)),i&&(h=i+h),a&&(_+=a),v&&(h=`-`+h),e=h+(d&&u||``)+_,e}function I(e){var t=e.decimalSeparator;t===void 0&&(t=`.`);var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=`,`),r||=[t,`.`],{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function L(e,t){e===void 0&&(e=``);var n=RegExp(`(-)`),r=RegExp(`(-)(.)*(-)`),i=n.test(e),a=r.test(e);return e=e.replace(/-/g,``),i&&!a&&t&&(e=`-`+e),e}function R(e,t){return RegExp(`(^-)|[0-9]|`+u(e),t?`g`:void 0)}function z(e,t,n){return e===``||!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e==`string`&&!isNaN(Number(e))}function B(e,t,n){var r;t===void 0&&(t=E(e));var i=n.allowNegative,a=n.prefix;a===void 0&&(a=``);var s=n.suffix;s===void 0&&(s=``);var c=n.decimalScale,l=t.from,d=t.to,f=d.start,p=d.end,h=I(n),g=h.allowedDecimalSeparators,_=h.decimalSeparator,v=e[p]===_;if(o(e)&&(e===a||e===s)&&t.lastValue===``)return e;if(p-f===1&&g.indexOf(e[f])!==-1){var y=c===0?``:_;e=e.substring(0,f)+y+e.substring(f+1,e.length)}var b=function(e,t,n){var r=!1,i=!1;a.startsWith(`-`)?r=!1:e.startsWith(`--`)?(r=!1,i=!0):s.startsWith(`-`)&&e.length===s.length?r=!1:e[0]===`-`&&(r=!0);var o=+!!r;return i&&(o=2),o&&(e=e.substring(o),t-=o,n-=o),{value:e,start:t,end:n,hasNegation:r}},x=b(e,f,p),S=x.hasNegation;r=x,e=r.value,f=r.start,p=r.end;var C=b(t.lastValue,l.start,l.end),w=C.start,T=C.end,D=C.value,O=e.substring(f,p);e.length&&D.length&&(w>D.length-s.length||T<a.length)&&!(O&&s.startsWith(O))&&(e=D);var k=0;e.startsWith(a)?k+=a.length:f<a.length&&(k=f),e=e.substring(k),p-=k;var A=e.length,j=e.length-s.length;e.endsWith(s)?A=j:(p>j||p>e.length-s.length)&&(A=p),e=e.substring(0,A),e=L(S?`-`+e:e,i),e=(e.match(R(_,!0))||[]).join(``);var M=e.indexOf(_);e=e.replace(new RegExp(u(_),`g`),function(e,t){return t===M?`.`:``});var N=m(e,i),P=N.beforeDecimal,F=N.afterDecimal,z=N.addNegation;return d.end-d.start<l.end-l.start&&P===``&&v&&!parseFloat(F)&&(e=z?`-`:``),e}function V(e,t){var n=t.prefix;n===void 0&&(n=``);var r=t.suffix;r===void 0&&(r=``);var i=Array.from({length:e.length+1}).map(function(){return!0}),a=e[0]===`-`;i.fill(!1,0,Math.min(n.length+ +!!a,e.length));var o=e.length;return i.fill(!1,o-r.length+1,o+1),i}function H(e){var t=I(e),n=t.thousandSeparator,r=t.decimalSeparator,i=e.prefix;i===void 0&&(i=``);var a=e.allowNegative;if(a===void 0&&(a=!0),n===r)throw Error(`
|
|
2
|
+
Decimal separator can't be same as thousand separator.
|
|
3
|
+
thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
|
|
4
|
+
decimalSeparator: `+r+` (default value for decimalSeparator is .)
|
|
5
|
+
`);return i.startsWith(`-`)&&a&&(console.error(`
|
|
6
|
+
Prefix can't start with '-' when allowNegative is true.
|
|
7
|
+
prefix: `+i+`
|
|
8
|
+
allowNegative: `+a+`
|
|
9
|
+
`),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function U(e){e=H(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,a=e.allowNegative,c=e.allowLeadingZeros,u=e.onKeyDown;u===void 0&&(u=i);var d=e.onBlur;d===void 0&&(d=i);var f=e.thousandSeparator,p=e.decimalScale,m=e.fixedDecimalScale,g=e.prefix;g===void 0&&(g=``);var _=e.defaultValue,S=e.value,C=e.valueIsNumericString,w=e.onValueChange,T=n(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),E=I(e),D=E.decimalSeparator,O=E.allowedDecimalSeparators,k=function(t){return F(t,e)},A=function(t,n){return B(t,n,e)},M=s(S)?_:S,N=C??z(M,g,t);s(S)?s(_)||(N||=typeof _==`number`):N||=typeof S==`number`;var P=function(e){return l(e)?e:(typeof e==`number`&&(e=v(e)),N&&typeof p==`number`?y(e,p,!!m):e)},L=j(P(S),P(_),!!N,k,A,w),R=L[0],U=R.numAsString,W=R.formattedValue,G=L[1];return Object.assign(Object.assign({},T),{value:W,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===D||o(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],s=r[a],c=x(n,t).to,l=function(e){return A(e).indexOf(`.`)+g.length};return S===0&&m&&p&&t[c.start]===D&&l(t)<i&&l(r)>a?!1:i>=c.start&&i<c.end&&O&&O.includes(o)&&s===D?!0:o===s},onValueChange:G,format:k,removeFormatting:A,getCaretBoundary:function(t){return V(t,e)},onKeyDown:function(e){var t=e.target,n=e.key,r=t.selectionStart,i=t.selectionEnd,o=t.value;if(o===void 0&&(o=``),(n===`Backspace`||n===`Delete`)&&i<g.length&&o!==`-`)e.preventDefault();else if(r!==i)u(e);else{n===`Backspace`&&o[0]===`-`&&r===g.length+1&&a&&b(t,1),p&&m&&(n===`Backspace`&&o[r-1]===D?(b(t,r-1),e.preventDefault()):n===`Delete`&&o[r]===D&&e.preventDefault()),O?.includes(n)&&o[r]===D&&b(t,r+1);var s=f===!0?`,`:f;n===`Backspace`&&o[r-1]===s&&b(t,r-1),n===`Delete`&&o[r]===s&&b(t,r+1),u(e)}},onBlur:function(t){var n=U;n.match(/\d/g)||(n=``),c||(n=h(n)),m&&p&&(n=y(n,p,m)),n!==U&&G({formattedValue:F(n,e),value:n,floatValue:parseFloat(n)},{event:t,source:r.event}),d(t)}})}function W(e){var n=U(e);return t.default.createElement(P,Object.assign({},n))}exports.NumberFormatBase=P,exports.NumericFormat=W,exports.getNumericCaretBoundary=V,exports.numericFormatter=F,exports.removeNumericFormat=B,exports.useNumericFormat=U;
|