@irozon/design-system-react 0.5.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 CHANGED
@@ -192,6 +192,25 @@ import { NavItem } from "@irozon/design-system-react";
192
192
  </NavItem>;
193
193
  ```
194
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
+
195
214
  ### Canonical API
196
215
 
197
216
  Prop names and values match the CSS package's own vocabulary exactly —
@@ -210,6 +229,14 @@ these names at the call sites, not keep a permanent translation layer.
210
229
 
211
230
  React and React DOM `>=18.0.0` are peer dependencies and are not bundled.
212
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
+
213
240
  ## Versioning and compatibility
214
241
 
215
242
  This package is currently in `0.x` and uses the component vocabulary from
@@ -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;
@@ -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.5.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.8.2"
45
+ "@irozon/design-system": "^0.9.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/react": "^19.2.0",