@refinn/core-ui 0.1.14 → 0.1.16

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.d.mts CHANGED
@@ -18,12 +18,20 @@ declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.
18
18
 
19
19
  type AlertVariant$1 = 'none' | 'info' | 'danger' | 'warning' | 'success';
20
20
  type AlertMode$1 = 'page' | 'section' | 'inline';
21
+ interface AlertBannerAction {
22
+ label: string;
23
+ href?: string;
24
+ onClick?: () => void;
25
+ }
21
26
  interface AlertBannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
22
27
  variant?: AlertVariant$1;
23
28
  mode?: AlertMode$1;
24
29
  title?: ReactNode;
25
30
  description?: ReactNode;
26
- action?: [string?, string?];
31
+ /** Renders as a button (page mode) or an icon link (section/inline mode) on its own row below the content. */
32
+ buttonAction?: AlertBannerAction;
33
+ /** Renders as an underlined link inline with the content, next to the close button. */
34
+ buttonLink?: AlertBannerAction;
27
35
  icon?: ReactNode;
28
36
  onClose?: () => void;
29
37
  }
@@ -84,18 +92,59 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "siz
84
92
  declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
85
93
 
86
94
  type ChipSize = "sm" | "md" | "lg";
87
- interface ChipProps extends HTMLAttributes<HTMLDivElement> {
95
+ type ChipVariant = "brand" | "dark";
96
+ interface ChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
88
97
  size?: ChipSize;
89
- src?: string;
90
- alt?: string;
91
98
  label: string;
92
- icon?: ReactNode;
93
- isOutlined?: boolean;
94
- isDark?: boolean;
95
- isSelected?: boolean;
99
+ /** Only affects the selected appearance — unselected chips look the same for both variants. */
100
+ variant?: ChipVariant;
101
+ /** Ignored while selected — selection always renders as a solid chip. */
102
+ outline?: boolean;
103
+ selected?: boolean;
104
+ defaultSelected?: boolean;
105
+ onSelectedChange?: (selected: boolean) => void;
106
+ startIcon?: ReactNode;
107
+ endIcon?: ReactNode;
108
+ /** Renders a circular financial-institution logo in place of startIcon. Not supported at size "sm". */
109
+ bankLogoSrc?: string;
110
+ bankLogoAlt?: string;
111
+ }
112
+ declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLButtonElement>>;
113
+
114
+ type TextFieldSize = "md" | "lg";
115
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
116
+ size?: TextFieldSize;
117
+ error?: string;
118
+ label?: string;
119
+ placeholder?: string;
120
+ helperText?: string;
121
+ prefix?: ReactNode;
122
+ suffix?: ReactNode;
123
+ optional?: boolean;
124
+ success?: boolean;
125
+ pending?: boolean;
126
+ clearable?: boolean;
96
127
  disabled?: boolean;
128
+ value?: string;
129
+ onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
97
130
  }
98
- declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLDivElement>>;
131
+ declare const TextField: react__default.ForwardRefExoticComponent<TextFieldProps & react__default.RefAttributes<HTMLInputElement>>;
132
+
133
+ interface CurrencyFieldProps extends Omit<TextFieldProps, "value" | "onChange" | "prefix" | "type" | "inputMode"> {
134
+ value?: number;
135
+ onChange?: (value: number | undefined) => void;
136
+ /** จำนวนเงินขั้นต่ำที่ยอมรับได้ — ถ้าไม่กำหนดจะไม่มีการตรวจสอบขั้นต่ำ */
137
+ min?: number;
138
+ /** ข้อความ error ที่แสดงเมื่อค่าต่ำกว่า min (ค่าเริ่มต้นจะสร้างให้อัตโนมัติ) */
139
+ minErrorText?: string;
140
+ /** จำนวนเงินสูงสุดที่ยอมรับได้ — ถ้าไม่กำหนดจะไม่มีการตรวจสอบสูงสุด */
141
+ max?: number;
142
+ /** ข้อความ error ที่แสดงเมื่อค่าเกิน max (ค่าเริ่มต้นจะสร้างให้อัตโนมัติ) */
143
+ maxErrorText?: string;
144
+ /** สัญลักษณ์สกุลเงินที่แสดงหน้าช่องกรอก (ค่าเริ่มต้นคือ ฿) */
145
+ currencyIcon?: ReactNode;
146
+ }
147
+ declare const CurrencyField: react__default.ForwardRefExoticComponent<CurrencyFieldProps & react__default.RefAttributes<HTMLInputElement>>;
99
148
 
