@zenkigen-inc/component-ui 1.15.3 → 1.16.1

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,80 +90,101 @@ 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 = {
146
+ /** 表示するアイコン名 */
132
147
  icon: IconName;
148
+ /** ボタンのサイズ */
133
149
  size?: Size;
150
+ /** ボタンが無効かどうか */
134
151
  isDisabled?: boolean;
152
+ /** ボタンが選択されているかどうか */
153
+ isSelected?: boolean;
154
+ /** パディングを無効にするかどうか */
135
155
  isNoPadding?: boolean;
156
+ /** ボタンのバリアント */
136
157
  variant?: Variant;
137
- } & ({
158
+ } & (({
138
159
  isAnchor: true;
139
160
  href: string;
140
161
  target?: HTMLAnchorElement['target'];
141
- } | {
162
+ } & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'className'>) | ({
142
163
  isAnchor?: false;
143
164
  onClick?: () => void;
144
- });
145
- declare function IconButton({ size, variant, isNoPadding, isDisabled, ...props }: Props$m): react.JSX.Element;
165
+ } & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'disabled' | 'className'>));
166
+ declare function IconButton({ icon, size, variant, isNoPadding, isDisabled, isSelected, ...props }: Props$n): react.JSX.Element;
146
167
 
147
- type Props$l = {
168
+ type Props$m = {
148
169
  size?: 'small' | 'medium' | 'large';
149
170
  position?: 'fixed' | 'absolute' | 'static';
150
171
  height?: string;
151
172
  };
152
- declare function Loading({ size, position, height }: Props$l): react.JSX.Element;
173
+ declare function Loading({ size, position, height }: Props$m): react.JSX.Element;
153
174
 
154
175
  declare function ModalBody({ children }: PropsWithChildren): react.JSX.Element;
155
176
 
156
- type Props$k = {
177
+ type Props$l = {
157
178
  isNoBorder?: boolean;
158
179
  };
159
- declare function ModalFooter({ children, isNoBorder }: PropsWithChildren<Props$k>): react__default.JSX.Element;
180
+ declare function ModalFooter({ children, isNoBorder }: PropsWithChildren<Props$l>): react__default.JSX.Element;
160
181
 
161
- type Props$j = {
182
+ type Props$k = {
162
183
  isNoBorder?: boolean;
163
184
  };
164
- declare function ModalHeader({ children, isNoBorder }: PropsWithChildren<Props$j>): react.JSX.Element;
185
+ declare function ModalHeader({ children, isNoBorder }: PropsWithChildren<Props$k>): react.JSX.Element;
165
186
 
166
- type Props$i = {
187
+ type Props$j = {
167
188
  width?: CSSProperties['width'];
168
189
  height?: CSSProperties['height'];
169
190
  maxWidth?: CSSProperties['maxWidth'];
@@ -171,14 +192,14 @@ type Props$i = {
171
192
  onClose?: () => void;
172
193
  portalTargetRef?: MutableRefObject<HTMLElement | null>;
173
194
  };
174
- declare function Modal({ children, width, height, maxWidth, isOpen, onClose, portalTargetRef, }: PropsWithChildren<Props$i>): react.JSX.Element | null;
195
+ declare function Modal({ children, width, height, maxWidth, isOpen, onClose, portalTargetRef, }: PropsWithChildren<Props$j>): react.JSX.Element | null;
175
196
  declare namespace Modal {
176
197
  var Body: typeof ModalBody;
177
198
  var Header: typeof ModalHeader;
178
199
  var Footer: typeof ModalFooter;
179
200
  }
180
201
 
181
- type Props$h = {
202
+ type Props$i = {
182
203
  state?: 'success' | 'warning' | 'information' | 'attention' | 'default';
183
204
  size?: 'small' | 'medium';
184
205
  children?: ReactNode;
@@ -188,9 +209,9 @@ type Props$h = {
188
209
  showClose: true;
189
210
  onClickClose: () => void;
190
211
  });
191
- declare function NotificationInline({ state, size, ...props }: Props$h): react.JSX.Element;
212
+ declare function NotificationInline({ state, size, ...props }: Props$i): react.JSX.Element;
192
213
 
193
- type Props$g = {
214
+ type Props$h = {
194
215
  /** 現在のページ番号 */
195
216
  currentPage: number;
196
217
  /** トータルのページ数 */
@@ -200,9 +221,9 @@ type Props$g = {
200
221
  /** ボタンが押されたときのイベントハンドラ */
201
222
  onClick: (value: number) => void;
202
223
  };
203
- declare function Pagination({ currentPage, totalPage, sideNumPagesToShow, onClick }: Props$g): react.JSX.Element;
224
+ declare function Pagination({ currentPage, totalPage, sideNumPagesToShow, onClick }: Props$h): react.JSX.Element;
204
225
 
205
- type Props$f = {
226
+ type Props$g = {
206
227
  /** トータル件数 */
207
228
  totalSize: number;
208
229
  /** ページあたり件数 */
@@ -222,9 +243,9 @@ type Props$f = {
222
243
  /** Selectが切り替わった時のイベントハンドラ */
223
244
  onChange: (value: number) => void;
224
245
  };
225
- declare function PaginationSelect({ totalSize, currentPage, sizePerPage, countLabel, pageLabel, optionListMaxHeight, onClickPrevButton, onClickNextButton, onChange, }: Props$f): react.JSX.Element;
246
+ declare function PaginationSelect({ totalSize, currentPage, sizePerPage, countLabel, pageLabel, optionListMaxHeight, onClickPrevButton, onClickNextButton, onChange, }: Props$g): react.JSX.Element;
226
247
 
227
- type Props$e = {
248
+ type Props$f = {
228
249
  name?: string;
229
250
  value?: string;
230
251
  id?: string;
@@ -233,9 +254,9 @@ type Props$e = {
233
254
  isDisabled?: boolean;
234
255
  onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
235
256
  };
236
- declare function Radio({ name, value, id, label, isChecked, isDisabled, onChange }: Props$e): react.JSX.Element;
257
+ declare function Radio({ name, value, id, label, isChecked, isDisabled, onChange }: Props$f): react.JSX.Element;
237
258
 
238
- type Props$d = {
259
+ type Props$e = {
239
260
  size?: 'medium' | 'large';
240
261
  placeholder?: string;
241
262
  width?: string;
@@ -244,7 +265,42 @@ type Props$d = {
244
265
  onSubmit?: (e: FormEvent<HTMLFormElement>) => void;
245
266
  onClickClearButton?: () => void;
246
267
  };
247
- declare const Search: react.ForwardRefExoticComponent<Props$d & react.RefAttributes<HTMLDivElement>>;
268
+ declare const Search: react.ForwardRefExoticComponent<Props$e & react.RefAttributes<HTMLDivElement>>;
269
+
270
+ type BaseProps = Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'className'> & {
271
+ value: string;
272
+ isDisabled?: boolean;
273
+ };
274
+ type SegmentedControlItemProps = BaseProps & ({
275
+ icon: IconName;
276
+ label?: never;
277
+ 'aria-label': string;
278
+ } | {
279
+ icon: IconName;
280
+ label: string;
281
+ 'aria-label'?: string;
282
+ } | {
283
+ icon?: never;
284
+ label: string;
285
+ 'aria-label'?: string;
286
+ } | {
287
+ icon?: never;
288
+ label?: never;
289
+ 'aria-label'?: string;
290
+ });
291
+
292
+ type SegmentedControlProps = Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'className'> & {
293
+ children: ReactNode;
294
+ value?: string;
295
+ size?: 'small' | 'medium';
296
+ 'aria-label': string;
297
+ isDisabled?: boolean;
298
+ onChange?: (value: string) => void;
299
+ };
300
+ declare const SegmentedControl: {
301
+ ({ children, value, onChange, size, isDisabled, "aria-label": ariaLabel, ...rest }: SegmentedControlProps): react__default.JSX.Element;
302
+ Item: ({ label, value, icon, isDisabled: itemDisabled, "aria-label": ariaLabel, ...rest }: SegmentedControlItemProps) => react__default.JSX.Element;
303
+ };
248
304
 
249
305
  type SelectOption = {
250
306
  id: string;
@@ -253,12 +309,12 @@ type SelectOption = {
253
309
  icon?: IconName;
254
310
  };
255
311
 
256
- type Props$c = {
312
+ type Props$d = {
257
313
  option: SelectOption;
258
314
  };
259
- declare function SelectItem({ option }: Props$c): react.JSX.Element;
315
+ declare function SelectItem({ option }: Props$d): react.JSX.Element;
260
316
 
261
- type Props$b = {
317
+ type Props$c = {
262
318
  size?: 'x-small' | 'small' | 'medium' | 'large';
263
319
  variant?: 'outline' | 'text';
264
320
  width?: CSSProperties['width'];
@@ -268,17 +324,18 @@ type Props$b = {
268
324
  selectedOption?: SelectOption | null;
269
325
  optionListMaxHeight?: CSSProperties['height'];
270
326
  isDisabled?: boolean;
327
+ isError?: boolean;
271
328
  isOptionSelected?: boolean;
272
329
  onChange?: (option: SelectOption | null) => void;
273
330
  };
274
- declare function Select({ children, size, variant, width, maxWidth, placeholder, placeholderIcon, selectedOption, isDisabled, isOptionSelected, onChange, optionListMaxHeight, }: PropsWithChildren<Props$b>): react.JSX.Element;
331
+ declare function Select({ children, size, variant, width, maxWidth, placeholder, placeholderIcon, selectedOption, isDisabled, isError, isOptionSelected, onChange, optionListMaxHeight, }: PropsWithChildren<Props$c>): react.JSX.Element;
275
332
  declare namespace Select {
276
333
  var Option: typeof SelectItem;
277
334
  }
278
335
 
279
336
  type SortOrder = 'ascend' | 'descend' | null;
280
337
 
281
- type Props$a = {
338
+ type Props$b = {
282
339
  size?: 'x-small' | 'small' | 'medium' | 'large';
283
340
  variant?: 'outline' | 'text';
284
341
  width?: CSSProperties['width'];
@@ -289,12 +346,25 @@ type Props$a = {
289
346
  onChange?: (value: SortOrder) => void;
290
347
  onClickDeselect?: () => void;
291
348
  };
292
- declare function SelectSort({ size, variant, width, label, sortOrder, isDisabled, isSortKey, onChange, onClickDeselect, }: Props$a): react.JSX.Element;
349
+ declare function SelectSort({ size, variant, width, label, sortOrder, isDisabled, isSortKey, onChange, onClickDeselect, }: Props$b): react.JSX.Element;
350
+
351
+ type Props$a = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'className' | 'type' | 'disabled' | 'onClick' | 'aria-disabled' | 'aria-label'> & {
352
+ size?: 'x-small' | 'small' | 'medium' | 'large';
353
+ width?: CSSProperties['width'];
354
+ label: string;
355
+ sortOrder: SortOrder;
356
+ isDisabled?: boolean;
357
+ 'aria-label': string;
358
+ onClick?: () => void;
359
+ };
360
+ declare function SortButton({ size, width, label, sortOrder, isDisabled, onClick, 'aria-label': ariaLabel, ...rest }: Props$a): react.JSX.Element;
293
361
 
294
362
  type Props$9 = {
295
363
  children?: ReactNode;
364
+ /** レイアウトタイプ */
365
+ layout?: 'auto' | 'equal';
296
366
  };
297
- declare function Tab({ children }: Props$9): react.JSX.Element;
367
+ declare function Tab({ children, layout }: Props$9): react.JSX.Element;
298
368
  declare namespace Tab {
299
369
  var Item: ({ isSelected, ...props }: {
300
370
  id: string;
@@ -431,4 +501,4 @@ type Props = {
431
501
  };
432
502
  declare function Tooltip({ children, content, size, maxWidth, verticalPosition, horizontalAlign, isDisabledHover, portalTarget, }: PropsWithChildren<Props>): react.JSX.Element;
433
503
 
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 };
504
+ 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 };