@zenkigen-inc/component-ui 1.15.2 → 1.16.0

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,16 +1,16 @@
1
1
  import * as react from 'react';
2
- import react__default, { PropsWithChildren, ElementType, ComponentPropsWithoutRef, CSSProperties, ReactNode, ChangeEvent, MouseEvent, MutableRefObject, ReactElement, RefObject, FormEvent, TextareaHTMLAttributes, InputHTMLAttributes } from 'react';
2
+ import react__default, { PropsWithChildren, ElementType, ComponentPropsWithoutRef, CSSProperties, ReactNode, ChangeEvent, MouseEvent, MutableRefObject, ReactElement, RefObject, FormEvent, ButtonHTMLAttributes, TextareaHTMLAttributes, InputHTMLAttributes } from 'react';
3
3
  import { IconName } from '@zenkigen-inc/component-icons';
4
4
  import { iconColors, tagLightColors } from '@zenkigen-inc/component-theme';
5
5
 
6
- type Props$v = {
6
+ type Props$w = {
7
7
  size?: 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
8
8
  userId?: number;
9
9
  firstName: string;
10
10
  lastName: string;
11
11
  isDisabled?: boolean;
12
12
  };
13
- declare function Avatar({ size, ...props }: Props$v): react.JSX.Element;
13
+ declare function Avatar({ size, ...props }: Props$w): react.JSX.Element;
14
14
 
15
15
  declare function Breadcrumb({ children }: PropsWithChildren): react.JSX.Element;
16
16
  declare namespace Breadcrumb {
@@ -25,7 +25,7 @@ type AsProp<T extends ElementAs> = {
25
25
  elementAs?: T;
26
26
  };
27
27
  type PolymorphicPropsWithoutRef<T extends ElementAs, P extends object> = PropsWithChildren<P> & ComponentPropsWithoutRef<T> & AsProp<T>;
28
- type Props$u<T extends ElementAs> = PolymorphicPropsWithoutRef<T, {
28
+ type Props$v<T extends ElementAs> = PolymorphicPropsWithoutRef<T, {
29
29
  size?: Size$2;
30
30
  width?: CSSProperties['width'];
31
31
  isSelected?: boolean;
@@ -36,9 +36,9 @@ type Props$u<T extends ElementAs> = PolymorphicPropsWithoutRef<T, {
36
36
  borderRadius?: CSSProperties['borderRadius'];
37
37
  justifyContent?: JustifyContent;
38
38
  }>;
39
- declare const Button: <T extends ElementAs = "button">({ size, variant, isDisabled, isSelected, width, borderRadius, justifyContent, before, after, elementAs, children, ...props }: Props$u<T>) => react.JSX.Element;
39
+ declare const Button: <T extends ElementAs = "button">({ size, variant, isDisabled, isSelected, width, borderRadius, justifyContent, before, after, elementAs, children, ...props }: Props$v<T>) => react.JSX.Element;
40
40
 
41
- type Props$t = {
41
+ type Props$u = {
42
42
  name?: string;
43
43
  value?: string;
44
44
  id?: string;
@@ -49,13 +49,13 @@ type Props$t = {
49
49
  label?: string;
50
50
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
51
51
  };
52
- declare function Checkbox({ name, value, id, isChecked, isIndeterminate, isDisabled, onChange, label, color, }: Props$t): react.JSX.Element;
52
+ declare function Checkbox({ name, value, id, isChecked, isIndeterminate, isDisabled, onChange, label, color, }: Props$u): react.JSX.Element;
53
53
 
54
- type Props$s = {
54
+ type Props$t = {
55
55
  color?: 'gray' | 'red';
56
56
  onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
57
57
  };
58
- declare function DropdownItem({ children, color, onClick }: PropsWithChildren<Props$s>): react.JSX.Element;
58
+ declare function DropdownItem({ children, color, onClick }: PropsWithChildren<Props$t>): react.JSX.Element;
59
59
 
60
60
  type DropdownItemType = {
61
61
  id: string;
@@ -66,15 +66,15 @@ type DropdownItemType = {
66
66
  type DropdownVerticalPosition = 'top' | 'bottom';
67
67
  type DropdownHorizontalAlign = 'left' | 'center' | 'right';
68
68
 
69
- type Props$r = {
69
+ type Props$s = {
70
70
  maxHeight?: CSSProperties['height'];
71
71
  isNoPadding?: boolean;
72
72
  verticalPosition?: DropdownVerticalPosition;
73
73
  horizontalAlign?: DropdownHorizontalAlign;
74
74
  };
75
- declare function DropdownMenu({ children, maxHeight, isNoPadding, verticalPosition, horizontalAlign, }: PropsWithChildren<Props$r>): false | react.JSX.Element;
75
+ declare function DropdownMenu({ children, maxHeight, isNoPadding, verticalPosition, horizontalAlign, }: PropsWithChildren<Props$s>): false | react.JSX.Element;
76
76
 
77
- type Props$q = {
77
+ type Props$r = {
78
78
  size?: 'x-small' | 'small' | 'medium' | 'large';
79
79
  variant?: 'text' | 'outline';
80
80
  title?: string;
@@ -90,45 +90,59 @@ type Props$q = {
90
90
  label: string;
91
91
  icon?: IconName;
92
92
  });
93
- declare function Dropdown({ children, target, label, icon, size, variant, title, isDisabled, isArrowHidden, portalTargetRef, }: PropsWithChildren<Props$q>): react.JSX.Element;
93
+ declare function Dropdown({ children, target, label, icon, size, variant, title, isDisabled, isArrowHidden, portalTargetRef, }: PropsWithChildren<Props$r>): react.JSX.Element;
94
94
  declare namespace Dropdown {
95
95
  var Menu: typeof DropdownMenu;
96
96
  var Item: typeof DropdownItem;
97
97
  }
98
98
 
99
- type Props$p = {
99
+ type Props$q = {
100
100
  value: number;
101
101
  isEditable?: boolean;
102
102
  onChangeRating?: (newRating: number) => void | null;
103
103
  size?: 'medium' | 'large';
104
104
  };
105
- declare function EvaluationStar({ value, isEditable, onChangeRating, size }: Props$p): react.JSX.Element;
105
+ declare function EvaluationStar({ value, isEditable, onChangeRating, size }: Props$q): react.JSX.Element;
106
106
 
107
107
  type Level = 1 | 2 | 3 | 4 | 5;
108
- type Props$o = {
108
+ type Props$p = {
109
109
  level: Level;
110
110
  before?: ReactNode;
111
111
  after?: ReactNode;
112
112
  children?: ReactNode;
113
113
  };
114
- declare function Heading(props: Props$o): react.JSX.Element;
114
+ declare function Heading(props: Props$p): react.JSX.Element;
115
115
 
116
116
  declare const useOutsideClick: <T extends HTMLElement = HTMLElement>(ref: RefObject<T | null>, handler: (event: Event) => void, enabled?: boolean) => void;
117
117
 
118
+ type UseRovingFocusProps = {
119
+ values: string[];
120
+ defaultFocusedValue?: string;
121
+ isDisabled?: boolean;
122
+ };
123
+ type UseRovingFocusReturn = {
124
+ focusedValue: string | null;
125
+ handleFocusChange: (value: string) => void;
126
+ handleKeyDown: (event: React.KeyboardEvent) => void;
127
+ handleBlur: () => void;
128
+ setFocusedValue: React.Dispatch<React.SetStateAction<string | null>>;
129
+ };
130
+ declare const useRovingFocus: ({ values, defaultFocusedValue, isDisabled, }: UseRovingFocusProps) => UseRovingFocusReturn;
131
+
118
132
  type Size$1 = 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
119
133
  type Color = keyof typeof iconColors;
120
- type Props$n = {
134
+ type Props$o = {
121
135
  name: IconName;
122
136
  size?: Size$1;
123
137
  color?: Color;
124
138
  isDisabled?: boolean;
125
139
  className?: string;
126
140
  };
127
- declare const Icon: ({ size, isDisabled, ...props }: Props$n) => react.JSX.Element;
141
+ declare const Icon: ({ size, isDisabled, ...props }: Props$o) => react.JSX.Element;
128
142
 
129
143
  type Size = 'small' | 'medium' | 'large';
130
144
  type Variant = 'outline' | 'text';
131
- type Props$m = {
145
+ type Props$n = {
132
146
  icon: IconName;
133
147
  size?: Size;
134
148
  isDisabled?: boolean;
@@ -142,28 +156,28 @@ type Props$m = {
142
156
  isAnchor?: false;
143
157
  onClick?: () => void;
144
158
  });
145
- declare function IconButton({ size, variant, isNoPadding, isDisabled, ...props }: Props$m): react.JSX.Element;
159
+ declare function IconButton({ size, variant, isNoPadding, isDisabled, ...props }: Props$n): react.JSX.Element;
146
160
 
147
- type Props$l = {
161
+ type Props$m = {
148
162
  size?: 'small' | 'medium' | 'large';
149
163
  position?: 'fixed' | 'absolute' | 'static';
150
164
  height?: string;
151
165
  };
152
- declare function Loading({ size, position, height }: Props$l): react.JSX.Element;
166
+ declare function Loading({ size, position, height }: Props$m): react.JSX.Element;
153
167
 
154
168
  declare function ModalBody({ children }: PropsWithChildren): react.JSX.Element;
155
169
 
156
- type Props$k = {
170
+ type Props$l = {
157
171
  isNoBorder?: boolean;
158
172
  };
159
- declare function ModalFooter({ children, isNoBorder }: PropsWithChildren<Props$k>): react__default.JSX.Element;
173
+ declare function ModalFooter({ children, isNoBorder }: PropsWithChildren<Props$l>): react__default.JSX.Element;
160
174
 
161
- type Props$j = {
175
+ type Props$k = {
162
176
  isNoBorder?: boolean;
163
177
  };
164
- declare function ModalHeader({ children, isNoBorder }: PropsWithChildren<Props$j>): react.JSX.Element;
178
+ declare function ModalHeader({ children, isNoBorder }: PropsWithChildren<Props$k>): react.JSX.Element;
165
179
 
166
- type Props$i = {
180
+ type Props$j = {
167
181
  width?: CSSProperties['width'];
168
182
  height?: CSSProperties['height'];
169
183
  maxWidth?: CSSProperties['maxWidth'];
@@ -171,14 +185,14 @@ type Props$i = {
171
185
  onClose?: () => void;
172
186
  portalTargetRef?: MutableRefObject<HTMLElement | null>;
173
187
  };
174
- declare function Modal({ children, width, height, maxWidth, isOpen, onClose, portalTargetRef, }: PropsWithChildren<Props$i>): react.JSX.Element | null;
188
+ declare function Modal({ children, width, height, maxWidth, isOpen, onClose, portalTargetRef, }: PropsWithChildren<Props$j>): react.JSX.Element | null;
175
189
  declare namespace Modal {
176
190
  var Body: typeof ModalBody;
177
191
  var Header: typeof ModalHeader;
178
192
  var Footer: typeof ModalFooter;
179
193
  }
180
194
 
181
- type Props$h = {
195
+ type Props$i = {
182
196
  state?: 'success' | 'warning' | 'information' | 'attention' | 'default';
183
197
  size?: 'small' | 'medium';
184
198
  children?: ReactNode;
@@ -188,9 +202,9 @@ type Props$h = {
188
202
  showClose: true;
189
203
  onClickClose: () => void;
190
204
  });
191
- declare function NotificationInline({ state, size, ...props }: Props$h): react.JSX.Element;
205
+ declare function NotificationInline({ state, size, ...props }: Props$i): react.JSX.Element;
192
206
 
193
- type Props$g = {
207
+ type Props$h = {
194
208
  /** 現在のページ番号 */
195
209
  currentPage: number;
196
210
  /** トータルのページ数 */
@@ -200,9 +214,9 @@ type Props$g = {
200
214
  /** ボタンが押されたときのイベントハンドラ */
201
215
  onClick: (value: number) => void;
202
216
  };
203
- declare function Pagination({ currentPage, totalPage, sideNumPagesToShow, onClick }: Props$g): react.JSX.Element;
217
+ declare function Pagination({ currentPage, totalPage, sideNumPagesToShow, onClick }: Props$h): react.JSX.Element;
204
218
 
205
- type Props$f = {
219
+ type Props$g = {
206
220
  /** トータル件数 */
207
221
  totalSize: number;
208
222
  /** ページあたり件数 */
@@ -222,9 +236,9 @@ type Props$f = {
222
236
  /** Selectが切り替わった時のイベントハンドラ */
223
237
  onChange: (value: number) => void;
224
238
  };
225
- declare function PaginationSelect({ totalSize, currentPage, sizePerPage, countLabel, pageLabel, optionListMaxHeight, onClickPrevButton, onClickNextButton, onChange, }: Props$f): react.JSX.Element;
239
+ declare function PaginationSelect({ totalSize, currentPage, sizePerPage, countLabel, pageLabel, optionListMaxHeight, onClickPrevButton, onClickNextButton, onChange, }: Props$g): react.JSX.Element;
226
240
 
227
- type Props$e = {
241
+ type Props$f = {
228
242
  name?: string;
229
243
  value?: string;
230
244
  id?: string;
@@ -233,9 +247,9 @@ type Props$e = {
233
247
  isDisabled?: boolean;
234
248
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
235
249
  };
236
- declare function Radio({ name, value, id, label, isChecked, isDisabled, onChange }: Props$e): react.JSX.Element;
250
+ declare function Radio({ name, value, id, label, isChecked, isDisabled, onChange }: Props$f): react.JSX.Element;
237
251
 
238
- type Props$d = {
252
+ type Props$e = {
239
253
  size?: 'medium' | 'large';
240
254
  placeholder?: string;
241
255
  width?: string;
@@ -244,7 +258,42 @@ type Props$d = {
244
258
  onSubmit?: (e: FormEvent<HTMLFormElement>) => void;
245
259
  onClickClearButton?: () => void;
246
260
  };
247
- declare const Search: react.ForwardRefExoticComponent<Props$d & react.RefAttributes<HTMLDivElement>>;
261
+ declare const Search: react.ForwardRefExoticComponent<Props$e & react.RefAttributes<HTMLDivElement>>;
262
+
263
+ type BaseProps = Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'className'> & {
264
+ value: string;
265
+ isDisabled?: boolean;
266
+ };
267
+ type SegmentedControlItemProps = BaseProps & ({
268
+ icon: IconName;
269
+ label?: never;
270
+ 'aria-label': string;
271
+ } | {
272
+ icon: IconName;
273
+ label: string;
274
+ 'aria-label'?: string;
275
+ } | {
276
+ icon?: never;
277
+ label: string;
278
+ 'aria-label'?: string;
279
+ } | {
280
+ icon?: never;
281
+ label?: never;
282
+ 'aria-label'?: string;
283
+ });
284
+
285
+ type SegmentedControlProps = Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'className'> & {
286
+ children: ReactNode;
287
+ value?: string;
288
+ size?: 'small' | 'medium';
289
+ 'aria-label': string;
290
+ isDisabled?: boolean;
291
+ onChange?: (value: string) => void;
292
+ };
293
+ declare const SegmentedControl: {
294
+ ({ children, value, onChange, size, isDisabled, "aria-label": ariaLabel, ...rest }: SegmentedControlProps): react__default.JSX.Element;
295
+ Item: ({ label, value, icon, isDisabled: itemDisabled, "aria-label": ariaLabel, ...rest }: SegmentedControlItemProps) => react__default.JSX.Element;
296
+ };
248
297
 
249
298
  type SelectOption = {
250
299
  id: string;
@@ -253,12 +302,12 @@ type SelectOption = {
253
302
  icon?: IconName;
254
303
  };
255
304
 
256
- type Props$c = {
305
+ type Props$d = {
257
306
  option: SelectOption;
258
307
  };
259
- declare function SelectItem({ option }: Props$c): react.JSX.Element;
308
+ declare function SelectItem({ option }: Props$d): react.JSX.Element;
260
309
 
261
- type Props$b = {
310
+ type Props$c = {
262
311
  size?: 'x-small' | 'small' | 'medium' | 'large';
263
312
  variant?: 'outline' | 'text';
264
313
  width?: CSSProperties['width'];
@@ -268,17 +317,18 @@ type Props$b = {
268
317
  selectedOption?: SelectOption | null;
269
318
  optionListMaxHeight?: CSSProperties['height'];
270
319
  isDisabled?: boolean;
320
+ isError?: boolean;
271
321
  isOptionSelected?: boolean;
272
322
  onChange?: (option: SelectOption | null) => void;
273
323
  };
274
- declare function Select({ children, size, variant, width, maxWidth, placeholder, placeholderIcon, selectedOption, isDisabled, isOptionSelected, onChange, optionListMaxHeight, }: PropsWithChildren<Props$b>): react.JSX.Element;
324
+ declare function Select({ children, size, variant, width, maxWidth, placeholder, placeholderIcon, selectedOption, isDisabled, isError, isOptionSelected, onChange, optionListMaxHeight, }: PropsWithChildren<Props$c>): react.JSX.Element;
275
325
  declare namespace Select {
276
326
  var Option: typeof SelectItem;
277
327
  }
278
328
 
279
329
  type SortOrder = 'ascend' | 'descend' | null;
280
330
 
281
- type Props$a = {
331
+ type Props$b = {
282
332
  size?: 'x-small' | 'small' | 'medium' | 'large';
283
333
  variant?: 'outline' | 'text';
284
334
  width?: CSSProperties['width'];
@@ -289,7 +339,18 @@ type Props$a = {
289
339
  onChange?: (value: SortOrder) => void;
290
340
  onClickDeselect?: () => void;
291
341
  };
292
- declare function SelectSort({ size, variant, width, label, sortOrder, isDisabled, isSortKey, onChange, onClickDeselect, }: Props$a): react.JSX.Element;
342
+ declare function SelectSort({ size, variant, width, label, sortOrder, isDisabled, isSortKey, onChange, onClickDeselect, }: Props$b): react.JSX.Element;
343
+
344
+ type Props$a = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'type' | 'disabled' | 'onClick' | 'aria-disabled' | 'aria-label'> & {
345
+ size?: 'x-small' | 'small' | 'medium' | 'large';
346
+ width?: CSSProperties['width'];
347
+ label: string;
348
+ sortOrder: SortOrder;
349
+ isDisabled?: boolean;
350
+ 'aria-label': string;
351
+ onClick?: () => void;
352
+ };
353
+ declare function SortButton({ size, width, label, sortOrder, isDisabled, onClick, 'aria-label': ariaLabel, ...rest }: Props$a): react.JSX.Element;
293
354
 
294
355
  type Props$9 = {
295
356
  children?: ReactNode;
@@ -431,4 +492,4 @@ type Props = {
431
492
  };
432
493
  declare function Tooltip({ children, content, size, maxWidth, verticalPosition, horizontalAlign, isDisabledHover, portalTarget, }: PropsWithChildren<Props>): react.JSX.Element;
433
494
 
434
- export { Avatar, Breadcrumb, Button, Checkbox, type ColorVariant, Dropdown, type DropdownHorizontalAlign, type DropdownItemType, type DropdownVerticalPosition, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, Select, type SelectOption, SelectSort, type SortOrder, Tab, TabItem, Table, TableCell, TableRow, Tag, type TagColor, TextArea, TextInput, Toast, ToastProvider, Toggle, Tooltip, useOutsideClick, useToast };
495
+ export { Avatar, Breadcrumb, Button, Checkbox, type ColorVariant, Dropdown, type DropdownHorizontalAlign, type DropdownItemType, type DropdownVerticalPosition, EvaluationStar, Heading, Icon, IconButton, Loading, Modal, NotificationInline, Pagination, PaginationSelect, Radio, Search, SegmentedControl, Select, type SelectOption, SelectSort, SortButton, type SortOrder, Tab, TabItem, Table, TableCell, TableRow, Tag, type TagColor, TextArea, TextInput, Toast, ToastProvider, Toggle, Tooltip, type UseRovingFocusProps, type UseRovingFocusReturn, useOutsideClick, useRovingFocus, useToast };