100
149
  type DialogDisplay = 'centered' | 'slide-up' | 'full';
101
150
  type DialogActionProps = Omit<ButtonProps, 'variant' | 'children'> & {
@@ -185,9 +234,14 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
185
234
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
186
235
 
187
236
  type IconButtonSize = 'xs' | 's' | 'm' | 'l';
237
+ type IconButtonSurface = 'default' | 'dark' | 'light';
188
238
  interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
189
239
  icon: ReactNode;
190
240
  size?: IconButtonSize;
241
+ /** Which background the button sits on — picks the enabled/hover/active tint. */
242
+ surface?: IconButtonSurface;
243
+ /** Enabled state has no fill; hover/active/focus/disabled/danger are unaffected. */
244
+ transparent?: boolean;
191
245
  danger?: boolean;
192
246
  'aria-label': string;
193
247
  }
@@ -222,7 +276,7 @@ interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"
222
276
  declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
223
277
 
224
278
  type SegmentControlSize = "sm" | "md" | "lg";
225
- interface SegmentControlProps extends HTMLAttributes<HTMLDivElement> {
279
+ interface SegmentControlProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
226
280
  size?: SegmentControlSize;
227
281
  items: {
228
282
  label: string;
@@ -230,6 +284,7 @@ interface SegmentControlProps extends HTMLAttributes<HTMLDivElement> {
230
284
  }[];
231
285
  selected: string;
232
286
  setSelected?: (value: string) => void;
287
+ onChange?: (value: string) => void;
233
288
  }
234
289
  declare const SegmentControl: react.ForwardRefExoticComponent<SegmentControlProps & react.RefAttributes<HTMLDivElement>>;
235
290
 
@@ -279,25 +334,6 @@ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
279
334
  }
280
335
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
281
336
 
282
- type TextFieldSize = "md" | "lg";
283
- interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
284
- size?: TextFieldSize;
285
- error?: string;
286
- label?: string;
287
- placeholder?: string;
288
- helperText?: string;
289
- prefix?: ReactNode;
290
- suffix?: ReactNode;
291
- optional?: boolean;
292
- success?: boolean;
293
- pending?: boolean;
294
- clearable?: boolean;
295
- disabled?: boolean;
296
- value?: string;
297
- onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
298
- }
299
- declare const TextField: react__default.ForwardRefExoticComponent<TextFieldProps & react__default.RefAttributes<HTMLInputElement>>;
300
-
301
337
  type ToastType = 'default' | 'progress' | 'error';
302
338
  interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
303
339
  type?: ToastType;
@@ -327,4 +363,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
327
363
  }
328
364
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
329
365
 
330
- export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Dialog, type DialogActionProps, type DialogDisplay, type DialogProps, Drawer, type DrawerActionProps, type DrawerProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, IconButton, type IconButtonProps, type IconProps, Link, type LinkProps, Loading, type LoadingProps, Radio, type RadioProps, SegmentControl, type SegmentControlProps, Slider, type SliderProps, Tab, type TabProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Toast, type ToastProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps };
366
+ export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerAction, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CurrencyField, type CurrencyFieldProps, Dialog, type DialogActionProps, type DialogDisplay, type DialogProps, Drawer, type DrawerActionProps, type DrawerProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, IconButton, type IconButtonProps, type IconProps, Link, type LinkProps, Loading, type LoadingProps, Radio, type RadioProps, SegmentControl, type SegmentControlProps, Slider, type SliderProps, Tab, type TabProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Toast, type ToastProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps };
package/dist/index.d.ts CHANGED
@@ -18,12 +18,20 @@ declare const Accordion: react.ForwardRefExoticComponent<AccordionProps & react.
18
18
 
