@bigtablet/design-system 1.8.0 → 1.9.1

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
@@ -866,6 +866,98 @@
866
866
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
867
867
  }
868
868
 
869
+ /* src/ui/form/date-picker/style.scss */
870
+ .date_picker {
871
+ display: flex;
872
+ flex-direction: column;
873
+ gap: 0.25rem;
874
+ }
875
+ .date_picker_label {
876
+ font-family: "Pretendard", sans-serif;
877
+ font-size: 0.875rem;
878
+ line-height: 1.5;
879
+ color: #666666;
880
+ }
881
+ .date_picker_required {
882
+ margin-left: 0.25rem;
883
+ color: #ef4444;
884
+ }
885
+ .date_picker_fields {
886
+ display: flex;
887
+ gap: 0.5rem;
888
+ }
889
+ .date_picker select {
890
+ min-width: 88px;
891
+ height: 44px;
892
+ padding: 0 0.75rem;
893
+ font-family: "Pretendard", sans-serif;
894
+ font-size: 0.9375rem;
895
+ line-height: 1.5;
896
+ color: #1a1a1a;
897
+ background-color: #ffffff;
898
+ border: 1px solid #e5e5e5;
899
+ border-radius: 6px;
900
+ cursor: pointer;
901
+ transition:
902
+ border-color 0.1s ease-out,
903
+ box-shadow 0.1s ease-out,
904
+ background-color 0.1s ease-out;
905
+ appearance: none;
906
+ background-image:
907
+ linear-gradient(
908
+ 45deg,
909
+ transparent 50%,
910
+ #666666 50%),
911
+ linear-gradient(
912
+ 135deg,
913
+ #666666 50%,
914
+ transparent 50%);
915
+ background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
916
+ background-size: 5px 5px;
917
+ background-repeat: no-repeat;
918
+ }
919
+ .date_picker select:hover:not(:disabled) {
920
+ border-color: #000000;
921
+ background-color: #fafafa;
922
+ }
923
+ .date_picker select:focus-visible {
924
+ outline: none;
925
+ border-color: #000000;
926
+ box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
927
+ background-color: #ffffff;
928
+ }
929
+ .date_picker select:disabled {
930
+ cursor: not-allowed;
931
+ color: #9ca3af;
932
+ background-color: #fafafa;
933
+ border-color: rgba(0, 0, 0, 0.08);
934
+ }
935
+ .date_picker select option {
936
+ color: #1a1a1a;
937
+ }
938
+ .date_picker_full {
939
+ width: 100%;
940
+ }
941
+ .date_picker_full .date_picker_fields {
942
+ width: 100%;
943
+ }
944
+ .date_picker_full select {
945
+ flex: 1;
946
+ min-width: 0;
947
+ }
948
+ .date_picker_disabled .date_picker_label {
949
+ color: #9ca3af;
950
+ }
951
+ @media (max-width: 480px) {
952
+ .date_picker_fields {
953
+ gap: 0.25rem;
954
+ }
955
+ .date_picker select {
956
+ flex: 1;
957
+ min-width: 0;
958
+ }
959
+ }
960
+
869
961
  /* src/ui/navigation/pagination/style.scss */
870
962
  .pagination {
871
963
  display: flex;
package/dist/index.d.ts CHANGED
@@ -123,6 +123,19 @@ interface TextFieldProps extends Omit<React.InputHTMLAttributes<HTMLInputElement
123
123
  }
124
124
  declare const TextField: React.ForwardRefExoticComponent<TextFieldProps & React.RefAttributes<HTMLInputElement>>;
125
125
 
126
+ type DatePickerMode = "year-month" | "year-month-day";
127
+ interface DatePickerProps {
128
+ label?: string;
129
+ required?: boolean;
130
+ value?: string;
131
+ onChange: (value: string) => void;
132
+ mode?: DatePickerMode;
133
+ startYear?: number;
134
+ endYear?: number;
135
+ disabled?: boolean;
136
+ }
137
+ declare const DatePicker: ({ label, required, value, onChange, mode, startYear, endYear, disabled, }: DatePickerProps) => react_jsx_runtime.JSX.Element;
138
+
126
139
  interface PaginationProps {
127
140
  page: number;
128
141
  totalPages: number;
@@ -139,4 +152,4 @@ interface ModalProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">
139
152
  }
140
153
  declare const Modal: ({ open, onClose, closeOnOverlay, width, title, children, className, ...props }: ModalProps) => react_jsx_runtime.JSX.Element | null;
141
154
 
142
- export { AlertProvider, Button, Card, Checkbox, FileInput, Loading, Modal, Pagination, Radio, Select, type SelectOption, Switch, TextField, ToastProvider, useAlert, useToast };
155
+ export { AlertProvider, Button, Card, Checkbox, DatePicker, FileInput, Loading, Modal, Pagination, Radio, Select, type SelectOption, Switch, TextField, ToastProvider, useAlert, useToast };
package/dist/index.js CHANGED
@@ -524,6 +524,86 @@ var TextField = React3.forwardRef(
524
524
  }
525
525
  );
