@bigtablet/design-system 1.11.4 → 1.11.5

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 CHANGED
@@ -873,10 +873,11 @@
873
873
  gap: 0.25rem;
874
874
  }
875
875
  .date_picker_label {
876
- font-family: "Pretendard", sans-serif;
876
+ color: #1a1a1a;
877
+ margin-bottom: 0.25rem;
878
+ font-weight: 500;
877
879
  font-size: 0.875rem;
878
880
  line-height: 1.5;
879
- color: #666666;
880
881
  }
881
882
  .date_picker_required {
882
883
  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
- const result = mode === "year-month" ? `${yy}-${pad(mm)}` : `${yy}-${pad(mm)}-${pad(dd ?? 1)}`;
614
- onChange(result);
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
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "1.11.4",
3
+ "version": "1.11.5",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",