@pichetch08/trip-ui 0.2.5 → 0.2.7

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.
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { forwardRef } from "react";
9
9
  import { Spinner } from "./spinner";
10
10
  const VARIANT = {
11
- primary: "bg-primary text-on-primary hover:[filter:brightness(0.88)] shadow-sm hover:shadow-md active:scale-[0.98]",
11
+ primary: "bg-primary text-(--on-primary) hover:[filter:brightness(0.88)] shadow-sm hover:shadow-md active:scale-[0.98]",
12
12
  secondary: "bg-surface-container text-on-surface hover:bg-surface-container-high active:scale-[0.98]",
13
13
  outline: "bg-transparent border border-outline-variant text-on-surface hover:bg-surface-container-low hover:border-outline active:scale-[0.98]",
14
14
  ghost: "bg-transparent text-on-surface-variant hover:bg-surface-container hover:text-on-surface active:scale-[0.98]",
@@ -11,9 +11,10 @@ interface DatePickerProps {
11
11
  error?: string;
12
12
  icon?: string;
13
13
  name?: string;
14
+ size?: "sm" | "md";
14
15
  dayNames?: string[];
15
16
  monthNames?: string[];
16
17
  }
17
- declare function DatePicker({ label, value, onChange, placeholder, todayLabel, clearLabel, min, max, required, error, icon, name, dayNames, monthNames, }: DatePickerProps): React.ReactNode;
18
+ declare function DatePicker({ label, value, onChange, placeholder, todayLabel, clearLabel, min, max, required, error, icon, name, size, dayNames, monthNames, }: DatePickerProps): React.ReactNode;
18
19
 
19
20
  export { DatePicker };
@@ -50,6 +50,7 @@ function DatePicker({
50
50
  error,
51
51
  icon = "calendar_today",
52
52
  name,
53
+ size = "md",
53
54
  dayNames = DAYS_TH,
54
55
  monthNames = MONTHS_TH
55
56
  }) {
@@ -137,9 +138,9 @@ function DatePicker({
137
138
  "aria-haspopup": "dialog",
138
139
  "aria-required": required,
139
140
  onClick: () => setOpen(!open),
140
- className: `relative w-full bg-surface-container-low border rounded-xl py-4 px-6 text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${icon ? "pl-12" : ""} ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
141
+ className: `relative w-full bg-surface-container-low border rounded-xl text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${size === "sm" ? `h-10 px-3 text-sm ${icon ? "pl-8" : ""}` : `py-4 px-6 ${icon ? "pl-12" : ""}`} ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
141
142
  children: [
142
- icon && /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined absolute left-4 top-1/2 -translate-y-1/2 text-on-surface-variant", children: icon }),
143
+ icon && /* @__PURE__ */ jsx("span", { className: `material-symbols-outlined absolute top-1/2 -translate-y-1/2 text-on-surface-variant ${size === "sm" ? "left-2.5 text-base" : "left-4"}`, children: icon }),
143
144
  displayValue ? /* @__PURE__ */ jsx("span", { className: "text-on-surface", children: displayValue }) : /* @__PURE__ */ jsx("span", { className: "text-outline/40", children: placeholder })
144
145
  ]
145
146
  }
@@ -17,9 +17,10 @@ interface DateRangePickerProps {
17
17
  icon?: string;
18
18
  nameStart?: string;
19
19
  nameEnd?: string;
20
+ size?: "sm" | "md";
20
21
  monthNames?: string[];
21
22
  dayNames?: string[];
22
23
  }
23
- declare function DateRangePicker({ label, startDate, endDate, onStartChange, onEndChange, required, error, placeholder, clearLabel, confirmLabel, minDate: minDateStr, maxDate: maxDateStr, icon, nameStart, nameEnd, monthNames, dayNames, }: DateRangePickerProps): React.ReactNode;
24
+ declare function DateRangePicker({ label, startDate, endDate, onStartChange, onEndChange, required, error, placeholder, clearLabel, confirmLabel, minDate: minDateStr, maxDate: maxDateStr, icon, nameStart, nameEnd, size, monthNames, dayNames, }: DateRangePickerProps): React.ReactNode;
24
25
 
25
26
  export { DateRangePicker };
@@ -187,6 +187,7 @@ function DateRangePicker({
187
187
  icon = "calendar_month",
188
188
  nameStart,
189
189
  nameEnd,
190
+ size = "md",
190
191
  monthNames = THAI_MONTHS_SHORT,
191
192
  dayNames = WEEKDAY_LABELS
192
193
  }) {
@@ -316,9 +317,9 @@ function DateRangePicker({
316
317
  "aria-haspopup": "dialog",
317
318
  "aria-required": required,
318
319
  onClick: handleOpen,
319
- className: `relative w-full bg-surface-container-low border rounded-xl py-4 pl-12 pr-10 text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
320
+ className: `relative w-full bg-surface-container-low border rounded-xl text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${size === "sm" ? "h-10 pl-8 pr-8 text-sm" : "py-4 pl-12 pr-10"} ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
320
321
  children: [
321
- /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined absolute left-4 top-1/2 -translate-y-1/2 text-on-surface-variant", children: icon }),
322
+ /* @__PURE__ */ jsx("span", { className: `material-symbols-outlined absolute top-1/2 -translate-y-1/2 text-on-surface-variant ${size === "sm" ? "left-2.5 text-base" : "left-4"}`, children: icon }),
322
323
  displayText ? /* @__PURE__ */ jsx("span", { className: "text-on-surface text-sm", children: displayText }) : /* @__PURE__ */ jsxs("span", { className: "text-outline/40 text-sm", children: [
323
324
  placeholder.start,
324
325
  " \u2192 ",
@@ -13,7 +13,8 @@ interface TimePickerProps {
13
13
  error?: string;
14
14
  icon?: string;
15
15
  name?: string;
16
+ size?: "sm" | "md";
16
17
  }
17
- declare function TimePicker({ label, value, onChange, onBlur, placeholder, hourLabel, minuteLabel, quickSelectLabel, clearLabel, confirmLabel, required, error, icon, name, }: TimePickerProps): React.ReactNode;
18
+ declare function TimePicker({ label, value, onChange, onBlur, placeholder, hourLabel, minuteLabel, quickSelectLabel, clearLabel, confirmLabel, required, error, icon, name, size, }: TimePickerProps): React.ReactNode;
18
19
 
19
20
  export { TimePicker };
@@ -34,7 +34,8 @@ function TimePicker({
34
34
  required,
35
35
  error,
36
36
  icon = "schedule",
37
- name
37
+ name,
38
+ size = "md"
38
39
  }) {
39
40
  const [open, setOpen] = useState(false);
40
41
  const containerRef = useRef(null);
@@ -124,9 +125,9 @@ function TimePicker({
124
125
  "aria-haspopup": "dialog",
125
126
  "aria-required": required,
126
127
  onClick: () => setOpen(!open),
127
- className: `relative w-full bg-surface-container-low border rounded-xl py-4 px-6 text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${icon ? "pl-12" : ""} ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
128
+ className: `relative w-full bg-surface-container-low border rounded-xl text-left transition-all font-medium outline-none active:scale-[0.99] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30 ${size === "sm" ? `h-10 px-3 text-sm ${icon ? "pl-8" : ""}` : `py-4 px-6 ${icon ? "pl-12" : ""}`} ${open ? "bg-surface ring-2 ring-primary/20 border-primary" : error ? "border-red-400 bg-red-50/30" : "border-transparent hover:border-outline-variant"}`,
128
129
  children: [
129
- icon && /* @__PURE__ */ jsx("span", { className: "material-symbols-outlined absolute left-4 top-1/2 -translate-y-1/2 text-on-surface-variant", children: icon }),
130
+ icon && /* @__PURE__ */ jsx("span", { className: `material-symbols-outlined absolute top-1/2 -translate-y-1/2 text-on-surface-variant ${size === "sm" ? "left-2.5 text-base" : "left-4"}`, children: icon }),
130
131
  displayValue ? /* @__PURE__ */ jsx("span", { className: "text-on-surface", children: displayValue }) : /* @__PURE__ */ jsx("span", { className: "text-outline/40", children: placeholder })
131
132
  ]
132
133
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pichetch08/trip-ui",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Trip UI — shared React component library built with Tailwind v4 and Material Design 3 tokens",
5
5
  "author": "pichetch08",
6
6
  "license": "MIT",