526
526
  TextField.displayName = "TextField";
527
+ var pad = (n) => String(n).padStart(2, "0");
528
+ var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
529
+ var DatePicker = ({
530
+ label,
531
+ required,
532
+ value,
533
+ onChange,
534
+ mode = "year-month-day",
535
+ startYear = 1950,
536
+ endYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
537
+ disabled
538
+ }) => {
539
+ const [y, m, d] = value?.split("-").map(Number) ?? [];
540
+ const year = y ?? "";
541
+ const month = m ?? "";
542
+ const day = d ?? "";
543
+ const days = year && month ? getDaysInMonth(year, month) : 31;
544
+ const emit = (yy, mm, dd) => {
545
+ const result = mode === "year-month" ? `${yy}-${pad(mm)}-01` : `${yy}-${pad(mm)}-${pad(dd ?? 1)}`;
546
+ onChange(result);
547
+ };
548
+ return /* @__PURE__ */ jsxs(
549
+ "div",
550
+ {
551
+ className: [
552
+ "date_picker",
553
+ disabled && "date_picker_disabled"
554
+ ].filter(Boolean).join(" "),
555
+ children: [
556
+ label && /* @__PURE__ */ jsxs("label", { className: "date_picker_label", children: [
557
+ label,
558
+ required && /* @__PURE__ */ jsx("span", { className: "date_picker_required", children: "*" })
559
+ ] }),
560
+ /* @__PURE__ */ jsxs("div", { className: "date_picker_fields", children: [
561
+ /* @__PURE__ */ jsxs(
562
+ "select",
563
+ {
564
+ value: year,
565
+ disabled,
566
+ onChange: (e) => emit(Number(e.target.value), month || 1, day || 1),
567
+ children: [
568
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true }),
569
+ Array.from(
570
+ { length: endYear - startYear + 1 },
571
+ (_, i) => startYear + i
572
+ ).map((y2) => /* @__PURE__ */ jsx("option", { value: y2, children: y2 }, y2))
573
+ ]
574
+ }
575
+ ),
576
+ /* @__PURE__ */ jsxs(
577
+ "select",
578
+ {
579
+ value: month,
580
+ disabled: disabled || !year,
581
+ onChange: (e) => emit(year, Number(e.target.value), day || 1),
582
+ children: [
583
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true }),
584
+ Array.from({ length: 12 }, (_, i) => i + 1).map((m2) => /* @__PURE__ */ jsx("option", { value: m2, children: pad(m2) }, m2))
585
+ ]
586
+ }
587
+ ),
588
+ mode === "year-month-day" && /* @__PURE__ */ jsxs(
589
+ "select",
590
+ {
591
+ value: day,
592
+ disabled: disabled || !month,
593
+ onChange: (e) => emit(year, month, Number(e.target.value)),
594
+ children: [
595
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true }),
596
+ Array.from({ length: days }, (_, i) => i + 1).map(
597
+ (d2) => /* @__PURE__ */ jsx("option", { value: d2, children: pad(d2) }, d2)
598
+ )
599
+ ]
600
+ }
601
+ )
602
+ ] })
603
+ ]
604
+ }
605
+ );
606
+ };
527
607
  var range = (start, end) => {
528
608
  const out = [];
529
609
  for (let i = start; i <= end; i += 1) out.push(i);
@@ -632,4 +712,4 @@ var Modal = ({
632
712
  );
633
713
  };
634
714
 
635
- export { AlertProvider, Button, Card, Checkbox, FileInput, Loading, Modal, Pagination, Radio, Select, Switch, TextField, ToastProvider, useAlert, useToast };
715
+ export { AlertProvider, Button, Card, Checkbox, DatePicker, FileInput, Loading, Modal, Pagination, Radio, Select, Switch, TextField, ToastProvider, useAlert, useToast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "1.8.0",
3
+ "version": "1.9.1",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",