Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/react-versioned-guides.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@devslab/dds-react": patch
---

Ship English and Korean guides for toast notifications, input controls, and layouts with the React package so consumers can read the documentation for their installed version.
9 changes: 5 additions & 4 deletions packages/dds-react/README.ko.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DDS React

아래 사용 가이드 링크는 설치한 버전의 `dist/docs/` 파일을 엽니다. 저장소에서 읽을 때는 [Toast](https://github.com/devslab-kr/dds/blob/HEAD/docs/toast.ko.md), [입력·선택 컨트롤](https://github.com/devslab-kr/dds/blob/HEAD/docs/components-input-choice-calendar.ko.md), [레이아웃](https://github.com/devslab-kr/dds/blob/HEAD/docs/layouts.ko.md) 원문을 참고하세요.

Ark UI 5.39.3과 DDS 토큰·CSS·아이콘을 사용하는 React 접근성 컴포넌트입니다. React/React DOM 18.3 또는 19를 peer dependency로 사용합니다.

```tsx
Expand All @@ -21,7 +23,7 @@ React DOM 속성(`className`, `htmlFor`, `onChange`)과 객체/콜백 ref를 사

Dialog는 기본적으로 portal을 사용하며 Ark가 중첩 모달, 포커스 복원, Escape, 스크롤 잠금을 관리합니다. `portal={false}`로 SSR 열린 콘텐츠를 인라인 렌더링할 수 있습니다. `contentProps`, `actions`, `frame`, `initialFocus`, `finalFocus`, `unstyled`와 Ark root 옵션을 제공합니다. `closeLabel`을 주면 오른쪽 위(인라인 끝) 모서리에 그 이름의 닫기(X) 버튼이 생기고, `frame`은 이를 `parts.close`로 받습니다. 버튼 줄은 위 내용과 한 단계 간격을 둡니다. Solid의 커스텀 additionalFocusContainers는 모방하지 않습니다. 고급 구성은 ArkDialog/ArkTabs/ArkTooltip/ArkRadioGroup/ArkCheckbox/ArkSwitch/ArkField/ArkToast 네임스페이스를 사용하세요.

Tooltip은 하나의 포커스 가능한 요소 또는 trigger props를 받는 render 함수를 사용합니다. ToastProvider의 regionLabel/dismissLabel은 호출자가 지정합니다. dismissLabel이 없으면 닫기 버튼이 없습니다. useToast는 show/loading/update/promise/dismiss/clear를 반환하며 duration 0은 유지됩니다. 언마운트 때 알림을 정리합니다. React·Solid·Vue의 동일한 계약은 [Toast 가이드](../../docs/toast.ko.md)를 참고하세요.
Tooltip은 하나의 포커스 가능한 요소 또는 trigger props를 받는 render 함수를 사용합니다. ToastProvider의 regionLabel/dismissLabel은 호출자가 지정합니다. dismissLabel이 없으면 닫기 버튼이 없습니다. useToast는 show/loading/update/promise/dismiss/clear를 반환하며 duration 0은 유지됩니다. 언마운트 때 알림을 정리합니다. React·Solid·Vue의 동일한 계약은 [Toast 가이드](./dist/docs/toast.ko.md)를 참고하세요.

```tsx
const toast = useToast(); // ToastProvider 내부
Expand Down Expand Up @@ -100,8 +102,7 @@ validity callback은 최초 mount, 의미 있는 입력·제약·외부 값 변

Input/InputGroup은 검색 전용이 아닌 일반 입력 기반이며 라벨 배치·내용 지우기를 지원합니다. Combobox/SelectPicker는 가상화를, DropdownMenu/Popover는 접근 가능한 팝업을, Calendar/DatePicker/DateRangePicker/MonthPicker는 공유 달력을 제공합니다.

상세 import: `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/date-range-picker`, `/month-picker`. 기존 루트 import와 `styles.css`는 유지합니다. [공통 사용 가이드](https://github.com/devslab-kr/dds/blob/main/docs/components-input-choice-calendar.ko.md)를 참고하세요.
상세 import: `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/time-picker`, `/date-range-picker`, `/month-picker`, `/segmented-control`, `/number-input`. 기존 루트 import와 `styles.css`는 유지합니다. [공통 사용 가이드](https://github.com/devslab-kr/dds/blob/main/docs/components-input-choice-calendar.ko.md)를 참고하세요.
상세 import: `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/time-picker`, `/date-range-picker`, `/month-picker`, `/segmented-control`, `/number-input`. 기존 루트 import와 `styles.css`는 유지합니다. [공통 사용 가이드](./dist/docs/components-input-choice-calendar.ko.md)를 참고하세요.

## 선택형 콘솔 메뉴 그룹

Expand All @@ -120,4 +121,4 @@ ID 생략 시 `group-<index>`를 사용하므로 순서 변경·상태 보관에

## 공통 업무 화면

Layout·LeftNav·TopNav는 공통 간격과 타이포 규격을 사용합니다. [조립 방법과 수치](../../docs/layouts.ko.md)를 참고하세요.
Layout·LeftNav·TopNav는 공통 간격과 타이포 규격을 사용합니다. [조립 방법과 수치](./dist/docs/layouts.ko.md)를 참고하세요.
9 changes: 5 additions & 4 deletions packages/dds-react/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# DDS React

The usage guides linked below ship in `dist/docs/` and match the installed package version. When browsing the repository, see the source guides for [toast](https://github.com/devslab-kr/dds/blob/HEAD/docs/toast.md), [input and selection controls](https://github.com/devslab-kr/dds/blob/HEAD/docs/components-input-choice-calendar.md), and [layouts](https://github.com/devslab-kr/dds/blob/HEAD/docs/layouts.md).

Accessible React primitives using Ark UI 5.39.3 and shared DDS tokens, CSS and icons. React and React DOM are peers (18.3 or 19). Import CSS once in the application:

```tsx
Expand All @@ -25,7 +27,7 @@ Native DOM attributes use React spelling (`className`, `htmlFor`, `onChange`). D

Tabs extends Ark root options, with `onValueChange(string)`; parts accept normal Ark DOM props including `asChild`. Dialog accepts Ark root options with `onOpenChange(boolean)`, `closeOnOutside`, `initialFocus`, `finalFocus`, `contentProps`, `actions`, `frame(parts)` and `unstyled`. Pass `closeLabel` to add a close (X) button in the top inline-end corner, named by that label; `frame` receives it as `parts.close`. Actions keep one step of space from the content above them. Dialog portals by default; use `portal={false}` for inline markup, including open SSR content. Ark owns nested modal isolation, focus, Escape handling and scroll locking. Additional focus containers from the Solid package are not emulated; use Ark `persistentElements` and `modal`/`trapFocus` according to application needs.

Tooltip accepts one element child (Ark `asChild`) or a render function receiving native button trigger props. Use a focusable trigger and preserve the supplied events. `ToastProvider` accepts optional caller `regionLabel` and `dismissLabel` (string or record-to-string function); without `dismissLabel` it renders no close button. `useToast()` returns `show`, `loading`, `update`, `promise`, `dismiss`, and `clear`; duration 0 persists. Providers clear their notifications on unmount. The [Toast guide](../../docs/toast.md) covers the identical React/Solid/Vue contract.
Tooltip accepts one element child (Ark `asChild`) or a render function receiving native button trigger props. Use a focusable trigger and preserve the supplied events. `ToastProvider` accepts optional caller `regionLabel` and `dismissLabel` (string or record-to-string function); without `dismissLabel` it renders no close button. `useToast()` returns `show`, `loading`, `update`, `promise`, `dismiss`, and `clear`; duration 0 persists. Providers clear their notifications on unmount. The [Toast guide](./dist/docs/toast.md) covers the identical React/Solid/Vue contract.

```tsx
const toast = useToast(); // inside ToastProvider
Expand Down Expand Up @@ -134,8 +136,7 @@ Delayed controlled echoes matching an outstanding local emission acknowledge tha

Input/InputGroup are general-purpose native inputs, not search-only, with label placement and clear actions. Combobox/SelectPicker support fixed-row virtualization; DropdownMenu/Popover provide accessible overlays; Calendar/DatePicker/DateRangePicker/MonthPicker share a calendar view.

Use explicit subpaths `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/date-range-picker`, `/month-picker`, or the existing root exports. Keep importing `styles.css` once. See the [common usage guide](https://github.com/devslab-kr/dds/blob/main/docs/components-input-choice-calendar.md).
Use explicit subpaths `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/time-picker`, `/date-range-picker`, `/month-picker`, `/segmented-control`, `/number-input`, or the existing root exports. Keep importing `styles.css` once. See the [common usage guide](https://github.com/devslab-kr/dds/blob/main/docs/components-input-choice-calendar.md).
Use explicit subpaths `@devslab/dds-react/input`, `/combobox`, `/select-picker`, `/dropdown-menu`, `/popover`, `/calendar`, `/date-picker`, `/time-picker`, `/date-range-picker`, `/month-picker`, `/segmented-control`, `/number-input`, or the existing root exports. Keep importing `styles.css` once. See the [common usage guide](./dist/docs/components-input-choice-calendar.md).

## Optional console navigation groups

Expand Down Expand Up @@ -165,4 +166,4 @@ the desktop rail and mobile drawer.

## Shared application layouts

Layout, LeftNav and TopNav use the common geometry and typography rules. See [composition and exact dimensions](../../docs/layouts.md).
Layout, LeftNav and TopNav use the common geometry and typography rules. See [composition and exact dimensions](./dist/docs/layouts.md).
1 change: 1 addition & 0 deletions packages/dds-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
"@types/node": "26.3.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@ui-sdk/core": "0.1.0-beta.14",
"axe-core": "4.13.0",
"jsdom": "30.0.1",
"react": "19.3.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/dds-react/src/__tests__/primitives.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createRef, StrictMode, useEffect, useState } from "react";
import { act, render, screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { checkPattern } from "@ui-sdk/core/testing";
import { describe, it, expect, vi } from "vitest";
import {
Button,
Expand Down Expand Up @@ -63,8 +64,8 @@ describe("React DDS behavior", () => {
await userEvent.click(screen.getByRole("checkbox"));
expect(screen.getByRole("checkbox")).not.toBeChecked();
});
it("delegates tab keyboard selection and panel visibility to Ark", async () => {
render(
it("follows the accessible tabs pattern and displays the panel selected with the keyboard", async () => {
const { container } = render(
<Tabs defaultValue="a">
<TabList aria-label="영역">
<Tab value="a">첫째</Tab>
Expand All @@ -83,6 +84,7 @@ describe("React DDS behavior", () => {
),
);
expect(screen.getByRole("tabpanel")).toHaveTextContent("둘 내용");
await checkPattern(container, "tabs");
});
it("uses Ark radio roving focus", async () => {
render(
Expand Down
26 changes: 26 additions & 0 deletions packages/dds-react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
import { readFile } from "node:fs/promises";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [
{
name: "dds-react-usage-guides",
async generateBundle() {
for (const topic of [
"toast",
"components-input-choice-calendar",
"layouts",
]) {
for (const suffix of [".md", ".ko.md"]) {
const filename = topic + suffix;
const source = await readFile(
new URL(`../../docs/${filename}`, import.meta.url),
);
this.emitFile({
type: "asset",
fileName: `docs/${filename}`,
source,
});
}
}
},
},
],
build: {
lib: {
entry: {
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions scripts/verify-react-release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,30 @@ try {
const manifest = JSON.parse(
await readFile(join(installed, "package.json"), "utf8"),
);
if (mode === "react") {
for (const suffix of [".md", ".ko.md"]) {
const readme = await readFile(join(installed, `README${suffix}`), "utf8");
const links = Array.from(
readme.matchAll(/\]\(\.\/([^)\s#]+\.md)(?:#[^)\s]*)?\)/g),
(match) => match[1],
);
for (const topic of [
"toast",
"components-input-choice-calendar",
"layouts",
]) {
const filename = topic + suffix;
const link = links.find((path) => basename(path) === filename);
assert.ok(link, `Packed README${suffix} must link to ${filename}`);
const guide = await readFile(join(installed, link), "utf8");
assert.equal(
guide,
await readFile(join(workspace, "docs", filename), "utf8"),
`Packed ${filename} must match the guide for this release`,
);
}
}
}
for (const path of [
"dist/index.js",
"dist/index.d.ts",
Expand Down