@k8ordo/ui 1.0.0 → 2.0.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/README.md +37 -12
- package/dist/components/ai/conversation/conversation.d.mts +8 -10
- package/dist/components/ai/conversation/conversation.mjs +1 -6
- package/dist/components/ai/conversation/index.d.mts +15 -1
- package/dist/components/ai/conversation/index.mjs +8 -1
- package/dist/components/ai/index.d.mts +5 -9
- package/dist/components/ai/index.mjs +4 -4
- package/dist/components/ai/message/index.d.mts +12 -1
- package/dist/components/ai/message/index.mjs +7 -1
- package/dist/components/ai/message/message.d.mts +3 -5
- package/dist/components/ai/message/message.mjs +1 -5
- package/dist/components/ai/prompt-input/index.d.mts +23 -1
- package/dist/components/ai/prompt-input/index.mjs +8 -1
- package/dist/components/ai/prompt-input/prompt-input.d.mts +4 -6
- package/dist/components/ai/prompt-input/prompt-input.mjs +1 -6
- package/dist/components/ai/suggestion/index.d.mts +13 -1
- package/dist/components/ai/suggestion/index.mjs +7 -1
- package/dist/components/ai/suggestion/suggestion.d.mts +3 -5
- package/dist/components/ai/suggestion/suggestion.mjs +1 -5
- package/dist/components/buttons/icon-button/icon-button.mjs +1 -1
- package/dist/components/form/checkbox/checkbox.d.mts +1 -0
- package/dist/components/form/checkbox/checkbox.mjs +3 -2
- package/dist/components/form/checkbox-group/index.d.mts +1 -0
- package/dist/components/form/file-field/file-field.d.mts +12 -15
- package/dist/components/form/file-field/file-field.mjs +1 -6
- package/dist/components/form/file-field/index.d.mts +17 -1
- package/dist/components/form/file-field/index.mjs +8 -1
- package/dist/components/form/radio/radio.d.mts +1 -0
- package/dist/components/form/radio/radio.mjs +3 -2
- package/dist/components/index.d.mts +15 -21
- package/dist/components/index.mjs +7 -7
- package/dist/components/navigation/anchor/anchor.mjs +1 -1
- package/dist/components/navigation/tabs/index.d.mts +19 -1
- package/dist/components/navigation/tabs/index.mjs +9 -1
- package/dist/components/navigation/tabs/tabs.d.mts +16 -18
- package/dist/components/navigation/tabs/tabs.mjs +1 -7
- package/dist/components/overlays/dialog/dialog.d.mts +12 -16
- package/dist/components/overlays/dialog/dialog.mjs +1 -6
- package/dist/components/overlays/dialog/index.d.mts +17 -1
- package/dist/components/overlays/dialog/index.mjs +8 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +20 -24
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +2 -11
- package/dist/components/overlays/dropdown-menu/index.d.mts +31 -1
- package/dist/components/overlays/dropdown-menu/index.mjs +12 -1
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +1 -1
- package/dist/components/overlays/list-box/index.d.mts +27 -1
- package/dist/components/overlays/list-box/index.mjs +9 -1
- package/dist/components/overlays/list-box/list-box.d.mts +20 -22
- package/dist/components/overlays/list-box/list-box.mjs +2 -8
- package/dist/components/overlays/popover/index.d.mts +24 -1
- package/dist/components/overlays/popover/index.mjs +8 -1
- package/dist/components/overlays/popover/popover.d.mts +18 -20
- package/dist/components/overlays/popover/popover.mjs +2 -7
- package/dist/components/overlays/tooltip/index.d.mts +21 -1
- package/dist/components/overlays/tooltip/index.mjs +8 -1
- package/dist/components/overlays/tooltip/tooltip.d.mts +18 -22
- package/dist/components/overlays/tooltip/tooltip.mjs +2 -7
- package/dist/hooks/index.d.mts +1 -4
- package/dist/hooks/index.mjs +2 -5
- package/dist/index.d.mts +13 -15
- package/dist/index.mjs +9 -12
- package/dist/integrations/_shared/renderers.mjs +7 -7
- package/dist/integrations/_shared/schemas.d.mts +1 -1
- package/dist/{hooks/focus-trap/index.d.mts → internal/focus-trap.d.mts} +1 -1
- package/dist/{hooks/focus-trap/index.mjs → internal/focus-trap.mjs} +1 -1
- package/dist/styles/index.css +0 -8
- package/docs/GUIDE.md +148 -133
- package/docs/llms.txt +11 -7
- package/docs/props.generated.json +18 -0
- package/docs/references/ai-chat.md +67 -67
- package/docs/references/color.md +108 -107
- package/docs/references/components.md +318 -310
- package/docs/references/generative-ui.md +51 -30
- package/docs/references/helpers.md +155 -52
- package/docs/references/hooks.md +61 -74
- package/docs/references/interaction-design.md +47 -47
- package/docs/references/spatial-design.md +83 -81
- package/docs/references/typography.md +68 -67
- package/package.json +32 -33
- package/dist/hooks/hash/index.d.mts +0 -4
- package/dist/hooks/hash/index.mjs +0 -25
- package/dist/hooks/local-storage/index.d.mts +0 -4
- package/dist/hooks/local-storage/index.mjs +0 -46
- package/dist/hooks/session-storage/index.d.mts +0 -4
- package/dist/hooks/session-storage/index.mjs +0 -46
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# @k8ordo/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React components from [k8ordo](https://ordo.k8o.me) — semantic design
|
|
4
|
+
tokens, built-in Japanese/English wording, and adapters that let an LLM generate
|
|
5
|
+
on-brand UIs.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Like every k8ordo package it assumes React 19 and Server Components, uses only
|
|
8
|
+
what has reached Baseline, and ships no polyfills or legacy fallbacks.
|
|
9
|
+
|
|
10
|
+
- **Documentation**: https://ordo.k8o.me/ui
|
|
6
11
|
- **Storybook**: https://main--687a213c85e2e4589d8db1bb.chromatic.com
|
|
7
12
|
|
|
8
13
|
## Installation
|
|
@@ -17,17 +22,35 @@ yarn add @k8ordo/ui
|
|
|
17
22
|
|
|
18
23
|
## Peer Dependencies
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
Only React is required:
|
|
21
26
|
|
|
22
27
|
```bash
|
|
23
|
-
npm install react react-dom
|
|
28
|
+
npm install react react-dom
|
|
24
29
|
```
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
+
| Package | Version |
|
|
32
|
+
| ----------- | ------- |
|
|
33
|
+
| `react` | ≥19.2.6 |
|
|
34
|
+
| `react-dom` | ≥19.2.6 |
|
|
35
|
+
|
|
36
|
+
Everything else is an optional peer, needed only for the entry point that uses
|
|
37
|
+
it. Install one when you import the entry it belongs to.
|
|
38
|
+
|
|
39
|
+
| Package | Version | Needed for |
|
|
40
|
+
| ----------------------------------------- | -------- | ----------------------------------------------------------------------------- |
|
|
41
|
+
| `typescript` | ≥7.0.2 | the shipped type declarations |
|
|
42
|
+
| `@types/react` | ≥19.2.18 | the shipped type declarations |
|
|
43
|
+
| `@types/react-dom` | ≥19.2.4 | the shipped type declarations |
|
|
44
|
+
| `tailwindcss` | ≥4.3.3 | the `tailwind.css` entry (see [Imports & Bundle Size](#imports--bundle-size)) |
|
|
45
|
+
| `zod` | ≥4.4.3 | generative-UI schemas |
|
|
46
|
+
| `@json-render/core`, `@json-render/react` | ≥0.19.0 | `@k8ordo/ui/json-render` |
|
|
47
|
+
| `@openuidev/lang-core` | ≥0.2.10 | `@k8ordo/ui/openui` |
|
|
48
|
+
| `@openuidev/react-lang` | ≥0.2.9 | `@k8ordo/ui/openui` |
|
|
49
|
+
| `ai` | ≥7.0.51 | `@k8ordo/ui/ai-sdk` |
|
|
50
|
+
| `streamdown` | ≥2.5.0 | `@k8ordo/ui/ai/response` |
|
|
51
|
+
|
|
52
|
+
The `styles.css` entry needs no peer at all — it is prebuilt CSS, so CSS Modules
|
|
53
|
+
and plain-CSS projects can use the components without Tailwind.
|
|
31
54
|
|
|
32
55
|
## Quick Start
|
|
33
56
|
|
|
@@ -225,6 +248,8 @@ stories and rendered props rather than relying on trained knowledge:
|
|
|
225
248
|
|
|
226
249
|
### Layout
|
|
227
250
|
|
|
251
|
+
- **Grid** - CSS grid with token-based gaps and responsive auto-fill/auto-fit columns
|
|
252
|
+
- **Stack** - Flex layout with token-based gaps
|
|
228
253
|
- **ScrollLinked** - Scroll progress indicator
|
|
229
254
|
- **Separator** - Visual content divider
|
|
230
255
|
|
|
@@ -318,7 +343,7 @@ All components and hooks ship from a single ESM entry point — there are no per
|
|
|
318
343
|
|
|
319
344
|
```tsx
|
|
320
345
|
// Named imports from the root entry — unused exports are tree-shaken away
|
|
321
|
-
import { Button, Card, useClickAway,
|
|
346
|
+
import { Button, Card, useClickAway, useDisclosure } from '@k8ordo/ui';
|
|
322
347
|
```
|
|
323
348
|
|
|
324
349
|
Optional features live behind dedicated subpath exports:
|
|
@@ -551,11 +576,9 @@ The library includes several useful hooks:
|
|
|
551
576
|
- **useDebouncedTransition** - Rate-limited transition with `AbortSignal`
|
|
552
577
|
- **useDeferredDebounce** - `useDeferredValue` with pending flag
|
|
553
578
|
- **useDisclosure** - Open/close/toggle disclosure state
|
|
554
|
-
- **useHash** - URL hash management
|
|
555
579
|
- **useHover** - Element hover detection
|
|
556
580
|
- **useIntersectionObserver** / **useInView** - Element visibility
|
|
557
581
|
- **useInterval** - Interval timer management
|
|
558
|
-
- **useLocalStorage** / **useSessionStorage** - Web Storage with React state
|
|
559
582
|
- **useResize** - Element resize detection (ResizeObserver)
|
|
560
583
|
- **useScrollDirection** - Scroll direction detection
|
|
561
584
|
- **useScrollLock** - Body/element scroll lock
|
|
@@ -565,6 +588,8 @@ The library includes several useful hooks:
|
|
|
565
588
|
- **useWindowSize** - Window size tracking
|
|
566
589
|
- **useWritingMode** - Detect horizontal/vertical `writing-mode`
|
|
567
590
|
|
|
591
|
+
State that lives in a place — the URL, a history entry, localStorage, memory — is [`@k8ordo/state`](https://www.npmjs.com/package/@k8ordo/state)'s job (`defineLocalState` and friends), not a hook here: a package that owned it twice would give an app two answers.
|
|
592
|
+
|
|
568
593
|
## Accessibility
|
|
569
594
|
|
|
570
595
|
All components follow WCAG accessibility guidelines:
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
2
|
//#region src/components/ai/conversation/conversation.d.ts
|
|
3
|
+
declare const Root: FC<{
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}>;
|
|
3
6
|
type MessagesProps = {
|
|
4
7
|
label?: string;
|
|
5
8
|
isStreaming?: boolean;
|
|
6
9
|
children: ReactNode;
|
|
7
10
|
};
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly Messages: FC<MessagesProps>;
|
|
13
|
-
readonly ScrollButton: FC<{
|
|
14
|
-
label?: string;
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
11
|
+
declare const Messages: FC<MessagesProps>;
|
|
12
|
+
declare const ScrollButton: FC<{
|
|
13
|
+
label?: string;
|
|
14
|
+
}>;
|
|
17
15
|
//#endregion
|
|
18
|
-
export {
|
|
16
|
+
export { Messages, Root, ScrollButton };
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/components/ai/conversation/index.d.ts
|
|
2
|
+
declare const Conversation: {
|
|
3
|
+
readonly Root: import("react").FC<{
|
|
4
|
+
children: import("react").ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
readonly Messages: import("react").FC<{
|
|
7
|
+
label?: string;
|
|
8
|
+
isStreaming?: boolean;
|
|
9
|
+
children: import("react").ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
readonly ScrollButton: import("react").FC<{
|
|
12
|
+
label?: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
2
16
|
export { Conversation };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Messages, Root, ScrollButton } from "./conversation.mjs";
|
|
2
|
+
//#region src/components/ai/conversation/index.ts
|
|
3
|
+
const Conversation = {
|
|
4
|
+
Root,
|
|
5
|
+
Messages,
|
|
6
|
+
ScrollButton
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
2
9
|
export { Conversation };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { Conversation } from "./conversation/
|
|
2
|
-
import "./
|
|
3
|
-
import {
|
|
4
|
-
import "./message/index.mjs";
|
|
5
|
-
import { ChatStatus, ToolState } from "./types.mjs";
|
|
6
|
-
import { PromptInput } from "./prompt-input/prompt-input.mjs";
|
|
7
|
-
import "./prompt-input/index.mjs";
|
|
1
|
+
import { Conversation } from "./conversation/index.mjs";
|
|
2
|
+
import { Message } from "./message/index.mjs";
|
|
3
|
+
import { PromptInput } from "./prompt-input/index.mjs";
|
|
8
4
|
import { Reasoning } from "./reasoning/reasoning.mjs";
|
|
9
5
|
import "./reasoning/index.mjs";
|
|
10
|
-
import { Suggestion } from "./suggestion/
|
|
11
|
-
import "./
|
|
6
|
+
import { Suggestion } from "./suggestion/index.mjs";
|
|
7
|
+
import { ChatStatus, ToolState } from "./types.mjs";
|
|
12
8
|
import { ToolInvocation } from "./tool-invocation/tool-invocation.mjs";
|
|
13
9
|
import "./tool-invocation/index.mjs";
|
|
14
10
|
export { type ChatStatus, Conversation, Message, PromptInput, Reasoning, Suggestion, ToolInvocation, type ToolState };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Conversation } from "./conversation/
|
|
2
|
-
import { Message } from "./message/
|
|
3
|
-
import { PromptInput } from "./prompt-input/
|
|
1
|
+
import { Conversation } from "./conversation/index.mjs";
|
|
2
|
+
import { Message } from "./message/index.mjs";
|
|
3
|
+
import { PromptInput } from "./prompt-input/index.mjs";
|
|
4
4
|
import { Reasoning } from "./reasoning/reasoning.mjs";
|
|
5
|
-
import { Suggestion } from "./suggestion/
|
|
5
|
+
import { Suggestion } from "./suggestion/index.mjs";
|
|
6
6
|
import { ToolInvocation } from "./tool-invocation/tool-invocation.mjs";
|
|
7
7
|
export { Conversation, Message, PromptInput, Reasoning, Suggestion, ToolInvocation };
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/components/ai/message/index.d.ts
|
|
2
|
+
declare const Message: {
|
|
3
|
+
readonly Root: import("react").FC<{
|
|
4
|
+
from: "assistant" | "user";
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "className" | "style">>;
|
|
7
|
+
readonly Content: import("react").FC<{
|
|
8
|
+
isStreaming?: boolean;
|
|
9
|
+
children: import("react").ReactNode;
|
|
10
|
+
} & Omit<import("react").HTMLAttributes<HTMLDivElement>, "className" | "style">>;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
2
13
|
export { Message };
|
|
@@ -5,13 +5,11 @@ type RootProps = {
|
|
|
5
5
|
from: MessageRole;
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
|
|
8
|
+
declare const Root: FC<RootProps>;
|
|
8
9
|
type ContentProps = {
|
|
9
10
|
isStreaming?: boolean;
|
|
10
11
|
children: ReactNode;
|
|
11
12
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'style'>;
|
|
12
|
-
declare const
|
|
13
|
-
readonly Root: FC<RootProps>;
|
|
14
|
-
readonly Content: FC<ContentProps>;
|
|
15
|
-
};
|
|
13
|
+
declare const Content: FC<ContentProps>;
|
|
16
14
|
//#endregion
|
|
17
|
-
export {
|
|
15
|
+
export { Content, Root };
|
|
@@ -26,9 +26,5 @@ const Content = ({ isStreaming = false, children, ...rest }) => {
|
|
|
26
26
|
children: [children, isStreaming ? /* @__PURE__ */ jsx(StreamingCursor, {}) : null]
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
const Message = {
|
|
30
|
-
Root,
|
|
31
|
-
Content
|
|
32
|
-
};
|
|
33
29
|
//#endregion
|
|
34
|
-
export {
|
|
30
|
+
export { Content, Root };
|
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatStatus } from "../types.mjs";
|
|
2
|
+
import "../index.mjs";
|
|
3
|
+
//#region src/components/ai/prompt-input/index.d.ts
|
|
4
|
+
declare const PromptInput: {
|
|
5
|
+
readonly Root: import("react").FC<{
|
|
6
|
+
status?: ChatStatus;
|
|
7
|
+
value?: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
onChange?: (value: string) => void;
|
|
10
|
+
onSubmit?: (message: string) => void;
|
|
11
|
+
onStop?: () => void;
|
|
12
|
+
children: import("react").ReactNode;
|
|
13
|
+
}>;
|
|
14
|
+
readonly Textarea: import("react").FC<{
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
ref?: import("react").Ref<HTMLTextAreaElement>;
|
|
17
|
+
} & Omit<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, "className" | "defaultValue" | "onChange" | "rows" | "style" | "value">>;
|
|
18
|
+
readonly Submit: import("react").FC<{
|
|
19
|
+
sendLabel?: string;
|
|
20
|
+
stopLabel?: string;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
2
24
|
export { PromptInput };
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Root, Submit, Textarea } from "./prompt-input.mjs";
|
|
2
|
+
//#region src/components/ai/prompt-input/index.ts
|
|
3
|
+
const PromptInput = {
|
|
4
|
+
Root,
|
|
5
|
+
Textarea,
|
|
6
|
+
Submit
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
2
9
|
export { PromptInput };
|
|
@@ -10,18 +10,16 @@ type RootProps = {
|
|
|
10
10
|
onStop?: () => void;
|
|
11
11
|
children: ReactNode;
|
|
12
12
|
};
|
|
13
|
+
declare const Root: FC<RootProps>;
|
|
13
14
|
type TextareaProps = {
|
|
14
15
|
placeholder?: string;
|
|
15
16
|
ref?: Ref<HTMLTextAreaElement>;
|
|
16
17
|
} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value' | 'defaultValue' | 'onChange' | 'className' | 'style' | 'rows'>;
|
|
18
|
+
declare const Textarea: FC<TextareaProps>;
|
|
17
19
|
type SubmitProps = {
|
|
18
20
|
sendLabel?: string;
|
|
19
21
|
stopLabel?: string;
|
|
20
22
|
};
|
|
21
|
-
declare const
|
|
22
|
-
readonly Root: FC<RootProps>;
|
|
23
|
-
readonly Textarea: FC<TextareaProps>;
|
|
24
|
-
readonly Submit: FC<SubmitProps>;
|
|
25
|
-
};
|
|
23
|
+
declare const Submit: FC<SubmitProps>;
|
|
26
24
|
//#endregion
|
|
27
|
-
export {
|
|
25
|
+
export { Root, Submit, Textarea };
|
|
@@ -99,10 +99,5 @@ const Submit = ({ sendLabel, stopLabel }) => {
|
|
|
99
99
|
children: /* @__PURE__ */ jsx(SendIcon, { size: "sm" })
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
-
const PromptInput = {
|
|
103
|
-
Root,
|
|
104
|
-
Textarea,
|
|
105
|
-
Submit
|
|
106
|
-
};
|
|
107
102
|
//#endregion
|
|
108
|
-
export {
|
|
103
|
+
export { Root, Submit, Textarea };
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/components/ai/suggestion/index.d.ts
|
|
2
|
+
declare const Suggestion: {
|
|
3
|
+
readonly List: import("react").FC<{
|
|
4
|
+
label?: string;
|
|
5
|
+
children: import("react").ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
readonly Item: import("react").FC<{
|
|
8
|
+
value: string;
|
|
9
|
+
onSelect?: (value: string) => void;
|
|
10
|
+
children?: import("react").ReactNode;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
2
14
|
export { Suggestion };
|
|
@@ -4,14 +4,12 @@ type ListProps = {
|
|
|
4
4
|
label?: string;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
};
|
|
7
|
+
declare const List: FC<ListProps>;
|
|
7
8
|
type ItemProps = {
|
|
8
9
|
value: string;
|
|
9
10
|
onSelect?: (value: string) => void;
|
|
10
11
|
children?: ReactNode;
|
|
11
12
|
};
|
|
12
|
-
declare const
|
|
13
|
-
readonly List: FC<ListProps>;
|
|
14
|
-
readonly Item: FC<ItemProps>;
|
|
15
|
-
};
|
|
13
|
+
declare const Item: FC<ItemProps>;
|
|
16
14
|
//#endregion
|
|
17
|
-
export {
|
|
15
|
+
export { Item, List };
|
|
@@ -3,7 +3,7 @@ import { FOCUS_RING } from "../../_internal/focus-ring.mjs";
|
|
|
3
3
|
import { cn } from "../../../helpers/cn.mjs";
|
|
4
4
|
import { chain } from "../../../helpers/chain.mjs";
|
|
5
5
|
import { mergeRefs } from "../../../helpers/merge-refs.mjs";
|
|
6
|
-
import { Tooltip } from "../../overlays/tooltip/
|
|
6
|
+
import { Tooltip } from "../../overlays/tooltip/index.mjs";
|
|
7
7
|
import { useTransition } from "react";
|
|
8
8
|
import { useFormStatus } from "react-dom";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -7,7 +7,7 @@ import { useCheckboxGroupContext } from "../checkbox-group/checkbox-group.mjs";
|
|
|
7
7
|
import { useFormStatus } from "react-dom";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/form/checkbox/checkbox.tsx
|
|
10
|
-
const Checkbox = ({ name, itemValue, disabled = false, label, checked, defaultChecked, onChange, ref, ...rest }) => {
|
|
10
|
+
const Checkbox = ({ name, itemValue, disabled = false, invalid = false, label, checked, defaultChecked, onChange, ref, ...rest }) => {
|
|
11
11
|
const groupContext = useCheckboxGroupContext();
|
|
12
12
|
const { pending } = useFormStatus();
|
|
13
13
|
const [internalChecked, setInternalChecked] = useControllableState({
|
|
@@ -29,6 +29,7 @@ const Checkbox = ({ name, itemValue, disabled = false, label, checked, defaultCh
|
|
|
29
29
|
/* @__PURE__ */ jsx("input", {
|
|
30
30
|
...rest,
|
|
31
31
|
...groupContext || isControlled ? { checked: isChecked } : { defaultChecked },
|
|
32
|
+
"aria-invalid": invalid,
|
|
32
33
|
className: "peer sr-only",
|
|
33
34
|
disabled: disabledResolved,
|
|
34
35
|
name: groupContext?.name ?? name,
|
|
@@ -45,7 +46,7 @@ const Checkbox = ({ name, itemValue, disabled = false, label, checked, defaultCh
|
|
|
45
46
|
}),
|
|
46
47
|
/* @__PURE__ */ jsx("span", {
|
|
47
48
|
"aria-hidden": true,
|
|
48
|
-
className: cn("inline-flex size-5 items-center justify-center rounded-md border-2 transition-colors", FOCUS_RING_PEER, disabledResolved && "border-border-mute bg-bg-mute", isChecked ? "border-border-base bg-primary-bg text-fg-base" : "border-border-mute bg-bg-base"),
|
|
49
|
+
className: cn("inline-flex size-5 items-center justify-center rounded-md border-2 transition-colors", FOCUS_RING_PEER, disabledResolved && "border-border-mute bg-bg-mute", isChecked ? "border-border-base bg-primary-bg text-fg-base" : "border-border-mute bg-bg-base", invalid && "border-border-error"),
|
|
49
50
|
children: isChecked ? /* @__PURE__ */ jsx(CheckIcon, { size: "sm" }) : null
|
|
50
51
|
}),
|
|
51
52
|
/* @__PURE__ */ jsx("span", {
|
|
@@ -9,19 +9,16 @@ type RootProps = PropsWithChildren<{
|
|
|
9
9
|
ref?: Ref<HTMLInputElement>;
|
|
10
10
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'className' | 'style' | 'onChange' | 'defaultValue' | 'value' | 'children'>>;
|
|
11
11
|
declare const Root: ({ children, disabled, invalid, required, multiple, maxFiles, defaultValue, onChange, webkitDirectory, ref, ...rest }: RootProps) => import("react").JSX.Element;
|
|
12
|
-
declare const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
clearable?: boolean;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
12
|
+
declare const Trigger: FC<{
|
|
13
|
+
renderItem: (props: {
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
invalid: boolean;
|
|
17
|
+
}) => ReactElement;
|
|
18
|
+
}>;
|
|
19
|
+
declare const ItemList: FC<{
|
|
20
|
+
showWebkitRelativePath?: boolean;
|
|
21
|
+
clearable?: boolean;
|
|
22
|
+
}>;
|
|
26
23
|
//#endregion
|
|
27
|
-
export {
|
|
24
|
+
export { ItemList, Root, Trigger };
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Root } from "./file-field.mjs";
|
|
2
|
+
//#region src/components/form/file-field/index.d.ts
|
|
3
|
+
declare const FileField: {
|
|
4
|
+
readonly Root: typeof Root;
|
|
5
|
+
readonly Trigger: import("react").FC<{
|
|
6
|
+
renderItem: (props: {
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
invalid: boolean;
|
|
10
|
+
}) => import("react").ReactElement;
|
|
11
|
+
}>;
|
|
12
|
+
readonly ItemList: import("react").FC<{
|
|
13
|
+
showWebkitRelativePath?: boolean;
|
|
14
|
+
clearable?: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
2
18
|
export { FileField };
|
|
@@ -5,6 +5,7 @@ type BaseProps = {
|
|
|
5
5
|
'aria-labelledby': string;
|
|
6
6
|
name?: string;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
8
9
|
options: readonly Option[];
|
|
9
10
|
ref?: Ref<HTMLDivElement>;
|
|
10
11
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'role' | 'className' | 'style' | 'children' | 'aria-labelledby' | 'onChange'>;
|
|
@@ -5,7 +5,7 @@ import { useControllableState } from "../../../hooks/controllable-state/index.mj
|
|
|
5
5
|
import { useFormStatus } from "react-dom";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/form/radio/radio.tsx
|
|
8
|
-
const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, value, defaultValue, onChange, options, ref, ...rest }) => {
|
|
8
|
+
const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, invalid = false, value, defaultValue, onChange, options, ref, ...rest }) => {
|
|
9
9
|
const [selectedValue, setSelectedValue] = useControllableState({
|
|
10
10
|
value,
|
|
11
11
|
defaultValue
|
|
@@ -19,6 +19,7 @@ const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, value,
|
|
|
19
19
|
};
|
|
20
20
|
return /* @__PURE__ */ jsx("div", {
|
|
21
21
|
...rest,
|
|
22
|
+
"aria-invalid": invalid,
|
|
22
23
|
"aria-labelledby": labelledbyId,
|
|
23
24
|
className: cn("flex cursor-pointer flex-col gap-2", disabledResolved && "cursor-not-allowed"),
|
|
24
25
|
ref,
|
|
@@ -39,7 +40,7 @@ const Radio = ({ "aria-labelledby": labelledbyId, name, disabled = false, value,
|
|
|
39
40
|
}),
|
|
40
41
|
/* @__PURE__ */ jsx("span", {
|
|
41
42
|
"aria-hidden": true,
|
|
42
|
-
className: cn("inline-flex size-5 items-center justify-center rounded-full border-2 transition-colors", FOCUS_RING_PEER, selectedValue === option.value ? "border-border-base bg-primary-bg" : "border-border-mute bg-bg-base", disabledResolved && "border-border-mute bg-bg-mute"),
|
|
43
|
+
className: cn("inline-flex size-5 items-center justify-center rounded-full border-2 transition-colors", FOCUS_RING_PEER, selectedValue === option.value ? "border-border-base bg-primary-bg" : "border-border-mute bg-bg-base", disabledResolved && "border-border-mute bg-bg-mute", invalid && "border-border-error"),
|
|
43
44
|
children: /* @__PURE__ */ jsx("span", { className: cn("size-2 rounded-full transition-opacity", selectedValue === option.value ? "bg-primary-border opacity-100" : "bg-transparent opacity-0") })
|
|
44
45
|
}),
|
|
45
46
|
/* @__PURE__ */ jsx("span", { children: option.label })
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Button } from "./buttons/button/button.mjs";
|
|
2
2
|
import "./buttons/button/index.mjs";
|
|
3
|
-
import { Tooltip, TooltipTriggerProps } from "./overlays/tooltip/tooltip.mjs";
|
|
4
|
-
import "./overlays/tooltip/index.mjs";
|
|
5
|
-
import { IconButton, IconButtonTriggerProps } from "./buttons/icon-button/icon-button.mjs";
|
|
6
3
|
import "./buttons/icon-button/index.mjs";
|
|
7
4
|
import { Accordion } from "./data-display/accordion/index.mjs";
|
|
8
5
|
import { Avatar } from "./data-display/avatar/avatar.mjs";
|
|
@@ -30,25 +27,24 @@ import { ToastProvider } from "./feedback/toast/provider.mjs";
|
|
|
30
27
|
import "./feedback/toast/index.mjs";
|
|
31
28
|
import { Autocomplete } from "./form/autocomplete/autocomplete.mjs";
|
|
32
29
|
import "./form/autocomplete/index.mjs";
|
|
30
|
+
import { Checkbox } from "./form/checkbox/checkbox.mjs";
|
|
31
|
+
import "./form/checkbox/index.mjs";
|
|
33
32
|
import { CheckboxCard, CheckboxCardOption } from "./form/checkbox-card/checkbox-card.mjs";
|
|
34
33
|
import "./form/checkbox-card/index.mjs";
|
|
35
34
|
import { CheckboxGroup } from "./form/checkbox-group/index.mjs";
|
|
36
|
-
import {
|
|
37
|
-
import "./form/checkbox/index.mjs";
|
|
38
|
-
import { FileField } from "./form/file-field/file-field.mjs";
|
|
39
|
-
import "./form/file-field/index.mjs";
|
|
40
|
-
import { FormControl } from "./form/form-control/form-control.mjs";
|
|
41
|
-
import "./form/form-control/index.mjs";
|
|
35
|
+
import { FileField } from "./form/file-field/index.mjs";
|
|
42
36
|
import { Form } from "./form/form/form.mjs";
|
|
43
37
|
import "./form/form/index.mjs";
|
|
38
|
+
import { FormControl } from "./form/form-control/form-control.mjs";
|
|
39
|
+
import "./form/form-control/index.mjs";
|
|
44
40
|
import { NumberField } from "./form/number-field/number-field.mjs";
|
|
45
41
|
import "./form/number-field/index.mjs";
|
|
46
42
|
import { PasswordInput } from "./form/password-input/password-input.mjs";
|
|
47
43
|
import "./form/password-input/index.mjs";
|
|
48
|
-
import { RadioCard, RadioCardOption } from "./form/radio-card/radio-card.mjs";
|
|
49
|
-
import "./form/radio-card/index.mjs";
|
|
50
44
|
import { Radio } from "./form/radio/radio.mjs";
|
|
51
45
|
import "./form/radio/index.mjs";
|
|
46
|
+
import { RadioCard, RadioCardOption } from "./form/radio-card/radio-card.mjs";
|
|
47
|
+
import "./form/radio-card/index.mjs";
|
|
52
48
|
import { Select } from "./form/select/select.mjs";
|
|
53
49
|
import "./form/select/index.mjs";
|
|
54
50
|
import { Slider } from "./form/slider/slider.mjs";
|
|
@@ -84,23 +80,21 @@ import "./navigation/anchor/index.mjs";
|
|
|
84
80
|
import { Breadcrumb } from "./navigation/breadcrumb/index.mjs";
|
|
85
81
|
import { Pagination } from "./navigation/pagination/pagination.mjs";
|
|
86
82
|
import "./navigation/pagination/index.mjs";
|
|
87
|
-
import { Tabs } from "./navigation/tabs/
|
|
88
|
-
import "./
|
|
89
|
-
import { Dialog } from "./overlays/dialog/dialog.mjs";
|
|
90
|
-
import "./overlays/dialog/index.mjs";
|
|
83
|
+
import { Tabs } from "./navigation/tabs/index.mjs";
|
|
84
|
+
import { Dialog } from "./overlays/dialog/index.mjs";
|
|
91
85
|
import { Drawer } from "./overlays/drawer/drawer.mjs";
|
|
92
86
|
import "./overlays/drawer/index.mjs";
|
|
93
|
-
import { DropdownMenu } from "./overlays/dropdown-menu/
|
|
94
|
-
import "./overlays/
|
|
95
|
-
import { ListBox } from "./overlays/list-box/list-box.mjs";
|
|
96
|
-
import "./overlays/list-box/index.mjs";
|
|
87
|
+
import { DropdownMenu } from "./overlays/dropdown-menu/index.mjs";
|
|
88
|
+
import { ListBox } from "./overlays/list-box/index.mjs";
|
|
97
89
|
import { Modal } from "./overlays/modal/modal.mjs";
|
|
98
90
|
import "./overlays/modal/index.mjs";
|
|
99
91
|
import { PopoverContentProps, PopoverTriggerProps } from "./overlays/popover/hooks.mjs";
|
|
100
|
-
import { Popover } from "./overlays/popover/
|
|
101
|
-
import "./overlays/popover/index.mjs";
|
|
92
|
+
import { Popover } from "./overlays/popover/index.mjs";
|
|
102
93
|
import { Messages } from "../i18n/messages.mjs";
|
|
103
94
|
import { UIProvider } from "./providers/ui-provider.mjs";
|
|
104
95
|
import { PortalRootProvider, usePortalRoot } from "./providers/portal-root.mjs";
|
|
105
96
|
import "./providers/index.mjs";
|
|
97
|
+
import { TooltipTriggerProps } from "./overlays/tooltip/tooltip.mjs";
|
|
98
|
+
import { Tooltip } from "./overlays/tooltip/index.mjs";
|
|
99
|
+
import { IconButton, IconButtonTriggerProps } from "./buttons/icon-button/icon-button.mjs";
|
|
106
100
|
export { AIIcon, AccessibilityIcon, Accordion, Alert, type AlertAction, AlertIcon, Anchor, AssistantIcon, AtomIcon, Autocomplete, Avatar, BadIcon, Badge, type BaseIconProps, BlogIcon, BoringIcon, Breadcrumb, Button, Card, type CellAlign, CheckIcon, Checkbox, CheckboxCard, type CheckboxCardOption, CheckboxGroup, ChevronIcon, ChromeIcon, CloseIcon, Code, CodeXmlIcon, ColorContrastIcon, ColorInfoIcon, ColorScaleIcon, CopyIcon, DarkModeIcon, Dialog, DifficultIcon, Drawer, DropdownMenu, EasyIcon, EdgeIcon, ExternalLinkIcon, FileField, FirefoxIcon, FlaskIcon, ForkIcon, Form, FormControl, FormIcon, FullscreenIcon, type GapSize, GitHubIcon, GoodIcon, Grid, type GridProps, Heading, HistoryIcon, HorizontalWritingIcon, IconButton, type IconButtonTriggerProps, type IconRenderProps, InformativeIcon, InterestingIcon, LightModeIcon, LinkIcon, ListBox, ListIcon, LocationIcon, LockIcon, LockOpenIcon, Logo, LogoIcon, MailIcon, type Messages, MinusIcon, MixedColorIcon, Modal, NavigationMenuIcon, NewsIcon, NumberField, PackageIcon, type PaddingSize, Pagination, PaletteIcon, PasswordInput, PlusIcon, Popover, type PopoverContentProps, type PopoverTriggerProps, PortalRootProvider, PrepareIcon, Progress, PublishDateIcon, QiitaIcon, RSSIcon, Radio, RadioCard, type RadioCardOption, RefreshIcon, SafariIcon, ScrollLinked, Select, SendIcon, Separator, ShallowIcon, ShieldCheckIcon, Skeleton, SlideIcon, Slider, SparklesIcon, Spinner, SquircleIcon, Stack, type StackProps, SubscribeIcon, Switch, Table, TableIcon, Tabs, TagIcon, TextField, Textarea, type ToastAction, type ToastOptions, ToastProvider, Tooltip, type TooltipTriggerProps, TwitterIcon, UIProvider, UpdateDateIcon, VerticalWritingIcon, ViewIcon, ViewOffIcon, usePortalRoot, useToast };
|