@bigtablet/design-system 1.11.4 → 1.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -2
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -869,14 +869,14 @@
|
|
|
869
869
|
/* src/ui/form/date-picker/style.scss */
|
|
870
870
|
.date_picker {
|
|
871
871
|
display: flex;
|
|
872
|
-
flex-direction: column;
|
|
873
872
|
gap: 0.25rem;
|
|
874
873
|
}
|
|
875
874
|
.date_picker_label {
|
|
876
|
-
|
|
875
|
+
color: #1a1a1a;
|
|
876
|
+
margin-bottom: 0.25rem;
|
|
877
|
+
font-weight: 500;
|
|
877
878
|
font-size: 0.875rem;
|
|
878
879
|
line-height: 1.5;
|
|
879
|
-
color: #666666;
|
|
880
880
|
}
|
|
881
881
|
.date_picker_required {
|
|
882
882
|
margin-left: 0.25rem;
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.
|
|
|
129
129
|
|
|
130
130
|
type DatePickerMode = "year-month" | "year-month-day";
|
|
131
131
|
interface DatePickerProps {
|
|
132
|
+
label?: string;
|
|
132
133
|
value?: string;
|
|
133
134
|
onChange: (value: string) => void;
|
|
134
135
|
mode?: DatePickerMode;
|
|
@@ -143,7 +144,7 @@ interface DatePickerProps {
|
|
|
143
144
|
day?: number | string;
|
|
144
145
|
};
|
|
145
146
|
}
|
|
146
|
-
declare const DatePicker: ({ value, onChange, mode, startYear, endYear, minDate, disabled, width, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
147
|
+
declare const DatePicker: ({ label, value, onChange, mode, startYear, endYear, minDate, disabled, width, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
|
|
147
148
|
|
|
148
149
|
interface PaginationProps {
|
|
149
150
|
page: number;
|
package/dist/index.js
CHANGED
|
@@ -592,6 +592,7 @@ var pad = (n) => String(n).padStart(2, "0");
|
|
|
592
592
|
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
593
593
|
var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
|
|
594
594
|
var DatePicker = ({
|
|
595
|
+
label,
|
|
595
596
|
value,
|
|
596
597
|
onChange,
|
|
597
598
|
mode = "year-month-day",
|
|
@@ -609,11 +610,20 @@ var DatePicker = ({
|
|
|
609
610
|
const minMonth = minY && year === minY ? minM : 1;
|
|
610
611
|
const minDay = minY && minM && year === minY && month === minM ? minD : 1;
|
|
611
612
|
const days = year && month ? getDaysInMonth(year, month) : 31;
|
|
613
|
+
const clampDay = (year2, month2, day2) => {
|
|
614
|
+
const maxDay = getDaysInMonth(year2, month2);
|
|
615
|
+
return Math.min(day2, maxDay);
|
|
616
|
+
};
|
|
612
617
|
const emit = (yy, mm, dd) => {
|
|
613
|
-
|
|
614
|
-
|
|
618
|
+
if (mode === "year-month") {
|
|
619
|
+
onChange(`${yy}-${pad(mm)}`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
const safeDay = clampDay(yy, mm, dd ?? 1);
|
|
623
|
+
onChange(`${yy}-${pad(mm)}-${pad(safeDay)}`);
|
|
615
624
|
};
|
|
616
625
|
return /* @__PURE__ */ jsxs("div", { className: "date_picker", style: { width: normalizeWidth(width?.container) }, children: [
|
|
626
|
+
label && /* @__PURE__ */ jsx("label", { className: "date_picker_label", children: label }),
|
|
617
627
|
/* @__PURE__ */ jsxs(
|
|
618
628
|
"select",
|
|
619
629
|
{
|