19
19
  type AlertVariant$1 = 'none' | 'info' | 'danger' | 'warning' | 'success';
20
20
  type AlertMode$1 = 'page' | 'section' | 'inline';
21
+ interface AlertBannerAction {
22
+ label: string;
23
+ href?: string;
24
+ onClick?: () => void;
25
+ }
21
26
  interface AlertBannerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
22
27
  variant?: AlertVariant$1;
23
28
  mode?: AlertMode$1;
24
29
  title?: ReactNode;
25
30
  description?: ReactNode;
26
- action?: [string?, string?];
31
+ /** Renders as a button (page mode) or an icon link (section/inline mode) on its own row below the content. */
32
+ buttonAction?: AlertBannerAction;
33
+ /** Renders as an underlined link inline with the content, next to the close button. */
34
+ buttonLink?: AlertBannerAction;
27
35
  icon?: ReactNode;
28
36
  onClose?: () => void;
29
37
  }
@@ -84,18 +92,59 @@ interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "siz
84
92
  declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>>;
85
93
 
86
94
  type ChipSize = "sm" | "md" | "lg";
87
- interface ChipProps extends HTMLAttributes<HTMLDivElement> {
95
+ type ChipVariant = "brand" | "dark";
96
+ interface ChipProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onChange"> {
88
97
  size?: ChipSize;
89
- src?: string;
90
- alt?: string;
91
98
  label: string;
92
- icon?: ReactNode;
93
- isOutlined?: boolean;
94
- isDark?: boolean;
95
- isSelected?: boolean;
99
+ /** Only affects the selected appearance — unselected chips look the same for both variants. */
100
+ variant?: ChipVariant;
101
+ /** Ignored while selected — selection always renders as a solid chip. */
102
+ outline?: boolean;
103
+ selected?: boolean;
104
+ defaultSelected?: boolean;
105
+ onSelectedChange?: (selected: boolean) => void;
106
+ startIcon?: ReactNode;
107
+ endIcon?: ReactNode;
108
+ /** Renders a circular financial-institution logo in place of startIcon. Not supported at size "sm". */
109
+ bankLogoSrc?: string;
110
+ bankLogoAlt?: string;
111
+ }
112
+ declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLButtonElement>>;
113
+
114
+ type TextFieldSize = "md" | "lg";
115
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
116
+ size?: TextFieldSize;
117
+ error?: string;
118
+ label?: string;
119
+ placeholder?: string;
120
+ helperText?: string;
121
+ prefix?: ReactNode;
122
+ suffix?: ReactNode;
123
+ optional?: boolean;
124
+ success?: boolean;
125
+ pending?: boolean;
126
+ clearable?: boolean;
96
127
  disabled?: boolean;
128
+ value?: string;
129
+ onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
97
130
  }
98
- declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLDivElement>>;
131
+ declare const TextField: react__default.ForwardRefExoticComponent<TextFieldProps & react__default.RefAttributes<HTMLInputElement>>;
132
+
133
+ interface CurrencyFieldProps extends Omit<TextFieldProps, "value" | "onChange" | "prefix" | "type" | "inputMode"> {
134
+ value?: number;
135
+ onChange?: (value: number | undefined) => void;
136
+ /** จำนวนเงินขั้นต่ำที่ยอมรับได้ — ถ้าไม่กำหนดจะไม่มีการตรวจสอบขั้นต่ำ */
137
+ min?: number;
138
+ /** ข้อความ error ที่แสดงเมื่อค่าต่ำกว่า min (ค่าเริ่มต้นจะสร้างให้อัตโนมัติ) */
139
+ minErrorText?: string;
140
+ /** จำนวนเงินสูงสุดที่ยอมรับได้ — ถ้าไม่กำหนดจะไม่มีการตรวจสอบสูงสุด */
141
+ max?: number;
142
+ /** ข้อความ error ที่แสดงเมื่อค่าเกิน max (ค่าเริ่มต้นจะสร้างให้อัตโนมัติ) */
143
+ maxErrorText?: string;
144
+ /** สัญลักษณ์สกุลเงินที่แสดงหน้าช่องกรอก (ค่าเริ่มต้นคือ ฿) */
145
+ currencyIcon?: ReactNode;
146
+ }
147
+ declare const CurrencyField: react__default.ForwardRefExoticComponent<CurrencyFieldProps & react__default.RefAttributes<HTMLInputElement>>;
99
148
 
