@tide-design/components 0.11.5 → 0.12.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/Switch/Switch.js
CHANGED
|
@@ -22,7 +22,7 @@ const thumbSizeClass = {
|
|
|
22
22
|
};
|
|
23
23
|
const trackClass = "peer m-0 shrink-0 cursor-pointer appearance-none rounded-full border border-strong bg-transparent transition-colors aria-invalid:border-danger focus-visible:focus-ring checked:enabled:border-accent checked:enabled:bg-accent-solid group-hover/switch:checked:enabled:bg-accent-solid-hover group-active/switch:checked:enabled:bg-accent-solid-active group-hover/switch:not-checked:enabled:bg-accent-subtle group-active/switch:not-checked:enabled:bg-accent-subtle-active disabled:cursor-not-allowed disabled:border-default disabled:bg-disabled";
|
|
24
24
|
const thumbClass = "pointer-events-none absolute start-0.75 top-0.75 rounded-full bg-current text-muted shadow-sm transition-colors motion-safe:transition-[color,background-color,translate] peer-checked:peer-enabled:text-accent-on-solid group-hover/switch:peer-enabled:peer-not-checked:text-accent group-active/switch:peer-enabled:peer-not-checked:text-accent peer-disabled:text-disabled";
|
|
25
|
-
const trackForcedClass = "forced-colors:forced-color-adjust-none forced-colors:[--tide-border-strong:CanvasText] forced-colors:[--tide-border-danger:CanvasText] forced-colors:[--tide-accent-border:Highlight] forced-colors:[--tide-accent-solid:Highlight] forced-colors:[--tide-accent-solid-hover:Highlight] forced-colors:[--tide-accent-solid-active:Highlight] forced-colors:[--tide-accent-subtle:Canvas] forced-colors:[--tide-accent-subtle-active:Canvas] forced-colors:[--tide-border-default:GrayText] forced-colors:[--tide-bg-disabled:Canvas] forced-colors:[--tide-
|
|
25
|
+
const trackForcedClass = "forced-colors:forced-color-adjust-none forced-colors:[--tide-border-strong:CanvasText] forced-colors:[--tide-border-danger:CanvasText] forced-colors:[--tide-accent-border:Highlight] forced-colors:[--tide-accent-solid:Highlight] forced-colors:[--tide-accent-solid-hover:Highlight] forced-colors:[--tide-accent-solid-active:Highlight] forced-colors:[--tide-accent-subtle:Canvas] forced-colors:[--tide-accent-subtle-active:Canvas] forced-colors:[--tide-border-default:GrayText] forced-colors:[--tide-bg-disabled:Canvas] forced-colors:[--tide-accent-subtle-border:Highlight]";
|
|
26
26
|
const thumbForcedClass = "forced-colors:forced-color-adjust-none forced-colors:[--tide-text-muted:CanvasText] forced-colors:[--tide-accent-text:CanvasText] forced-colors:[--tide-accent-on-solid:HighlightText] forced-colors:[--tide-text-disabled:GrayText]";
|
|
27
27
|
/**
|
|
28
28
|
* 켜고 끄는 스위치. 네이티브 체크박스(`role="switch"`)라 form 제출이 그대로 된다.
|
|
@@ -4,7 +4,7 @@ const choiceRootClass = "group/choice inline-flex items-start gap-2 align-top te
|
|
|
4
4
|
/** 상자보다 큰 24×24 조작 영역(WCAG 2.5.8). */
|
|
5
5
|
const choiceAreaClass = "grid size-6 shrink-0 place-items-center";
|
|
6
6
|
/** 네이티브 input을 상자로 그린다. group-hover가 checked:보다 우선순위가 높아 체크 전 규칙에 not-checked를 붙인다. */
|
|
7
|
-
const choiceInputClass = "peer col-start-1 row-start-1 m-0 appearance-none border border-strong bg-canvas cursor-pointer transition-colors checked:border-accent checked:bg-accent-solid enabled:not-checked:not-indeterminate:group-hover/choice:bg-accent-subtle enabled:checked:group-hover/choice:bg-accent-solid-hover indeterminate:border-accent indeterminate:bg-accent-solid enabled:indeterminate:group-hover/choice:bg-accent-solid-hover enabled:not-checked:not-indeterminate:group-active/choice:bg-accent-subtle-active enabled:checked:group-active/choice:bg-accent-solid-active enabled:indeterminate:group-active/choice:bg-accent-solid-active aria-invalid:border-danger focus-visible:focus-
|
|
7
|
+
const choiceInputClass = "peer col-start-1 row-start-1 m-0 appearance-none border border-strong bg-canvas cursor-pointer transition-colors checked:border-accent checked:bg-accent-solid enabled:not-checked:not-indeterminate:group-hover/choice:bg-accent-subtle enabled:checked:group-hover/choice:bg-accent-solid-hover indeterminate:border-accent indeterminate:bg-accent-solid enabled:indeterminate:group-hover/choice:bg-accent-solid-hover enabled:not-checked:not-indeterminate:group-active/choice:bg-accent-subtle-active enabled:checked:group-active/choice:bg-accent-solid-active enabled:indeterminate:group-active/choice:bg-accent-solid-active aria-invalid:border-danger focus-visible:focus-field disabled:cursor-not-allowed disabled:border-default disabled:bg-disabled forced-colors:forced-color-adjust-none forced-colors:[--tide-bg-canvas:Canvas] forced-colors:[--tide-border-strong:CanvasText] forced-colors:[--tide-border-danger:CanvasText] forced-colors:[--tide-accent-border:Highlight] forced-colors:[--tide-accent-solid:Highlight] forced-colors:[--tide-accent-solid-hover:Highlight] forced-colors:[--tide-accent-solid-active:Highlight] forced-colors:[--tide-accent-subtle:Canvas] forced-colors:[--tide-accent-subtle-active:Canvas] forced-colors:[--tide-border-default:GrayText] forced-colors:[--tide-bg-disabled:Canvas] forced-colors:[--tide-accent-subtle-border:Highlight] forced-colors:[--tide-border-danger-subtle:Highlight]";
|
|
8
8
|
/** 상자 위에 겹치는 표시 아이콘. 누름은 input이 받는다. 보이는 조건 class는 Component가 붙인다. */
|
|
9
9
|
const choiceMarkClass = "pointer-events-none col-start-1 row-start-1 hidden text-accent-on-solid peer-disabled:text-disabled forced-colors:forced-color-adjust-none forced-colors:[--tide-accent-on-solid:HighlightText] forced-colors:[--tide-text-disabled:GrayText]";
|
|
10
10
|
/** 글자 스타일. md 행간 24px은 조작 영역과 같고, sm 행간 20px은 위아래 2px을 둬 첫 줄을 상자 가운데에 맞춘다. */
|
|
@@ -22,9 +22,16 @@ const pressableDisabledClass = {
|
|
|
22
22
|
outline: "cursor-not-allowed border-default text-disabled",
|
|
23
23
|
ghost: "cursor-not-allowed border-transparent text-disabled"
|
|
24
24
|
};
|
|
25
|
+
/** 포커스 표시. 색 있는 테두리가 보이는 outline만 테두리도 바꾸고, 나머지는 투명 border라 halo만 둔다(ADR 0032). */
|
|
26
|
+
const pressableFocusClass = {
|
|
27
|
+
solid: "focus-visible:focus-ring",
|
|
28
|
+
subtle: "focus-visible:focus-ring",
|
|
29
|
+
outline: "focus-visible:focus-field",
|
|
30
|
+
ghost: "focus-visible:focus-ring"
|
|
31
|
+
};
|
|
25
32
|
/** 모양의 공통 부분. radius는 모든 size에서 `md`다. 높이·폭·padding은 Component가 정한다. */
|
|
26
|
-
const pressableBaseClass = "inline-flex shrink-0 items-center justify-center rounded-md border whitespace-nowrap select-none transition-colors
|
|
33
|
+
const pressableBaseClass = "inline-flex shrink-0 items-center justify-center rounded-md border whitespace-nowrap select-none transition-colors";
|
|
27
34
|
/** 누름 축소. motion-safe:일 때만 줄이고 scale도 그때만 전환 대상에 넣는다(ADR 0010). */
|
|
28
35
|
const pressableScaleClass = "motion-safe:transition-[color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,scale] motion-safe:active:scale-96";
|
|
29
36
|
|
|
30
|
-
export { pressableBaseClass, pressableColorClass, pressableDisabledClass, pressableInteractionClass, pressableScaleClass };
|
|
37
|
+
export { pressableBaseClass, pressableColorClass, pressableDisabledClass, pressableFocusClass, pressableInteractionClass, pressableScaleClass };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pressableColorClass, pressableDisabledClass, pressableInteractionClass, pressableScaleClass } from "../constants/pressableClass.js";
|
|
1
|
+
import { pressableColorClass, pressableDisabledClass, pressableFocusClass, pressableInteractionClass, pressableScaleClass } from "../constants/pressableClass.js";
|
|
2
2
|
|
|
3
3
|
// src/_internal/libs/pressableState.ts
|
|
4
4
|
/** `disabled`를 네이티브로 지원하는 요소인지. Button류가 렌더할 만한 요소 중에서는 `button`뿐이다. */
|
|
@@ -16,6 +16,7 @@ function pressableState({ variant, color, disabled, loading, noPressScale, rende
|
|
|
16
16
|
return {
|
|
17
17
|
className: [
|
|
18
18
|
disabled ? pressableDisabledClass[variant] : pressableColorClass[variant],
|
|
19
|
+
pressableFocusClass[variant],
|
|
19
20
|
interactive ? pressableInteractionClass[variant] : void 0,
|
|
20
21
|
interactive && !noPressScale ? pressableScaleClass : void 0,
|
|
21
22
|
interactive ? "cursor-pointer" : void 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tide-design/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.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.
|
|
38
|
-
"@tide-design/icons": "0.
|
|
37
|
+
"@tide-design/foundation": "0.12.0",
|
|
38
|
+
"@tide-design/icons": "0.12.0",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react-aria": "^3.53.1",
|
|
41
41
|
"react-stately": "^3.51.0",
|