@dashforge/tw 0.11.0-beta → 1.1.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/CHANGELOG.md +234 -12
- package/COVERAGE.md +2 -2
- package/PARITY.md +7 -9
- package/PERFORMANCE.md +3 -4
- package/README.md +74 -15
- package/THEME-AUDIT.md +3 -4
- package/dashforge-tw-1.0.0.tgz +0 -0
- package/dist/index.esm.js +3127 -748
- package/dist/src/components/Alert/Alert.d.ts +65 -0
- package/dist/src/components/Alert/Alert.d.ts.map +1 -0
- package/dist/src/components/Alert/alert.types.d.ts +130 -0
- package/dist/src/components/Alert/alert.types.d.ts.map +1 -0
- package/dist/src/components/Alert/alert.variants.d.ts +85 -0
- package/dist/src/components/Alert/alert.variants.d.ts.map +1 -0
- package/dist/src/components/Avatar/Avatar.d.ts +48 -0
- package/dist/src/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/src/components/Avatar/avatar.types.d.ts +162 -0
- package/dist/src/components/Avatar/avatar.types.d.ts.map +1 -0
- package/dist/src/components/Avatar/avatar.variants.d.ts +208 -0
- package/dist/src/components/Avatar/avatar.variants.d.ts.map +1 -0
- package/dist/src/components/Badge/Badge.d.ts +63 -0
- package/dist/src/components/Badge/Badge.d.ts.map +1 -0
- package/dist/src/components/Badge/badge.types.d.ts +124 -0
- package/dist/src/components/Badge/badge.types.d.ts.map +1 -0
- package/dist/src/components/Badge/badge.variants.d.ts +262 -0
- package/dist/src/components/Badge/badge.variants.d.ts.map +1 -0
- package/dist/src/components/Box/Box.d.ts.map +1 -1
- package/dist/src/components/Box/box.types.d.ts +53 -0
- package/dist/src/components/Box/box.types.d.ts.map +1 -1
- package/dist/src/components/Button/Button.d.ts.map +1 -1
- package/dist/src/components/Button/button.types.d.ts +35 -0
- package/dist/src/components/Button/button.types.d.ts.map +1 -1
- package/dist/src/components/Card/Card.d.ts +107 -0
- package/dist/src/components/Card/Card.d.ts.map +1 -0
- package/dist/src/components/Card/card.types.d.ts +119 -0
- package/dist/src/components/Card/card.types.d.ts.map +1 -0
- package/dist/src/components/Chip/Chip.d.ts +67 -0
- package/dist/src/components/Chip/Chip.d.ts.map +1 -0
- package/dist/src/components/Chip/chip.types.d.ts +113 -0
- package/dist/src/components/Chip/chip.types.d.ts.map +1 -0
- package/dist/src/components/Chip/chip.variants.d.ts +155 -0
- package/dist/src/components/Chip/chip.variants.d.ts.map +1 -0
- package/dist/src/components/IconButton/IconButton.d.ts +57 -0
- package/dist/src/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/src/components/IconButton/iconButton.types.d.ts +96 -0
- package/dist/src/components/IconButton/iconButton.types.d.ts.map +1 -0
- package/dist/src/components/IconButton/iconButton.variants.d.ts +26 -0
- package/dist/src/components/IconButton/iconButton.variants.d.ts.map +1 -0
- package/dist/src/components/Menu/Menu.d.ts +118 -0
- package/dist/src/components/Menu/Menu.d.ts.map +1 -0
- package/dist/src/components/Menu/menu.types.d.ts +179 -0
- package/dist/src/components/Menu/menu.types.d.ts.map +1 -0
- package/dist/src/components/Menu/menu.variants.d.ts +129 -0
- package/dist/src/components/Menu/menu.variants.d.ts.map +1 -0
- package/dist/src/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/dist/src/components/Snackbar/snackbar.types.d.ts +40 -3
- package/dist/src/components/Snackbar/snackbar.types.d.ts.map +1 -1
- package/dist/src/components/Snackbar/snackbar.variants.d.ts +12 -57
- package/dist/src/components/Snackbar/snackbar.variants.d.ts.map +1 -1
- package/dist/src/components/Spinner/Spinner.d.ts +44 -0
- package/dist/src/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/src/components/Spinner/spinner.types.d.ts +89 -0
- package/dist/src/components/Spinner/spinner.types.d.ts.map +1 -0
- package/dist/src/components/Spinner/spinner.variants.d.ts +111 -0
- package/dist/src/components/Spinner/spinner.variants.d.ts.map +1 -0
- package/dist/src/components/Table/cells/RenderChip.d.ts +15 -72
- package/dist/src/components/Table/cells/RenderChip.d.ts.map +1 -1
- package/dist/src/components/_shared/severity/index.d.ts +21 -0
- package/dist/src/components/_shared/severity/index.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severity.types.d.ts +48 -0
- package/dist/src/components/_shared/severity/severity.types.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severityIcons.d.ts +45 -0
- package/dist/src/components/_shared/severity/severityIcons.d.ts.map +1 -0
- package/dist/src/components/_shared/severity/severityVariants.d.ts +22 -0
- package/dist/src/components/_shared/severity/severityVariants.d.ts.map +1 -0
- package/dist/src/index.d.ts +27 -2
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/components/Alert/Alert.test.tsx +302 -0
- package/src/components/Alert/Alert.tsx +186 -0
- package/src/components/Alert/alert.types.ts +144 -0
- package/src/components/Alert/alert.variants.ts +71 -0
- package/src/components/Autocomplete/autocomplete.variants.ts +1 -1
- package/src/components/Avatar/Avatar.test.tsx +287 -0
- package/src/components/Avatar/Avatar.tsx +304 -0
- package/src/components/Avatar/avatar.types.ts +205 -0
- package/src/components/Avatar/avatar.variants.ts +194 -0
- package/src/components/Badge/Badge.test.tsx +385 -0
- package/src/components/Badge/Badge.tsx +174 -0
- package/src/components/Badge/badge.types.ts +154 -0
- package/src/components/Badge/badge.variants.ts +161 -0
- package/src/components/Box/Box.test.tsx +21 -0
- package/src/components/Box/Box.tsx +32 -3
- package/src/components/Box/box.types.ts +55 -0
- package/src/components/Button/Button.test.tsx +21 -0
- package/src/components/Button/Button.tsx +28 -27
- package/src/components/Button/button.types.ts +36 -0
- package/src/components/Card/Card.test.tsx +291 -0
- package/src/components/Card/Card.tsx +241 -0
- package/src/components/Card/card.types.ts +132 -0
- package/src/components/Chip/Chip.test.tsx +316 -0
- package/src/components/Chip/Chip.tsx +224 -0
- package/src/components/Chip/chip.types.ts +128 -0
- package/src/components/Chip/chip.variants.ts +173 -0
- package/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx +1 -1
- package/src/components/IconButton/IconButton.test.tsx +367 -0
- package/src/components/IconButton/IconButton.tsx +159 -0
- package/src/components/IconButton/iconButton.types.ts +106 -0
- package/src/components/IconButton/iconButton.variants.ts +31 -0
- package/src/components/LeftNav/leftNav.variants.ts +2 -2
- package/src/components/Menu/Menu.test.tsx +408 -0
- package/src/components/Menu/Menu.tsx +335 -0
- package/src/components/Menu/menu.types.ts +221 -0
- package/src/components/Menu/menu.variants.ts +132 -0
- package/src/components/Pagination/pagination.variants.ts +1 -1
- package/src/components/Snackbar/Snackbar.tsx +46 -28
- package/src/components/Snackbar/snackbar.types.ts +47 -3
- package/src/components/Snackbar/snackbar.variants.ts +29 -22
- package/src/components/Spinner/Spinner.test.tsx +199 -0
- package/src/components/Spinner/Spinner.tsx +158 -0
- package/src/components/Spinner/spinner.types.ts +113 -0
- package/src/components/Spinner/spinner.variants.ts +83 -0
- package/src/components/Table/cells/RenderChip.tsx +24 -87
- package/src/components/Table/cells/RowActionsMenu.tsx +1 -1
- package/src/components/TextField/TextField.test.tsx +5 -1
- package/src/components/_shared/severity/index.ts +33 -0
- package/src/components/_shared/severity/severity.types.ts +50 -0
- package/src/components/_shared/severity/severityIcons.tsx +104 -0
- package/src/components/_shared/severity/severityVariants.test.ts +136 -0
- package/src/components/_shared/severity/severityVariants.ts +115 -0
- package/src/index.ts +163 -1
- package/vite.config.ts +8 -0
- package/vitest.config.mts +8 -1
- package/LICENSE +0 -21
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
3
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
2
4
|
import type { BoxVariants } from './box.variants.js';
|
|
3
5
|
/**
|
|
4
6
|
* Props for `<Box>` — the surface primitive.
|
|
@@ -50,5 +52,56 @@ export interface BoxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'classNam
|
|
|
50
52
|
* position, animation, etc.).
|
|
51
53
|
*/
|
|
52
54
|
sx?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Reactive visibility predicate — added in 1.1.0 (Sprint 4.4
|
|
57
|
+
* surface alignment). When the predicate returns `false`, the
|
|
58
|
+
* component renders `null`. Inside a `<DashForm>` it subscribes
|
|
59
|
+
* reactively to engine state changes; outside a form, it's
|
|
60
|
+
* evaluated as a plain closure.
|
|
61
|
+
*
|
|
62
|
+
* Use for state-driven hiding of dashboard cards, conditional
|
|
63
|
+
* sections, gated content, etc. **For permission-driven hiding,
|
|
64
|
+
* prefer `access` with `onUnauthorized: 'hide'`** — it's semantically
|
|
65
|
+
* the correct path and surfaces better in RBAC dev tools.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* // Dashboard card visible only when there are pending shipments
|
|
70
|
+
* <Box variant="outlined" rounded="lg" p={4}
|
|
71
|
+
* visibleWhen={() => pendingCount > 0}>
|
|
72
|
+
* <Typography variant="h3">{pendingCount} pending</Typography>
|
|
73
|
+
* </Box>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
77
|
+
/**
|
|
78
|
+
* RBAC requirement — added in 1.1.0 (Sprint 4.4 surface alignment).
|
|
79
|
+
* Controls Box visibility / disabled-state via the centralized
|
|
80
|
+
* `@dashforge/rbac` policy engine.
|
|
81
|
+
*
|
|
82
|
+
* - `onUnauthorized: 'hide'` → Box does not render
|
|
83
|
+
* - `onUnauthorized: 'disable'` → adds `aria-disabled` + dimmed
|
|
84
|
+
* visual; interactive children should derive their disabled state
|
|
85
|
+
* from `data-disabled` on the Box or pass their own `access`
|
|
86
|
+
* - `onUnauthorized: 'readonly'` → adds `aria-readonly`; mostly used
|
|
87
|
+
* when Box wraps form sections that propagate readonly to children
|
|
88
|
+
*
|
|
89
|
+
* Use for permission-gated dashboard cards, admin-only sections,
|
|
90
|
+
* tenant-aware layouts. The hide path is the common case.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* // Revenue card visible only to users with billing:read permission
|
|
95
|
+
* <Box variant="elevated" rounded="lg" elevation={2} p={4}
|
|
96
|
+
* access={{
|
|
97
|
+
* resource: 'billing',
|
|
98
|
+
* action: 'read',
|
|
99
|
+
* onUnauthorized: 'hide'
|
|
100
|
+
* }}>
|
|
101
|
+
* <Typography variant="h3">Q3 Revenue</Typography>
|
|
102
|
+
* </Box>
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
access?: AccessRequirement;
|
|
53
106
|
}
|
|
54
107
|
//# sourceMappingURL=box.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,QACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAC3D,IAAI,CAAC,WAAW,EACd,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAC3C,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GACrC,WAAW,GAAG,YAAY,CAAC;IACvC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"box.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,QACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAC3D,IAAI,CAAC,WAAW,EACd,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAC3C,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GACrC,WAAW,GAAG,YAAY,CAAC;IACvC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAarD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,MAAM,2GAwFjB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
2
3
|
import type { AccessRequirement } from '@dashforge/rbac';
|
|
3
4
|
import type { ButtonVariants } from './button.variants.js';
|
|
4
5
|
/**
|
|
@@ -37,6 +38,40 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
37
38
|
* Combines with `disabled` and `loading` props via OR logic.
|
|
38
39
|
*/
|
|
39
40
|
access?: AccessRequirement;
|
|
41
|
+
/**
|
|
42
|
+
* Reactive visibility predicate. Re-evaluated on every engine state
|
|
43
|
+
* change when the button is mounted inside a `<DashForm>`; outside
|
|
44
|
+
* a form, evaluated as a plain predicate (the consumer captures
|
|
45
|
+
* any external state in the closure).
|
|
46
|
+
*
|
|
47
|
+
* When the predicate returns `false`, the component renders `null`.
|
|
48
|
+
*
|
|
49
|
+
* **Added in 1.1.0 (Sprint 4.4 alignment)** — extends the
|
|
50
|
+
* engine-reactive visibility pattern previously available only on
|
|
51
|
+
* form fields + `<Alert>` to every interactive component in the
|
|
52
|
+
* Dashforge TW catalog (Button, IconButton, Chip, …).
|
|
53
|
+
*
|
|
54
|
+
* Note: `visibleWhen` is for **state-driven** hide. For
|
|
55
|
+
* **permission-driven** hide, use `access` with
|
|
56
|
+
* `onUnauthorized: 'hide'` — it's the semantically correct path
|
|
57
|
+
* and provides better error messages in RBAC dev tools.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* // Inside a DashForm — reactive on engine state
|
|
62
|
+
* <Button
|
|
63
|
+
* visibleWhen={(engine) =>
|
|
64
|
+
* engine.getNode('plan')?.value === 'premium'
|
|
65
|
+
* }
|
|
66
|
+
* >
|
|
67
|
+
* Upgrade extras
|
|
68
|
+
* </Button>
|
|
69
|
+
*
|
|
70
|
+
* // Outside a form — closure over external React state
|
|
71
|
+
* <Button visibleWhen={() => itemCount > 0}>Bulk delete</Button>
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
40
75
|
/**
|
|
41
76
|
* When `true`, the immediate child element is rendered with the
|
|
42
77
|
* Button's classes merged in (via `@radix-ui/react-slot`). The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,WAKf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAC1E,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAC9E;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;OAQG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
1
|
+
{"version":3,"file":"button.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,WAKf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAC1E,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;IAC9E;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;;;OAQG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { CardActionAreaProps, CardContentProps, CardProps } from './card.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<Card>` — opinionated surface preset over `<Box>`.
|
|
4
|
+
*
|
|
5
|
+
* Thin alias that pre-fills card-shaped Box defaults (`outlined`,
|
|
6
|
+
* `rounded='lg'`, `elevation=1`, no padding). Reads as `<Card>` in
|
|
7
|
+
* consumer code while reusing every Box affordance: surface variants,
|
|
8
|
+
* 7 intent colors, spacing scale, polymorphism, and the bridge
|
|
9
|
+
* integration (`access` + `visibleWhen`) retrofitted to Box in 1.1.0.
|
|
10
|
+
*
|
|
11
|
+
* Restricted variant axis: only `'outlined' | 'elevated' | 'plain'`.
|
|
12
|
+
* `'soft'` and `'solid'` are deliberately excluded — they belong to
|
|
13
|
+
* Box (as `<Alert>`-shaped callouts) and to banners, not to cards.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Most common — outlined card with content padding via CardContent
|
|
18
|
+
* <Card>
|
|
19
|
+
* <CardContent>
|
|
20
|
+
* <Typography variant="h3">Title</Typography>
|
|
21
|
+
* <Typography variant="body">Body</Typography>
|
|
22
|
+
* </CardContent>
|
|
23
|
+
* </Card>
|
|
24
|
+
*
|
|
25
|
+
* // Elevated, clickable, gated by RBAC (inherits access from Box)
|
|
26
|
+
* <Card
|
|
27
|
+
* variant="elevated"
|
|
28
|
+
* elevation={2}
|
|
29
|
+
* access={{ resource: 'billing', action: 'read', onUnauthorized: 'hide' }}
|
|
30
|
+
* >
|
|
31
|
+
* <CardActionArea onClick={openBilling}>
|
|
32
|
+
* <CardContent>
|
|
33
|
+
* <Typography variant="h3">Revenue</Typography>
|
|
34
|
+
* </CardContent>
|
|
35
|
+
* </CardActionArea>
|
|
36
|
+
* </Card>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLElement>>;
|
|
40
|
+
/**
|
|
41
|
+
* `<CardContent>` — padded inner section of a Card.
|
|
42
|
+
*
|
|
43
|
+
* Semantic alias for an inner `<Box p={4}>`. The default padding step
|
|
44
|
+
* (4) maps to `--df-tw-spacing-4` (1rem) via the dashforgePreset,
|
|
45
|
+
* matching common card-content paddings across MUI / shadcn / Chakra.
|
|
46
|
+
* Override `p` to dial up/down per the spacing token scale.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Card>
|
|
51
|
+
* <CardContent p={6}> {/* bigger inner padding *}/}
|
|
52
|
+
* <Typography variant="h3">Spacious card</Typography>
|
|
53
|
+
* </CardContent>
|
|
54
|
+
* </Card>
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare function CardContent({ p, children, className, sx, }: CardContentProps): import("react/jsx-runtime").JSX.Element;
|
|
58
|
+
export declare namespace CardContent {
|
|
59
|
+
var displayName: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* `<CardActionArea>` — clickable wrapper for Card content.
|
|
63
|
+
*
|
|
64
|
+
* Adds focus ring + hover tint + Radix Slot polymorphism. Renders as
|
|
65
|
+
* `<button type="button">` by default, or as the immediate child via
|
|
66
|
+
* `asChild` (typical pattern: wrap a router `<Link>`).
|
|
67
|
+
*
|
|
68
|
+
* Bridge integration is local — CardActionArea is an action trigger
|
|
69
|
+
* (not a surface), so it carries `access` + `visibleWhen` directly
|
|
70
|
+
* (rather than relying on the wrapping Card's props). This lets the
|
|
71
|
+
* consumer differentiate "the card is visible but not clickable" from
|
|
72
|
+
* "the card is not visible at all".
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* // Card-as-CTA
|
|
77
|
+
* <Card>
|
|
78
|
+
* <CardActionArea onClick={navigate}>
|
|
79
|
+
* <CardContent>
|
|
80
|
+
* <Typography variant="h3">Open dashboard</Typography>
|
|
81
|
+
* <Typography variant="body">Hover to see the focus ring.</Typography>
|
|
82
|
+
* </CardContent>
|
|
83
|
+
* </CardActionArea>
|
|
84
|
+
* </Card>
|
|
85
|
+
*
|
|
86
|
+
* // Polymorphic — wrap a router Link
|
|
87
|
+
* <Card>
|
|
88
|
+
* <CardActionArea asChild>
|
|
89
|
+
* <Link to="/billing">
|
|
90
|
+
* <CardContent>
|
|
91
|
+
* <Typography variant="h3">Billing</Typography>
|
|
92
|
+
* </CardContent>
|
|
93
|
+
* </Link>
|
|
94
|
+
* </CardActionArea>
|
|
95
|
+
* </Card>
|
|
96
|
+
*
|
|
97
|
+
* // Selectable card (filter / option pattern)
|
|
98
|
+
* <CardActionArea
|
|
99
|
+
* selected={selected === 'monthly'}
|
|
100
|
+
* onClick={() => setSelected('monthly')}
|
|
101
|
+
* >
|
|
102
|
+
* <CardContent>Monthly plan</CardContent>
|
|
103
|
+
* </CardActionArea>
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare const CardActionArea: import("react").ForwardRefExoticComponent<CardActionAreaProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
107
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,eAAO,MAAM,IAAI,mGAyBf,CAAC;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,CAAK,EACL,QAAQ,EACR,SAAS,EACT,EAAE,GACH,EAAE,gBAAgB,2CAMlB;yBAXe,WAAW;;;AAe3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,cAAc,mHAmF1B,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
3
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
4
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
5
|
+
import type { BoxProps } from '../Box/box.types.js';
|
|
6
|
+
/**
|
|
7
|
+
* `<Card>` — opinionated surface preset over `<Box>`.
|
|
8
|
+
*
|
|
9
|
+
* Architectural note: `<Box>` already implements the full surface
|
|
10
|
+
* vocabulary (variant × color, elevation, rounded, spacing). `<Card>`
|
|
11
|
+
* exists for **two reasons** on top of Box:
|
|
12
|
+
*
|
|
13
|
+
* 1. **MUI mental model** — devs migrating from `@mui/material/Card`
|
|
14
|
+
* reach for `<Card>` reflexively. Having the component (as a
|
|
15
|
+
* thin Box alias with card-shaped defaults) removes adoption
|
|
16
|
+
* friction without duplicating the surface system.
|
|
17
|
+
* 2. **Restricted variant axis** — Card excludes `'soft'` and
|
|
18
|
+
* `'solid'` from Box's 5 variants. A "solid card" is semantically
|
|
19
|
+
* a banner; a "soft card" is a callout (use `<Alert>`). Restricting
|
|
20
|
+
* to `'outlined' | 'elevated' | 'plain'` is opinionated typing
|
|
21
|
+
* that catches misuse at compile time.
|
|
22
|
+
*
|
|
23
|
+
* Card inherits `access` + `visibleWhen` from Box (Sprint 4.4 surface
|
|
24
|
+
* alignment) automatically — no per-component wiring needed.
|
|
25
|
+
*
|
|
26
|
+
* Defaults set by Card (override at the call site):
|
|
27
|
+
* - `variant='outlined'` → soft border + bg tint (most card-like)
|
|
28
|
+
* - `rounded='lg'` → 8px radius
|
|
29
|
+
* - `elevation={1}` → faint shadow for visual weight
|
|
30
|
+
* - `p={0}` → no inner padding (use `<CardContent>`)
|
|
31
|
+
*/
|
|
32
|
+
export interface CardProps extends Omit<BoxProps, 'variant'> {
|
|
33
|
+
/**
|
|
34
|
+
* Restricted variant — only the three card-appropriate Box variants.
|
|
35
|
+
* - `'outlined'` (default) — bordered surface with subtle tint.
|
|
36
|
+
* - `'elevated'` — surface with shadow, no border.
|
|
37
|
+
* - `'plain'` — bare surface (background + radius), no border, no
|
|
38
|
+
* shadow. Use when wrapping content that already provides chrome.
|
|
39
|
+
*
|
|
40
|
+
* @default 'outlined'
|
|
41
|
+
*/
|
|
42
|
+
variant?: 'outlined' | 'elevated' | 'plain';
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* `<CardContent>` — padded inner section of a Card.
|
|
46
|
+
*
|
|
47
|
+
* A semantic alias for `<Box p={4}>` (or the equivalent spacing
|
|
48
|
+
* step). Reads better in starter-kit code than the equivalent Box
|
|
49
|
+
* call — the consumer expresses "this is the content area of the
|
|
50
|
+
* card" rather than "this is a box with padding-4 inside a card".
|
|
51
|
+
*
|
|
52
|
+
* No surface props — CardContent inherits its background from the
|
|
53
|
+
* parent Card. The only configurable axis is the padding step.
|
|
54
|
+
*/
|
|
55
|
+
export interface CardContentProps {
|
|
56
|
+
/**
|
|
57
|
+
* Inner padding token step (same scale as `<Box p>`).
|
|
58
|
+
* @default 4
|
|
59
|
+
*/
|
|
60
|
+
p?: BoxProps['p'];
|
|
61
|
+
/** Content of the section. */
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
/** Standard React `className` — appended to the root via `cn()`. */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Root-element class shortcut (string or clsx-compatible value). */
|
|
66
|
+
sx?: ClassValue;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `<CardActionArea>` — clickable wrapper inside (or around) a Card.
|
|
70
|
+
*
|
|
71
|
+
* The single value-add over a raw `<Box>` wrapper: focus ring +
|
|
72
|
+
* hover state + Radix Slot polymorphism so the wrapper can become a
|
|
73
|
+
* router `<Link>` without nesting `<a>` inside `<button>` (a11y
|
|
74
|
+
* violation).
|
|
75
|
+
*
|
|
76
|
+
* Use cases:
|
|
77
|
+
* - "Card-as-CTA" patterns where the whole card surface should be
|
|
78
|
+
* clickable (e.g. "Open dashboard" tile)
|
|
79
|
+
* - Card-shaped router links in dashboards / navigation grids
|
|
80
|
+
* - Selectable cards in galleries (with `selected` + `onClick`)
|
|
81
|
+
*
|
|
82
|
+
* Always renders as `<button>` (or the asChild element) — focusable,
|
|
83
|
+
* keyboard-accessible by default. `aria-pressed` when `selected=true`
|
|
84
|
+
* for the toggle pattern (filter card / option card).
|
|
85
|
+
*/
|
|
86
|
+
export interface CardActionAreaProps extends Omit<ComponentPropsWithoutRef<'button'>, 'className' | 'color'> {
|
|
87
|
+
/** The card body / content to wrap. */
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
/**
|
|
90
|
+
* Render-as-child via Radix Slot. The CardActionArea styles paint
|
|
91
|
+
* onto the immediate child element (typically a router `<Link>`).
|
|
92
|
+
* No `<button>` DOM emitted.
|
|
93
|
+
*/
|
|
94
|
+
asChild?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Selected state — for toggle / option-card patterns. Adds
|
|
97
|
+
* `aria-pressed="true"` and a primary-toned focus ring even when
|
|
98
|
+
* not focused.
|
|
99
|
+
*/
|
|
100
|
+
selected?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* RBAC requirement — controls clickability via the centralized
|
|
103
|
+
* `@dashforge/rbac` policy engine.
|
|
104
|
+
* - `onUnauthorized: 'hide'` → action area does not render
|
|
105
|
+
* - `onUnauthorized: 'disable'` → clicks suppressed + dimmed
|
|
106
|
+
* - `onUnauthorized: 'readonly'` → mapped to disabled
|
|
107
|
+
*/
|
|
108
|
+
access?: AccessRequirement;
|
|
109
|
+
/**
|
|
110
|
+
* Engine-reactive visibility predicate — Sprint 4.4 alignment.
|
|
111
|
+
* When the predicate returns `false`, the action area renders `null`.
|
|
112
|
+
*/
|
|
113
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
114
|
+
/** Root-element class shortcut. */
|
|
115
|
+
sx?: ClassValue;
|
|
116
|
+
/** Standard React className — appended via `cn()`. */
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=card.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Card/card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IAElB,8BAA8B;IAC9B,QAAQ,EAAE,SAAS,CAAC;IAEpB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qEAAqE;IACrE,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IACvE,uCAAuC;IACvC,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C,mCAAmC;IACnC,EAAE,CAAC,EAAE,UAAU,CAAC;IAEhB,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ChipProps } from './chip.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashforge TW Chip — status / filter / tag pill.
|
|
4
|
+
*
|
|
5
|
+
* Promoted from the internal `Table/cells/RenderChip` (Sprint 4.4):
|
|
6
|
+
* preserves the 3 × 7 variant × color matrix byte-identical and adds
|
|
7
|
+
* the public API (label, icon, avatar, clickable, onClick, onDelete,
|
|
8
|
+
* selected, access).
|
|
9
|
+
*
|
|
10
|
+
* **Rendering modes** (chosen at runtime from props):
|
|
11
|
+
* - **Static** (default) → `<span>`. Pure display.
|
|
12
|
+
* - **Clickable** (`clickable` true OR `onClick` provided) →
|
|
13
|
+
* `<button type="button">` with focus ring + hover state.
|
|
14
|
+
* - **Deletable** (`onDelete` provided) → root + trailing `<button>`
|
|
15
|
+
* for the delete glyph. Static or clickable root depending on
|
|
16
|
+
* whether `onClick` is also set.
|
|
17
|
+
*
|
|
18
|
+
* **Variant axis** is `soft | solid | outline` (Dashforge chip
|
|
19
|
+
* vocabulary, default `'soft'`). Distinct from Button's
|
|
20
|
+
* (`solid | outline | ghost | link`) and Alert's
|
|
21
|
+
* (`standard | filled | outlined`) by design — see CHANGELOG.
|
|
22
|
+
*
|
|
23
|
+
* **A11y**:
|
|
24
|
+
* - Static chip → no role (it's a `<span>`).
|
|
25
|
+
* - Clickable chip → native `<button>` semantics.
|
|
26
|
+
* - `selected` → `aria-pressed="true"` (so it announces as a toggle
|
|
27
|
+
* button in pressed state).
|
|
28
|
+
* - Delete button → its own `<button>` with `aria-label`
|
|
29
|
+
* (defaults to `'Remove'`).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Static status chip
|
|
34
|
+
* <Chip label="Active" color="success" />
|
|
35
|
+
*
|
|
36
|
+
* // With icon
|
|
37
|
+
* import { CheckIcon } from 'lucide-react';
|
|
38
|
+
* <Chip label="Verified" color="success" icon={<CheckIcon size={14} />} />
|
|
39
|
+
*
|
|
40
|
+
* // Filter chip (clickable + toggle via selected)
|
|
41
|
+
* <Chip
|
|
42
|
+
* label="Last 7 days"
|
|
43
|
+
* color="primary"
|
|
44
|
+
* clickable
|
|
45
|
+
* selected={range === '7d'}
|
|
46
|
+
* onClick={() => setRange('7d')}
|
|
47
|
+
* />
|
|
48
|
+
*
|
|
49
|
+
* // Removable tag
|
|
50
|
+
* <Chip
|
|
51
|
+
* label="design-system"
|
|
52
|
+
* color="info"
|
|
53
|
+
* variant="outline"
|
|
54
|
+
* onDelete={() => removeTag('design-system')}
|
|
55
|
+
* />
|
|
56
|
+
*
|
|
57
|
+
* // RBAC-gated admin chip
|
|
58
|
+
* <Chip
|
|
59
|
+
* label="Admin"
|
|
60
|
+
* color="danger"
|
|
61
|
+
* variant="solid"
|
|
62
|
+
* access={{ resource: 'role', action: 'read', onUnauthorized: 'hide' }}
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare const Chip: import("react").ForwardRefExoticComponent<ChipProps & import("react").RefAttributes<HTMLElement>>;
|
|
67
|
+
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/Chip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA0BjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,IAAI,mGAgIf,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
3
|
+
import type { Engine } from '@dashforge/ui-core';
|
|
4
|
+
import type { AccessRequirement } from '@dashforge/rbac';
|
|
5
|
+
import type { ChipVariants } from './chip.variants.js';
|
|
6
|
+
/**
|
|
7
|
+
* Props for `<Chip>` — status / filter / tag pill.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors MUI Chip's API surface where it makes sense (label, icon,
|
|
10
|
+
* avatar, clickable, onDelete) and extends with Dashforge-specific
|
|
11
|
+
* affordances (`selected` for filter chips, `access` for RBAC).
|
|
12
|
+
*
|
|
13
|
+
* Variant axis (`soft | solid | outline`) is the **Dashforge chip
|
|
14
|
+
* vocabulary** — distinct from Button's (`solid | outline | ghost |
|
|
15
|
+
* link`) and Alert's (`standard | filled | outlined`). The asymmetry
|
|
16
|
+
* is intentional and category-scoped: each component family uses the
|
|
17
|
+
* vocabulary that maps to its design needs (see CHANGELOG +
|
|
18
|
+
* MIGRATION.md for the design note).
|
|
19
|
+
*
|
|
20
|
+
* @see https://mui.com/material-ui/api/chip/
|
|
21
|
+
*/
|
|
22
|
+
export interface ChipProps extends Pick<ChipVariants, 'color' | 'variant' | 'size' | 'selected' | 'disabled'> {
|
|
23
|
+
/**
|
|
24
|
+
* The chip's textual content. Named `label` for MUI parity — most
|
|
25
|
+
* design systems (MUI, Radix Themes, Mantine, Tremor) use `label`
|
|
26
|
+
* as the canonical content prop on Chip / Badge / Pill primitives.
|
|
27
|
+
*/
|
|
28
|
+
label: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Leading icon — typically a small SVG (16px). Consumer brings
|
|
31
|
+
* their iconography. Rendered inside the chip BEFORE the label.
|
|
32
|
+
* Falls back to `avatar` if not provided.
|
|
33
|
+
*/
|
|
34
|
+
icon?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Leading avatar — alternative to `icon`, typically a small
|
|
37
|
+
* circular image (Avatar component or `<img>`). When BOTH `icon`
|
|
38
|
+
* and `avatar` are set, `avatar` wins (matches MUI behaviour).
|
|
39
|
+
*/
|
|
40
|
+
avatar?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Makes the chip interactive — renders as `<button>` (instead of
|
|
43
|
+
* `<span>`), adds focus ring + hover state. Set automatically to
|
|
44
|
+
* `true` when `onClick` is provided.
|
|
45
|
+
*/
|
|
46
|
+
clickable?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Click handler. Implies `clickable=true`. Fires on chip-body
|
|
49
|
+
* click (NOT on the delete button — `onDelete` is the dedicated
|
|
50
|
+
* path for that).
|
|
51
|
+
*/
|
|
52
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
53
|
+
/**
|
|
54
|
+
* When set, renders a trailing × delete button. The handler fires
|
|
55
|
+
* on delete-button click and stops propagation so the chip's
|
|
56
|
+
* `onClick` doesn't also fire.
|
|
57
|
+
*/
|
|
58
|
+
onDelete?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Custom delete icon. Defaults to an inline stroke-style × SVG.
|
|
61
|
+
* `currentColor` flows through, so the icon inherits the chip's
|
|
62
|
+
* text colour.
|
|
63
|
+
*/
|
|
64
|
+
deleteIcon?: ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* `aria-label` for the delete button. Required for screen readers
|
|
67
|
+
* since the × glyph alone is not semantic.
|
|
68
|
+
* @default 'Remove'
|
|
69
|
+
*/
|
|
70
|
+
deleteLabel?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Reactive visibility predicate. Re-evaluated on every engine state
|
|
73
|
+
* change when the chip is mounted inside a `<DashForm>`; outside
|
|
74
|
+
* a form, evaluated as a plain predicate (the consumer captures
|
|
75
|
+
* any external state in the closure).
|
|
76
|
+
*
|
|
77
|
+
* When the predicate returns `false`, the component renders `null`
|
|
78
|
+
* — same contract as `<Alert>` / `<TextField>` / other bridge-aware
|
|
79
|
+
* components. Useful for status chips that should appear / disappear
|
|
80
|
+
* based on form values without forcing JSX guards on the consumer.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```tsx
|
|
84
|
+
* // Inside a DashForm — engine-reactive
|
|
85
|
+
* <Chip
|
|
86
|
+
* label="Premium"
|
|
87
|
+
* color="primary"
|
|
88
|
+
* visibleWhen={(engine) => engine.getNode('plan')?.value === 'premium'}
|
|
89
|
+
* />
|
|
90
|
+
*
|
|
91
|
+
* // Outside a form — closure over external state
|
|
92
|
+
* <Chip
|
|
93
|
+
* label={`${count} results`}
|
|
94
|
+
* visibleWhen={() => count > 0}
|
|
95
|
+
* />
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
visibleWhen?: (engine: Engine) => boolean;
|
|
99
|
+
/**
|
|
100
|
+
* RBAC requirement. Same contract as `<Button>` / `<IconButton>` —
|
|
101
|
+
* `onUnauthorized: 'hide' | 'disable' | 'readonly'`.
|
|
102
|
+
* (`readonly` maps to `disabled` for chips, matching Button.)
|
|
103
|
+
*/
|
|
104
|
+
access?: AccessRequirement;
|
|
105
|
+
/**
|
|
106
|
+
* Root-element class shortcut (string or clsx-compatible value).
|
|
107
|
+
* Last-wins via `tailwind-merge` inside `cn()`.
|
|
108
|
+
*/
|
|
109
|
+
sx?: ClassValue;
|
|
110
|
+
/** Standard React `className` — appended to the root via `cn()`. */
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=chip.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/chip.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,SACf,SAAQ,IAAI,CACV,YAAY,EACZ,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CACvD;IACD;;;;OAIG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAEzD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAE1D;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAE1C;;;;OAIG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;OAGG;IACH,EAAE,CAAC,EAAE,UAAU,CAAC;IAEhB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|