@refinn/core-ui 0.1.9 → 0.1.11

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,61 @@ 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
+ fullScreen?: boolean;
128
+ header?: boolean;
129
+ background?: 'primary' | 'secondary';
130
+ children?: ReactNode;
131
+ dismiss?: DrawerActionProps;
132
+ secondary?: DrawerActionProps;
133
+ confirm?: DrawerActionProps;
132
134
  }
133
- declare const Dialog: react__default.ForwardRefExoticComponent<DialogProps & react__default.RefAttributes<HTMLSpanElement>>;
135
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
134
136
 
135
137
  type DropdownSize = "md" | "lg";
138
+ type DropdownVariant = "default" | "combobox";
136
139
  interface DropdownItemsInterface {
137
140
  label: string;
138
141
  value: string;
139
142
  }
140
143
  interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
141
144
  size?: DropdownSize;
145
+ /** "default" = เลือกจากรายการอย่างเดียว, "combobox" = พิมพ์ค้นหาในช่องได้ */
146
+ variant?: DropdownVariant;
142
147
  error?: string;
143
148
  label?: string;
144
149
  placeholder?: string;
145
- isDisabled?: boolean;
146
- isSearchable?: boolean;
147
- isTextCenter?: boolean;
150
+ helperText?: string;
151
+ disabled?: boolean;
152
+ textCenter?: boolean;
148
153
  value: DropdownItemsInterface;
149
154
  setValue: (value: DropdownItemsInterface) => void;
150
155
  dropDownItems?: DropdownItemsInterface[];
@@ -177,6 +182,15 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
177
182
  }
178
183
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
179
184
 
185
+ type IconButtonSize = 'xs' | 's' | 'm' | 'l';
186
+ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
187
+ icon: ReactNode;
188
+ size?: IconButtonSize;
189
+ danger?: boolean;
190
+ 'aria-label': string;
191
+ }
192
+ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
193
+
180
194
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
181
195
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
182
196
  interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -245,37 +259,37 @@ interface TabProps extends HTMLAttributes<HTMLDivElement> {
245
259
  }
246
260
  declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLDivElement>>;
247
261
 
248
- interface TextAreaProps extends HTMLAttributes<HTMLTextAreaElement> {
249
- maxText?: number;
250
- height?: number;
262
+ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "prefix"> {
251
263
  error?: string;
252
264
  label?: string;
253
265
  placeholder?: string;
254
- description?: string;
255
- icon?: string;
256
- isDisabled?: boolean;
257
- isLoading?: boolean;
258
- isVertify?: boolean;
259
- isClearable?: boolean;
266
+ helperText?: string;
267
+ optional?: boolean;
268
+ success?: boolean;
269
+ pending?: boolean;
270
+ clearable?: boolean;
260
271
  disabled?: boolean;
272
+ showCounter?: boolean;
273
+ maxLength?: number;
274
+ height?: number;
261
275
  value?: string;
262
276
  onChange?: (event: react__default.ChangeEvent<HTMLTextAreaElement>) => void;
263
277
  }
264
278
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
265
279
 
266
280
  type TextFieldSize = "md" | "lg";
267
- interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
268
- inputSize?: TextFieldSize;
281
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
282
+ size?: TextFieldSize;
269
283
  error?: string;
270
284
  label?: string;
271
285
  placeholder?: string;
272
- description?: string;
273
- icon?: ReactNode;
274
- isDisabled?: boolean;
275
- isLoading?: boolean;
276
- isVertify?: boolean;
277
- isUnrequired?: boolean;
278
- isClearable?: boolean;
286
+ helperText?: string;
287
+ prefix?: ReactNode;
288
+ suffix?: ReactNode;
289
+ optional?: boolean;
290
+ success?: boolean;
291
+ pending?: boolean;
292
+ clearable?: boolean;
279
293
  disabled?: boolean;
280
294
  value?: string;
281
295
  onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
@@ -311,4 +325,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
311
325
  }
312
326
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
313
327
 
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 };
328
+ 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,61 @@ 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
+ fullScreen?: boolean;
128
+ header?: boolean;
129
+ background?: 'primary' | 'secondary';
130
+ children?: ReactNode;
131
+ dismiss?: DrawerActionProps;
132
+ secondary?: DrawerActionProps;
133
+ confirm?: DrawerActionProps;
132
134
  }
