@deepnoid/ui 0.1.115 → 0.1.116
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/.turbo/turbo-build.log +199 -194
- package/dist/chunk-2Q25LXZT.mjs +316 -0
- package/dist/{chunk-UNYKQTEP.mjs → chunk-3ZH6PWFC.mjs} +2 -2
- package/dist/chunk-4DESGO3D.mjs +54 -0
- package/dist/{chunk-BKYNB52Z.mjs → chunk-676Y7NKV.mjs} +1 -1
- package/dist/{chunk-AHBBUMPX.mjs → chunk-6VNOOJDQ.mjs} +2 -2
- package/dist/{chunk-NEBMBSKV.mjs → chunk-CUCLHYCE.mjs} +3 -3
- package/dist/{chunk-L3WKBOWY.mjs → chunk-ER3SUAE2.mjs} +1 -1
- package/dist/{chunk-AX3FVJMY.mjs → chunk-F7PC2JAF.mjs} +1 -1
- package/dist/{chunk-CEMBGO4V.mjs → chunk-HD2PTCE6.mjs} +2 -2
- package/dist/{chunk-FU4CDBVG.mjs → chunk-HLYTCS7L.mjs} +1 -1
- package/dist/{chunk-DDJ2EU3P.mjs → chunk-LCWEO4U6.mjs} +40 -14
- package/dist/{chunk-WKMBRUGX.mjs → chunk-LZRBMVT7.mjs} +1 -1
- package/dist/{chunk-MTQGHQ7Z.mjs → chunk-MG5E5YZ7.mjs} +1 -1
- package/dist/{chunk-BFZ6OTVA.mjs → chunk-PHWTRXOL.mjs} +2 -2
- package/dist/{chunk-5AEN7QTL.mjs → chunk-PMSUPDDW.mjs} +1 -1
- package/dist/{chunk-QREBEXKF.mjs → chunk-RSD67ORA.mjs} +1 -1
- package/dist/{chunk-TMHYS2DC.mjs → chunk-TO6OPRBH.mjs} +1 -1
- package/dist/{chunk-EDAREIAN.mjs → chunk-TRNL3IXF.mjs} +1 -1
- package/dist/{chunk-MLD6EZAE.mjs → chunk-UPPNTDNG.mjs} +1 -1
- package/dist/{chunk-7YCUFFKZ.mjs → chunk-VPGJ4HZ7.mjs} +1 -1
- package/dist/components/avatar/avatar.js +40 -14
- package/dist/components/avatar/avatar.mjs +2 -2
- package/dist/components/avatar/index.js +40 -14
- package/dist/components/avatar/index.mjs +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +40 -14
- package/dist/components/breadcrumb/breadcrumb.mjs +5 -5
- package/dist/components/breadcrumb/index.js +40 -14
- package/dist/components/breadcrumb/index.mjs +5 -5
- package/dist/components/button/button.js +40 -14
- package/dist/components/button/button.mjs +3 -3
- package/dist/components/button/icon-button.js +40 -14
- package/dist/components/button/icon-button.mjs +3 -3
- package/dist/components/button/index.js +40 -14
- package/dist/components/button/index.mjs +4 -4
- package/dist/components/chip/chip.js +40 -14
- package/dist/components/chip/chip.mjs +3 -3
- package/dist/components/chip/index.js +40 -14
- package/dist/components/chip/index.mjs +3 -3
- package/dist/components/fileUpload/fileUpload.js +40 -14
- package/dist/components/fileUpload/fileUpload.mjs +6 -6
- package/dist/components/fileUpload/index.js +40 -14
- package/dist/components/fileUpload/index.mjs +6 -6
- package/dist/components/icon/Icon.d.mts +8 -4
- package/dist/components/icon/Icon.d.ts +8 -4
- package/dist/components/icon/Icon.js +40 -14
- package/dist/components/icon/Icon.mjs +2 -2
- package/dist/components/icon/index.js +40 -14
- package/dist/components/icon/index.mjs +2 -2
- package/dist/components/icon/template.d.mts +2 -1
- package/dist/components/icon/template.d.ts +2 -1
- package/dist/components/icon/template.js +40 -14
- package/dist/components/icon/template.mjs +1 -1
- package/dist/components/input/index.js +40 -14
- package/dist/components/input/index.mjs +3 -3
- package/dist/components/input/input.js +40 -14
- package/dist/components/input/input.mjs +3 -3
- package/dist/components/list/index.js +40 -14
- package/dist/components/list/index.mjs +4 -4
- package/dist/components/list/listItem.js +40 -14
- package/dist/components/list/listItem.mjs +4 -4
- package/dist/components/modal/index.js +40 -14
- package/dist/components/modal/index.mjs +5 -5
- package/dist/components/modal/modal.js +40 -14
- package/dist/components/modal/modal.mjs +5 -5
- package/dist/components/pagination/index.js +40 -14
- package/dist/components/pagination/index.mjs +4 -4
- package/dist/components/pagination/pagination.js +40 -14
- package/dist/components/pagination/pagination.mjs +4 -4
- package/dist/components/picker/datePicker.d.mts +54 -171
- package/dist/components/picker/datePicker.d.ts +54 -171
- package/dist/components/picker/datePicker.js +1753 -399
- package/dist/components/picker/datePicker.mjs +14 -3
- package/dist/components/picker/day.d.mts +94 -0
- package/dist/components/picker/day.d.ts +94 -0
- package/dist/components/picker/day.js +414 -0
- package/dist/components/picker/day.mjs +12 -0
- package/dist/components/picker/index.d.mts +1 -0
- package/dist/components/picker/index.d.ts +1 -0
- package/dist/components/picker/index.js +2341 -983
- package/dist/components/picker/index.mjs +20 -6
- package/dist/components/picker/timePicker.js +40 -14
- package/dist/components/picker/timePicker.mjs +4 -4
- package/dist/components/select/index.js +40 -14
- package/dist/components/select/index.mjs +3 -3
- package/dist/components/select/select.js +40 -14
- package/dist/components/select/select.mjs +3 -3
- package/dist/components/table/index.js +40 -14
- package/dist/components/table/index.mjs +8 -8
- package/dist/components/table/table-body.js +40 -14
- package/dist/components/table/table-body.mjs +5 -5
- package/dist/components/table/table-head.js +40 -14
- package/dist/components/table/table-head.mjs +5 -5
- package/dist/components/table/table.js +40 -14
- package/dist/components/table/table.mjs +5 -5
- package/dist/components/toast/index.js +40 -14
- package/dist/components/toast/index.mjs +4 -4
- package/dist/components/toast/toast.js +40 -14
- package/dist/components/toast/toast.mjs +3 -3
- package/dist/components/toast/use-toast.js +40 -14
- package/dist/components/toast/use-toast.mjs +4 -4
- package/dist/components/tree/index.js +40 -14
- package/dist/components/tree/index.mjs +3 -3
- package/dist/components/tree/tree.js +40 -14
- package/dist/components/tree/tree.mjs +3 -3
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +412 -454
- package/dist/index.mjs +42 -38
- package/package.json +1 -1
- package/dist/chunk-2VQM2ZBF.mjs +0 -408
- /package/dist/{chunk-ZG4WRZOU.mjs → chunk-4VWG4726.mjs} +0 -0
|
@@ -106,7 +106,7 @@ __export(datePicker_exports, {
|
|
|
106
106
|
default: () => datePicker_default
|
|
107
107
|
});
|
|
108
108
|
module.exports = __toCommonJS(datePicker_exports);
|
|
109
|
-
var
|
|
109
|
+
var import_react7 = require("react");
|
|
110
110
|
var import_react_dom = require("react-dom");
|
|
111
111
|
|
|
112
112
|
// src/utils/tailwind-variants.ts
|
|
@@ -474,20 +474,6 @@ var template = {
|
|
|
474
474
|
}
|
|
475
475
|
);
|
|
476
476
|
},
|
|
477
|
-
right: ({ className }) => {
|
|
478
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
479
|
-
"svg",
|
|
480
|
-
{
|
|
481
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
482
|
-
width: "18",
|
|
483
|
-
height: "18",
|
|
484
|
-
viewBox: "0 0 18 18",
|
|
485
|
-
fill: "none",
|
|
486
|
-
className,
|
|
487
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.5 4L11.5 9L6.5 14", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
488
|
-
}
|
|
489
|
-
);
|
|
490
|
-
},
|
|
491
477
|
avatar: ({ className }) => {
|
|
492
478
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
493
479
|
"svg",
|
|
@@ -1669,6 +1655,46 @@ var template = {
|
|
|
1669
1655
|
}
|
|
1670
1656
|
);
|
|
1671
1657
|
},
|
|
1658
|
+
left: ({ className }) => {
|
|
1659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1660
|
+
"svg",
|
|
1661
|
+
{
|
|
1662
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1663
|
+
width: "22",
|
|
1664
|
+
height: "22",
|
|
1665
|
+
viewBox: "0 0 22 22",
|
|
1666
|
+
fill: "none",
|
|
1667
|
+
className,
|
|
1668
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1669
|
+
"path",
|
|
1670
|
+
{
|
|
1671
|
+
d: "M14.4955 7.21404C14.4957 7.26442 14.4957 7.26442 14.4959 7.31582C14.4962 7.40882 14.4962 7.50182 14.496 7.59482C14.496 7.69521 14.4962 7.79559 14.4965 7.89598C14.4969 8.09257 14.497 8.28915 14.4969 8.48574C14.4968 8.64555 14.4969 8.80536 14.497 8.96516C14.4971 8.98791 14.4971 9.01066 14.4971 9.0341C14.4971 9.08032 14.4972 9.12653 14.4972 9.17275C14.4976 9.60613 14.4975 10.0395 14.4973 10.4729C14.4971 10.8692 14.4975 11.2656 14.4981 11.6619C14.4988 12.069 14.499 12.4761 14.4989 12.8832C14.4989 13.1117 14.4989 13.3402 14.4994 13.5687C14.4998 13.7633 14.4998 13.9578 14.4994 14.1524C14.4992 14.2516 14.4992 14.3508 14.4996 14.45C14.4999 14.5577 14.4997 14.6653 14.4993 14.7729C14.4995 14.8042 14.4997 14.8354 14.5 14.8676C14.4981 15.094 14.4635 15.2952 14.2769 15.4694C14.0633 15.6269 13.8501 15.6664 13.574 15.6667C13.3359 15.6312 13.1607 15.5177 12.9847 15.381C12.9446 15.3506 12.9044 15.3202 12.8642 15.2898C12.8338 15.2666 12.8338 15.2666 12.8028 15.2429C12.7059 15.1692 12.6076 15.0969 12.5094 15.0246C12.4807 15.0034 12.4807 15.0034 12.4515 14.9819C12.3238 14.8875 12.1955 14.7936 12.0669 14.7C11.8604 14.5497 11.6552 14.3982 11.4501 14.2465C11.3539 14.1754 11.2577 14.1043 11.1615 14.0332C11.1231 14.0048 11.0847 13.9765 11.0462 13.9481C11.0177 13.927 11.0177 13.927 10.9886 13.9055C10.1627 13.2955 9.33686 12.6854 8.51098 12.0753C8.49194 12.0613 8.47291 12.0472 8.45329 12.0328C8.41508 12.0045 8.37691 11.9762 8.33878 11.9479C8.23994 11.8746 8.14044 11.8021 8.03961 11.7309C7.56492 11.3929 7.56492 11.3929 7.50676 11.139C7.48169 10.8947 7.5218 10.7077 7.70431 10.5165C7.82684 10.4027 7.96443 10.3072 8.1052 10.2107C8.19396 10.1488 8.27857 10.0845 8.36282 10.0181C8.5044 9.90695 8.65122 9.80273 8.80011 9.69893C8.88704 9.63693 8.97086 9.57289 9.05425 9.50739C9.19583 9.3962 9.34265 9.29198 9.49154 9.18818C9.57847 9.12618 9.6623 9.06214 9.74569 8.99664C9.88726 8.88544 10.0341 8.78123 10.183 8.67742C10.2699 8.61542 10.3537 8.55139 10.4371 8.48589C10.5787 8.37469 10.7255 8.27048 10.8744 8.16667C10.9613 8.10467 11.0452 8.04064 11.1286 7.97514C11.2379 7.88937 11.3491 7.80701 11.464 7.72686C11.676 7.57888 11.881 7.42428 12.0868 7.26992C12.2036 7.18255 12.321 7.09588 12.4386 7.00934C12.5366 6.93723 12.6341 6.8648 12.7311 6.7917C13.3456 6.32986 13.3456 6.32986 13.7814 6.33404C13.9843 6.35117 14.1418 6.41415 14.2854 6.53943C14.4816 6.75169 14.4966 6.95069 14.4955 7.21404Z",
|
|
1672
|
+
fill: "currentColor"
|
|
1673
|
+
}
|
|
1674
|
+
)
|
|
1675
|
+
}
|
|
1676
|
+
);
|
|
1677
|
+
},
|
|
1678
|
+
right: ({ className }) => {
|
|
1679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1680
|
+
"svg",
|
|
1681
|
+
{
|
|
1682
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1683
|
+
width: "22",
|
|
1684
|
+
height: "22",
|
|
1685
|
+
viewBox: "0 0 22 22",
|
|
1686
|
+
fill: "none",
|
|
1687
|
+
className,
|
|
1688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1689
|
+
"path",
|
|
1690
|
+
{
|
|
1691
|
+
d: "M7.50447 7.21404C7.50428 7.26442 7.50428 7.26442 7.50409 7.31582C7.50381 7.40882 7.50383 7.50182 7.50397 7.59482C7.50405 7.69521 7.50375 7.79559 7.5035 7.89598C7.50308 8.09257 7.50303 8.28915 7.5031 8.48574C7.50316 8.64555 7.5031 8.80536 7.50296 8.96516C7.50294 8.98791 7.50292 9.01066 7.5029 9.0341C7.50286 9.08032 7.50282 9.12653 7.50278 9.17275C7.50243 9.60613 7.5025 10.0395 7.5027 10.4729C7.50287 10.8692 7.5025 11.2656 7.50187 11.6619C7.50123 12.069 7.50096 12.4761 7.50109 12.8832C7.50115 13.1117 7.50107 13.3402 7.5006 13.5687C7.50021 13.7633 7.50016 13.9578 7.50056 14.1524C7.50076 14.2516 7.50079 14.3508 7.5004 14.45C7.50005 14.5577 7.50032 14.6653 7.50074 14.7729C7.50049 14.8042 7.50025 14.8354 7.5 14.8676C7.50185 15.094 7.53645 15.2952 7.72309 15.4694C7.93671 15.6269 8.14985 15.6664 8.42597 15.6667C8.66414 15.6312 8.8393 15.5177 9.01528 15.381C9.05544 15.3506 9.09561 15.3202 9.13579 15.2898C9.16617 15.2666 9.16617 15.2666 9.19716 15.2429C9.29408 15.1692 9.39237 15.0969 9.49064 15.0246C9.51926 15.0034 9.51926 15.0034 9.54847 14.9819C9.67623 14.8875 9.80451 14.7936 9.93307 14.7C10.1396 14.5497 10.3448 14.3982 10.5499 14.2465C10.6461 14.1754 10.7423 14.1043 10.8385 14.0332C10.8769 14.0048 10.9153 13.9765 10.9538 13.9481C10.9823 13.927 10.9823 13.927 11.0114 13.9055C11.8373 13.2955 12.6631 12.6854 13.489 12.0753C13.5081 12.0613 13.5271 12.0472 13.5467 12.0328C13.5849 12.0045 13.6231 11.9762 13.6612 11.9479C13.7601 11.8746 13.8596 11.8021 13.9604 11.7309C14.4351 11.3929 14.4351 11.3929 14.4932 11.139C14.5183 10.8947 14.4782 10.7077 14.2957 10.5165C14.1732 10.4027 14.0356 10.3072 13.8948 10.2107C13.806 10.1488 13.7214 10.0845 13.6372 10.0181C13.4956 9.90695 13.3488 9.80273 13.1999 9.69893C13.113 9.63693 13.0291 9.57289 12.9457 9.50739C12.8042 9.3962 12.6573 9.29198 12.5085 9.18818C12.4215 9.12618 12.3377 9.06214 12.2543 8.99664C12.1127 8.88544 11.9659 8.78123 11.817 8.67742C11.7301 8.61542 11.6463 8.55139 11.5629 8.48589C11.4213 8.37469 11.2745 8.27048 11.1256 8.16667C11.0387 8.10467 10.9548 8.04064 10.8714 7.97514C10.7621 7.88937 10.6509 7.80701 10.536 7.72686C10.324 7.57888 10.119 7.42428 9.9132 7.26992C9.79643 7.18255 9.67897 7.09588 9.56138 7.00934C9.46343 6.93723 9.36586 6.8648 9.26891 6.7917C8.65441 6.32986 8.65441 6.32986 8.21864 6.33404C8.01565 6.35117 7.85817 6.41415 7.7146 6.53943C7.51841 6.75169 7.50343 6.95069 7.50447 7.21404Z",
|
|
1692
|
+
fill: "currentColor"
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1695
|
+
}
|
|
1696
|
+
);
|
|
1697
|
+
},
|
|
1672
1698
|
// ----------------------------------- old ---------------------------------
|
|
1673
1699
|
// ** Status **
|
|
1674
1700
|
check: ({ className, fill }) => {
|
|
@@ -5011,46 +5037,6 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
|
|
|
5011
5037
|
};
|
|
5012
5038
|
var Icon_default = Icon;
|
|
5013
5039
|
|
|
5014
|
-
// src/utils/clsx.ts
|
|
5015
|
-
function clsx(...args) {
|
|
5016
|
-
var i = 0, tmp, x, str = "";
|
|
5017
|
-
while (i < args.length) {
|
|
5018
|
-
if (tmp = args[i++]) {
|
|
5019
|
-
if (x = toVal(tmp)) {
|
|
5020
|
-
str && (str += " ");
|
|
5021
|
-
str += x;
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
return str;
|
|
5026
|
-
}
|
|
5027
|
-
function toVal(mix) {
|
|
5028
|
-
var k, y, str = "";
|
|
5029
|
-
if (typeof mix === "string" || typeof mix === "number") {
|
|
5030
|
-
str += mix;
|
|
5031
|
-
} else if (typeof mix === "object") {
|
|
5032
|
-
if (Array.isArray(mix)) {
|
|
5033
|
-
var len = mix.length;
|
|
5034
|
-
for (k = 0; k < len; k++) {
|
|
5035
|
-
if (mix[k]) {
|
|
5036
|
-
if (y = toVal(mix[k])) {
|
|
5037
|
-
str && (str += " ");
|
|
5038
|
-
str += y;
|
|
5039
|
-
}
|
|
5040
|
-
}
|
|
5041
|
-
}
|
|
5042
|
-
} else {
|
|
5043
|
-
for (y in mix) {
|
|
5044
|
-
if (mix[y]) {
|
|
5045
|
-
str && (str += " ");
|
|
5046
|
-
str += y;
|
|
5047
|
-
}
|
|
5048
|
-
}
|
|
5049
|
-
}
|
|
5050
|
-
}
|
|
5051
|
-
return str;
|
|
5052
|
-
}
|
|
5053
|
-
|
|
5054
5040
|
// src/components/picker/utils.ts
|
|
5055
5041
|
var formatDateToString = (date) => {
|
|
5056
5042
|
const year = date.getFullYear();
|
|
@@ -5063,382 +5049,1750 @@ var formatStringToDate = (date) => {
|
|
|
5063
5049
|
return formattedDate;
|
|
5064
5050
|
};
|
|
5065
5051
|
|
|
5066
|
-
// src/components/
|
|
5052
|
+
// src/components/button/button.tsx
|
|
5053
|
+
var import_react2 = require("react");
|
|
5054
|
+
|
|
5055
|
+
// src/components/ripple/ripple.tsx
|
|
5056
|
+
var import_framer_motion = require("framer-motion");
|
|
5067
5057
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
5068
|
-
var
|
|
5069
|
-
const [
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5058
|
+
var Ripple = (props) => {
|
|
5059
|
+
const { ripples = [], motionProps, color = "currentColor", style, onClear } = props;
|
|
5060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: ripples.map((ripple) => {
|
|
5061
|
+
const duration = (0, import_framer_motion.clamp)(ripple.size > 100 ? 0.75 : 0.5, 0.01 * ripple.size, 0.2);
|
|
5062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion.LazyMotion, { features: import_framer_motion.domAnimation, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_framer_motion.AnimatePresence, { mode: "popLayout", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
5063
|
+
import_framer_motion.m.span,
|
|
5064
|
+
{
|
|
5065
|
+
animate: { transform: "scale(2)", opacity: 0 },
|
|
5066
|
+
className: "deepnoidui-ripple",
|
|
5067
|
+
exit: { opacity: 0 },
|
|
5068
|
+
initial: { transform: "scale(0)", opacity: 0.35 },
|
|
5069
|
+
style: {
|
|
5070
|
+
position: "absolute",
|
|
5071
|
+
backgroundColor: color,
|
|
5072
|
+
borderRadius: "100%",
|
|
5073
|
+
transformOrigin: "center",
|
|
5074
|
+
pointerEvents: "none",
|
|
5075
|
+
overflow: "hidden",
|
|
5076
|
+
inset: 0,
|
|
5077
|
+
zIndex: 0,
|
|
5078
|
+
top: ripple.y,
|
|
5079
|
+
left: ripple.x,
|
|
5080
|
+
width: `${ripple.size}px`,
|
|
5081
|
+
height: `${ripple.size}px`,
|
|
5082
|
+
...style
|
|
5083
|
+
},
|
|
5084
|
+
transition: { duration },
|
|
5085
|
+
onAnimationComplete: () => {
|
|
5086
|
+
onClear(ripple.key);
|
|
5087
|
+
},
|
|
5088
|
+
...motionProps
|
|
5089
|
+
}
|
|
5090
|
+
) }) }, ripple.key);
|
|
5091
|
+
}) });
|
|
5092
|
+
};
|
|
5093
|
+
Ripple.displayName = "HeroUI.Ripple";
|
|
5094
|
+
var ripple_default = Ripple;
|
|
5095
|
+
|
|
5096
|
+
// src/components/ripple/useRipple.ts
|
|
5097
|
+
var import_react = require("react");
|
|
5098
|
+
function useRipple(props = {}) {
|
|
5099
|
+
const [ripples, setRipples] = (0, import_react.useState)([]);
|
|
5100
|
+
const getUniqueID = (key) => `${key}-${Math.random().toString(36).substr(2, 9)}`;
|
|
5101
|
+
const onPress = (0, import_react.useCallback)((event) => {
|
|
5102
|
+
const trigger = event.currentTarget;
|
|
5103
|
+
const rect = trigger.getBoundingClientRect();
|
|
5104
|
+
const size = Math.max(trigger.clientWidth, trigger.clientHeight);
|
|
5105
|
+
setRipples((prevRipples) => [
|
|
5106
|
+
...prevRipples,
|
|
5107
|
+
{
|
|
5108
|
+
key: getUniqueID(prevRipples.length.toString()),
|
|
5109
|
+
size,
|
|
5110
|
+
x: event.clientX - rect.left - size / 2,
|
|
5111
|
+
y: event.clientY - rect.top - size / 2
|
|
5112
|
+
}
|
|
5113
|
+
]);
|
|
5112
5114
|
}, []);
|
|
5113
|
-
const
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
};
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
const year = currentDate.getFullYear();
|
|
5131
|
-
const month = currentDate.getMonth();
|
|
5132
|
-
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
5133
|
-
const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
|
|
5134
|
-
const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
|
|
5135
|
-
let dates = [];
|
|
5136
|
-
for (let i = firstDayOfMonth - 1; i >= 0; i--) {
|
|
5137
|
-
dates.push({
|
|
5138
|
-
date: lastDateOfPrevMonth - i,
|
|
5139
|
-
currentMonth: false
|
|
5140
|
-
});
|
|
5141
|
-
}
|
|
5142
|
-
for (let date = 1; date <= lastDateOfMonth; date++) {
|
|
5143
|
-
dates.push({
|
|
5144
|
-
date,
|
|
5145
|
-
currentMonth: true
|
|
5146
|
-
});
|
|
5147
|
-
}
|
|
5148
|
-
const remainingDays = 42 - dates.length;
|
|
5149
|
-
for (let i = 1; i <= remainingDays; i++) {
|
|
5150
|
-
dates.push({
|
|
5151
|
-
date: i,
|
|
5152
|
-
currentMonth: false
|
|
5153
|
-
});
|
|
5154
|
-
}
|
|
5155
|
-
const weeks = [];
|
|
5156
|
-
for (let i = 0; i < dates.length; i += 7) {
|
|
5157
|
-
weeks.push(dates.slice(i, i + 7));
|
|
5158
|
-
}
|
|
5159
|
-
return weeks;
|
|
5160
|
-
}, [currentDate]);
|
|
5161
|
-
const handlePrevMonth = () => {
|
|
5162
|
-
setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1));
|
|
5163
|
-
};
|
|
5164
|
-
const handleNextMonth = () => {
|
|
5165
|
-
setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1));
|
|
5166
|
-
};
|
|
5167
|
-
const handleDateSelect = (date, isCurrentMonth) => {
|
|
5168
|
-
if (!isCurrentMonth) return;
|
|
5169
|
-
const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
|
|
5170
|
-
const formatted = formatDateToString(selected);
|
|
5171
|
-
setSelectedDate(formatted);
|
|
5172
|
-
onChange == null ? void 0 : onChange(formatted);
|
|
5173
|
-
setIsPanelOpen(false);
|
|
5174
|
-
};
|
|
5175
|
-
const handleClearDate = () => {
|
|
5176
|
-
setSelectedDate("");
|
|
5177
|
-
onChange == null ? void 0 : onChange("");
|
|
5178
|
-
};
|
|
5179
|
-
const slots = (0, import_react.useMemo)(() => datePickerStyle({ ...variantProps }), [variantProps]);
|
|
5180
|
-
const getDateTitleProps = (0, import_react.useCallback)(
|
|
5181
|
-
(index) => {
|
|
5182
|
-
return {
|
|
5183
|
-
className: clsx(
|
|
5184
|
-
"text-sm font-[500]",
|
|
5185
|
-
highlightWeekend && index === 6 && "text-[#1E7EEE]",
|
|
5186
|
-
highlightWeekend && index === 0 && "text-[#FF4684]"
|
|
5187
|
-
)
|
|
5188
|
-
};
|
|
5115
|
+
const onClear = (0, import_react.useCallback)((key) => {
|
|
5116
|
+
setRipples((prevState) => prevState.filter((ripple) => ripple.key !== key));
|
|
5117
|
+
}, []);
|
|
5118
|
+
return { ripples, onClear, onPress, ...props };
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
// src/components/button/button.tsx
|
|
5122
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
5123
|
+
var Button = (0, import_react2.forwardRef)((originalProps, ref) => {
|
|
5124
|
+
const [props, variantProps] = mapPropsVariants(originalProps, buttonStyle.variantKeys);
|
|
5125
|
+
const { classNames, startContent, endContent, disableRipple, asChild, children, ...buttonProps } = props;
|
|
5126
|
+
const slots = (0, import_react2.useMemo)(() => buttonStyle({ ...variantProps }), [variantProps]);
|
|
5127
|
+
const { onPress: onRipplePressHandler, onClear: onClearRipple, ripples } = useRipple();
|
|
5128
|
+
const handlePress = (0, import_react2.useCallback)(
|
|
5129
|
+
(e) => {
|
|
5130
|
+
if (disableRipple || originalProps.disabled) return;
|
|
5131
|
+
onRipplePressHandler(e);
|
|
5189
5132
|
},
|
|
5190
|
-
[
|
|
5133
|
+
[disableRipple, originalProps.disabled, ref, onRipplePressHandler]
|
|
5191
5134
|
);
|
|
5192
|
-
const
|
|
5193
|
-
(
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
const dayOfWeek = new Date(currentDate.getFullYear(), currentDate.getMonth(), dateObj.date).getDay();
|
|
5199
|
-
return {
|
|
5200
|
-
className: clsx(
|
|
5201
|
-
"flex justify-center items-center h-[25px] text-sm rounded-full cursor-pointer hover:bg-neutral-light",
|
|
5202
|
-
dateObj.currentMonth && isToday && "border border-foreground",
|
|
5203
|
-
dateObj.currentMonth && isSelected && "!text-white border-none",
|
|
5204
|
-
calendarColor === "primary" && dateObj.currentMonth && isSelected && "!border-primary-main bg-primary-main",
|
|
5205
|
-
calendarColor === "secondary" && dateObj.currentMonth && isSelected && "!border-secondary-main bg-secondary-main",
|
|
5206
|
-
highlightWeekend && dayOfWeek === 6 && "text-neutral-main",
|
|
5207
|
-
highlightWeekend && dayOfWeek === 6 && isToday && "!border-neutral-light",
|
|
5208
|
-
highlightWeekend && dayOfWeek === 0 && "text-danger-main",
|
|
5209
|
-
highlightWeekend && dayOfWeek === 0 && isToday && "!border-danger-light",
|
|
5210
|
-
!dateObj.currentMonth && "!text-neutral-main cursor-default hover:bg-transparent"
|
|
5211
|
-
),
|
|
5212
|
-
onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth)
|
|
5213
|
-
};
|
|
5135
|
+
const mouseDownHandler = (0, import_react2.useCallback)(
|
|
5136
|
+
(e) => {
|
|
5137
|
+
var _a;
|
|
5138
|
+
(_a = buttonProps.onMouseDown) == null ? void 0 : _a.call(buttonProps, e);
|
|
5139
|
+
if (disableRipple || originalProps.disabled) return;
|
|
5140
|
+
handlePress(e);
|
|
5214
5141
|
},
|
|
5215
|
-
[
|
|
5142
|
+
[buttonProps.onMouseDown, disableRipple, originalProps.disabled, ref, onRipplePressHandler]
|
|
5216
5143
|
);
|
|
5217
|
-
const
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5144
|
+
const getRippleProps = (0, import_react2.useCallback)(
|
|
5145
|
+
() => ({ ripples, onClear: onClearRipple }),
|
|
5146
|
+
[ripples, onClearRipple]
|
|
5147
|
+
);
|
|
5148
|
+
const getBaseProps = (0, import_react2.useCallback)(
|
|
5149
|
+
() => ({
|
|
5150
|
+
...buttonProps,
|
|
5151
|
+
onMouseDown: mouseDownHandler,
|
|
5152
|
+
ref,
|
|
5153
|
+
disabled: originalProps.disabled || originalProps.isLoading,
|
|
5154
|
+
"data-loading": originalProps.isLoading,
|
|
5155
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base })
|
|
5156
|
+
}),
|
|
5157
|
+
[buttonProps, ref, originalProps.disabled, originalProps.isLoading, slots, classNames == null ? void 0 : classNames.base]
|
|
5158
|
+
);
|
|
5159
|
+
const getContentProps = (0, import_react2.useCallback)(
|
|
5160
|
+
() => ({
|
|
5161
|
+
className: slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
5162
|
+
size: originalProps.size
|
|
5163
|
+
}),
|
|
5164
|
+
[slots, classNames, originalProps.size]
|
|
5165
|
+
);
|
|
5166
|
+
const renderContent = (content) => {
|
|
5167
|
+
if ((0, import_react2.isValidElement)(content)) {
|
|
5168
|
+
const _content = content;
|
|
5169
|
+
const existingProps = _content.props;
|
|
5170
|
+
const mergedProps = {
|
|
5171
|
+
...getContentProps(),
|
|
5172
|
+
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
5173
|
+
};
|
|
5174
|
+
return (0, import_react2.cloneElement)(content, mergedProps);
|
|
5175
|
+
} else {
|
|
5176
|
+
const contentProps = getContentProps();
|
|
5177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { ...contentProps, children: content });
|
|
5229
5178
|
}
|
|
5230
|
-
}
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
Icon_default,
|
|
5265
|
-
{
|
|
5266
|
-
name: "calendar",
|
|
5267
|
-
className: "cursor-pointer",
|
|
5268
|
-
fill: true,
|
|
5269
|
-
onClick: () => {
|
|
5270
|
-
calculatePosition();
|
|
5271
|
-
setIsPanelOpen((v) => !v);
|
|
5272
|
-
}
|
|
5273
|
-
}
|
|
5274
|
-
)
|
|
5275
|
-
] })
|
|
5276
|
-
] }),
|
|
5277
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
5278
|
-
] })
|
|
5279
|
-
] }),
|
|
5280
|
-
isPanelOpen && (0, import_react_dom.createPortal)(
|
|
5281
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
5282
|
-
"div",
|
|
5283
|
-
{
|
|
5284
|
-
ref: panelWrapperRef,
|
|
5285
|
-
className: slots.optionsWrapper({ class: classNames == null ? void 0 : classNames.optionsWrapper }),
|
|
5286
|
-
style: {
|
|
5287
|
-
position: "absolute",
|
|
5288
|
-
top: panelPos.top,
|
|
5289
|
-
left: panelPos.left,
|
|
5290
|
-
zIndex: 1e3
|
|
5291
|
-
},
|
|
5292
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
5293
|
-
children: [
|
|
5294
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "calendar-header mb-4 flex items-center justify-between", children: [
|
|
5295
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "brace-left", size: "md", className: "cursor-pointer", onClick: handlePrevMonth }),
|
|
5296
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-h6 font-semibold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
5297
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Icon_default, { name: "brace-right", size: "md", className: "cursor-pointer", onClick: handleNextMonth })
|
|
5298
|
-
] }),
|
|
5299
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "grid grid-cols-7 gap-2 text-center", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getDateTitleProps(index), children: day }, `${day}-${index}`)) }),
|
|
5300
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "mt-2 grid grid-cols-7 gap-[5px] text-center", children: calendarDates.map((week, weekIndex) => {
|
|
5301
|
-
const hasCurrentMonthDates = week.some((dateObj) => dateObj.currentMonth);
|
|
5302
|
-
if (!hasCurrentMonthDates) return null;
|
|
5303
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react.default.Fragment, { children: week.map((dateObj, index) => {
|
|
5304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { ...getDateProps(dateObj), children: dateObj.date }, index);
|
|
5305
|
-
}) }, weekIndex);
|
|
5306
|
-
}) })
|
|
5307
|
-
]
|
|
5308
|
-
}
|
|
5309
|
-
),
|
|
5310
|
-
document.body
|
|
5311
|
-
)
|
|
5312
|
-
] });
|
|
5179
|
+
};
|
|
5180
|
+
const buttonContent = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5181
|
+
startContent && renderContent(startContent),
|
|
5182
|
+
children,
|
|
5183
|
+
endContent && renderContent(endContent),
|
|
5184
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5185
|
+
] }) });
|
|
5186
|
+
if (asChild && (0, import_react2.isValidElement)(children)) {
|
|
5187
|
+
const childElement = children;
|
|
5188
|
+
const baseProps = getBaseProps();
|
|
5189
|
+
const mergedProps = {
|
|
5190
|
+
...childElement.props,
|
|
5191
|
+
...baseProps,
|
|
5192
|
+
className: `${baseProps.className || ""} ${childElement.props.className || ""}`.trim(),
|
|
5193
|
+
onClick: (e) => {
|
|
5194
|
+
var _a, _b, _c;
|
|
5195
|
+
(_b = (_a = childElement.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
5196
|
+
(_c = baseProps.onClick) == null ? void 0 : _c.call(baseProps, e);
|
|
5197
|
+
},
|
|
5198
|
+
onMouseDown: (e) => {
|
|
5199
|
+
var _a, _b, _c;
|
|
5200
|
+
(_b = (_a = childElement.props).onMouseDown) == null ? void 0 : _b.call(_a, e);
|
|
5201
|
+
(_c = baseProps.onMouseDown) == null ? void 0 : _c.call(baseProps, e);
|
|
5202
|
+
},
|
|
5203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: originalProps.isLoading ? renderContent(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon_default, { name: "loading", className: "animate-spin" })) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
5204
|
+
startContent && renderContent(startContent),
|
|
5205
|
+
childElement.props.children,
|
|
5206
|
+
endContent && renderContent(endContent),
|
|
5207
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ripple_default, { ...getRippleProps() })
|
|
5208
|
+
] }) })
|
|
5209
|
+
};
|
|
5210
|
+
return (0, import_react2.cloneElement)(childElement, mergedProps);
|
|
5211
|
+
}
|
|
5212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { ...getBaseProps(), children: buttonContent });
|
|
5313
5213
|
});
|
|
5314
|
-
|
|
5315
|
-
var
|
|
5316
|
-
var
|
|
5214
|
+
Button.displayName = "Button";
|
|
5215
|
+
var button_default = Button;
|
|
5216
|
+
var buttonStyle = tv({
|
|
5317
5217
|
slots: {
|
|
5318
|
-
base:
|
|
5319
|
-
|
|
5320
|
-
wrapper: ["flex", "flex-col"],
|
|
5321
|
-
inputWrapper: [
|
|
5322
|
-
"flex",
|
|
5323
|
-
"items-center",
|
|
5324
|
-
"justify-between",
|
|
5325
|
-
"border",
|
|
5326
|
-
"cursor-pointer",
|
|
5327
|
-
"text-neutral-main",
|
|
5328
|
-
"group-has-[p.error]/datepicker:border-danger-main",
|
|
5329
|
-
"group-has-[p.error]/datepicker:bg-danger-soft",
|
|
5330
|
-
"group-has-[p.error]/datepicker:text-danger-main",
|
|
5331
|
-
"group-has-[p.error]/datepicker:hover:bg-danger-soft"
|
|
5332
|
-
],
|
|
5333
|
-
input: [
|
|
5334
|
-
"bg-transparent",
|
|
5335
|
-
"w-full",
|
|
5336
|
-
"outline-none",
|
|
5337
|
-
"placeholder:text-neutral-main",
|
|
5338
|
-
"text-body-foreground",
|
|
5339
|
-
"group-has-[p.error]/datepicker:text-danger-main",
|
|
5340
|
-
"group-has-[p.error]/datepicker:placeholder:text-danger-main",
|
|
5341
|
-
"cursor-pointer"
|
|
5342
|
-
],
|
|
5343
|
-
icon: [
|
|
5344
|
-
"flex",
|
|
5345
|
-
"items-center",
|
|
5346
|
-
"select-none",
|
|
5347
|
-
"text-body-foreground",
|
|
5348
|
-
"group-has-[p.error]/datepicker:text-danger-main"
|
|
5349
|
-
],
|
|
5350
|
-
optionsWrapper: [
|
|
5351
|
-
"flex",
|
|
5352
|
-
"flex-col",
|
|
5353
|
-
"border",
|
|
5354
|
-
"rounded-md",
|
|
5355
|
-
"bg-body-background",
|
|
5356
|
-
"shadow-lg",
|
|
5357
|
-
"overflow-auto",
|
|
5358
|
-
"w-[240px]",
|
|
5359
|
-
"select-none",
|
|
5360
|
-
"p-[10px]"
|
|
5361
|
-
],
|
|
5362
|
-
errorMessage: ["text-danger-main", "text-sm"]
|
|
5218
|
+
base: "relative flex items-center justify-center whitespace-nowrap transition duration-200 select-none overflow-hidden box-border border border-transparent",
|
|
5219
|
+
content: ""
|
|
5363
5220
|
},
|
|
5364
5221
|
variants: {
|
|
5222
|
+
variant: {
|
|
5223
|
+
solid: "",
|
|
5224
|
+
soft: "",
|
|
5225
|
+
outline: "",
|
|
5226
|
+
ghost: ""
|
|
5227
|
+
},
|
|
5365
5228
|
color: {
|
|
5366
|
-
primary:
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5229
|
+
primary: "",
|
|
5230
|
+
secondary: "",
|
|
5231
|
+
neutral: "",
|
|
5232
|
+
info: "",
|
|
5233
|
+
success: "",
|
|
5234
|
+
warning: "",
|
|
5235
|
+
danger: ""
|
|
5372
5236
|
},
|
|
5373
5237
|
size: {
|
|
5374
5238
|
sm: {
|
|
5375
|
-
base: [
|
|
5376
|
-
label: ["text-sm"],
|
|
5377
|
-
wrapper: ["gap-[4px]"],
|
|
5378
|
-
inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
|
|
5379
|
-
input: ["text-sm"],
|
|
5380
|
-
icon: ["text-sm"],
|
|
5381
|
-
errorMessage: ["text-sm"]
|
|
5239
|
+
base: "h-[24px] px-[8px] py-[3px] text-sm font-[700] rounded-sm gap-sm"
|
|
5382
5240
|
},
|
|
5383
5241
|
md: {
|
|
5384
|
-
base: [
|
|
5385
|
-
label: ["text-md"],
|
|
5386
|
-
wrapper: ["gap-[6px]"],
|
|
5387
|
-
inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
|
|
5388
|
-
input: ["text-md"],
|
|
5389
|
-
icon: ["text-md"],
|
|
5390
|
-
errorMessage: ["text-sm"]
|
|
5242
|
+
base: "h-[32px] px-[12px] py-[5.5px] text-md font-[700] rounded-md gap-md"
|
|
5391
5243
|
},
|
|
5392
5244
|
lg: {
|
|
5393
|
-
base: [
|
|
5394
|
-
label: ["text-lg"],
|
|
5395
|
-
wrapper: ["gap-[8px]"],
|
|
5396
|
-
inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
|
|
5397
|
-
input: ["text-lg"],
|
|
5398
|
-
icon: ["text-lg"],
|
|
5399
|
-
errorMessage: ["text-md"]
|
|
5245
|
+
base: "h-[40px] px-[16px] py-[8px] text-lg font-[700] rounded-lg gap-lg"
|
|
5400
5246
|
},
|
|
5401
5247
|
xl: {
|
|
5402
|
-
base: [
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5248
|
+
base: "h-[50px] px-[20px] py-[11.5px] text-xl font-[700] rounded-xl gap-xl"
|
|
5249
|
+
}
|
|
5250
|
+
},
|
|
5251
|
+
radius: {
|
|
5252
|
+
default: {
|
|
5253
|
+
base: ""
|
|
5254
|
+
},
|
|
5255
|
+
full: {
|
|
5256
|
+
base: "rounded-full"
|
|
5257
|
+
},
|
|
5258
|
+
none: {
|
|
5259
|
+
base: "rounded-none"
|
|
5409
5260
|
}
|
|
5410
5261
|
},
|
|
5411
5262
|
full: {
|
|
5412
5263
|
true: {
|
|
5413
|
-
base:
|
|
5414
|
-
wrapper: ["w-full"],
|
|
5415
|
-
inputWrapper: ["w-full"]
|
|
5264
|
+
base: "w-full"
|
|
5416
5265
|
}
|
|
5417
5266
|
},
|
|
5267
|
+
isLoading: {
|
|
5268
|
+
true: {}
|
|
5269
|
+
},
|
|
5418
5270
|
disabled: {
|
|
5419
5271
|
true: {
|
|
5420
|
-
base:
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
"group-has-[p.error]/datepicker:bg-danger-soft",
|
|
5427
|
-
"group-has-[p.error]/datepicker:border-danger-light",
|
|
5428
|
-
"cursor-not-allowed"
|
|
5429
|
-
],
|
|
5430
|
-
input: [
|
|
5431
|
-
"text-neutral-light",
|
|
5432
|
-
"placeholder:text-neutral-light",
|
|
5433
|
-
"group-has-[p.error]/datepicker:text-danger-light",
|
|
5434
|
-
"group-has-[p.error]/datepicker:placeholder:text-danger-light",
|
|
5435
|
-
"cursor-not-allowed"
|
|
5436
|
-
],
|
|
5437
|
-
icon: ["text-neutral-light"],
|
|
5438
|
-
errorMessage: ["text-danger-light"]
|
|
5272
|
+
base: "!bg-neutral-soft !border-neutral-soft !text-neutral-light pointer-events-none"
|
|
5273
|
+
}
|
|
5274
|
+
},
|
|
5275
|
+
isInGroup: {
|
|
5276
|
+
true: {
|
|
5277
|
+
base: "[&:not(:first-child):not(:last-child)]:rounded-none first:rounded-r-none last:rounded-l-none [&:not(:first-child)]:border-l-0"
|
|
5439
5278
|
}
|
|
5440
5279
|
}
|
|
5441
5280
|
},
|
|
5281
|
+
defaultVariants: {
|
|
5282
|
+
size: "md",
|
|
5283
|
+
variant: "solid",
|
|
5284
|
+
color: "primary",
|
|
5285
|
+
full: false,
|
|
5286
|
+
disabled: false,
|
|
5287
|
+
isLoading: false,
|
|
5288
|
+
isInGroup: false
|
|
5289
|
+
},
|
|
5290
|
+
compoundVariants: [
|
|
5291
|
+
// solid & color
|
|
5292
|
+
{
|
|
5293
|
+
variant: "solid",
|
|
5294
|
+
color: "primary",
|
|
5295
|
+
class: {
|
|
5296
|
+
base: ["text-white", "bg-primary-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5297
|
+
}
|
|
5298
|
+
},
|
|
5299
|
+
{
|
|
5300
|
+
variant: "solid",
|
|
5301
|
+
color: "secondary",
|
|
5302
|
+
class: {
|
|
5303
|
+
base: ["text-white", "bg-secondary-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5304
|
+
}
|
|
5305
|
+
},
|
|
5306
|
+
{
|
|
5307
|
+
variant: "solid",
|
|
5308
|
+
color: "neutral",
|
|
5309
|
+
class: {
|
|
5310
|
+
base: ["text-white", "bg-neutral-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5311
|
+
}
|
|
5312
|
+
},
|
|
5313
|
+
{
|
|
5314
|
+
variant: "solid",
|
|
5315
|
+
color: "info",
|
|
5316
|
+
class: {
|
|
5317
|
+
base: ["text-white", "bg-info-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5318
|
+
}
|
|
5319
|
+
},
|
|
5320
|
+
{
|
|
5321
|
+
variant: "solid",
|
|
5322
|
+
color: "success",
|
|
5323
|
+
class: {
|
|
5324
|
+
base: ["text-white", "bg-success-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5325
|
+
}
|
|
5326
|
+
},
|
|
5327
|
+
{
|
|
5328
|
+
variant: "solid",
|
|
5329
|
+
color: "warning",
|
|
5330
|
+
class: {
|
|
5331
|
+
base: ["text-white", "bg-warning-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5332
|
+
}
|
|
5333
|
+
},
|
|
5334
|
+
{
|
|
5335
|
+
variant: "solid",
|
|
5336
|
+
color: "danger",
|
|
5337
|
+
class: {
|
|
5338
|
+
base: ["text-white", "bg-danger-main", "hover:bg-gradient-to-r", "hover:from-white/20", "hover:to-white/20"]
|
|
5339
|
+
}
|
|
5340
|
+
},
|
|
5341
|
+
// soft & color
|
|
5342
|
+
{
|
|
5343
|
+
variant: "soft",
|
|
5344
|
+
color: "primary",
|
|
5345
|
+
class: {
|
|
5346
|
+
base: ["text-primary-main", "bg-primary-soft", "border-primary-soft", "hover:border-primary-light"]
|
|
5347
|
+
}
|
|
5348
|
+
},
|
|
5349
|
+
{
|
|
5350
|
+
variant: "soft",
|
|
5351
|
+
color: "secondary",
|
|
5352
|
+
class: {
|
|
5353
|
+
base: ["text-secondary-main", "bg-secondary-soft", "border-secondary-soft", "hover:border-secondary-light"]
|
|
5354
|
+
}
|
|
5355
|
+
},
|
|
5356
|
+
{
|
|
5357
|
+
variant: "soft",
|
|
5358
|
+
color: "neutral",
|
|
5359
|
+
class: {
|
|
5360
|
+
base: ["text-neutral-main", "bg-neutral-soft", "border-neutral-soft", "hover:border-neutral-light"]
|
|
5361
|
+
}
|
|
5362
|
+
},
|
|
5363
|
+
{
|
|
5364
|
+
variant: "soft",
|
|
5365
|
+
color: "info",
|
|
5366
|
+
class: {
|
|
5367
|
+
base: ["text-info-main", "bg-info-soft", "border-info-soft", "hover:border-info-light"]
|
|
5368
|
+
}
|
|
5369
|
+
},
|
|
5370
|
+
{
|
|
5371
|
+
variant: "soft",
|
|
5372
|
+
color: "success",
|
|
5373
|
+
class: {
|
|
5374
|
+
base: ["text-success-main", "bg-success-soft", "border-success-soft", "hover:border-success-light"]
|
|
5375
|
+
}
|
|
5376
|
+
},
|
|
5377
|
+
{
|
|
5378
|
+
variant: "soft",
|
|
5379
|
+
color: "warning",
|
|
5380
|
+
class: {
|
|
5381
|
+
base: ["text-warning-main", "bg-warning-soft", "border-warning-soft", "hover:border-warning-light"]
|
|
5382
|
+
}
|
|
5383
|
+
},
|
|
5384
|
+
{
|
|
5385
|
+
variant: "soft",
|
|
5386
|
+
color: "danger",
|
|
5387
|
+
class: {
|
|
5388
|
+
base: ["text-danger-main", "bg-danger-soft", "border-danger-soft", "hover:border-danger-light"]
|
|
5389
|
+
}
|
|
5390
|
+
},
|
|
5391
|
+
// outline & color
|
|
5392
|
+
{
|
|
5393
|
+
variant: "outline",
|
|
5394
|
+
color: "primary",
|
|
5395
|
+
class: {
|
|
5396
|
+
base: ["bg-body-background", "border-primary-main", "text-primary-main", "hover:bg-primary-soft"]
|
|
5397
|
+
}
|
|
5398
|
+
},
|
|
5399
|
+
{
|
|
5400
|
+
variant: "outline",
|
|
5401
|
+
color: "secondary",
|
|
5402
|
+
class: {
|
|
5403
|
+
base: ["bg-body-background", "border-secondary-main", "text-secondary-main", "hover:bg-secondary-soft"]
|
|
5404
|
+
}
|
|
5405
|
+
},
|
|
5406
|
+
{
|
|
5407
|
+
variant: "outline",
|
|
5408
|
+
color: "neutral",
|
|
5409
|
+
class: {
|
|
5410
|
+
base: ["bg-body-background", "border-neutral-main", "text-neutral-main", "hover:bg-neutral-soft"]
|
|
5411
|
+
}
|
|
5412
|
+
},
|
|
5413
|
+
{
|
|
5414
|
+
variant: "outline",
|
|
5415
|
+
color: "info",
|
|
5416
|
+
class: {
|
|
5417
|
+
base: ["bg-body-background", "border-info-main", "text-info-main", "hover:bg-info-soft"]
|
|
5418
|
+
}
|
|
5419
|
+
},
|
|
5420
|
+
{
|
|
5421
|
+
variant: "outline",
|
|
5422
|
+
color: "success",
|
|
5423
|
+
class: {
|
|
5424
|
+
base: ["bg-body-background", "border-success-main", "text-success-main", "hover:bg-success-soft"]
|
|
5425
|
+
}
|
|
5426
|
+
},
|
|
5427
|
+
{
|
|
5428
|
+
variant: "outline",
|
|
5429
|
+
color: "warning",
|
|
5430
|
+
class: {
|
|
5431
|
+
base: ["bg-body-background", "border-warning-main", "text-warning-main", "hover:bg-warning-soft"]
|
|
5432
|
+
}
|
|
5433
|
+
},
|
|
5434
|
+
{
|
|
5435
|
+
variant: "outline",
|
|
5436
|
+
color: "danger",
|
|
5437
|
+
class: {
|
|
5438
|
+
base: ["bg-body-background", "border-danger-main", "text-danger-main", "hover:bg-danger-soft"]
|
|
5439
|
+
}
|
|
5440
|
+
},
|
|
5441
|
+
// ghost & color
|
|
5442
|
+
{
|
|
5443
|
+
variant: "ghost",
|
|
5444
|
+
color: "primary",
|
|
5445
|
+
class: {
|
|
5446
|
+
base: ["text-primary-main", "border-transparent", "hover:bg-primary-soft"]
|
|
5447
|
+
}
|
|
5448
|
+
},
|
|
5449
|
+
{
|
|
5450
|
+
variant: "ghost",
|
|
5451
|
+
color: "secondary",
|
|
5452
|
+
class: {
|
|
5453
|
+
base: ["text-secondary-main", "border-transparent", "hover:bg-secondary-soft"]
|
|
5454
|
+
}
|
|
5455
|
+
},
|
|
5456
|
+
{
|
|
5457
|
+
variant: "ghost",
|
|
5458
|
+
color: "neutral",
|
|
5459
|
+
class: {
|
|
5460
|
+
base: ["text-neutral-main", "border-transparent", "hover:bg-neutral-soft"]
|
|
5461
|
+
}
|
|
5462
|
+
},
|
|
5463
|
+
{
|
|
5464
|
+
variant: "ghost",
|
|
5465
|
+
color: "info",
|
|
5466
|
+
class: {
|
|
5467
|
+
base: ["text-info-main", "border-transparent", "hover:bg-info-soft"]
|
|
5468
|
+
}
|
|
5469
|
+
},
|
|
5470
|
+
{
|
|
5471
|
+
variant: "ghost",
|
|
5472
|
+
color: "success",
|
|
5473
|
+
class: {
|
|
5474
|
+
base: ["text-success-main", "border-transparent", "hover:bg-success-soft"]
|
|
5475
|
+
}
|
|
5476
|
+
},
|
|
5477
|
+
{
|
|
5478
|
+
variant: "ghost",
|
|
5479
|
+
color: "warning",
|
|
5480
|
+
class: {
|
|
5481
|
+
base: ["text-warning-main", "border-transparent", "hover:bg-warning-soft"]
|
|
5482
|
+
}
|
|
5483
|
+
},
|
|
5484
|
+
{
|
|
5485
|
+
variant: "ghost",
|
|
5486
|
+
color: "danger",
|
|
5487
|
+
class: {
|
|
5488
|
+
base: ["text-danger-main", "border-transparent", "hover:bg-danger-soft"]
|
|
5489
|
+
}
|
|
5490
|
+
},
|
|
5491
|
+
// variant && size
|
|
5492
|
+
{
|
|
5493
|
+
variant: ["soft", "outline"],
|
|
5494
|
+
size: "sm",
|
|
5495
|
+
class: {
|
|
5496
|
+
base: "border-[1px]"
|
|
5497
|
+
}
|
|
5498
|
+
},
|
|
5499
|
+
{
|
|
5500
|
+
variant: ["soft", "outline"],
|
|
5501
|
+
size: "md",
|
|
5502
|
+
class: {
|
|
5503
|
+
base: "border-[1.25px]"
|
|
5504
|
+
}
|
|
5505
|
+
},
|
|
5506
|
+
{
|
|
5507
|
+
variant: ["soft", "outline"],
|
|
5508
|
+
size: "lg",
|
|
5509
|
+
class: {
|
|
5510
|
+
base: "border-[1.5px]"
|
|
5511
|
+
}
|
|
5512
|
+
},
|
|
5513
|
+
{
|
|
5514
|
+
variant: ["soft", "outline"],
|
|
5515
|
+
size: "xl",
|
|
5516
|
+
class: {
|
|
5517
|
+
base: "border-[1.75px]"
|
|
5518
|
+
}
|
|
5519
|
+
},
|
|
5520
|
+
// variant && disabled
|
|
5521
|
+
{
|
|
5522
|
+
variant: ["soft", "ghost"],
|
|
5523
|
+
disabled: true,
|
|
5524
|
+
class: {
|
|
5525
|
+
base: "!border-neutral-soft"
|
|
5526
|
+
}
|
|
5527
|
+
},
|
|
5528
|
+
{
|
|
5529
|
+
variant: ["outline"],
|
|
5530
|
+
disabled: true,
|
|
5531
|
+
class: {
|
|
5532
|
+
base: "!border-neutral-light"
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
]
|
|
5536
|
+
});
|
|
5537
|
+
|
|
5538
|
+
// src/components/button/icon-button.tsx
|
|
5539
|
+
var import_react3 = require("react");
|
|
5540
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
5541
|
+
var IconButton = (0, import_react3.forwardRef)((props, ref) => {
|
|
5542
|
+
const [localProps, variantProps] = mapPropsVariants(props, iconButtonStyle.variantKeys);
|
|
5543
|
+
const { classNames, name, disableRipple, disabled, isLoading, size, full, isInGroup, onMouseDown, ...buttonProps } = {
|
|
5544
|
+
...localProps,
|
|
5545
|
+
...variantProps
|
|
5546
|
+
};
|
|
5547
|
+
const slots = (0, import_react3.useMemo)(() => iconButtonStyle({ ...variantProps }), [variantProps]);
|
|
5548
|
+
const { onPress, onClear, ripples } = useRipple();
|
|
5549
|
+
const handleRipple = (0, import_react3.useCallback)(
|
|
5550
|
+
(e) => {
|
|
5551
|
+
if (!disableRipple && !disabled) {
|
|
5552
|
+
onPress(e);
|
|
5553
|
+
}
|
|
5554
|
+
},
|
|
5555
|
+
[disableRipple, disabled, onPress]
|
|
5556
|
+
);
|
|
5557
|
+
const handleMouseDown = (0, import_react3.useCallback)(
|
|
5558
|
+
(e) => {
|
|
5559
|
+
onMouseDown == null ? void 0 : onMouseDown(e);
|
|
5560
|
+
handleRipple(e);
|
|
5561
|
+
},
|
|
5562
|
+
[onMouseDown, handleRipple]
|
|
5563
|
+
);
|
|
5564
|
+
const rippleProps = (0, import_react3.useMemo)(() => ({ ripples, onClear }), [ripples, onClear]);
|
|
5565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
5566
|
+
"button",
|
|
5567
|
+
{
|
|
5568
|
+
...buttonProps,
|
|
5569
|
+
onMouseDown: handleMouseDown,
|
|
5570
|
+
ref,
|
|
5571
|
+
disabled: disabled || isLoading,
|
|
5572
|
+
"data-loading": isLoading,
|
|
5573
|
+
className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
5574
|
+
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: "loading", size, className: "animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
5575
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name, size }),
|
|
5576
|
+
!disableRipple && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ripple_default, { ...rippleProps })
|
|
5577
|
+
] })
|
|
5578
|
+
}
|
|
5579
|
+
);
|
|
5580
|
+
});
|
|
5581
|
+
IconButton.displayName = "IconButton";
|
|
5582
|
+
var icon_button_default = IconButton;
|
|
5583
|
+
var iconButtonStyle = tv({
|
|
5584
|
+
slots: {
|
|
5585
|
+
base: [
|
|
5586
|
+
"relative",
|
|
5587
|
+
"flex",
|
|
5588
|
+
"items-center",
|
|
5589
|
+
"justify-center",
|
|
5590
|
+
"whitespace-nowrap",
|
|
5591
|
+
"transition",
|
|
5592
|
+
"duration-200",
|
|
5593
|
+
"select-none",
|
|
5594
|
+
"overflow-hidden",
|
|
5595
|
+
"box-border"
|
|
5596
|
+
]
|
|
5597
|
+
},
|
|
5598
|
+
variants: {
|
|
5599
|
+
variant: {
|
|
5600
|
+
solid: [],
|
|
5601
|
+
soft: [],
|
|
5602
|
+
outline: [],
|
|
5603
|
+
ghost: []
|
|
5604
|
+
},
|
|
5605
|
+
color: {
|
|
5606
|
+
primary: [],
|
|
5607
|
+
secondary: [],
|
|
5608
|
+
neutral: [],
|
|
5609
|
+
info: [],
|
|
5610
|
+
success: [],
|
|
5611
|
+
warning: [],
|
|
5612
|
+
danger: []
|
|
5613
|
+
},
|
|
5614
|
+
size: {
|
|
5615
|
+
sm: {
|
|
5616
|
+
base: ["w-[24px]", "h-[24px]", "rounded-sm"]
|
|
5617
|
+
},
|
|
5618
|
+
md: {
|
|
5619
|
+
base: ["w-[32px]", "h-[32px]", "rounded-md"]
|
|
5620
|
+
},
|
|
5621
|
+
lg: {
|
|
5622
|
+
base: ["w-[40px]", "h-[40px]", "rounded-lg"]
|
|
5623
|
+
},
|
|
5624
|
+
xl: {
|
|
5625
|
+
base: ["w-[50px]", "h-[50px]", "rounded-xl"]
|
|
5626
|
+
}
|
|
5627
|
+
},
|
|
5628
|
+
isLoading: {
|
|
5629
|
+
true: {}
|
|
5630
|
+
},
|
|
5631
|
+
disabled: {
|
|
5632
|
+
true: {
|
|
5633
|
+
base: ["!bg-neutral-soft", "!border-neutral-soft", "!text-neutral-light", "pointer-events-none"]
|
|
5634
|
+
}
|
|
5635
|
+
},
|
|
5636
|
+
isInGroup: {
|
|
5637
|
+
true: {
|
|
5638
|
+
base: [
|
|
5639
|
+
"[&:not(:first-child):not(:last-child)]:rounded-none",
|
|
5640
|
+
"first:rounded-r-none",
|
|
5641
|
+
"last:rounded-l-none",
|
|
5642
|
+
"[&:not(:first-child)]:border-l-0"
|
|
5643
|
+
]
|
|
5644
|
+
}
|
|
5645
|
+
}
|
|
5646
|
+
},
|
|
5647
|
+
compoundVariants: [
|
|
5648
|
+
{
|
|
5649
|
+
variant: "solid",
|
|
5650
|
+
color: "primary",
|
|
5651
|
+
class: {
|
|
5652
|
+
base: ["text-white", "bg-primary-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5653
|
+
}
|
|
5654
|
+
},
|
|
5655
|
+
{
|
|
5656
|
+
variant: "solid",
|
|
5657
|
+
color: "secondary",
|
|
5658
|
+
class: {
|
|
5659
|
+
base: ["text-white", "bg-secondary-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5660
|
+
}
|
|
5661
|
+
},
|
|
5662
|
+
{
|
|
5663
|
+
variant: "solid",
|
|
5664
|
+
color: "neutral",
|
|
5665
|
+
class: {
|
|
5666
|
+
base: ["text-white", "bg-neutral-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5667
|
+
}
|
|
5668
|
+
},
|
|
5669
|
+
{
|
|
5670
|
+
variant: "solid",
|
|
5671
|
+
color: "info",
|
|
5672
|
+
class: {
|
|
5673
|
+
base: ["text-white", "bg-info-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5674
|
+
}
|
|
5675
|
+
},
|
|
5676
|
+
{
|
|
5677
|
+
variant: "solid",
|
|
5678
|
+
color: "success",
|
|
5679
|
+
class: {
|
|
5680
|
+
base: ["text-white", "bg-success-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5681
|
+
}
|
|
5682
|
+
},
|
|
5683
|
+
{
|
|
5684
|
+
variant: "solid",
|
|
5685
|
+
color: "warning",
|
|
5686
|
+
class: {
|
|
5687
|
+
base: ["text-white", "bg-warning-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5688
|
+
}
|
|
5689
|
+
},
|
|
5690
|
+
{
|
|
5691
|
+
variant: "solid",
|
|
5692
|
+
color: "danger",
|
|
5693
|
+
class: {
|
|
5694
|
+
base: ["text-white", "bg-danger-main", "hover:bg-gradient-to-t", "hover:from-white/20", "hover:to-white/20"]
|
|
5695
|
+
}
|
|
5696
|
+
},
|
|
5697
|
+
// soft
|
|
5698
|
+
{
|
|
5699
|
+
variant: "soft",
|
|
5700
|
+
color: "primary",
|
|
5701
|
+
class: {
|
|
5702
|
+
base: ["text-primary-main", "bg-primary-soft", "!border-primary-soft", "hover:!border-primary-light"]
|
|
5703
|
+
}
|
|
5704
|
+
},
|
|
5705
|
+
{
|
|
5706
|
+
variant: "soft",
|
|
5707
|
+
color: "secondary",
|
|
5708
|
+
class: {
|
|
5709
|
+
base: ["text-secondary-main", "bg-secondary-soft", "!border-secondary-soft", "hover:!border-secondary-light"]
|
|
5710
|
+
}
|
|
5711
|
+
},
|
|
5712
|
+
{
|
|
5713
|
+
variant: "soft",
|
|
5714
|
+
color: "neutral",
|
|
5715
|
+
class: {
|
|
5716
|
+
base: ["text-neutral-main", "bg-neutral-soft", "!border-neutral-soft", "hover:!border-neutral-light"]
|
|
5717
|
+
}
|
|
5718
|
+
},
|
|
5719
|
+
{
|
|
5720
|
+
variant: "soft",
|
|
5721
|
+
color: "info",
|
|
5722
|
+
class: {
|
|
5723
|
+
base: ["text-info-main", "bg-info-soft", "!border-info-soft", "hover:!border-info-light"]
|
|
5724
|
+
}
|
|
5725
|
+
},
|
|
5726
|
+
{
|
|
5727
|
+
variant: "soft",
|
|
5728
|
+
color: "success",
|
|
5729
|
+
class: {
|
|
5730
|
+
base: ["text-success-main", "bg-success-soft", "!border-success-soft", "hover:!border-success-light"]
|
|
5731
|
+
}
|
|
5732
|
+
},
|
|
5733
|
+
{
|
|
5734
|
+
variant: "soft",
|
|
5735
|
+
color: "warning",
|
|
5736
|
+
class: {
|
|
5737
|
+
base: ["text-warning-main", "bg-warning-soft", "!border-warning-soft", "hover:!border-warning-light"]
|
|
5738
|
+
}
|
|
5739
|
+
},
|
|
5740
|
+
{
|
|
5741
|
+
variant: "soft",
|
|
5742
|
+
color: "danger",
|
|
5743
|
+
class: {
|
|
5744
|
+
base: ["text-danger-main", "bg-danger-soft", "!border-danger-soft", "hover:!border-danger-light"]
|
|
5745
|
+
}
|
|
5746
|
+
},
|
|
5747
|
+
// outline
|
|
5748
|
+
{
|
|
5749
|
+
variant: "outline",
|
|
5750
|
+
color: "primary",
|
|
5751
|
+
class: {
|
|
5752
|
+
base: ["bg-body-background", "!border-primary-main", "text-primary-main", "hover:bg-primary-soft"]
|
|
5753
|
+
}
|
|
5754
|
+
},
|
|
5755
|
+
{
|
|
5756
|
+
variant: "outline",
|
|
5757
|
+
color: "secondary",
|
|
5758
|
+
class: {
|
|
5759
|
+
base: ["bg-body-background", "!border-secondary-main", "text-secondary-main", "hover:bg-secondary-soft"]
|
|
5760
|
+
}
|
|
5761
|
+
},
|
|
5762
|
+
{
|
|
5763
|
+
variant: "outline",
|
|
5764
|
+
color: "neutral",
|
|
5765
|
+
class: {
|
|
5766
|
+
base: ["bg-body-background", "!border-neutral-light", "text-neutral-main", "hover:bg-neutral-soft"]
|
|
5767
|
+
}
|
|
5768
|
+
},
|
|
5769
|
+
{
|
|
5770
|
+
variant: "outline",
|
|
5771
|
+
color: "info",
|
|
5772
|
+
class: {
|
|
5773
|
+
base: ["bg-body-background", "!border-info-main", "text-info-main", "hover:bg-info-soft"]
|
|
5774
|
+
}
|
|
5775
|
+
},
|
|
5776
|
+
{
|
|
5777
|
+
variant: "outline",
|
|
5778
|
+
color: "success",
|
|
5779
|
+
class: {
|
|
5780
|
+
base: ["bg-body-background", "!border-success-main", "text-success-main", "hover:bg-success-soft"]
|
|
5781
|
+
}
|
|
5782
|
+
},
|
|
5783
|
+
{
|
|
5784
|
+
variant: "outline",
|
|
5785
|
+
color: "warning",
|
|
5786
|
+
class: {
|
|
5787
|
+
base: ["bg-body-background", "!border-warning-main", "text-warning-main", "hover:bg-warning-soft"]
|
|
5788
|
+
}
|
|
5789
|
+
},
|
|
5790
|
+
{
|
|
5791
|
+
variant: "outline",
|
|
5792
|
+
color: "danger",
|
|
5793
|
+
class: {
|
|
5794
|
+
base: ["bg-body-background", "!border-danger-main", "text-danger-main", "hover:bg-danger-soft"]
|
|
5795
|
+
}
|
|
5796
|
+
},
|
|
5797
|
+
// ghost
|
|
5798
|
+
{
|
|
5799
|
+
variant: "ghost",
|
|
5800
|
+
color: "primary",
|
|
5801
|
+
class: {
|
|
5802
|
+
base: ["text-primary-main", "border-transparent", "hover:bg-primary-soft"]
|
|
5803
|
+
}
|
|
5804
|
+
},
|
|
5805
|
+
{
|
|
5806
|
+
variant: "ghost",
|
|
5807
|
+
color: "secondary",
|
|
5808
|
+
class: {
|
|
5809
|
+
base: ["text-secondary-main", "border-transparent", "hover:bg-secondary-soft"]
|
|
5810
|
+
}
|
|
5811
|
+
},
|
|
5812
|
+
{
|
|
5813
|
+
variant: "ghost",
|
|
5814
|
+
color: "neutral",
|
|
5815
|
+
class: {
|
|
5816
|
+
base: ["text-neutral-main", "border-transparent", "hover:bg-neutral-soft"]
|
|
5817
|
+
}
|
|
5818
|
+
},
|
|
5819
|
+
{
|
|
5820
|
+
variant: "ghost",
|
|
5821
|
+
color: "info",
|
|
5822
|
+
class: {
|
|
5823
|
+
base: ["text-info-main", "border-transparent", "hover:bg-info-soft"]
|
|
5824
|
+
}
|
|
5825
|
+
},
|
|
5826
|
+
{
|
|
5827
|
+
variant: "ghost",
|
|
5828
|
+
color: "success",
|
|
5829
|
+
class: {
|
|
5830
|
+
base: ["text-success-main", "border-transparent", "hover:bg-success-soft"]
|
|
5831
|
+
}
|
|
5832
|
+
},
|
|
5833
|
+
{
|
|
5834
|
+
variant: "ghost",
|
|
5835
|
+
color: "warning",
|
|
5836
|
+
class: {
|
|
5837
|
+
base: ["text-warning-main", "border-transparent", "hover:bg-warning-soft"]
|
|
5838
|
+
}
|
|
5839
|
+
},
|
|
5840
|
+
{
|
|
5841
|
+
variant: "ghost",
|
|
5842
|
+
color: "danger",
|
|
5843
|
+
class: {
|
|
5844
|
+
base: ["text-danger-main", "border-transparent", "hover:bg-danger-soft"]
|
|
5845
|
+
}
|
|
5846
|
+
},
|
|
5847
|
+
// soft/outline + size
|
|
5848
|
+
{
|
|
5849
|
+
variant: ["soft", "outline"],
|
|
5850
|
+
size: "sm",
|
|
5851
|
+
class: {
|
|
5852
|
+
base: ["border-sm"]
|
|
5853
|
+
}
|
|
5854
|
+
},
|
|
5855
|
+
{
|
|
5856
|
+
variant: ["soft", "outline"],
|
|
5857
|
+
size: "md",
|
|
5858
|
+
class: {
|
|
5859
|
+
base: ["border-md"]
|
|
5860
|
+
}
|
|
5861
|
+
},
|
|
5862
|
+
{
|
|
5863
|
+
variant: ["soft", "outline"],
|
|
5864
|
+
size: "lg",
|
|
5865
|
+
class: {
|
|
5866
|
+
base: ["border-lg"]
|
|
5867
|
+
}
|
|
5868
|
+
},
|
|
5869
|
+
{
|
|
5870
|
+
variant: ["soft", "outline"],
|
|
5871
|
+
size: "xl",
|
|
5872
|
+
class: {
|
|
5873
|
+
base: ["border-xl"]
|
|
5874
|
+
}
|
|
5875
|
+
},
|
|
5876
|
+
// disabled + variant
|
|
5877
|
+
{
|
|
5878
|
+
variant: ["soft", "ghost"],
|
|
5879
|
+
disabled: true,
|
|
5880
|
+
class: {
|
|
5881
|
+
base: ["!border-neutral-soft"]
|
|
5882
|
+
}
|
|
5883
|
+
},
|
|
5884
|
+
{
|
|
5885
|
+
variant: ["outline"],
|
|
5886
|
+
disabled: true,
|
|
5887
|
+
class: {
|
|
5888
|
+
base: ["!border-neutral-light"]
|
|
5889
|
+
}
|
|
5890
|
+
}
|
|
5891
|
+
],
|
|
5892
|
+
defaultVariants: {
|
|
5893
|
+
size: "md",
|
|
5894
|
+
variant: "solid",
|
|
5895
|
+
color: "primary",
|
|
5896
|
+
full: false,
|
|
5897
|
+
disabled: false,
|
|
5898
|
+
isLoading: false,
|
|
5899
|
+
isInGroup: false
|
|
5900
|
+
}
|
|
5901
|
+
});
|
|
5902
|
+
|
|
5903
|
+
// src/components/button/text-button.tsx
|
|
5904
|
+
var import_react4 = require("react");
|
|
5905
|
+
|
|
5906
|
+
// src/utils/clsx.ts
|
|
5907
|
+
function clsx(...args) {
|
|
5908
|
+
var i = 0, tmp, x, str = "";
|
|
5909
|
+
while (i < args.length) {
|
|
5910
|
+
if (tmp = args[i++]) {
|
|
5911
|
+
if (x = toVal(tmp)) {
|
|
5912
|
+
str && (str += " ");
|
|
5913
|
+
str += x;
|
|
5914
|
+
}
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
return str;
|
|
5918
|
+
}
|
|
5919
|
+
function toVal(mix) {
|
|
5920
|
+
var k, y, str = "";
|
|
5921
|
+
if (typeof mix === "string" || typeof mix === "number") {
|
|
5922
|
+
str += mix;
|
|
5923
|
+
} else if (typeof mix === "object") {
|
|
5924
|
+
if (Array.isArray(mix)) {
|
|
5925
|
+
var len = mix.length;
|
|
5926
|
+
for (k = 0; k < len; k++) {
|
|
5927
|
+
if (mix[k]) {
|
|
5928
|
+
if (y = toVal(mix[k])) {
|
|
5929
|
+
str && (str += " ");
|
|
5930
|
+
str += y;
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
} else {
|
|
5935
|
+
for (y in mix) {
|
|
5936
|
+
if (mix[y]) {
|
|
5937
|
+
str && (str += " ");
|
|
5938
|
+
str += y;
|
|
5939
|
+
}
|
|
5940
|
+
}
|
|
5941
|
+
}
|
|
5942
|
+
}
|
|
5943
|
+
return str;
|
|
5944
|
+
}
|
|
5945
|
+
|
|
5946
|
+
// src/components/button/text-button.tsx
|
|
5947
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
5948
|
+
var TextButton = (0, import_react4.forwardRef)((originalProps, ref) => {
|
|
5949
|
+
const [props, variantProps] = mapPropsVariants(originalProps, textButtonStyle.variantKeys);
|
|
5950
|
+
const { children, startContent, endContent, classNames, variant, disabled, size, ...buttonProps } = {
|
|
5951
|
+
...props,
|
|
5952
|
+
...variantProps
|
|
5953
|
+
};
|
|
5954
|
+
const slots = (0, import_react4.useMemo)(() => textButtonStyle({ ...variantProps }), [variantProps]);
|
|
5955
|
+
const getContentProps = (0, import_react4.useCallback)(() => {
|
|
5956
|
+
const className = slots.content({ class: classNames == null ? void 0 : classNames.content });
|
|
5957
|
+
return { className, size };
|
|
5958
|
+
}, [slots, classNames, size]);
|
|
5959
|
+
const renderContent = (content) => {
|
|
5960
|
+
const contentProps = getContentProps();
|
|
5961
|
+
if ((0, import_react4.isValidElement)(content)) {
|
|
5962
|
+
const _content = content;
|
|
5963
|
+
const contentProps2 = getContentProps();
|
|
5964
|
+
const mergedProps = {
|
|
5965
|
+
...contentProps2,
|
|
5966
|
+
...typeof _content.props.className === "string" && {
|
|
5967
|
+
className: clsx(contentProps2.className, _content.props.className)
|
|
5968
|
+
}
|
|
5969
|
+
};
|
|
5970
|
+
return (0, import_react4.cloneElement)(_content, mergedProps);
|
|
5971
|
+
}
|
|
5972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...contentProps, children: content });
|
|
5973
|
+
};
|
|
5974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
5975
|
+
"button",
|
|
5976
|
+
{
|
|
5977
|
+
...buttonProps,
|
|
5978
|
+
ref,
|
|
5979
|
+
disabled,
|
|
5980
|
+
className: clsx(
|
|
5981
|
+
slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
5982
|
+
variant === "underline" && slots.underline({ class: classNames == null ? void 0 : classNames.underline })
|
|
5983
|
+
),
|
|
5984
|
+
children: [
|
|
5985
|
+
startContent && renderContent(startContent),
|
|
5986
|
+
children,
|
|
5987
|
+
endContent && renderContent(endContent)
|
|
5988
|
+
]
|
|
5989
|
+
}
|
|
5990
|
+
);
|
|
5991
|
+
});
|
|
5992
|
+
TextButton.displayName = "TextButton";
|
|
5993
|
+
var text_button_default = TextButton;
|
|
5994
|
+
var textButtonStyle = tv({
|
|
5995
|
+
slots: {
|
|
5996
|
+
base: ["flex", "items-center", "justify-center", "whitespace-nowrap", "overflow-hidden"],
|
|
5997
|
+
content: [],
|
|
5998
|
+
underline: ["underline", "decoration-skip-ink", "underline-offset-auto"]
|
|
5999
|
+
},
|
|
6000
|
+
variants: {
|
|
6001
|
+
variant: {
|
|
6002
|
+
"non-under": [],
|
|
6003
|
+
underline: []
|
|
6004
|
+
},
|
|
6005
|
+
color: {
|
|
6006
|
+
primary: [],
|
|
6007
|
+
secondary: [],
|
|
6008
|
+
neutral: [],
|
|
6009
|
+
info: [],
|
|
6010
|
+
success: [],
|
|
6011
|
+
warning: [],
|
|
6012
|
+
danger: []
|
|
6013
|
+
},
|
|
6014
|
+
size: {
|
|
6015
|
+
sm: {
|
|
6016
|
+
base: ["text-sm"],
|
|
6017
|
+
underline: ["decoration-[1px]"]
|
|
6018
|
+
},
|
|
6019
|
+
md: {
|
|
6020
|
+
base: ["text-md"],
|
|
6021
|
+
underline: ["decoration-[1.25px]"]
|
|
6022
|
+
},
|
|
6023
|
+
lg: {
|
|
6024
|
+
base: ["text-lg"],
|
|
6025
|
+
underline: ["decoration-[1.5px]"]
|
|
6026
|
+
},
|
|
6027
|
+
xl: {
|
|
6028
|
+
base: ["text-xl"],
|
|
6029
|
+
underline: ["decoration-[1.75px]"]
|
|
6030
|
+
}
|
|
6031
|
+
},
|
|
6032
|
+
disabled: {
|
|
6033
|
+
true: {
|
|
6034
|
+
base: ["!text-neutral-light", "pointer-events-none"]
|
|
6035
|
+
}
|
|
6036
|
+
},
|
|
6037
|
+
isInGroup: {
|
|
6038
|
+
true: {
|
|
6039
|
+
base: [
|
|
6040
|
+
"[&:not(:first-child):not(:last-child)]:rounded-none",
|
|
6041
|
+
"first:rounded-r-none",
|
|
6042
|
+
"last:rounded-l-none",
|
|
6043
|
+
"[&:not(:first-child)]:border-l-0"
|
|
6044
|
+
]
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
},
|
|
6048
|
+
compoundVariants: [
|
|
6049
|
+
{
|
|
6050
|
+
color: "primary",
|
|
6051
|
+
class: {
|
|
6052
|
+
base: ["text-primary-main", "hover:text-primary-dark", "active:text-primary-strong"]
|
|
6053
|
+
}
|
|
6054
|
+
},
|
|
6055
|
+
{
|
|
6056
|
+
color: "secondary",
|
|
6057
|
+
class: {
|
|
6058
|
+
base: ["text-secondary-main", "hover:text-secondary-dark", "active:text-secondary-strong"]
|
|
6059
|
+
}
|
|
6060
|
+
},
|
|
6061
|
+
{
|
|
6062
|
+
color: "neutral",
|
|
6063
|
+
class: {
|
|
6064
|
+
base: ["text-neutral-main", "hover:text-neutral-dark", "active:text-neutral-strong"]
|
|
6065
|
+
}
|
|
6066
|
+
},
|
|
6067
|
+
{
|
|
6068
|
+
color: "info",
|
|
6069
|
+
class: {
|
|
6070
|
+
base: ["text-info-main", "hover:text-info-dark", "active:text-info-strong"]
|
|
6071
|
+
}
|
|
6072
|
+
},
|
|
6073
|
+
{
|
|
6074
|
+
color: "success",
|
|
6075
|
+
class: {
|
|
6076
|
+
base: ["text-success-main", "hover:text-success-dark", "active:text-success-strong"]
|
|
6077
|
+
}
|
|
6078
|
+
},
|
|
6079
|
+
{
|
|
6080
|
+
color: "warning",
|
|
6081
|
+
class: {
|
|
6082
|
+
base: ["text-warning-main", "hover:text-warning-dark", "active:text-warning-strong"]
|
|
6083
|
+
}
|
|
6084
|
+
},
|
|
6085
|
+
{
|
|
6086
|
+
color: "danger",
|
|
6087
|
+
class: {
|
|
6088
|
+
base: ["text-danger-main", "hover:text-danger-dark", "active:text-danger-strong"]
|
|
6089
|
+
}
|
|
6090
|
+
}
|
|
6091
|
+
],
|
|
6092
|
+
defaultVariants: {
|
|
6093
|
+
size: "md",
|
|
6094
|
+
color: "primary",
|
|
6095
|
+
variant: "non-under",
|
|
6096
|
+
disabled: false,
|
|
6097
|
+
isInGroup: false
|
|
6098
|
+
}
|
|
6099
|
+
});
|
|
6100
|
+
|
|
6101
|
+
// src/components/picker/day.tsx
|
|
6102
|
+
var import_react5 = require("react");
|
|
6103
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
6104
|
+
var Day = (0, import_react5.forwardRef)((originalProps, ref) => {
|
|
6105
|
+
const [props, variantProps] = mapPropsVariants(originalProps, dayStyle.variantKeys);
|
|
6106
|
+
const { classNames, children, ...divProps } = props;
|
|
6107
|
+
const slots = (0, import_react5.useMemo)(() => dayStyle({ ...variantProps }), [variantProps]);
|
|
6108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), ...divProps, children });
|
|
6109
|
+
});
|
|
6110
|
+
Day.displayName = "Day";
|
|
6111
|
+
var day_default = Day;
|
|
6112
|
+
var dayStyle = tv({
|
|
6113
|
+
slots: {
|
|
6114
|
+
base: [
|
|
6115
|
+
"w-[40px]",
|
|
6116
|
+
"h-[40px]",
|
|
6117
|
+
"flex",
|
|
6118
|
+
"justify-center",
|
|
6119
|
+
"items-center",
|
|
6120
|
+
"font-bold",
|
|
6121
|
+
"text-sm",
|
|
6122
|
+
"text-neutral-strong",
|
|
6123
|
+
"rounded-xl",
|
|
6124
|
+
"cursor-pointer"
|
|
6125
|
+
]
|
|
6126
|
+
},
|
|
6127
|
+
variants: {
|
|
6128
|
+
variant: {
|
|
6129
|
+
default: { base: ["hover:bg-trans-soft"] },
|
|
6130
|
+
hover: { base: ["bg-trans-soft"] },
|
|
6131
|
+
selected: { base: ["bg-primary-main", "text-common-white"] },
|
|
6132
|
+
disabled: { base: ["pointer-events-none", "bg-common-transparent", "text-neutral-light"] },
|
|
6133
|
+
period: { base: ["bg-primary-soft", "rounded-none"] },
|
|
6134
|
+
today: { base: ["shadow-[inset_0_0_0_2px_var(--dn-primary-light)]", "hover:bg-trans-soft"] },
|
|
6135
|
+
text: { base: ["text-md"] }
|
|
6136
|
+
}
|
|
6137
|
+
},
|
|
6138
|
+
defaultVariants: {
|
|
6139
|
+
variant: "default"
|
|
6140
|
+
}
|
|
6141
|
+
});
|
|
6142
|
+
|
|
6143
|
+
// src/components/input/input.tsx
|
|
6144
|
+
var import_react6 = require("react");
|
|
6145
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
6146
|
+
var Input = (0, import_react6.forwardRef)((originalProps, ref) => {
|
|
6147
|
+
const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
|
|
6148
|
+
const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
|
|
6149
|
+
const inputRef = (0, import_react6.useRef)(null);
|
|
6150
|
+
const slots = (0, import_react6.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
|
|
6151
|
+
const getContentProps = (0, import_react6.useCallback)(
|
|
6152
|
+
() => ({
|
|
6153
|
+
className: clsx(
|
|
6154
|
+
slots.content({ class: classNames == null ? void 0 : classNames.content }),
|
|
6155
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
6156
|
+
),
|
|
6157
|
+
size: originalProps.size
|
|
6158
|
+
}),
|
|
6159
|
+
[slots, classNames, originalProps.size]
|
|
6160
|
+
);
|
|
6161
|
+
const renderStartContent = () => {
|
|
6162
|
+
if ((0, import_react6.isValidElement)(startContent)) {
|
|
6163
|
+
const existingProps = startContent.props;
|
|
6164
|
+
const mergedProps = {
|
|
6165
|
+
...getContentProps(),
|
|
6166
|
+
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
6167
|
+
};
|
|
6168
|
+
return (0, import_react6.cloneElement)(startContent, mergedProps);
|
|
6169
|
+
} else {
|
|
6170
|
+
const contentProps = getContentProps();
|
|
6171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...contentProps, children: startContent });
|
|
6172
|
+
}
|
|
6173
|
+
};
|
|
6174
|
+
const renderDateTimePickerIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6175
|
+
"div",
|
|
6176
|
+
{
|
|
6177
|
+
...getContentProps(),
|
|
6178
|
+
onClick: () => {
|
|
6179
|
+
const target = ref && "current" in ref ? ref.current : inputRef.current;
|
|
6180
|
+
target == null ? void 0 : target.focus();
|
|
6181
|
+
target == null ? void 0 : target.showPicker();
|
|
6182
|
+
},
|
|
6183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: props.type === "time" ? "clock" : "calendar", size: originalProps.size, className: "cursor-pointer" })
|
|
6184
|
+
}
|
|
6185
|
+
);
|
|
6186
|
+
const renderContentWithIcon = () => {
|
|
6187
|
+
if ((0, import_react6.isValidElement)(endContent)) {
|
|
6188
|
+
const existingProps = endContent.props;
|
|
6189
|
+
const mergedProps = {
|
|
6190
|
+
...getContentProps(),
|
|
6191
|
+
className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
|
|
6192
|
+
};
|
|
6193
|
+
return (0, import_react6.cloneElement)(endContent, mergedProps);
|
|
6194
|
+
} else if (errorMessage) {
|
|
6195
|
+
const iconProps = { ...getContentProps(), className: getContentProps().className };
|
|
6196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
|
|
6197
|
+
} else {
|
|
6198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, {});
|
|
6199
|
+
}
|
|
6200
|
+
};
|
|
6201
|
+
const renderEndContent = () => {
|
|
6202
|
+
switch (props.type) {
|
|
6203
|
+
case "date":
|
|
6204
|
+
case "datetime-local":
|
|
6205
|
+
case "month":
|
|
6206
|
+
case "week":
|
|
6207
|
+
case "time":
|
|
6208
|
+
return renderDateTimePickerIcon();
|
|
6209
|
+
default:
|
|
6210
|
+
return renderContentWithIcon();
|
|
6211
|
+
}
|
|
6212
|
+
};
|
|
6213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
6214
|
+
"div",
|
|
6215
|
+
{
|
|
6216
|
+
className: clsx(
|
|
6217
|
+
slots.base({ class: classNames == null ? void 0 : classNames.base }),
|
|
6218
|
+
variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
|
|
6219
|
+
),
|
|
6220
|
+
children: [
|
|
6221
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper }), children: [
|
|
6223
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
6224
|
+
"div",
|
|
6225
|
+
{
|
|
6226
|
+
className: clsx(
|
|
6227
|
+
slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
|
|
6228
|
+
inputProps.readOnly ? slots.readonlyWrapper({ class: classNames == null ? void 0 : classNames.readonlyWrapper }) : ""
|
|
6229
|
+
),
|
|
6230
|
+
children: [
|
|
6231
|
+
startContent && renderStartContent(),
|
|
6232
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6233
|
+
"input",
|
|
6234
|
+
{
|
|
6235
|
+
ref: ref || inputRef,
|
|
6236
|
+
...inputProps,
|
|
6237
|
+
readOnly: props.readOnly,
|
|
6238
|
+
className: clsx(slots.input({ class: classNames == null ? void 0 : classNames.input })),
|
|
6239
|
+
size: 0
|
|
6240
|
+
}
|
|
6241
|
+
),
|
|
6242
|
+
renderEndContent()
|
|
6243
|
+
]
|
|
6244
|
+
}
|
|
6245
|
+
),
|
|
6246
|
+
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
6247
|
+
"p",
|
|
6248
|
+
{
|
|
6249
|
+
className: clsx(
|
|
6250
|
+
slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }),
|
|
6251
|
+
inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
|
|
6252
|
+
),
|
|
6253
|
+
children: helperMessage
|
|
6254
|
+
}
|
|
6255
|
+
),
|
|
6256
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
|
|
6257
|
+
] })
|
|
6258
|
+
]
|
|
6259
|
+
}
|
|
6260
|
+
);
|
|
6261
|
+
});
|
|
6262
|
+
Input.displayName = "Input";
|
|
6263
|
+
var input_default = Input;
|
|
6264
|
+
var inputStyle = tv(
|
|
6265
|
+
{
|
|
6266
|
+
slots: {
|
|
6267
|
+
base: ["group/input", "flex", "select-none"],
|
|
6268
|
+
vertical: ["flex-col"],
|
|
6269
|
+
horizon: ["flex-row", "gap-0"],
|
|
6270
|
+
label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
|
|
6271
|
+
innerWrapper: ["flex", "flex-col"],
|
|
6272
|
+
inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input:!bg-danger-soft"],
|
|
6273
|
+
input: [
|
|
6274
|
+
"w-full",
|
|
6275
|
+
"h-full",
|
|
6276
|
+
"bg-transparent",
|
|
6277
|
+
"text-neutral-main",
|
|
6278
|
+
"placeholder:text-neutral-main",
|
|
6279
|
+
"outline-none",
|
|
6280
|
+
"focus:ring-0",
|
|
6281
|
+
"group-has-[:hover]/input:text-neutral-dark",
|
|
6282
|
+
"group-has-[:hover]/input:placeholder:text-neutral-dark",
|
|
6283
|
+
"group-has-[:focus]/input:text-neutral-dark",
|
|
6284
|
+
"group-has-[:focus]/input:placeholder:text-neutral-dark",
|
|
6285
|
+
"group-has-[p.error]/input:text-danger-main",
|
|
6286
|
+
"group-has-[p.error]/input:placeholder:text-danger-main",
|
|
6287
|
+
"group-has-[p.error]/input:placeholder:hover:!text-danger-main"
|
|
6288
|
+
],
|
|
6289
|
+
content: [
|
|
6290
|
+
"flex",
|
|
6291
|
+
"items-center",
|
|
6292
|
+
"select-none",
|
|
6293
|
+
"text-neutral-main",
|
|
6294
|
+
"group-has-[:hover]/input:text-neutral-dark",
|
|
6295
|
+
"group-has-[p.error]/input:text-danger-main",
|
|
6296
|
+
"group-has-[p.error]/input:hover:text-danger-main",
|
|
6297
|
+
"group-has-[p.error]/input:focus:text-danger-main"
|
|
6298
|
+
],
|
|
6299
|
+
helperMessage: [
|
|
6300
|
+
"text-neutral-main",
|
|
6301
|
+
"group-has-[:hover]/input:text-neutral-dark",
|
|
6302
|
+
"group-has-[p.error]/input:text-danger-main",
|
|
6303
|
+
"group-has-[p.error]/input:hover:text-danger-main",
|
|
6304
|
+
"group-has-[p.error]/input:focus:text-danger-main"
|
|
6305
|
+
],
|
|
6306
|
+
errorMessage: ["text-danger-main"],
|
|
6307
|
+
readonlyWrapper: [
|
|
6308
|
+
"pointer-events-none",
|
|
6309
|
+
"text-body-foreground",
|
|
6310
|
+
"placeholder:text-body-foreground",
|
|
6311
|
+
"[&>input]:text-body-foreground",
|
|
6312
|
+
"[&>input]:placeholder:text-body-foreground"
|
|
6313
|
+
],
|
|
6314
|
+
readonly: []
|
|
6315
|
+
},
|
|
6316
|
+
variants: {
|
|
6317
|
+
variant: {
|
|
6318
|
+
solid: {
|
|
6319
|
+
inputWrapper: ["border-transparent", "bg-trans-soft"],
|
|
6320
|
+
readonlyWrapper: ["!bg-trans-light"]
|
|
6321
|
+
},
|
|
6322
|
+
outline: {
|
|
6323
|
+
inputWrapper: [
|
|
6324
|
+
"border-neutral-light",
|
|
6325
|
+
"group-has-[:hover]/input:bg-trans-soft",
|
|
6326
|
+
"group-has-[:focus]/input:bg-body-background",
|
|
6327
|
+
"group-has-[p.error]/input:border-danger-main"
|
|
6328
|
+
],
|
|
6329
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
6330
|
+
},
|
|
6331
|
+
underline: {
|
|
6332
|
+
inputWrapper: [
|
|
6333
|
+
"bg-transparent",
|
|
6334
|
+
"rounded-none",
|
|
6335
|
+
"group-has-[:hover]/input:bg-trans-soft",
|
|
6336
|
+
"group-has-[:focus]/input:bg-body-background",
|
|
6337
|
+
"group-has-[p.error]/input:border-danger-main"
|
|
6338
|
+
],
|
|
6339
|
+
readonlyWrapper: ["!bg-trans-soft"]
|
|
6340
|
+
}
|
|
6341
|
+
},
|
|
6342
|
+
color: {
|
|
6343
|
+
primary: {
|
|
6344
|
+
content: ["group-has-[:focus]/input:text-primary-main", "group-has-[:focus]/input:hover:text-primary-main"],
|
|
6345
|
+
helperMessage: [
|
|
6346
|
+
"group-has-[:focus]/input:text-primary-main",
|
|
6347
|
+
"group-has-[:focus]/input:hover:text-primary-main"
|
|
6348
|
+
],
|
|
6349
|
+
readonly: ["text-primary-main"]
|
|
6350
|
+
},
|
|
6351
|
+
secondary: {
|
|
6352
|
+
content: [
|
|
6353
|
+
"group-has-[:focus]/input:text-secondary-main",
|
|
6354
|
+
"group-has-[:focus]/input:hover:text-secondary-main"
|
|
6355
|
+
],
|
|
6356
|
+
helperMessage: [
|
|
6357
|
+
"group-has-[:focus]/input:text-secondary-main",
|
|
6358
|
+
"group-has-[:focus]/input:hover:text-secondary-main"
|
|
6359
|
+
],
|
|
6360
|
+
readonly: ["text-secondary-main"]
|
|
6361
|
+
}
|
|
6362
|
+
},
|
|
6363
|
+
size: {
|
|
6364
|
+
sm: {
|
|
6365
|
+
base: ["text-sm", "gap-[4px]"],
|
|
6366
|
+
label: ["text-sm"],
|
|
6367
|
+
innerWrapper: ["gap-[4px]"],
|
|
6368
|
+
inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]", "gap-[4px]"],
|
|
6369
|
+
helperMessage: ["text-sm"],
|
|
6370
|
+
errorMessage: ["text-sm"]
|
|
6371
|
+
},
|
|
6372
|
+
md: {
|
|
6373
|
+
base: ["text-md", "gap-[6px]"],
|
|
6374
|
+
label: ["text-md"],
|
|
6375
|
+
innerWrapper: ["gap-[6px]"],
|
|
6376
|
+
inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]", "gap-[6px]"],
|
|
6377
|
+
helperMessage: ["text-sm"],
|
|
6378
|
+
errorMessage: ["text-sm"]
|
|
6379
|
+
},
|
|
6380
|
+
lg: {
|
|
6381
|
+
base: ["text-lg", "gap-[8px]"],
|
|
6382
|
+
label: ["text-lg"],
|
|
6383
|
+
innerWrapper: ["gap-[8px]"],
|
|
6384
|
+
inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]", "gap-[8px]"],
|
|
6385
|
+
helperMessage: ["text-md"],
|
|
6386
|
+
errorMessage: ["text-md"]
|
|
6387
|
+
},
|
|
6388
|
+
xl: {
|
|
6389
|
+
base: ["text-xl", "gap-[10px]"],
|
|
6390
|
+
label: ["text-xl"],
|
|
6391
|
+
innerWrapper: ["gap-[10px]"],
|
|
6392
|
+
inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]", "gap-[10px]"],
|
|
6393
|
+
helperMessage: ["text-md"],
|
|
6394
|
+
errorMessage: ["text-md"]
|
|
6395
|
+
}
|
|
6396
|
+
},
|
|
6397
|
+
direction: {
|
|
6398
|
+
vertical: "",
|
|
6399
|
+
horizon: ""
|
|
6400
|
+
},
|
|
6401
|
+
full: {
|
|
6402
|
+
true: {
|
|
6403
|
+
base: ["w-full"],
|
|
6404
|
+
innerWrapper: ["flex-1"],
|
|
6405
|
+
inputWrapper: ["w-full"]
|
|
6406
|
+
}
|
|
6407
|
+
},
|
|
6408
|
+
disabled: {
|
|
6409
|
+
true: {
|
|
6410
|
+
inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "group-has-[p.error]/input:!text-danger-light"],
|
|
6411
|
+
input: [
|
|
6412
|
+
"!text-neutral-light",
|
|
6413
|
+
"placeholder:!text-neutral-light",
|
|
6414
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
6415
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
6416
|
+
],
|
|
6417
|
+
content: ["!text-neutral-light", "group-has-[p.error]/input:!text-danger-light"],
|
|
6418
|
+
helperMessage: ["!text-neutral-light"],
|
|
6419
|
+
errorMessage: ["!text-danger-light"]
|
|
6420
|
+
}
|
|
6421
|
+
},
|
|
6422
|
+
readonly: {
|
|
6423
|
+
true: {
|
|
6424
|
+
readonlyWrapper: ["pointer-events-none"],
|
|
6425
|
+
input: [
|
|
6426
|
+
"group-has-[p.error]/input:!text-danger-main",
|
|
6427
|
+
"group-has-[p.error]/input:placeholder:!text-danger-main"
|
|
6428
|
+
],
|
|
6429
|
+
content: ["group-has-[p.error]/input:!text-danger-main"]
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
},
|
|
6433
|
+
compoundVariants: [
|
|
6434
|
+
{
|
|
6435
|
+
variant: "outline",
|
|
6436
|
+
size: "sm",
|
|
6437
|
+
class: {
|
|
6438
|
+
inputWrapper: ["border-sm"]
|
|
6439
|
+
}
|
|
6440
|
+
},
|
|
6441
|
+
{
|
|
6442
|
+
variant: "outline",
|
|
6443
|
+
size: "md",
|
|
6444
|
+
class: {
|
|
6445
|
+
inputWrapper: ["border-md"]
|
|
6446
|
+
}
|
|
6447
|
+
},
|
|
6448
|
+
{
|
|
6449
|
+
variant: "outline",
|
|
6450
|
+
size: "lg",
|
|
6451
|
+
class: {
|
|
6452
|
+
inputWrapper: ["border-lg"]
|
|
6453
|
+
}
|
|
6454
|
+
},
|
|
6455
|
+
{
|
|
6456
|
+
variant: "outline",
|
|
6457
|
+
size: "xl",
|
|
6458
|
+
class: {
|
|
6459
|
+
inputWrapper: ["border-xl"]
|
|
6460
|
+
}
|
|
6461
|
+
},
|
|
6462
|
+
{
|
|
6463
|
+
variant: "underline",
|
|
6464
|
+
size: "sm",
|
|
6465
|
+
class: {
|
|
6466
|
+
inputWrapper: ["border-b-sm"]
|
|
6467
|
+
}
|
|
6468
|
+
},
|
|
6469
|
+
{
|
|
6470
|
+
variant: "underline",
|
|
6471
|
+
size: "md",
|
|
6472
|
+
class: {
|
|
6473
|
+
inputWrapper: ["border-b-md"]
|
|
6474
|
+
}
|
|
6475
|
+
},
|
|
6476
|
+
{
|
|
6477
|
+
variant: "underline",
|
|
6478
|
+
size: "lg",
|
|
6479
|
+
class: {
|
|
6480
|
+
inputWrapper: ["border-b-lg"]
|
|
6481
|
+
}
|
|
6482
|
+
},
|
|
6483
|
+
{
|
|
6484
|
+
variant: "underline",
|
|
6485
|
+
size: "xl",
|
|
6486
|
+
class: {
|
|
6487
|
+
inputWrapper: ["border-b-xl"]
|
|
6488
|
+
}
|
|
6489
|
+
},
|
|
6490
|
+
{
|
|
6491
|
+
disabled: true,
|
|
6492
|
+
variant: ["outline", "underline"],
|
|
6493
|
+
class: {
|
|
6494
|
+
inputWrapper: ["!bg-body-background", "group-has-[p.error]/input:!border-danger-light"],
|
|
6495
|
+
content: [
|
|
6496
|
+
"group-has-[p.error]/input:!text-danger-light",
|
|
6497
|
+
"group-has-[p.error]/input:placeholder:!text-danger-light"
|
|
6498
|
+
]
|
|
6499
|
+
}
|
|
6500
|
+
},
|
|
6501
|
+
{
|
|
6502
|
+
readonly: true,
|
|
6503
|
+
color: "primary",
|
|
6504
|
+
class: {
|
|
6505
|
+
input: ["!text-primary-main", "placeholder:!text-primary-main"],
|
|
6506
|
+
content: ["!text-primary-main"]
|
|
6507
|
+
}
|
|
6508
|
+
},
|
|
6509
|
+
{
|
|
6510
|
+
readonly: true,
|
|
6511
|
+
color: "secondary",
|
|
6512
|
+
class: {
|
|
6513
|
+
input: ["!text-secondary-main", "placeholder:!text-secondary-main"],
|
|
6514
|
+
content: ["!text-secondary-main"]
|
|
6515
|
+
}
|
|
6516
|
+
}
|
|
6517
|
+
],
|
|
6518
|
+
defaultVariants: {
|
|
6519
|
+
variant: "solid",
|
|
6520
|
+
color: "primary",
|
|
6521
|
+
size: "md",
|
|
6522
|
+
direction: "vertical",
|
|
6523
|
+
disabled: false,
|
|
6524
|
+
readonly: false
|
|
6525
|
+
}
|
|
6526
|
+
},
|
|
6527
|
+
{
|
|
6528
|
+
twMerge: false
|
|
6529
|
+
}
|
|
6530
|
+
);
|
|
6531
|
+
|
|
6532
|
+
// src/components/picker/datePicker.tsx
|
|
6533
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
6534
|
+
var DatePicker = (0, import_react7.forwardRef)((originalProps, ref) => {
|
|
6535
|
+
const [props, variantProps] = mapPropsVariants(originalProps, datePickerStyle.variantKeys);
|
|
6536
|
+
const {
|
|
6537
|
+
classNames,
|
|
6538
|
+
label,
|
|
6539
|
+
errorMessage,
|
|
6540
|
+
helperMessage,
|
|
6541
|
+
value,
|
|
6542
|
+
onChange,
|
|
6543
|
+
size = "md",
|
|
6544
|
+
variant = "solid",
|
|
6545
|
+
color = "primary",
|
|
6546
|
+
full = false,
|
|
6547
|
+
disabled = false,
|
|
6548
|
+
placeholder = "",
|
|
6549
|
+
format = "YYYY-MM-DD",
|
|
6550
|
+
highlightWeekend = true,
|
|
6551
|
+
locale = "default",
|
|
6552
|
+
daysOfWeek = ["\uC77C", "\uC6D4", "\uD654", "\uC218", "\uBAA9", "\uAE08", "\uD1A0"],
|
|
6553
|
+
monthYearFormat = (year, month) => locale === "default" ? `${year}. ${(month + 1).toString().padStart(2, "0")}` : new Date(year, month).toLocaleString(locale, { year: "numeric", month: "2-digit" }),
|
|
6554
|
+
resetTitle,
|
|
6555
|
+
todayTitle,
|
|
6556
|
+
cancelTitle,
|
|
6557
|
+
confirmTitle,
|
|
6558
|
+
...inputProps
|
|
6559
|
+
} = props;
|
|
6560
|
+
const [selectedDate, setSelectedDate] = (0, import_react7.useState)(value || "");
|
|
6561
|
+
const [tempSelectedDate, setTempSelectedDate] = (0, import_react7.useState)(value || "");
|
|
6562
|
+
const [isPanelOpen, setIsPanelOpen] = (0, import_react7.useState)(false);
|
|
6563
|
+
const [currentDate, setCurrentDate] = (0, import_react7.useState)(tempSelectedDate ? new Date(tempSelectedDate) : /* @__PURE__ */ new Date());
|
|
6564
|
+
const inputWrapperRef = (0, import_react7.useRef)(null);
|
|
6565
|
+
const calendarWrapperRef = (0, import_react7.useRef)(null);
|
|
6566
|
+
const [panelPos, setPanelPos] = (0, import_react7.useState)({ top: -9999, left: -9999 });
|
|
6567
|
+
const blurTimeoutRef = (0, import_react7.useRef)(null);
|
|
6568
|
+
const formatDate = (dateString) => {
|
|
6569
|
+
if (!dateString) return "";
|
|
6570
|
+
const [year, month, day] = dateString.split("-");
|
|
6571
|
+
switch (format) {
|
|
6572
|
+
case "MM/DD/YYYY":
|
|
6573
|
+
return `${month}/${day}/${year}`;
|
|
6574
|
+
case "DD/MM/YYYY":
|
|
6575
|
+
return `${day}/${month}/${year}`;
|
|
6576
|
+
default:
|
|
6577
|
+
return dateString;
|
|
6578
|
+
}
|
|
6579
|
+
};
|
|
6580
|
+
const displayValue = (0, import_react7.useMemo)(() => formatDate(selectedDate), [selectedDate, format]);
|
|
6581
|
+
const calculatePosition = (0, import_react7.useCallback)(() => {
|
|
6582
|
+
if (inputWrapperRef.current) {
|
|
6583
|
+
const rect = inputWrapperRef.current.getBoundingClientRect();
|
|
6584
|
+
setPanelPos({ top: rect.bottom + window.scrollY + 6, left: rect.left + window.scrollX });
|
|
6585
|
+
}
|
|
6586
|
+
}, []);
|
|
6587
|
+
const handleFocusInput = () => {
|
|
6588
|
+
if (disabled) return;
|
|
6589
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
6590
|
+
calculatePosition();
|
|
6591
|
+
setIsPanelOpen(true);
|
|
6592
|
+
};
|
|
6593
|
+
const handleClose = () => {
|
|
6594
|
+
blurTimeoutRef.current = setTimeout(() => setIsPanelOpen(false), 100);
|
|
6595
|
+
};
|
|
6596
|
+
const handleInputKeyDown = (e) => {
|
|
6597
|
+
if (disabled) return;
|
|
6598
|
+
if (["Enter", " "].includes(e.key)) {
|
|
6599
|
+
e.preventDefault();
|
|
6600
|
+
calculatePosition();
|
|
6601
|
+
setIsPanelOpen((prev) => !prev);
|
|
6602
|
+
} else if (e.key === "Escape") setIsPanelOpen(false);
|
|
6603
|
+
};
|
|
6604
|
+
const handleCalendarIconClick = (e) => {
|
|
6605
|
+
e.preventDefault();
|
|
6606
|
+
if (disabled) return;
|
|
6607
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
6608
|
+
calculatePosition();
|
|
6609
|
+
setIsPanelOpen((prev) => !prev);
|
|
6610
|
+
};
|
|
6611
|
+
const handleClearDate = (e) => {
|
|
6612
|
+
e.preventDefault();
|
|
6613
|
+
setTempSelectedDate("");
|
|
6614
|
+
};
|
|
6615
|
+
const handleCalendarMouseDown = (e) => {
|
|
6616
|
+
e.preventDefault();
|
|
6617
|
+
if (blurTimeoutRef.current) clearTimeout(blurTimeoutRef.current);
|
|
6618
|
+
};
|
|
6619
|
+
const getCalendarDates = (0, import_react7.useCallback)(() => {
|
|
6620
|
+
const year = currentDate.getFullYear();
|
|
6621
|
+
const month = currentDate.getMonth();
|
|
6622
|
+
const firstDayOfMonth = new Date(year, month, 1).getDay();
|
|
6623
|
+
const lastDateOfMonth = new Date(year, month + 1, 0).getDate();
|
|
6624
|
+
const lastDateOfPrevMonth = new Date(year, month, 0).getDate();
|
|
6625
|
+
let dates = [];
|
|
6626
|
+
for (let i = firstDayOfMonth - 1; i >= 0; i--) dates.push({ date: lastDateOfPrevMonth - i, currentMonth: false });
|
|
6627
|
+
for (let date = 1; date <= lastDateOfMonth; date++) dates.push({ date, currentMonth: true });
|
|
6628
|
+
const remainingDays = 42 - dates.length;
|
|
6629
|
+
for (let i = 1; i <= remainingDays; i++) dates.push({ date: i, currentMonth: false });
|
|
6630
|
+
const weeks = [];
|
|
6631
|
+
for (let i = 0; i < dates.length; i += 7) weeks.push(dates.slice(i, i + 7));
|
|
6632
|
+
return weeks;
|
|
6633
|
+
}, [currentDate]);
|
|
6634
|
+
const handlePrevMonth = () => setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1));
|
|
6635
|
+
const handleNextMonth = () => setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1));
|
|
6636
|
+
const handleDateSelect = (date, isCurrentMonth) => {
|
|
6637
|
+
if (!isCurrentMonth) return;
|
|
6638
|
+
const selected = new Date(currentDate.getFullYear(), currentDate.getMonth(), date);
|
|
6639
|
+
const formatted = formatDateToString(selected);
|
|
6640
|
+
setTempSelectedDate(formatted);
|
|
6641
|
+
};
|
|
6642
|
+
const handleSetToday = () => {
|
|
6643
|
+
const today = /* @__PURE__ */ new Date();
|
|
6644
|
+
const formatted = formatDateToString(today);
|
|
6645
|
+
setCurrentDate(today);
|
|
6646
|
+
setTempSelectedDate(formatted);
|
|
6647
|
+
};
|
|
6648
|
+
const handleConfirmDate = () => {
|
|
6649
|
+
setSelectedDate(tempSelectedDate);
|
|
6650
|
+
onChange == null ? void 0 : onChange(tempSelectedDate);
|
|
6651
|
+
setIsPanelOpen(false);
|
|
6652
|
+
};
|
|
6653
|
+
const handleResetDate = () => {
|
|
6654
|
+
setTempSelectedDate(selectedDate);
|
|
6655
|
+
setIsPanelOpen(false);
|
|
6656
|
+
};
|
|
6657
|
+
const getDayProps = (0, import_react7.useCallback)(
|
|
6658
|
+
(dateObj) => {
|
|
6659
|
+
const today = /* @__PURE__ */ new Date();
|
|
6660
|
+
const isToday = today.getDate() === dateObj.date && today.getMonth() === currentDate.getMonth() && today.getFullYear() === currentDate.getFullYear();
|
|
6661
|
+
const formatted = tempSelectedDate ? formatStringToDate(tempSelectedDate) : null;
|
|
6662
|
+
const isSelected = (formatted == null ? void 0 : formatted.getDate()) === dateObj.date && formatted.getMonth() === currentDate.getMonth() && formatted.getFullYear() === currentDate.getFullYear();
|
|
6663
|
+
return dateObj.currentMonth && isSelected ? "selected" : dateObj.currentMonth && isToday ? "today" : !dateObj.currentMonth ? "disabled" : "default";
|
|
6664
|
+
},
|
|
6665
|
+
[tempSelectedDate, currentDate]
|
|
6666
|
+
);
|
|
6667
|
+
(0, import_react7.useEffect)(() => {
|
|
6668
|
+
setSelectedDate(value || "");
|
|
6669
|
+
setTempSelectedDate(value || "");
|
|
6670
|
+
if (value) setCurrentDate(new Date(value));
|
|
6671
|
+
}, [value]);
|
|
6672
|
+
const slots = (0, import_react7.useMemo)(() => datePickerStyle({ ...variantProps }), [variantProps]);
|
|
6673
|
+
const endContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon_default, { name: "calendar", size, className: "cursor-pointer", fill: true, onClick: handleCalendarIconClick });
|
|
6674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
6675
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref: inputWrapperRef, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), onClick: handleFocusInput, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6676
|
+
input_default,
|
|
6677
|
+
{
|
|
6678
|
+
...inputProps,
|
|
6679
|
+
ref,
|
|
6680
|
+
label,
|
|
6681
|
+
value: displayValue,
|
|
6682
|
+
placeholder,
|
|
6683
|
+
errorMessage,
|
|
6684
|
+
helperMessage,
|
|
6685
|
+
size,
|
|
6686
|
+
variant,
|
|
6687
|
+
color,
|
|
6688
|
+
full,
|
|
6689
|
+
disabled,
|
|
6690
|
+
endContent,
|
|
6691
|
+
onFocus: handleFocusInput,
|
|
6692
|
+
onBlur: handleClose,
|
|
6693
|
+
onKeyDown: handleInputKeyDown,
|
|
6694
|
+
onChange: () => {
|
|
6695
|
+
},
|
|
6696
|
+
classNames: {
|
|
6697
|
+
base: classNames == null ? void 0 : classNames.inputBase,
|
|
6698
|
+
inputWrapper: classNames == null ? void 0 : classNames.inputWrapper,
|
|
6699
|
+
input: classNames == null ? void 0 : classNames.input,
|
|
6700
|
+
label: classNames == null ? void 0 : classNames.label,
|
|
6701
|
+
errorMessage: classNames == null ? void 0 : classNames.errorMessage,
|
|
6702
|
+
helperMessage: classNames == null ? void 0 : classNames.helperMessage
|
|
6703
|
+
}
|
|
6704
|
+
}
|
|
6705
|
+
) }),
|
|
6706
|
+
isPanelOpen && (0, import_react_dom.createPortal)(
|
|
6707
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
6708
|
+
"div",
|
|
6709
|
+
{
|
|
6710
|
+
ref: calendarWrapperRef,
|
|
6711
|
+
className: slots.calendarWrapper({ class: classNames == null ? void 0 : classNames.calendarWrapper }),
|
|
6712
|
+
style: { position: "absolute", top: panelPos.top, left: panelPos.left, zIndex: 1e3 },
|
|
6713
|
+
onMouseDown: handleCalendarMouseDown,
|
|
6714
|
+
children: [
|
|
6715
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: slots.calendarHead({ class: classNames == null ? void 0 : classNames.calendarHead }), children: [
|
|
6716
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "left", variant: "soft", color: "neutral", onClick: handlePrevMonth }),
|
|
6717
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-xl font-extrabold", children: monthYearFormat(currentDate.getFullYear(), currentDate.getMonth()) }),
|
|
6718
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(icon_button_default, { name: "right", variant: "soft", color: "neutral", onClick: handleNextMonth })
|
|
6719
|
+
] }),
|
|
6720
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-7", children: daysOfWeek.map((day, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(day_default, { variant: "text", children: day }, `${day}-${index}`)) }),
|
|
6721
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-7 gap-[5px] text-center", children: getCalendarDates().map((week, weekIndex) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react7.Fragment, { children: week.map((dateObj, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6722
|
+
day_default,
|
|
6723
|
+
{
|
|
6724
|
+
variant: getDayProps(dateObj),
|
|
6725
|
+
onClick: () => handleDateSelect(dateObj.date, dateObj.currentMonth),
|
|
6726
|
+
children: dateObj.date
|
|
6727
|
+
},
|
|
6728
|
+
index
|
|
6729
|
+
)) }, weekIndex)) }),
|
|
6730
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex justify-between px-[10px]", children: [
|
|
6731
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6732
|
+
text_button_default,
|
|
6733
|
+
{
|
|
6734
|
+
variant: "underline",
|
|
6735
|
+
color: "neutral",
|
|
6736
|
+
size: "sm",
|
|
6737
|
+
classNames: { base: "font-bold" },
|
|
6738
|
+
onClick: handleClearDate,
|
|
6739
|
+
children: resetTitle
|
|
6740
|
+
}
|
|
6741
|
+
),
|
|
6742
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(text_button_default, { variant: "underline", size: "sm", classNames: { base: "font-bold" }, onClick: handleSetToday, children: todayTitle })
|
|
6743
|
+
] }),
|
|
6744
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-[10px]", children: [
|
|
6745
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
6746
|
+
button_default,
|
|
6747
|
+
{
|
|
6748
|
+
variant: "soft",
|
|
6749
|
+
color: "neutral",
|
|
6750
|
+
size: "sm",
|
|
6751
|
+
classNames: { base: "flex flex-1" },
|
|
6752
|
+
onClick: handleResetDate,
|
|
6753
|
+
children: cancelTitle
|
|
6754
|
+
}
|
|
6755
|
+
),
|
|
6756
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(button_default, { size: "sm", classNames: { base: "flex flex-1" }, onClick: handleConfirmDate, children: confirmTitle })
|
|
6757
|
+
] })
|
|
6758
|
+
]
|
|
6759
|
+
}
|
|
6760
|
+
),
|
|
6761
|
+
document.body
|
|
6762
|
+
)
|
|
6763
|
+
] });
|
|
6764
|
+
});
|
|
6765
|
+
DatePicker.displayName = "DatePicker";
|
|
6766
|
+
var datePicker_default = DatePicker;
|
|
6767
|
+
var datePickerStyle = tv({
|
|
6768
|
+
slots: {
|
|
6769
|
+
base: ["group/datepicker", "flex", "flex-col", "cursor-pointer"],
|
|
6770
|
+
calendarWrapper: [
|
|
6771
|
+
"flex",
|
|
6772
|
+
"flex-col",
|
|
6773
|
+
"rounded-xl",
|
|
6774
|
+
"bg-body-background",
|
|
6775
|
+
"shadow-drop-xl",
|
|
6776
|
+
"gap-[5px]",
|
|
6777
|
+
"overflow-auto",
|
|
6778
|
+
"w-[300px]",
|
|
6779
|
+
"select-none",
|
|
6780
|
+
"p-[10px]"
|
|
6781
|
+
],
|
|
6782
|
+
calendarHead: ["calendar-header", "flex", "items-center", "justify-between", "h-[40px]"],
|
|
6783
|
+
inputBase: [],
|
|
6784
|
+
inputWrapper: [],
|
|
6785
|
+
input: [],
|
|
6786
|
+
label: [],
|
|
6787
|
+
errorMessage: [],
|
|
6788
|
+
helperMessage: []
|
|
6789
|
+
},
|
|
6790
|
+
variants: {
|
|
6791
|
+
color: { primary: {}, secondary: {} },
|
|
6792
|
+
size: { sm: {}, md: {}, lg: {}, xl: {} },
|
|
6793
|
+
full: { true: { base: ["w-full"] } },
|
|
6794
|
+
disabled: { true: { base: ["pointer-events-none"] } }
|
|
6795
|
+
},
|
|
5442
6796
|
defaultVariants: {
|
|
5443
6797
|
color: "primary",
|
|
5444
6798
|
size: "md",
|