100
149
  type DialogDisplay = 'centered' | 'slide-up' | 'full';
101
150
  type DialogActionProps = Omit<ButtonProps, 'variant' | 'children'> & {
@@ -185,9 +234,14 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
185
234
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
186
235
 
187
236
  type IconButtonSize = 'xs' | 's' | 'm' | 'l';
237
+ type IconButtonSurface = 'default' | 'dark' | 'light';
188
238
  interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
189
239
  icon: ReactNode;
190
240
  size?: IconButtonSize;
241
+ /** Which background the button sits on — picks the enabled/hover/active tint. */
242
+ surface?: IconButtonSurface;
243
+ /** Enabled state has no fill; hover/active/focus/disabled/danger are unaffected. */
244
+ transparent?: boolean;
191
245
  danger?: boolean;
192
246
  'aria-label': string;
193
247
  }
@@ -222,7 +276,7 @@ interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"
222
276
  declare const Radio: react.ForwardRefExoticComponent<RadioProps & react.RefAttributes<HTMLInputElement>>;
223
277
 
224
278
  type SegmentControlSize = "sm" | "md" | "lg";
225
- interface SegmentControlProps extends HTMLAttributes<HTMLDivElement> {
279
+ interface SegmentControlProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
226
280
  size?: SegmentControlSize;
227
281
  items: {
228
282
  label: string;
@@ -230,6 +284,7 @@ interface SegmentControlProps extends HTMLAttributes<HTMLDivElement> {
230
284
  }[];
231
285
  selected: string;
232
286
  setSelected?: (value: string) => void;
287
+ onChange?: (value: string) => void;
233
288
  }
234
289
  declare const SegmentControl: react.ForwardRefExoticComponent<SegmentControlProps & react.RefAttributes<HTMLDivElement>>;
235
290
 
@@ -279,25 +334,6 @@ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>
279
334
  }
280
335
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
281
336
 
282
- type TextFieldSize = "md" | "lg";
283
- interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
284
- size?: TextFieldSize;
285
- error?: string;
286
- label?: string;
287
- placeholder?: string;
288
- helperText?: string;
289
- prefix?: ReactNode;
290
- suffix?: ReactNode;
291
- optional?: boolean;
292
- success?: boolean;
293
- pending?: boolean;
294
- clearable?: boolean;
295
- disabled?: boolean;
296
- value?: string;
297
- onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
298
- }
299
- declare const TextField: react__default.ForwardRefExoticComponent<TextFieldProps & react__default.RefAttributes<HTMLInputElement>>;
300
-
301
337
  type ToastType = 'default' | 'progress' | 'error';
302
338
  interface ToastProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
303
339
  type?: ToastType;
@@ -327,4 +363,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
327
363
  }
328
364
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
329
365
 
330
- export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Dialog, type DialogActionProps, type DialogDisplay, type DialogProps, Drawer, type DrawerActionProps, type DrawerProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, IconButton, type IconButtonProps, type IconProps, Link, type LinkProps, Loading, type LoadingProps, Radio, type RadioProps, SegmentControl, type SegmentControlProps, Slider, type SliderProps, Tab, type TabProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Toast, type ToastProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps };
366
+ export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerAction, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, CurrencyField, type CurrencyFieldProps, Dialog, type DialogActionProps, type DialogDisplay, type DialogProps, Drawer, type DrawerActionProps, type DrawerProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, IconButton, type IconButtonProps, type IconProps, Link, type LinkProps, Loading, type LoadingProps, Radio, type RadioProps, SegmentControl, type SegmentControlProps, Slider, type SliderProps, Tab, type TabProps, TextArea, type TextAreaProps, TextField, type TextFieldProps, Toast, type ToastProps, ToggleSwitch, type ToggleSwitchProps, Tooltip, type TooltipProps };