@sunggang/ui-lib 0.1.21 → 0.1.22
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/index.esm2.js +51 -38
- package/package.json +1 -1
- package/src/components/ui/dateRangePicker.d.ts +2 -1
package/index.esm2.js
CHANGED
|
@@ -6880,7 +6880,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
6880
6880
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
6881
6881
|
}
|
|
6882
6882
|
function DateRangePicker(param) {
|
|
6883
|
-
var className = param.className, inputClassName = param.inputClassName, disable = param.disable, onChange = param.onChange, dates = param.dates;
|
|
6883
|
+
var className = param.className, inputClassName = param.inputClassName, disable = param.disable, _param_isShowCleanBtn = param.isShowCleanBtn, isShowCleanBtn = _param_isShowCleanBtn === void 0 ? true : _param_isShowCleanBtn, onChange = param.onChange, dates = param.dates;
|
|
6884
6884
|
var _useState = _sliced_to_array(useState({
|
|
6885
6885
|
from: (dates === null || dates === void 0 ? void 0 : dates.from) || undefined,
|
|
6886
6886
|
to: (dates === null || dates === void 0 ? void 0 : dates.to) || undefined
|
|
@@ -6891,47 +6891,60 @@ function DateRangePicker(param) {
|
|
|
6891
6891
|
if (onChange) onChange(newDate);
|
|
6892
6892
|
}
|
|
6893
6893
|
};
|
|
6894
|
-
return /*#__PURE__*/
|
|
6895
|
-
className:
|
|
6896
|
-
children:
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
children:
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
className: "
|
|
6907
|
-
}),
|
|
6908
|
-
(date === null || date === void 0 ? void 0 : date.from) ? date.to ? /*#__PURE__*/ jsxs(Fragment$1, {
|
|
6894
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
6895
|
+
className: "flex gap-2 items-center",
|
|
6896
|
+
children: [
|
|
6897
|
+
/*#__PURE__*/ jsx("div", {
|
|
6898
|
+
className: cn("grid gap-2", className, disable ? "pointer-events-none opacity-55" : "pointer-events-auto opacity-100"),
|
|
6899
|
+
children: /*#__PURE__*/ jsxs(Popover, {
|
|
6900
|
+
children: [
|
|
6901
|
+
/*#__PURE__*/ jsx(PopoverTrigger, {
|
|
6902
|
+
asChild: true,
|
|
6903
|
+
children: /*#__PURE__*/ jsxs(Button, {
|
|
6904
|
+
id: "date",
|
|
6905
|
+
variant: "outline",
|
|
6906
|
+
className: cn("w-[300px] justify-start text-left font-normal", !date && "text-muted-foreground", inputClassName),
|
|
6909
6907
|
children: [
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6908
|
+
/*#__PURE__*/ jsx(Calendar$1, {
|
|
6909
|
+
className: "mr-2 h-4 w-4"
|
|
6910
|
+
}),
|
|
6911
|
+
(date === null || date === void 0 ? void 0 : date.from) ? date.to ? /*#__PURE__*/ jsxs(Fragment$1, {
|
|
6912
|
+
children: [
|
|
6913
|
+
format(date.from, "yyyy-MM-dd"),
|
|
6914
|
+
" -",
|
|
6915
|
+
" ",
|
|
6916
|
+
format(date.to, "yyyy-MM-dd")
|
|
6917
|
+
]
|
|
6918
|
+
}) : format(date.from, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
|
|
6919
|
+
children: "請選擇日期"
|
|
6920
|
+
})
|
|
6914
6921
|
]
|
|
6915
|
-
}) : format(date.from, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
|
|
6916
|
-
children: "請選擇日期"
|
|
6917
6922
|
})
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6923
|
+
}),
|
|
6924
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
6925
|
+
className: "w-auto p-0",
|
|
6926
|
+
align: "start",
|
|
6927
|
+
children: /*#__PURE__*/ jsx(Calendar, {
|
|
6928
|
+
initialFocus: true,
|
|
6929
|
+
mode: "range",
|
|
6930
|
+
defaultMonth: date === null || date === void 0 ? void 0 : date.from,
|
|
6931
|
+
selected: date,
|
|
6932
|
+
onSelect: handleDateChange,
|
|
6933
|
+
numberOfMonths: 2
|
|
6934
|
+
})
|
|
6935
|
+
})
|
|
6936
|
+
]
|
|
6932
6937
|
})
|
|
6933
|
-
|
|
6934
|
-
|
|
6938
|
+
}),
|
|
6939
|
+
isShowCleanBtn && /*#__PURE__*/ jsx(Button, {
|
|
6940
|
+
variant: "ghost",
|
|
6941
|
+
className: cn("justify-start text-left font-normal"),
|
|
6942
|
+
onClick: function() {
|
|
6943
|
+
return setDate(undefined);
|
|
6944
|
+
},
|
|
6945
|
+
children: "清除日期"
|
|
6946
|
+
})
|
|
6947
|
+
]
|
|
6935
6948
|
});
|
|
6936
6949
|
}
|
|
6937
6950
|
|
package/package.json
CHANGED
|
@@ -7,8 +7,9 @@ interface DateRangePickerProps {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
inputClassName?: string;
|
|
9
9
|
disable?: boolean;
|
|
10
|
+
isShowCleanBtn?: boolean;
|
|
10
11
|
onChange?: (date: DateRange) => void;
|
|
11
12
|
dates?: DateRangeType;
|
|
12
13
|
}
|
|
13
|
-
declare function DateRangePicker({ className, inputClassName, disable, onChange, dates, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DateRangePicker({ className, inputClassName, disable, isShowCleanBtn, onChange, dates, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export { DateRangePicker };
|