@irozon/design-system-react 0.4.0 → 0.6.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 +32 -0
- package/dist/Dialog.d.ts +3 -1
- package/dist/Dialog.js +2 -2
- package/dist/ThemeToggle.d.ts +3 -1
- package/dist/ThemeToggle.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -82,6 +82,11 @@ both packages because your app imports the CSS package directly.
|
|
|
82
82
|
| `Nav`, `NavGroup`, `NavItem` | `.iz-nav`, `.iz-nav-group`, `.iz-nav-item` |
|
|
83
83
|
| `Tabs`, `TabPanel` | `.iz-tabs`, `.iz-tab`, `.iz-tab-panel` |
|
|
84
84
|
|
|
85
|
+
For side Sheets, pass `variant="sheet"`. The default size keeps the narrow
|
|
86
|
+
panel; `size="large"` uses about 80% of the desktop viewport. Both sizes use
|
|
87
|
+
the available screen width on small viewports. The native `<dialog>` retains
|
|
88
|
+
focus management, Escape handling, and backdrop behavior.
|
|
89
|
+
|
|
85
90
|
### Card
|
|
86
91
|
|
|
87
92
|
`Card` defaults to a static `<div>`. Set `interactive` to opt into the
|
|
@@ -187,6 +192,25 @@ import { NavItem } from "@irozon/design-system-react";
|
|
|
187
192
|
</NavItem>;
|
|
188
193
|
```
|
|
189
194
|
|
|
195
|
+
### ThemeToggle direction
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { ThemeToggle, type ThemeToggleProps } from "@irozon/design-system-react";
|
|
199
|
+
|
|
200
|
+
<ThemeToggle isDark={isDark} onToggle={toggleTheme} />;
|
|
201
|
+
<ThemeToggle isDark={isDark} onToggle={toggleTheme} direction="vertical" />;
|
|
202
|
+
<ThemeToggle isDark={isDark} onToggle={toggleTheme} direction="horizontal" />;
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
`direction?: "vertical" | "horizontal"` defaults to `"vertical"`. Vertical
|
|
206
|
+
reveals Light above Dark; horizontal reveals Light on the left and Dark on
|
|
207
|
+
the right. Both keep the centered resting dot, 44×44 hit area, colors,
|
|
208
|
+
keyboard activation, focus ring, and reduced-motion behavior. The horizontal
|
|
209
|
+
track is 38×20 instead of 20×38. Use the matching CSS package containing
|
|
210
|
+
`data-direction="horizontal"` support. `isDark` and `onToggle` remain required;
|
|
211
|
+
the consuming application continues to own theme state and persistence.
|
|
212
|
+
`ThemeToggleProps` is exported through the existing package entry point.
|
|
213
|
+
|
|
190
214
|
### Canonical API
|
|
191
215
|
|
|
192
216
|
Prop names and values match the CSS package's own vocabulary exactly —
|
|
@@ -205,6 +229,14 @@ these names at the call sites, not keep a permanent translation layer.
|
|
|
205
229
|
|
|
206
230
|
React and React DOM `>=18.0.0` are peer dependencies and are not bundled.
|
|
207
231
|
|
|
232
|
+
## Release notes
|
|
233
|
+
|
|
234
|
+
### 0.6.0
|
|
235
|
+
|
|
236
|
+
- Add optional ThemeToggle `direction="vertical" | "horizontal"`; vertical remains the default.
|
|
237
|
+
- Require `@irozon/design-system@^0.9.0` for the 38px track and shared 500ms spring movement.
|
|
238
|
+
- Preserve controlled theme state, accessible labels, keyboard activation and reduced motion.
|
|
239
|
+
|
|
208
240
|
## Versioning and compatibility
|
|
209
241
|
|
|
210
242
|
This package is currently in `0.x` and uses the component vocabulary from
|
package/dist/Dialog.d.ts
CHANGED
|
@@ -7,12 +7,14 @@ export interface DialogProps extends Omit<HTMLAttributes<HTMLDialogElement>, "on
|
|
|
7
7
|
* semantics rather than re-deriving it per consumer. */
|
|
8
8
|
onClose: () => void;
|
|
9
9
|
variant?: "sheet";
|
|
10
|
+
/** Sheet width preset. Ignored for the centered Dialog variant. */
|
|
11
|
+
size?: "default" | "large";
|
|
10
12
|
children: ReactNode;
|
|
11
13
|
}
|
|
12
14
|
/** Canonical `.iz-dialog` — built on the native `<dialog>` element, so
|
|
13
15
|
* focus trapping, Escape-to-dismiss, and the `::backdrop` come from the
|
|
14
16
|
* browser for free. Compose with DialogHeader/DialogBody/DialogFooter. */
|
|
15
|
-
export declare function Dialog({ open, onClose, variant, className, children, ...rest }: DialogProps): import("react").JSX.Element;
|
|
17
|
+
export declare function Dialog({ open, onClose, variant, size, className, children, ...rest }: DialogProps): import("react").JSX.Element;
|
|
16
18
|
export declare function DialogHeader({ children }: {
|
|
17
19
|
children: ReactNode;
|
|
18
20
|
}): import("react").JSX.Element;
|
package/dist/Dialog.js
CHANGED
|
@@ -4,7 +4,7 @@ import { cx } from "./internal/cx.js";
|
|
|
4
4
|
/** Canonical `.iz-dialog` — built on the native `<dialog>` element, so
|
|
5
5
|
* focus trapping, Escape-to-dismiss, and the `::backdrop` come from the
|
|
6
6
|
* browser for free. Compose with DialogHeader/DialogBody/DialogFooter. */
|
|
7
|
-
export function Dialog({ open, onClose, variant, className, children, ...rest }) {
|
|
7
|
+
export function Dialog({ open, onClose, variant, size, className, children, ...rest }) {
|
|
8
8
|
const ref = useRef(null);
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
const dialog = ref.current;
|
|
@@ -42,7 +42,7 @@ export function Dialog({ open, onClose, variant, className, children, ...rest })
|
|
|
42
42
|
dialog.addEventListener("click", handleClick);
|
|
43
43
|
return () => dialog.removeEventListener("click", handleClick);
|
|
44
44
|
}, [onClose]);
|
|
45
|
-
return (_jsx("dialog", { ref: ref, className: cx("iz-dialog", className), "data-variant": variant, ...rest, children: children }));
|
|
45
|
+
return (_jsx("dialog", { ref: ref, className: cx("iz-dialog", className), "data-variant": variant, "data-size": variant === "sheet" && size === "large" ? "large" : undefined, ...rest, children: children }));
|
|
46
46
|
}
|
|
47
47
|
export function DialogHeader({ children }) {
|
|
48
48
|
return _jsx("header", { className: "iz-dialog__header", children: children });
|
package/dist/ThemeToggle.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export interface ThemeToggleProps {
|
|
|
3
3
|
onToggle: () => void;
|
|
4
4
|
/** Base label before the target-state suffix — e.g. "Switch to". */
|
|
5
5
|
label?: string;
|
|
6
|
+
/** Track orientation; defaults to the existing vertical reveal. */
|
|
7
|
+
direction?: "vertical" | "horizontal";
|
|
6
8
|
}
|
|
7
9
|
/** Canonical `.iz-theme-toggle`. Presentation only — no localStorage, no
|
|
8
10
|
* `prefers-color-scheme` sync, no cross-tab event bus: those are
|
|
9
11
|
* per-application decisions (does this app persist per-user, per-device,
|
|
10
12
|
* follow the OS by default?) that don't belong in a design-system
|
|
11
13
|
* component. The caller owns `isDark` and what happens on toggle. */
|
|
12
|
-
export declare function ThemeToggle({ isDark, onToggle, label }: ThemeToggleProps): import("react").JSX.Element;
|
|
14
|
+
export declare function ThemeToggle({ isDark, onToggle, label, direction }: ThemeToggleProps): import("react").JSX.Element;
|
package/dist/ThemeToggle.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* per-application decisions (does this app persist per-user, per-device,
|
|
5
5
|
* follow the OS by default?) that don't belong in a design-system
|
|
6
6
|
* component. The caller owns `isDark` and what happens on toggle. */
|
|
7
|
-
export function ThemeToggle({ isDark, onToggle, label = "Switch to" }) {
|
|
7
|
+
export function ThemeToggle({ isDark, onToggle, label = "Switch to", direction = "vertical" }) {
|
|
8
8
|
const target = isDark ? "light" : "dark";
|
|
9
|
-
return (_jsx("button", { type: "button", className: "iz-theme-toggle", "aria-pressed": isDark, "aria-label": `${label} ${target} theme`, title: `${label} ${target} theme`, onClick: onToggle, children: _jsx("span", { className: "iz-theme-toggle__track", "aria-hidden": "true", children: _jsx("span", { className: "iz-theme-toggle__indicator" }) }) }));
|
|
9
|
+
return (_jsx("button", { type: "button", className: "iz-theme-toggle", "data-direction": direction, "aria-pressed": isDark, "aria-label": `${label} ${target} theme`, title: `${label} ${target} theme`, onClick: onToggle, children: _jsx("span", { className: "iz-theme-toggle__track", "aria-hidden": "true", children: _jsx("span", { className: "iz-theme-toggle__indicator" }) }) }));
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@irozon/design-system-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Canonical React components for the Irozon Design System — thin, accessible wrappers over @irozon/design-system's framework-neutral iz-* CSS. No independent visual styling of its own; the CSS package stays the single source of truth for how these look.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-dom": ">=18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@irozon/design-system": "^0.
|
|
45
|
+
"@irozon/design-system": "^0.9.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/react": "^19.2.0",
|