@octaviaflow/core 3.0.5 → 3.0.7
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/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +9 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/index.cjs +124 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +124 -29
- package/dist/index.js.map +1 -1
- package/dist/stories/state-matrix.d.ts +74 -0
- package/dist/stories/state-matrix.d.ts.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/a11y.d.ts +70 -0
- package/dist/utils/a11y.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* state-matrix — Storybook helper for documenting every visual state a
|
|
3
|
+
* component supports in a consistent, side-by-side grid.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* Most of our components have a single `Default` story. That makes
|
|
7
|
+
* visual regression coverage thin (you see one state, miss the others)
|
|
8
|
+
* and forces the docs reader to discover edge cases on their own.
|
|
9
|
+
* `stateMatrix` lets a single story declaration render N labelled
|
|
10
|
+
* variants in a labelled grid — perfect for both visual review in
|
|
11
|
+
* Storybook AND automated browser-mode snapshots via addon-vitest.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* import { stateMatrix } from '../../stories/state-matrix';
|
|
15
|
+
* import { Button } from './Button';
|
|
16
|
+
*
|
|
17
|
+
* export const States = stateMatrix({
|
|
18
|
+
* component: Button,
|
|
19
|
+
* groups: [
|
|
20
|
+
* {
|
|
21
|
+
* label: 'Default',
|
|
22
|
+
* items: [
|
|
23
|
+
* { label: 'idle', args: { children: 'Save' } },
|
|
24
|
+
* { label: 'hover', args: { children: 'Save' }, dataState: 'hover' },
|
|
25
|
+
* { label: 'disabled', args: { children: 'Save', disabled: true } },
|
|
26
|
+
* { label: 'loading', args: { children: 'Save', loading: true } },
|
|
27
|
+
* ],
|
|
28
|
+
* },
|
|
29
|
+
* {
|
|
30
|
+
* label: 'Variants',
|
|
31
|
+
* items: [
|
|
32
|
+
* { label: 'primary', args: { children: 'Save', variant: 'primary' } },
|
|
33
|
+
* { label: 'secondary', args: { children: 'Save', variant: 'secondary' } },
|
|
34
|
+
* { label: 'ghost', args: { children: 'Save', variant: 'ghost' } },
|
|
35
|
+
* { label: 'danger', args: { children: 'Save', variant: 'danger' } },
|
|
36
|
+
* ],
|
|
37
|
+
* },
|
|
38
|
+
* ],
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* The exported `States` is a real Storybook story (Component + args),
|
|
42
|
+
* so it shows up in Docs AND becomes a single browser-mode test that
|
|
43
|
+
* asserts every cell renders.
|
|
44
|
+
*/
|
|
45
|
+
import type { StoryObj } from "@storybook/react";
|
|
46
|
+
import type { ComponentType, ReactNode } from "react";
|
|
47
|
+
export interface StateMatrixItem<P> {
|
|
48
|
+
/** Label rendered above the cell. */
|
|
49
|
+
label: string;
|
|
50
|
+
/** Props passed to the component for this cell. */
|
|
51
|
+
args: P;
|
|
52
|
+
/** Optional caption rendered below the label (e.g. "hover" / "focus-visible"). */
|
|
53
|
+
caption?: ReactNode;
|
|
54
|
+
/** Optional wrapper around the cell (for context like a dark card). */
|
|
55
|
+
wrap?: (node: ReactNode) => ReactNode;
|
|
56
|
+
}
|
|
57
|
+
export interface StateMatrixGroup<P> {
|
|
58
|
+
label: string;
|
|
59
|
+
description?: ReactNode;
|
|
60
|
+
items: StateMatrixItem<P>[];
|
|
61
|
+
/** Override per-group columns. Default: auto-fit minmax 180px 1fr. */
|
|
62
|
+
columns?: number | string;
|
|
63
|
+
}
|
|
64
|
+
export interface StateMatrixConfig<P> {
|
|
65
|
+
component: ComponentType<P>;
|
|
66
|
+
groups: StateMatrixGroup<P>[];
|
|
67
|
+
/** Optional decorator applied to the whole matrix. */
|
|
68
|
+
wrap?: (node: ReactNode) => ReactNode;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build a Storybook StoryObj that renders the configured state matrix.
|
|
72
|
+
*/
|
|
73
|
+
export declare function stateMatrix<P>(config: StateMatrixConfig<P>): StoryObj<ComponentType<P>>;
|
|
74
|
+
//# sourceMappingURL=state-matrix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-matrix.d.ts","sourceRoot":"","sources":["../../src/stories/state-matrix.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,EAAE,CAAC,CAAC;IACR,kFAAkF;IAClF,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5B,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,sDAAsD;IACtD,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,SAAS,CAAC;CACvC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC3B,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CA0H5B"}
|