@refinn/core-ui 0.1.9 → 0.1.10

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
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes } from 'react';
2
+ import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
3
 
4
4
  interface AccordionItemData {
5
5
  id?: string;
@@ -72,25 +72,6 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
72
72
  }
73
73
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
74
74
 
75
- type BottomSheetSize = 'sm' | 'md' | 'lg';
76
- interface BottomSheetProps extends HTMLAttributes<HTMLSpanElement> {
77
- isForceOpen?: boolean;
78
- setIsForceOpen?: (val: boolean) => void;
79
- isClosedAble?: boolean;
80
- children: ReactNode;
81
- startModalBtn?: ReactElement<{
82
- onClick?: (e: react__default.MouseEvent) => void;
83
- }>;
84
- stopModalBtn?: ReactElement<{
85
- onClick?: (e: react__default.MouseEvent) => void;
86
- }>;
87
- afterStopBtn?: ReactElement<() => void>;
88
- size?: BottomSheetSize;
89
- modalTitle: string;
90
- modalDesc: string;
91
- }
92
- declare const BottomSheet: react__default.ForwardRefExoticComponent<BottomSheetProps & react__default.RefAttributes<HTMLSpanElement>>;
93
-
94
75
  interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
95
76
  label?: ReactNode;
96
77
  description?: ReactNode;
@@ -114,37 +95,58 @@ interface ChipProps extends HTMLAttributes<HTMLDivElement> {
114
95
  }
115
96
  declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLDivElement>>;
116
97
 
117
- interface DialogProps extends HTMLAttributes<HTMLSpanElement> {
118
- isForceOpen?: boolean;
119
- setIsForceOpen?: (val: boolean) => void;
120
- isClosedAble?: boolean;
121
- isCloseIcon?: boolean;
122
- children: ReactNode;
123
- startModalBtn?: ReactElement<{
124
- onClick?: (e: react__default.MouseEvent) => void;
125
- }>;
126
- stopModalBtn: ReactElement<{
127
- onClick?: (e: react__default.MouseEvent) => void;
128
- }>;
129
- afterStopBtn?: ReactElement<() => void>;
130
- p?: string;
131
- maxW?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl";
98
+ type DialogDisplay = 'centered' | 'slide-up' | 'full';
99
+ type DialogActionProps = Omit<ButtonProps, 'variant' | 'children'> & {
100
+ label: ReactNode;
101
+ };
102
+ interface DialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
103
+ open: boolean;
104
+ onOpenChange?: (open: boolean) => void;
105
+ display?: DialogDisplay;
106
+ artwork?: ReactNode;
107
+ title?: ReactNode;
108
+ subtitle?: ReactNode;
109
+ warning?: boolean;
110
+ closable?: boolean;
111
+ backdrop?: boolean;
112
+ children?: ReactNode;
113
+ dismiss?: DialogActionProps;
114
+ secondary?: DialogActionProps;
115
+ confirm?: DialogActionProps;
116
+ }
117
+ declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
118
+
119
+ type DrawerActionProps = DialogActionProps;
120
+ interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
121
+ open: boolean;
122
+ onOpenChange?: (open: boolean) => void;
123
+ title?: ReactNode;
124
+ subtitle?: ReactNode;
125
+ closable?: boolean;
126
+ backdrop?: boolean;
127
+ children?: ReactNode;
128
+ dismiss?: DrawerActionProps;
129
+ secondary?: DrawerActionProps;
130
+ confirm?: DrawerActionProps;
132
131
  }
133
- declare const Dialog: react__default.ForwardRefExoticComponent<DialogProps & react__default.RefAttributes<HTMLSpanElement>>;
132
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
134
133
 
135
134
  type DropdownSize = "md" | "lg";
135
+ type DropdownVariant = "default" | "combobox";
136
136
  interface DropdownItemsInterface {
137
137
  label: string;
138
138
  value: string;
139
139
  }
140
140
  interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
141
141
  size?: DropdownSize;
142
+ /** "default" = เลือกจากรายการอย่างเดียว, "combobox" = พิมพ์ค้นหาในช่องได้ */
143
+ variant?: DropdownVariant;
142
144
  error?: string;
143
145
  label?: string;
144
146
  placeholder?: string;
145
- isDisabled?: boolean;
146
- isSearchable?: boolean;
147
- isTextCenter?: boolean;
147
+ helperText?: string;
148
+ disabled?: boolean;
149
+ textCenter?: boolean;
148
150
  value: DropdownItemsInterface;
149
151
  setValue: (value: DropdownItemsInterface) => void;
150
152
  dropDownItems?: DropdownItemsInterface[];
@@ -177,6 +179,15 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
177
179
  }
178
180
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
179
181
 
182
+ type IconButtonSize = 'xs' | 's' | 'm' | 'l';
183
+ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
184
+ icon: ReactNode;
185
+ size?: IconButtonSize;
186
+ danger?: boolean;
187
+ 'aria-label': string;
188
+ }
189
+ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
190
+
180
191
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
181
192
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
182
193
  interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -245,37 +256,37 @@ interface TabProps extends HTMLAttributes<HTMLDivElement> {
245
256
  }