133
- declare const Dialog: react__default.ForwardRefExoticComponent<DialogProps & react__default.RefAttributes<HTMLSpanElement>>;
135
+ declare const Drawer: react.ForwardRefExoticComponent<DrawerProps & react.RefAttributes<HTMLDivElement>>;
134
136
 
135
137
  type DropdownSize = "md" | "lg";
138
+ type DropdownVariant = "default" | "combobox";
136
139
  interface DropdownItemsInterface {
137
140
  label: string;
138
141
  value: string;
139
142
  }
140
143
  interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
141
144
  size?: DropdownSize;
145
+ /** "default" = เลือกจากรายการอย่างเดียว, "combobox" = พิมพ์ค้นหาในช่องได้ */
146
+ variant?: DropdownVariant;
142
147
  error?: string;
143
148
  label?: string;
144
149
  placeholder?: string;
145
- isDisabled?: boolean;
146
- isSearchable?: boolean;
147
- isTextCenter?: boolean;
150
+ helperText?: string;
151
+ disabled?: boolean;
152
+ textCenter?: boolean;
148
153
  value: DropdownItemsInterface;
149
154
  setValue: (value: DropdownItemsInterface) => void;
150
155
  dropDownItems?: DropdownItemsInterface[];
@@ -177,6 +182,15 @@ interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
177
182
  }
178
183
  declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<HTMLSpanElement>>;
179
184
 
185
+ type IconButtonSize = 'xs' | 's' | 'm' | 'l';
186
+ interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
187
+ icon: ReactNode;
188
+ size?: IconButtonSize;
189
+ danger?: boolean;
190
+ 'aria-label': string;
191
+ }
192
+ declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
193
+
180
194
  type LinkVariant = 'xs' | 'sm' | 'md' | 'lg';
181
195
  type LinkStyle = 'brand' | 'white' | 'black' | 'brandLooped' | 'whiteLooped' | 'blackLooped';
182
196
  interface LinkProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -245,37 +259,37 @@ interface TabProps extends HTMLAttributes<HTMLDivElement> {
245
259
  }
246
260
  declare const Tab: react.ForwardRefExoticComponent<TabProps & react.RefAttributes<HTMLDivElement>>;
247
261
 
248
- interface TextAreaProps extends HTMLAttributes<HTMLTextAreaElement> {
249
- maxText?: number;
250
- height?: number;
262
+ interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "prefix"> {
251
263
  error?: string;
252
264
  label?: string;
253
265
  placeholder?: string;
254
- description?: string;
255
- icon?: string;
256
- isDisabled?: boolean;
257
- isLoading?: boolean;
258
- isVertify?: boolean;
259
- isClearable?: boolean;
266
+ helperText?: string;
267
+ optional?: boolean;
268
+ success?: boolean;
269
+ pending?: boolean;
270
+ clearable?: boolean;
260
271
  disabled?: boolean;
272
+ showCounter?: boolean;
273
+ maxLength?: number;
274
+ height?: number;
261
275
  value?: string;
262
276
  onChange?: (event: react__default.ChangeEvent<HTMLTextAreaElement>) => void;
263
277
  }
264
278
  declare const TextArea: react__default.ForwardRefExoticComponent<TextAreaProps & react__default.RefAttributes<HTMLTextAreaElement>>;
265
279
 
266
280
  type TextFieldSize = "md" | "lg";
267
- interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
268
- inputSize?: TextFieldSize;
281
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> {
282
+ size?: TextFieldSize;
269
283
  error?: string;
270
284
  label?: string;
271
285
  placeholder?: string;
272
- description?: string;
273
- icon?: ReactNode;
274
- isDisabled?: boolean;
275
- isLoading?: boolean;
276
- isVertify?: boolean;
277
- isUnrequired?: boolean;
278
- isClearable?: boolean;
286
+ helperText?: string;
287
+ prefix?: ReactNode;
288
+ suffix?: ReactNode;
289
+ optional?: boolean;
290
+ success?: boolean;
291
+ pending?: boolean;
292
+ clearable?: boolean;
279
293
  disabled?: boolean;
280
294
  value?: string;
281
295
  onChange?: (event: react__default.ChangeEvent<HTMLInputElement>) => void;
@@ -311,4 +325,4 @@ interface TooltipProps extends HTMLAttributes<HTMLDivElement> {
311
325
  }
312
326
  declare const Tooltip: react__default.ForwardRefExoticComponent<TooltipProps & react__default.RefAttributes<HTMLDivElement>>;
313
327
 
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 };
328
+ 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 };