@bestow-ui/react 0.3.0 → 0.4.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.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _bestow_ui_tokens from '@bestow-ui/tokens';
2
2
  import { space } from '@bestow-ui/tokens';
3
3
  import * as react from 'react';
4
- import { HTMLAttributes, CSSProperties, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ElementType, ReactElement } from 'react';
4
+ import { HTMLAttributes, CSSProperties, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ElementType, TextareaHTMLAttributes, ReactElement } from 'react';
5
5
  import * as Dialog from '@radix-ui/react-dialog';
6
6
 
7
7
  declare const lightTokens: {
@@ -240,6 +240,7 @@ type IntentName = 'primary' | 'neutral' | 'danger' | 'success';
240
240
  * 대표색 하나로 intent(primary 등)의 라이트·다크 색 세트를 만든다. 결과는 createTheme 에 넘긴다.
241
241
  * - solid 는 넘긴 색을 그대로 쓴다 (다크모드에서 너무 어두우면 조금 밝힌다).
242
242
  * - text 와 contrast(solid 위 글자색)는 WCAG AA 대비 4.5:1 을 만족하도록 계산한다.
243
+ * - intent 가 'primary' 면 포커스 링 색(border.focus)도 함께 바꾼다.
243
244
  *
244
245
  * @example createTheme(createIntentColors('primary', '#7c3aed'))
245
246
  */
@@ -359,6 +360,44 @@ declare function Modal({ open, defaultOpen, onOpenChange, trigger, title, descri
359
360
  */
360
361
  declare const ModalClose: react.ForwardRefExoticComponent<Dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
361
362
 
363
+ interface RadioOption {
364
+ value: string;
365
+ label: ReactNode;
366
+ /** 레이블 아래 보조 설명 */
367
+ description?: ReactNode;
368
+ disabled?: boolean;
369
+ }
370
+ interface RadioGroupProps {
371
+ /** 선택지 목록 */
372
+ options: RadioOption[];
373
+ /** 선택된 값 (제어 모드). undefined 를 넘기면 아무것도 선택하지 않은 상태 */
374
+ value?: string;
375
+ /** 처음 선택된 값 (비제어 모드) */
376
+ defaultValue?: string;
377
+ /** 값이 바뀔 때 호출된다 */
378
+ onValueChange?: (value: string) => void;
379
+ /** 그룹 위에 표시할 레이블 */
380
+ label?: ReactNode;
381
+ /** 그룹 아래에 표시할 도움말. error 일 때는 에러 메시지로 표시된다 */
382
+ helperText?: ReactNode;
383
+ /** 에러 상태 */
384
+ error?: boolean;
385
+ /** 배치 방향 */
386
+ orientation?: 'vertical' | 'horizontal';
387
+ /** 크기 */
388
+ size?: 'sm' | 'md';
389
+ disabled?: boolean;
390
+ required?: boolean;
391
+ /** form 제출 시 사용할 이름 */
392
+ name?: string;
393
+ id?: string;
394
+ /** label 이 없을 때 스크린리더용 이름 */
395
+ 'aria-label'?: string;
396
+ /** 바깥 래퍼 className */
397
+ className?: string;
398
+ }
399
+ declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
400
+
362
401
  interface SelectOption {
363
402
  value: string;
364
403
  label: ReactNode;
@@ -367,7 +406,7 @@ interface SelectOption {
367
406
  interface SelectProps {
368
407
  /** 선택지 목록 */
369
408
  options: SelectOption[];
370
- /** 선택된 값 (제어 모드) */
409
+ /** 선택된 값 (제어 모드). undefined 를 넘기면 선택 없음(placeholder)으로 표시한다 */
371
410
  value?: string;
372
411
  /** 처음 선택된 값 (비제어 모드) */
373
412
  defaultValue?: string;
@@ -413,6 +452,51 @@ interface StackProps extends HTMLAttributes<HTMLElement> {
413
452
  }
414
453
  declare const Stack: react.ForwardRefExoticComponent<StackProps & react.RefAttributes<HTMLElement>>;
415
454
 
455
+ interface SwitchProps {
456
+ /** 스위치 옆에 표시할 레이블 */
457
+ label?: ReactNode;
458
+ /** 크기 */
459
+ size?: 'sm' | 'md';
460
+ /** 켜짐 상태 (제어 모드) */
461
+ checked?: boolean;
462
+ /** 처음 켜짐 상태 (비제어 모드) */
463
+ defaultChecked?: boolean;
464
+ /** 켜짐 상태가 바뀔 때 호출된다 */
465
+ onCheckedChange?: (checked: boolean) => void;
466
+ disabled?: boolean;
467
+ required?: boolean;
468
+ /** form 제출 시 사용할 이름 */
469
+ name?: string;
470
+ /** form 제출 시 켜져 있을 때의 값 (기본 "on") */
471
+ value?: string;
472
+ id?: string;
473
+ /** label 이 없을 때 스크린리더용 이름 */
474
+ 'aria-label'?: string;
475
+ /** 바깥 래퍼 className */
476
+ className?: string;
477
+ }
478
+ declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
479
+
480
+ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
481
+ /** 입력창 위에 표시할 레이블 */
482
+ label?: ReactNode;
483
+ /** 입력창 아래에 표시할 도움말. error 일 때는 에러 메시지로 표시된다 */
484
+ helperText?: ReactNode;
485
+ /** 에러 상태 */
486
+ error?: boolean;
487
+ /** 크기 (안쪽 여백과 글자 크기) */
488
+ size?: 'sm' | 'md' | 'lg';
489
+ /** 부모 너비를 꽉 채운다 */
490
+ fullWidth?: boolean;
491
+ /** 사용자가 크기를 조절할 수 있는 방향. autoResize 이면 무시된다 */
492
+ resize?: 'none' | 'vertical' | 'both';
493
+ /** 내용에 맞춰 높이가 자동으로 늘어난다. 최대 높이는 style 의 maxHeight 로 제한한다 */
494
+ autoResize?: boolean;
495
+ /** 글자 수를 표시한다. maxLength 가 있으면 "12/200" 형태 */
496
+ showCount?: boolean;
497
+ }
498
+ declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
499
+
416
500
  interface ToastOptions {
417
501
  /** 제목 */
418
502
  title: ReactNode;
@@ -488,4 +572,4 @@ interface TypographyProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
488
572
  }
489
573
  declare const Typography: react.ForwardRefExoticComponent<TypographyProps & react.RefAttributes<HTMLElement>>;
490
574
 
491
- export { type BestowTheme, Button, type ButtonProps, Checkbox, type CheckboxProps, type DeepPartial, Input, type InputProps, type IntentName, Modal, ModalClose, type ModalProps, Select, type SelectOption, type SelectProps, Stack, type StackProps, TextField, type TextFieldProps, type ThemeInput, type ThemeName, type ThemeOverrides, ThemeProvider, type ThemeProviderProps, type ThemeTokens, type ToastOptions, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, contrastRatio, createIntentColors, createTheme, themeClass, usePortalClassName, usePortalProps, useTheme, useToast, vars };
575
+ export { type BestowTheme, Button, type ButtonProps, Checkbox, type CheckboxProps, type DeepPartial, Input, type InputProps, type IntentName, Modal, ModalClose, type ModalProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Stack, type StackProps, Switch, type SwitchProps, TextField, type TextFieldProps, Textarea, type TextareaProps, type ThemeInput, type ThemeName, type ThemeOverrides, ThemeProvider, type ThemeProviderProps, type ThemeTokens, type ToastOptions, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, contrastRatio, createIntentColors, createTheme, themeClass, usePortalClassName, usePortalProps, useTheme, useToast, vars };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _bestow_ui_tokens from '@bestow-ui/tokens';
2
2
  import { space } from '@bestow-ui/tokens';
3
3
  import * as react from 'react';
4
- import { HTMLAttributes, CSSProperties, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ElementType, ReactElement } from 'react';
4
+ import { HTMLAttributes, CSSProperties, ButtonHTMLAttributes, ReactNode, InputHTMLAttributes, ElementType, TextareaHTMLAttributes, ReactElement } from 'react';
5
5
  import * as Dialog from '@radix-ui/react-dialog';
6
6
 
7
7
  declare const lightTokens: {
@@ -240,6 +240,7 @@ type IntentName = 'primary' | 'neutral' | 'danger' | 'success';
240
240
  * 대표색 하나로 intent(primary 등)의 라이트·다크 색 세트를 만든다. 결과는 createTheme 에 넘긴다.
241
241
  * - solid 는 넘긴 색을 그대로 쓴다 (다크모드에서 너무 어두우면 조금 밝힌다).
242
242
  * - text 와 contrast(solid 위 글자색)는 WCAG AA 대비 4.5:1 을 만족하도록 계산한다.
243
+ * - intent 가 'primary' 면 포커스 링 색(border.focus)도 함께 바꾼다.
243
244
  *
244
245
  * @example createTheme(createIntentColors('primary', '#7c3aed'))
245
246
  */
@@ -359,6 +360,44 @@ declare function Modal({ open, defaultOpen, onOpenChange, trigger, title, descri
359
360
  */
360
361
  declare const ModalClose: react.ForwardRefExoticComponent<Dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
361
362
 
363
+ interface RadioOption {
364
+ value: string;
365
+ label: ReactNode;
366
+ /** 레이블 아래 보조 설명 */
367
+ description?: ReactNode;
368
+ disabled?: boolean;
369
+ }
370
+ interface RadioGroupProps {
371
+ /** 선택지 목록 */
372
+ options: RadioOption[];
373
+ /** 선택된 값 (제어 모드). undefined 를 넘기면 아무것도 선택하지 않은 상태 */
374
+ value?: string;
375
+ /** 처음 선택된 값 (비제어 모드) */
376
+ defaultValue?: string;
377
+ /** 값이 바뀔 때 호출된다 */
378
+ onValueChange?: (value: string) => void;
379
+ /** 그룹 위에 표시할 레이블 */
380
+ label?: ReactNode;
381
+ /** 그룹 아래에 표시할 도움말. error 일 때는 에러 메시지로 표시된다 */
382
+ helperText?: ReactNode;
383
+ /** 에러 상태 */
384
+ error?: boolean;
385
+ /** 배치 방향 */
386
+ orientation?: 'vertical' | 'horizontal';
387
+ /** 크기 */
388
+ size?: 'sm' | 'md';
389
+ disabled?: boolean;
390
+ required?: boolean;
391
+ /** form 제출 시 사용할 이름 */
392
+ name?: string;
393
+ id?: string;
394
+ /** label 이 없을 때 스크린리더용 이름 */
395
+ 'aria-label'?: string;
396
+ /** 바깥 래퍼 className */
397
+ className?: string;
398
+ }
399
+ declare const RadioGroup: react.ForwardRefExoticComponent<RadioGroupProps & react.RefAttributes<HTMLDivElement>>;
400
+
362
401
  interface SelectOption {
363
402
  value: string;
364
403
  label: ReactNode;
@@ -367,7 +406,7 @@ interface SelectOption {
367
406
  interface SelectProps {
368
407
  /** 선택지 목록 */
369
408
  options: SelectOption[];
370
- /** 선택된 값 (제어 모드) */
409
+ /** 선택된 값 (제어 모드). undefined 를 넘기면 선택 없음(placeholder)으로 표시한다 */
371
410
  value?: string;
372
411
  /** 처음 선택된 값 (비제어 모드) */
373
412
  defaultValue?: string;
@@ -413,6 +452,51 @@ interface StackProps extends HTMLAttributes<HTMLElement> {
413
452
  }
414
453
  declare const Stack: react.ForwardRefExoticComponent<StackProps & react.RefAttributes<HTMLElement>>;
415
454
 
455
+ interface SwitchProps {
456
+ /** 스위치 옆에 표시할 레이블 */
457
+ label?: ReactNode;
458
+ /** 크기 */
459
+ size?: 'sm' | 'md';
460
+ /** 켜짐 상태 (제어 모드) */
461
+ checked?: boolean;
462
+ /** 처음 켜짐 상태 (비제어 모드) */
463
+ defaultChecked?: boolean;
464
+ /** 켜짐 상태가 바뀔 때 호출된다 */
465
+ onCheckedChange?: (checked: boolean) => void;
466
+ disabled?: boolean;
467
+ required?: boolean;
468
+ /** form 제출 시 사용할 이름 */
469
+ name?: string;
470
+ /** form 제출 시 켜져 있을 때의 값 (기본 "on") */
471
+ value?: string;
472
+ id?: string;
473
+ /** label 이 없을 때 스크린리더용 이름 */
474
+ 'aria-label'?: string;
475
+ /** 바깥 래퍼 className */
476
+ className?: string;
477
+ }
478
+ declare const Switch: react.ForwardRefExoticComponent<SwitchProps & react.RefAttributes<HTMLButtonElement>>;
479
+
480
+ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
481
+ /** 입력창 위에 표시할 레이블 */
482
+ label?: ReactNode;
483
+ /** 입력창 아래에 표시할 도움말. error 일 때는 에러 메시지로 표시된다 */
484
+ helperText?: ReactNode;
485
+ /** 에러 상태 */
486
+ error?: boolean;
487
+ /** 크기 (안쪽 여백과 글자 크기) */
488
+ size?: 'sm' | 'md' | 'lg';
489
+ /** 부모 너비를 꽉 채운다 */
490
+ fullWidth?: boolean;
491
+ /** 사용자가 크기를 조절할 수 있는 방향. autoResize 이면 무시된다 */
492
+ resize?: 'none' | 'vertical' | 'both';
493
+ /** 내용에 맞춰 높이가 자동으로 늘어난다. 최대 높이는 style 의 maxHeight 로 제한한다 */
494
+ autoResize?: boolean;
495
+ /** 글자 수를 표시한다. maxLength 가 있으면 "12/200" 형태 */
496
+ showCount?: boolean;
497
+ }
498
+ declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
499
+
416
500
  interface ToastOptions {
417
501
  /** 제목 */
418
502
  title: ReactNode;
@@ -488,4 +572,4 @@ interface TypographyProps extends Omit<HTMLAttributes<HTMLElement>, 'color'> {
488
572
  }
489
573
  declare const Typography: react.ForwardRefExoticComponent<TypographyProps & react.RefAttributes<HTMLElement>>;
490
574
 
491
- export { type BestowTheme, Button, type ButtonProps, Checkbox, type CheckboxProps, type DeepPartial, Input, type InputProps, type IntentName, Modal, ModalClose, type ModalProps, Select, type SelectOption, type SelectProps, Stack, type StackProps, TextField, type TextFieldProps, type ThemeInput, type ThemeName, type ThemeOverrides, ThemeProvider, type ThemeProviderProps, type ThemeTokens, type ToastOptions, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, contrastRatio, createIntentColors, createTheme, themeClass, usePortalClassName, usePortalProps, useTheme, useToast, vars };
575
+ export { type BestowTheme, Button, type ButtonProps, Checkbox, type CheckboxProps, type DeepPartial, Input, type InputProps, type IntentName, Modal, ModalClose, type ModalProps, RadioGroup, type RadioGroupProps, type RadioOption, Select, type SelectOption, type SelectProps, Stack, type StackProps, Switch, type SwitchProps, TextField, type TextFieldProps, Textarea, type TextareaProps, type ThemeInput, type ThemeName, type ThemeOverrides, ThemeProvider, type ThemeProviderProps, type ThemeTokens, type ToastOptions, ToastProvider, type ToastProviderProps, Tooltip, type TooltipProps, Typography, type TypographyProps, type TypographyVariant, contrastRatio, createIntentColors, createTheme, themeClass, usePortalClassName, usePortalProps, useTheme, useToast, vars };