246
257
  declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLDivElement>>;
247
258
 
248
- interface TextAreaProps extends HTMLAttributes<HTMLTextAreaElement> {
249
- maxText?: number;
250
- height?: number;
259
+ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "prefix"> {
251
260
  error?: string;
252
261
  label?: string;
253
262
  placeholder?: string;
254
- description?: string;
255
- icon?: string;
256
- isDisabled?: boolean;
257
- isLoading?: boolean;
258
- isVertify?: boolean;
259
- isClearable?: boolean;
263
+ helperText?: string;
264
+ optional?: boolean;
265
+ success?: boolean;
266
+ pending?: boolean;
267
+ clearable?: boolean;
260
268
  disabled?: boolean;
269
+ showCounter?: boolean;
270
+ maxLength?: number;
271
+ height?: number;
261
272
  value?: string;
262
273
  onChange?: (event: react__default.ChangeEvent<HTMLTextAreaElement>) => void;
263
274
  }
264
275
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
265
276
 
266
277
  type TextFieldSize = "md" | "lg";
267
- interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
268
- inputSize?: TextFieldSize;
278
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
279
+ size?: TextFieldSize;
269
280
  error?: string;
270
281
  label?: string;
271
282
  placeholder?: string;
272
- description?: string;
273
- icon?: ReactNode;
274
- isDisabled?: boolean;
275
- isLoading?: boolean;
276
- isVertify?: boolean;
277
- isUnrequired?: boolean;
278
- isClearable?: boolean;
283
+ helperText?: string;
284
+ prefix?: ReactNode;
285
+ suffix?: ReactNode;
286
+ optional?: boolean;
287
+ success?: boolean;
288
+ pending?: boolean;
289
+ clearable?: boolean;
279
290
  disabled?: boolean;
280
291
  value?: string;
281
292
  onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
@@ -311,4 +322,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
311
322
  }
312
323
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
313
324
 
314
- export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BottomSheet, type BottomSheetProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Dialog, type DialogProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, 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 };
325
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, ReactElement, InputHTMLAttributes } from 'react';
2
+ import react__default, { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
3
3
 
4
4
  interface AccordionItemData {
5
5
  id?: string;
@@ -72,25 +72,6 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
72
72
  }
73
73
  declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
74
74
 
75
- type BottomSheetSize = 'sm' | 'md' | 'lg';
76
- interface BottomSheetProps extends HTMLAttributes<HTMLSpanElement> {
77
- isForceOpen?: boolean;
78
- setIsForceOpen?: (val: boolean) => void;
79
- isClosedAble?: boolean;
80
- children: ReactNode;
81
- startModalBtn?: ReactElement<{
82
- onClick?: (e: react__default.MouseEvent) => void;
83
- }>;
84
- stopModalBtn?: ReactElement<{
85
- onClick?: (e: react__default.MouseEvent) => void;
86
- }>;
87
- afterStopBtn?: ReactElement<() => void>;
88
- size?: BottomSheetSize;
89
- modalTitle: string;
90
- modalDesc: string;
91
- }
92
- declare const BottomSheet: react__default.ForwardRefExoticComponent<BottomSheetProps & react__default.RefAttributes<HTMLSpanElement>>;
93
-
94
75
  interface CheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
95
76
  label?: ReactNode;
96
77
  description?: ReactNode;
@@ -114,37 +95,58 @@ interface ChipProps extends HTMLAttributes<HTMLDivElement> {
114
95
  }
115
96
  declare const Chip: react.ForwardRefExoticComponent<ChipProps & react.RefAttributes<HTMLDivElement>>;
116
97
 
117
- interface DialogProps extends HTMLAttributes<HTMLSpanElement> {
118
- isForceOpen?: boolean;
119
- setIsForceOpen?: (val: boolean) => void;
120
- isClosedAble?: boolean;
121
- isCloseIcon?: boolean;
122
- children: ReactNode;
123
- startModalBtn?: ReactElement<{
124
- onClick?: (e: react__default.MouseEvent) => void;
125
- }>;
126
- stopModalBtn: ReactElement<{
127
- onClick?: (e: react__default.MouseEvent) => void;
128
- }>;
129
- afterStopBtn?: ReactElement<() => void>;
130
- p?: string;
131
- maxW?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl";
98
+ type DialogDisplay = 'centered' | 'slide-up' | 'full';
99
+ type DialogActionProps = Omit<ButtonProps, 'variant' | 'children'> & {
100
+ label: ReactNode;
101
+ };
102
+ interface DialogProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
103
+ open: boolean;
104
+ onOpenChange?: (open: boolean) => void;
105
+ display?: DialogDisplay;
106
+ artwork?: ReactNode;
107
+ title?: ReactNode;
108
+ subtitle?: ReactNode;
109
+ warning?: boolean;
110
+ closable?: boolean;
111
+ backdrop?: boolean;
112
+ children?: ReactNode;
113
+ dismiss?: DialogActionProps;
114
+ secondary?: DialogActionProps;
115
+ confirm?: DialogActionProps;
116
+ }
117
+ declare const Dialog: react.ForwardRefExoticComponent<DialogProps & react.RefAttributes<HTMLDivElement>>;
118
+
119
+ type DrawerActionProps = DialogActionProps;
120
+ interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
121
+ open: boolean;
122
+ onOpenChange?: (open: boolean) => void;
123
+ title?: ReactNode;
124
+ subtitle?: ReactNode;
125
+ closable?: boolean;
126
+ backdrop?: boolean;
127
+ children?: ReactNode;
128
+ dismiss?: DrawerActionProps;
129
+ secondary?: DrawerActionProps;
130
+ confirm?: DrawerActionProps;
132
131
  }
