@tide-design/components 0.18.3 → 0.20.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.
@@ -6,6 +6,8 @@ export interface CheckboxOwnProps {
6
6
  children?: ReactNode;
7
7
  /** 상자 16px(`sm`) 또는 20px(`md`). 누르는 영역은 둘 다 24×24px. 기본값 `md`. */
8
8
  size?: ChoiceSize;
9
+ /** 상자 모양. `circle`은 원이고 체크 전에도 회색 체크가 보인다. 기본값 `square`. */
10
+ shape?: CheckboxShape;
9
11
  /** 체크했을 때 상자 색(Role). 기본값 `primary`. */
10
12
  color?: Role;
11
13
  /** 일부만 선택된 상태(가로줄). 누르면 브라우저가 지우므로 앱이 다시 계산해 넘긴다. */
@@ -17,9 +19,10 @@ export interface CheckboxOwnProps {
17
19
  /** 루트 label의 style */
18
20
  style?: CSSProperties;
19
21
  }
22
+ export type CheckboxShape = "square" | "circle";
20
23
  export interface CheckboxProps extends CheckboxOwnProps, Omit<ComponentProps<"input">, keyof CheckboxOwnProps | "type"> {}
21
24
  /**
22
25
  * 네이티브 체크박스. 여러 개를 묶어 이름·설명·오류를 붙이려면 `Field group` 안의 `CheckboxGroup`에 둔다.
23
- * Tide props: `children`, `size`, `color`, `indeterminate`, `invalid`, `className`, `style` ({@link CheckboxOwnProps}). 나머지는 `<input>` 속성.
26
+ * Tide props: `children`, `size`, `shape`, `color`, `indeterminate`, `invalid`, `className`, `style` ({@link CheckboxOwnProps}). 나머지는 `<input>` 속성.
24
27
  */
25
- export declare function Checkbox({ children, size, color, indeterminate, invalid, id, disabled, required, className, style, ref, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }: CheckboxProps): ReactElement;
28
+ export declare function Checkbox({ children, size, shape, color, indeterminate, invalid, id, disabled, required, className, style, ref, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }: CheckboxProps): ReactElement;
@@ -3,22 +3,26 @@
3
3
  import { CheckboxGroupContext } from "../_internal/hooks/useChoiceGroup.js";
4
4
  import { choiceAreaClass, choiceInputClass, choiceMarkClass, choiceRootClass, choiceTextClass } from "../_internal/constants/choiceClass.js";
5
5
  import { cn } from "../_internal/libs/cn.js";
6
- import { checkboxFillClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass } from "./constants/checkboxClass.js";
6
+ import { checkboxFillClass, checkboxIdleMarkClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass } from "./constants/checkboxClass.js";
7
7
  import { CheckboxMark } from "./components/CheckboxMark.js";
8
8
  import { useFieldControl } from "../_internal/hooks/useFieldControl.js";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { use, useImperativeHandle, useLayoutEffect, useRef } from "react";
11
11
 
12
12
  // src/Checkbox/Checkbox.tsx
13
- const boxClass = {
14
- sm: "size-4 rounded-sm",
15
- md: "size-5 rounded-sm"
13
+ const boxSizeClass = {
14
+ sm: "size-4",
15
+ md: "size-5"
16
+ };
17
+ const boxShapeClass = {
18
+ square: "rounded-sm",
19
+ circle: "rounded-full"
16
20
  };
17
21
  /**
18
22
  * 네이티브 체크박스. 여러 개를 묶어 이름·설명·오류를 붙이려면 `Field group` 안의 `CheckboxGroup`에 둔다.
19
- * Tide props: `children`, `size`, `color`, `indeterminate`, `invalid`, `className`, `style` ({@link CheckboxOwnProps}). 나머지는 `<input>` 속성.
23
+ * Tide props: `children`, `size`, `shape`, `color`, `indeterminate`, `invalid`, `className`, `style` ({@link CheckboxOwnProps}). 나머지는 `<input>` 속성.
20
24
  */
21
- function Checkbox({ children, size = "md", color = "primary", indeterminate = false, invalid, id, disabled, required, className, style, ref, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }) {
25
+ function Checkbox({ children, size = "md", shape = "square", color = "primary", indeterminate = false, invalid, id, disabled, required, className, style, ref, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, ...props }) {
22
26
  const group = use(CheckboxGroupContext);
23
27
  const control = useFieldControl({
24
28
  id,
@@ -33,6 +37,7 @@ function Checkbox({ children, size = "md", color = "primary", indeterminate = fa
33
37
  useLayoutEffect(() => {
34
38
  if (inputRef.current) inputRef.current.indeterminate = indeterminate;
35
39
  });
40
+ const boxClass = cn(boxSizeClass[size], boxShapeClass[shape]);
36
41
  return /* @__PURE__ */ jsxs("label", {
37
42
  "data-color": color,
38
43
  "data-disabled": control.disabled ? "" : void 0,
@@ -47,12 +52,18 @@ function Checkbox({ children, size = "md", color = "primary", indeterminate = fa
47
52
  ...control,
48
53
  ref: inputRef,
49
54
  type: "checkbox",
50
- className: cn(boxClass[size], choiceInputClass, checkboxInputStateClass)
55
+ className: cn(boxClass, choiceInputClass, checkboxInputStateClass)
51
56
  }),
57
+ shape === "circle" ? /* @__PURE__ */ jsx(CheckboxMark, {
58
+ kind: "check",
59
+ size,
60
+ idle: true,
61
+ className: cn(choiceMarkClass, checkboxIdleMarkClass)
62
+ }) : null,
52
63
  /* @__PURE__ */ jsx("span", {
53
64
  "aria-hidden": "true",
54
65
  "data-fill": "",
55
- className: cn(boxClass[size], checkboxFillClass)
66
+ className: cn(boxClass, checkboxFillClass)
56
67
  }),
57
68
  /* @__PURE__ */ jsx(CheckboxMark, {
58
69
  kind: "check",
@@ -10,12 +10,13 @@ const pixelSize = {
10
10
  md: 16
11
11
  };
12
12
  /** 그려지는 체크 표시. 상태는 input이 보조 기술에 알려 장식으로 숨긴다. */
13
- function CheckboxMark({ kind, size, className }) {
13
+ function CheckboxMark({ kind, size, idle, className }) {
14
14
  const px = pixelSize[size];
15
15
  return /* @__PURE__ */ jsx("svg", {
16
16
  "aria-hidden": "true",
17
17
  focusable: "false",
18
18
  "data-mark": kind,
19
+ "data-idle": idle ? "" : void 0,
19
20
  width: px,
20
21
  height: px,
21
22
  viewBox: "0 0 24 24",
@@ -1,11 +1,13 @@
1
1
  // src/Checkbox/constants/checkboxClass.ts
2
- /** 체크 전 hover·누름은 subtle 바탕이다. 체크·indeterminate 채움은 채움 레이어가 맡고, forced-colors에서만 input이 칠한다. */
3
- const checkboxInputStateClass = "checked:border-accent indeterminate:border-accent enabled:not-checked:not-indeterminate:group-hover/choice:bg-accent-subtle enabled:not-checked:not-indeterminate:group-active/choice:bg-accent-subtle-active forced-colors:enabled:checked:bg-accent-solid forced-colors:enabled:indeterminate:bg-accent-solid";
2
+ /** 체크 전에는 hover·누름에도 바탕을 칠하지 않는다. 체크·indeterminate 채움은 채움 레이어가 맡고, forced-colors에서만 input이 칠한다. */
3
+ const checkboxInputStateClass = "checked:border-accent indeterminate:border-accent forced-colors:enabled:checked:bg-accent-solid forced-colors:enabled:indeterminate:bg-accent-solid";
4
4
  /**
5
5
  * 체크·indeterminate 채움. input과 같은 크기라 테두리까지 덮는다. opacity와 scale이 함께 fast로 바뀐다.
6
6
  * 비활성·forced-colors에서는 숨고 input 바탕이 그 색을 맡는다. 오류 색은 input의 변수가 닿지 않아 다시 적는다(ADR 0035).
7
7
  */
8
8
  const checkboxFillClass = "pointer-events-none col-start-1 row-start-1 bg-accent-solid opacity-0 transition-[opacity,background-color] group-hover/choice:bg-accent-solid-hover group-active/choice:bg-accent-solid-active peer-checked:opacity-100 peer-indeterminate:opacity-100 motion-safe:scale-70 motion-safe:transition-[opacity,scale,background-color] motion-safe:peer-checked:scale-100 motion-safe:peer-indeterminate:scale-100 peer-aria-invalid:[--tide-accent-solid:var(--tide-bg-danger-solid)] peer-aria-invalid:[--tide-accent-solid-hover:var(--tide-bg-danger-solid-hover)] peer-aria-invalid:[--tide-accent-solid-active:var(--tide-bg-danger-solid-active)] peer-disabled:hidden forced-colors:hidden";
9
+ /** circle의 체크 전 회색 체크. 비활성에서는 체크된 것처럼 보여 숨긴다. */
10
+ const checkboxIdleMarkClass = "text-disabled peer-enabled:peer-not-checked:peer-not-indeterminate:opacity-100";
9
11
  /** solid 위 흰 표시. 숨을 때는 지연 없이 fast로 거꾸로 지워지며 사라진다. dash는 svg에 두고 path가 물려받는다. */
10
12
  const checkboxMarkClass = "relative text-accent-on-solid forced-colors:[--tide-accent-on-solid:HighlightText] motion-safe:[stroke-dasharray:1] motion-safe:[stroke-dashoffset:1] motion-safe:transition-[opacity,stroke-dashoffset]";
11
13
  /** 보이는 조건과 그리기. 채움이 찬 뒤(fast 지연) opacity와 dash가 fast로 함께 바뀐다. */
@@ -14,4 +16,4 @@ const checkboxMarkShownClass = {
14
16
  indeterminate: "peer-indeterminate:opacity-100 motion-safe:peer-indeterminate:[stroke-dashoffset:0] motion-safe:peer-indeterminate:duration-fast motion-safe:peer-indeterminate:delay-(--tide-duration-fast)"
15
17
  };
16
18
 
17
- export { checkboxFillClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass };
19
+ export { checkboxFillClass, checkboxIdleMarkClass, checkboxInputStateClass, checkboxMarkClass, checkboxMarkShownClass };
@@ -1,2 +1,2 @@
1
- import { Checkbox, CheckboxOwnProps, CheckboxProps } from "./Checkbox.js";
2
- export { Checkbox, type CheckboxOwnProps, type CheckboxProps };
1
+ import { Checkbox, CheckboxOwnProps, CheckboxProps, CheckboxShape } from "./Checkbox.js";
2
+ export { Checkbox, type CheckboxOwnProps, type CheckboxProps, type CheckboxShape };
@@ -1,6 +1,6 @@
1
1
  // src/_internal/constants/choiceClass.ts
2
2
  /** 루트 label. 글자 크기 class와 사용자 className은 뒤에 붙인다. */
3
- const choiceRootClass = "group/choice inline-flex items-start gap-2 align-top text-default cursor-pointer has-disabled:cursor-not-allowed has-disabled:text-disabled";
3
+ const choiceRootClass = "group/choice inline-flex items-start gap-2 align-top text-default cursor-pointer select-none has-disabled:cursor-not-allowed has-disabled:text-disabled";
4
4
  /** 상자보다 큰 24×24 조작 영역(WCAG 2.5.8). */
5
5
  const choiceAreaClass = "grid size-6 shrink-0 place-items-center";
6
6
  /** 네이티브 input을 상자·원으로 그린다. 선택 상태 모양은 Checkbox·Radio가 각자 더한다. */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
1
  import { cn } from "./_internal/libs/cn.js";
2
2
  import { VisuallyHidden, VisuallyHiddenProps } from "./VisuallyHidden/VisuallyHidden.js";
3
3
  import "./VisuallyHidden/index.js";
4
- import { Typography, TypographyOwnProps, TypographyProps } from "./Typography/Typography.js";
5
- import "./Typography/index.js";
6
4
  import "./Spinner/index.js";
7
5
  import { Spinner, SpinnerOwnProps, SpinnerProps } from "./Spinner/Spinner.js";
8
6
  import "./Button/index.js";
@@ -18,7 +16,7 @@ import { Input, InputOwnProps, InputProps } from "./Input/Input.js";
18
16
  import "./Textarea/index.js";
19
17
  import { Textarea, TextareaOwnProps, TextareaProps } from "./Textarea/Textarea.js";
20
18
  import "./Checkbox/index.js";
21
- import { Checkbox, CheckboxOwnProps, CheckboxProps } from "./Checkbox/Checkbox.js";
19
+ import { Checkbox, CheckboxOwnProps, CheckboxProps, CheckboxShape } from "./Checkbox/Checkbox.js";
22
20
  import "./CheckboxGroup/index.js";
23
21
  import { ChoiceOrientation } from "./_internal/constants/choiceGroupClass.js";
24
22
  import { CheckboxGroup, CheckboxGroupOwnProps, CheckboxGroupProps } from "./CheckboxGroup/CheckboxGroup.js";
@@ -119,4 +117,4 @@ import { TooltipTrigger, TooltipTriggerOwnProps, TooltipTriggerProps } from "./T
119
117
  import { TooltipPlacement } from "./Tooltip/types.js";
120
118
  import { TooltipContent, TooltipContentOwnProps, TooltipContentProps } from "./Tooltip/components/TooltipContent.js";
121
119
  import { Color, ColorFamilyName, ColorFamilyRegistry, FillVariant, Role, RoleRegistry, Size } from "./types.js";
122
- export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, Typography, type TypographyOwnProps, type TypographyProps, VisuallyHidden, type VisuallyHiddenProps, cn };
120
+ export { Accordion, type AccordionHeadingLevel, AccordionItem, type AccordionItemOwnProps, type AccordionItemProps, type AccordionOwnProps, AccordionPanel, type AccordionPanelOwnProps, type AccordionPanelProps, type AccordionProps, AccordionTrigger, type AccordionTriggerOwnProps, type AccordionTriggerProps, Alert, AlertDialog, type AlertDialogProps, type AlertOwnProps, type AlertProps, Avatar, type AvatarOwnProps, type AvatarProps, Badge, type BadgeOwnProps, type BadgeProps, Breadcrumb, BreadcrumbCurrent, type BreadcrumbCurrentProps, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbLink, type BreadcrumbLinkOwnProps, type BreadcrumbLinkProps, type BreadcrumbOwnProps, type BreadcrumbProps, Button, type ButtonOwnProps, type ButtonProps, Card, type CardOwnProps, type CardProps, Checkbox, CheckboxGroup, type CheckboxGroupOwnProps, type CheckboxGroupProps, type CheckboxOwnProps, type CheckboxProps, type CheckboxShape, type ChoiceOrientation, type Color, type ColorFamilyName, type ColorFamilyRegistry, Combobox, ComboboxItem, type ComboboxItemOwnProps, type ComboboxItemProps, type ComboboxOwnProps, type ComboboxProps, ComboboxSection, type ComboboxSectionProps, Dialog, DialogClose, type DialogCloseOwnProps, type DialogCloseProps, DialogContent, type DialogContentOwnProps, type DialogContentProps, DialogDescription, type DialogDescriptionProps, DialogFooter, type DialogFooterProps, DialogHeader, type DialogHeaderAlign, type DialogHeaderOwnProps, type DialogHeaderProps, type DialogProps, type DialogSize, DialogTitle, type DialogTitleProps, DialogTrigger, type DialogTriggerOwnProps, type DialogTriggerProps, Field, type FieldOwnProps, type FieldProps, type FillVariant, IconButton, type IconButtonOwnProps, type IconButtonProps, Input, type InputOwnProps, type InputProps, Link, type LinkOwnProps, type LinkProps, Menu, MenuContent, type MenuContentOwnProps, type MenuContentProps, MenuItem, type MenuItemOwnProps, type MenuItemProps, type MenuPlacement, type MenuProps, MenuSection, type MenuSectionProps, MenuTrigger, type MenuTriggerOwnProps, type MenuTriggerProps, Pagination, PaginationEllipsis, type PaginationEllipsisOwnProps, type PaginationEllipsisProps, PaginationItem, type PaginationItemProps, PaginationLink, type PaginationLinkOwnProps, type PaginationLinkProps, PaginationNext, type PaginationNextOwnProps, type PaginationNextProps, type PaginationOwnProps, PaginationPrevious, type PaginationPreviousOwnProps, type PaginationPreviousProps, type PaginationProps, Popover, PopoverContent, type PopoverContentOwnProps, type PopoverContentProps, type PopoverPlacement, type PopoverProps, PopoverTrigger, type PopoverTriggerOwnProps, type PopoverTriggerProps, Progress, type ProgressOwnProps, type ProgressProps, Radio, RadioGroup, type RadioGroupOwnProps, type RadioGroupProps, type RadioOwnProps, type RadioProps, type Role, type RoleRegistry, Select, SelectItem, type SelectItemOwnProps, type SelectItemProps, type SelectOwnProps, type SelectProps, SelectSection, type SelectSectionProps, Separator, type SeparatorOwnProps, type SeparatorProps, type Size, Skeleton, type SkeletonOwnProps, type SkeletonProps, Spinner, type SpinnerOwnProps, type SpinnerProps, Switch, type SwitchOwnProps, type SwitchProps, Tab, TabList, type TabListOwnProps, type TabListProps, type TabOwnProps, TabPanel, type TabPanelOwnProps, type TabPanelProps, type TabProps, Table, TableBody, type TableBodyProps, TableCell, type TableCellProps, TableHead, type TableHeadProps, TableHeaderCell, type TableHeaderCellOwnProps, type TableHeaderCellProps, type TableProps, TableRow, type TableRowProps, Tabs, type TabsActivationMode, type TabsOrientation, type TabsOwnProps, type TabsProps, type TabsShape, Tag, TagGroup, type TagGroupOwnProps, type TagGroupProps, type TagOwnProps, type TagProps, Textarea, type TextareaOwnProps, type TextareaProps, type ToastAction, type ToastOptions, ToastQueue, type ToastQueueOptions, ToastRegion, type ToastRegionOwnProps, type ToastRegionProps, Tooltip, TooltipContent, type TooltipContentOwnProps, type TooltipContentProps, type TooltipPlacement, type TooltipProps, TooltipTrigger, type TooltipTriggerOwnProps, type TooltipTriggerProps, VisuallyHidden, type VisuallyHiddenProps, cn };
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import { cn } from "./_internal/libs/cn.js";
2
2
  import { VisuallyHidden } from "./VisuallyHidden/VisuallyHidden.js";
3
- import { Typography } from "./Typography/Typography.js";
4
3
  import { Spinner } from "./Spinner/Spinner.js";
5
4
  import { Button } from "./Button/Button.js";
6
5
  import { IconButton } from "./IconButton/IconButton.js";
@@ -75,4 +74,4 @@ import { Tooltip } from "./Tooltip/Tooltip.js";
75
74
  import { TooltipContent } from "./Tooltip/components/TooltipContent.js";
76
75
  import { TooltipTrigger } from "./Tooltip/components/TooltipTrigger.js";
77
76
 
78
- export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, Avatar, Badge, Breadcrumb, BreadcrumbCurrent, BreadcrumbItem, BreadcrumbLink, Button, Card, Checkbox, CheckboxGroup, Combobox, ComboboxItem, ComboboxSection, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, IconButton, Input, Link, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Pagination, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, SelectItem, SelectSection, Separator, Skeleton, Spinner, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Tag, TagGroup, Textarea, ToastQueue, ToastRegion, Tooltip, TooltipContent, TooltipTrigger, Typography, VisuallyHidden, cn };
77
+ export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDialog, Avatar, Badge, Breadcrumb, BreadcrumbCurrent, BreadcrumbItem, BreadcrumbLink, Button, Card, Checkbox, CheckboxGroup, Combobox, ComboboxItem, ComboboxSection, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, IconButton, Input, Link, Menu, MenuContent, MenuItem, MenuSection, MenuTrigger, Pagination, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, Progress, Radio, RadioGroup, Select, SelectItem, SelectSection, Separator, Skeleton, Spinner, Switch, Tab, TabList, TabPanel, Table, TableBody, TableCell, TableHead, TableHeaderCell, TableRow, Tabs, Tag, TagGroup, Textarea, ToastQueue, ToastRegion, Tooltip, TooltipContent, TooltipTrigger, VisuallyHidden, cn };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tide-design/components",
3
- "version": "0.18.3",
3
+ "version": "0.20.0",
4
4
  "description": "Tide 디자인 시스템의 React Component",
5
5
  "keywords": [
6
6
  "accessibility",
@@ -34,8 +34,8 @@
34
34
  "./styles.css": "./dist/styles.css"
35
35
  },
36
36
  "dependencies": {
37
- "@tide-design/foundation": "0.18.3",
38
- "@tide-design/icons": "0.18.3",
37
+ "@tide-design/foundation": "0.20.0",
38
+ "@tide-design/icons": "0.20.0",
39
39
  "clsx": "^2.1.1",
40
40
  "react-aria": "^3.53.1",
41
41
  "react-stately": "^3.51.0",
@@ -1,34 +0,0 @@
1
- import { HTMLAttributes, ReactElement, Ref } from "react";
2
- import { TextStyleName } from "@tide-design/foundation";
3
- type HeadingVariant = Extract<TextStyleName, `display-${string}` | `heading-${string}`>;
4
- type TextVariant = Exclude<TextStyleName, HeadingVariant>;
5
- type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
6
- interface TypographyElementProps extends HTMLAttributes<HTMLElement> {
7
- /** 루트 DOM 요소에 연결한다. */
8
- ref?: Ref<HTMLElement>;
9
- }
10
- interface TypographyRenderProps {
11
- /** 다른 요소로 렌더한다. 예: `render={<label htmlFor="name" />}`. 이때 `level`은 무시한다. */
12
- render?: ReactElement;
13
- }
14
- interface TypographyHeadingProps extends TypographyRenderProps {
15
- /** 텍스트 스타일 이름 */
16
- variant: HeadingVariant;
17
- /** 제목 단계. 주지 않으면 텍스트 스타일의 기본 단계를 쓴다. */
18
- level?: HeadingLevel;
19
- }
20
- interface TypographyTextProps extends TypographyRenderProps {
21
- /** 텍스트 스타일 이름. 기본값 `body-md`. */
22
- variant?: TextVariant;
23
- /** heading·display 텍스트 스타일에만 있다. */
24
- level?: never;
25
- }
26
- export type TypographyOwnProps = TypographyHeadingProps | TypographyTextProps;
27
- export type TypographyProps = TypographyOwnProps & Omit<TypographyElementProps, keyof TypographyOwnProps>;
28
- /**
29
- * 텍스트 스타일 하나로 크기·행간·굵기를 정하고 알맞은 시맨틱 요소로 렌더한다.
30
- * heading·display는 항상 `<h*>`다. 다른 요소는 `render`로. 서버 컴포넌트로 쓸 수 있다.
31
- * Tide props: `render`, `variant`, `level` ({@link TypographyOwnProps}). 나머지는 HTML 요소 속성.
32
- */
33
- export declare function Typography({ variant, level, render, ...props }: TypographyProps): ReactElement;
34
- export {};
@@ -1,51 +0,0 @@
1
- import { renderElement } from "../_internal/libs/renderElement.js";
2
-
3
- // src/Typography/Typography.tsx
4
- const variantClass = {
5
- "display-lg": "text-display-lg",
6
- "display-md": "text-display-md",
7
- "heading-xl": "text-heading-xl",
8
- "heading-lg": "text-heading-lg",
9
- "heading-md": "text-heading-md",
10
- "heading-sm": "text-heading-sm",
11
- "heading-xs": "text-heading-xs",
12
- "body-lg": "text-body-lg",
13
- "body-md": "text-body-md",
14
- "body-sm": "text-body-sm",
15
- "label-lg": "text-label-lg",
16
- "label-md": "text-label-md",
17
- "label-sm": "text-label-sm",
18
- caption: "text-caption"
19
- };
20
- const elementByVariant = {
21
- "display-lg": 1,
22
- "display-md": 1,
23
- "heading-xl": 1,
24
- "heading-lg": 2,
25
- "heading-md": 3,
26
- "heading-sm": 4,
27
- "heading-xs": 5,
28
- "body-lg": "p",
29
- "body-md": "p",
30
- "body-sm": "p",
31
- "label-lg": "span",
32
- "label-md": "span",
33
- "label-sm": "span",
34
- caption: "p"
35
- };
36
- /**
37
- * 텍스트 스타일 하나로 크기·행간·굵기를 정하고 알맞은 시맨틱 요소로 렌더한다.
38
- * heading·display는 항상 `<h*>`다. 다른 요소는 `render`로. 서버 컴포넌트로 쓸 수 있다.
39
- * Tide props: `render`, `variant`, `level` ({@link TypographyOwnProps}). 나머지는 HTML 요소 속성.
40
- */
41
- function Typography({ variant = "body-md", level, render, ...props }) {
42
- const element = elementByVariant[variant];
43
- return renderElement({
44
- defaultElement: typeof element === "number" ? `h${level ?? element}` : element,
45
- render,
46
- baseClassName: variantClass[variant],
47
- props
48
- });
49
- }
50
-
51
- export { Typography };
@@ -1,2 +0,0 @@
1
- import { Typography, TypographyOwnProps, TypographyProps } from "./Typography.js";
2
- export { Typography, type TypographyOwnProps, type TypographyProps };