133
- declare const Dialog: react__default.ForwardRefExoticComponent<DialogProps & react__default.RefAttributes<HTMLSpanElement>>;
132
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
134
133
 
135
134
  type DropdownSize = "md" | "lg";
135
+ type DropdownVariant = "default" | "combobox";
136
136
  interface DropdownItemsInterface {
137
137
  label: string;
138
138
  value: string;
139
139
  }
140
140
  interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
141
141
  size?: DropdownSize;
142
+ /** "default" = เลือกจากรายการอย่างเดียว, "combobox" = พิมพ์ค้นหาในช่องได้ */
143
+ variant?: DropdownVariant;
142
144
  error?: string;
143
145
  label?: string;
144
146
  placeholder?: string;
145
- isDisabled?: boolean;
146
- isSearchable?: boolean;
147
- isTextCenter?: boolean;
147
+ helperText?: string;
148
+ disabled?: boolean;
149
+ textCenter?: boolean;
148
150
  value: DropdownItemsInterface;
149
151
  setValue: (value: DropdownItemsInterface) => void;
150
152
  dropDownItems?: DropdownItemsInterface[];
@@ -177,6 +179,15 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
177
179
  }
178
180
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
179
181
 
182
+ type IconButtonSize = 'xs' | 's' | 'm' | 'l';
183
+ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
184
+ icon: ReactNode;
185
+ size?: IconButtonSize;
186
+ danger?: boolean;
187
+ 'aria-label': string;
188
+ }
189
+ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
190
+
180
191
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
181
192
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
182
193
  interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -245,37 +256,37 @@ interface TabProps extends HTMLAttributes<HTMLDivElement> {
245
256
  }
246
257
  declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLDivElement>>;
247
258
 
248
- interface TextAreaProps extends HTMLAttributes<HTMLTextAreaElement> {
249
- maxText?: number;
250
- height?: number;
259
+ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "prefix"> {
251
260
  error?: string;
252
261
  label?: string;
253
262
  placeholder?: string;
254
- description?: string;
255
- icon?: string;
256
- isDisabled?: boolean;
257
- isLoading?: boolean;
258
- isVertify?: boolean;
259
- isClearable?: boolean;
263
+ helperText?: string;
264
+ optional?: boolean;
265
+ success?: boolean;
266
+ pending?: boolean;
267
+ clearable?: boolean;
260
268
  disabled?: boolean;
269
+ showCounter?: boolean;
270
+ maxLength?: number;
271
+ height?: number;
261
272
  value?: string;
262
273
  onChange?: (event: react__default.ChangeEvent<HTMLTextAreaElement>) => void;
263
274
  }
264
275
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
265
276
 
266
277
  type TextFieldSize = "md" | "lg";
267
- interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
268
- inputSize?: TextFieldSize;
278
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
279
+ size?: TextFieldSize;
269
280
  error?: string;
270
281
  label?: string;
271
282
  placeholder?: string;
272
- description?: string;
273
- icon?: ReactNode;
274
- isDisabled?: boolean;
275
- isLoading?: boolean;
276
- isVertify?: boolean;
277
- isUnrequired?: boolean;
278
- isClearable?: boolean;
283
+ helperText?: string;
284
+ prefix?: ReactNode;
285
+ suffix?: ReactNode;
286
+ optional?: boolean;
287
+ success?: boolean;
288
+ pending?: boolean;
289
+ clearable?: boolean;
279
290
  disabled?: boolean;
280
291
  value?: string;
281
292
  onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
@@ -311,4 +322,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
311
322
  }
312
323
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
313
324
 
314
- export { Accordion, type AccordionItemData, type AccordionProps, AlertBanner, type AlertBannerProps, Avatar, type AvatarProps, Badge, type BadgeProps, BottomSheet, type BottomSheetProps, Branding, type BrandingProps, Button, type ButtonProps, Checkbox, type CheckboxProps, Chip, type ChipProps, Dialog, type DialogProps, Dropdown, type DropdownItemsInterface, type DropdownProps, FinancialLogo, type FinancialLogoProps, Icon, 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 };
325
+ 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 };