@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.
Files changed (134) hide show
  1. package/CHANGELOG.md +234 -12
  2. package/COVERAGE.md +2 -2
  3. package/PARITY.md +7 -9
  4. package/PERFORMANCE.md +3 -4
  5. package/README.md +74 -15
  6. package/THEME-AUDIT.md +3 -4
  7. package/dashforge-tw-1.0.0.tgz +0 -0
  8. package/dist/index.esm.js +3127 -748
  9. package/dist/src/components/Alert/Alert.d.ts +65 -0
  10. package/dist/src/components/Alert/Alert.d.ts.map +1 -0
  11. package/dist/src/components/Alert/alert.types.d.ts +130 -0
  12. package/dist/src/components/Alert/alert.types.d.ts.map +1 -0
  13. package/dist/src/components/Alert/alert.variants.d.ts +85 -0
  14. package/dist/src/components/Alert/alert.variants.d.ts.map +1 -0
  15. package/dist/src/components/Avatar/Avatar.d.ts +48 -0
  16. package/dist/src/components/Avatar/Avatar.d.ts.map +1 -0
  17. package/dist/src/components/Avatar/avatar.types.d.ts +162 -0
  18. package/dist/src/components/Avatar/avatar.types.d.ts.map +1 -0
  19. package/dist/src/components/Avatar/avatar.variants.d.ts +208 -0
  20. package/dist/src/components/Avatar/avatar.variants.d.ts.map +1 -0
  21. package/dist/src/components/Badge/Badge.d.ts +63 -0
  22. package/dist/src/components/Badge/Badge.d.ts.map +1 -0
  23. package/dist/src/components/Badge/badge.types.d.ts +124 -0
  24. package/dist/src/components/Badge/badge.types.d.ts.map +1 -0
  25. package/dist/src/components/Badge/badge.variants.d.ts +262 -0
  26. package/dist/src/components/Badge/badge.variants.d.ts.map +1 -0
  27. package/dist/src/components/Box/Box.d.ts.map +1 -1
  28. package/dist/src/components/Box/box.types.d.ts +53 -0
  29. package/dist/src/components/Box/box.types.d.ts.map +1 -1
  30. package/dist/src/components/Button/Button.d.ts.map +1 -1
  31. package/dist/src/components/Button/button.types.d.ts +35 -0
  32. package/dist/src/components/Button/button.types.d.ts.map +1 -1
  33. package/dist/src/components/Card/Card.d.ts +107 -0
  34. package/dist/src/components/Card/Card.d.ts.map +1 -0
  35. package/dist/src/components/Card/card.types.d.ts +119 -0
  36. package/dist/src/components/Card/card.types.d.ts.map +1 -0
  37. package/dist/src/components/Chip/Chip.d.ts +67 -0
  38. package/dist/src/components/Chip/Chip.d.ts.map +1 -0
  39. package/dist/src/components/Chip/chip.types.d.ts +113 -0
  40. package/dist/src/components/Chip/chip.types.d.ts.map +1 -0
  41. package/dist/src/components/Chip/chip.variants.d.ts +155 -0
  42. package/dist/src/components/Chip/chip.variants.d.ts.map +1 -0
  43. package/dist/src/components/IconButton/IconButton.d.ts +57 -0
  44. package/dist/src/components/IconButton/IconButton.d.ts.map +1 -0
  45. package/dist/src/components/IconButton/iconButton.types.d.ts +96 -0
  46. package/dist/src/components/IconButton/iconButton.types.d.ts.map +1 -0
  47. package/dist/src/components/IconButton/iconButton.variants.d.ts +26 -0
  48. package/dist/src/components/IconButton/iconButton.variants.d.ts.map +1 -0
  49. package/dist/src/components/Menu/Menu.d.ts +118 -0
  50. package/dist/src/components/Menu/Menu.d.ts.map +1 -0
  51. package/dist/src/components/Menu/menu.types.d.ts +179 -0
  52. package/dist/src/components/Menu/menu.types.d.ts.map +1 -0
  53. package/dist/src/components/Menu/menu.variants.d.ts +129 -0
  54. package/dist/src/components/Menu/menu.variants.d.ts.map +1 -0
  55. package/dist/src/components/Snackbar/Snackbar.d.ts.map +1 -1
  56. package/dist/src/components/Snackbar/snackbar.types.d.ts +40 -3
  57. package/dist/src/components/Snackbar/snackbar.types.d.ts.map +1 -1
  58. package/dist/src/components/Snackbar/snackbar.variants.d.ts +12 -57
  59. package/dist/src/components/Snackbar/snackbar.variants.d.ts.map +1 -1
  60. package/dist/src/components/Spinner/Spinner.d.ts +44 -0
  61. package/dist/src/components/Spinner/Spinner.d.ts.map +1 -0
  62. package/dist/src/components/Spinner/spinner.types.d.ts +89 -0
  63. package/dist/src/components/Spinner/spinner.types.d.ts.map +1 -0
  64. package/dist/src/components/Spinner/spinner.variants.d.ts +111 -0
  65. package/dist/src/components/Spinner/spinner.variants.d.ts.map +1 -0
  66. package/dist/src/components/Table/cells/RenderChip.d.ts +15 -72
  67. package/dist/src/components/Table/cells/RenderChip.d.ts.map +1 -1
  68. package/dist/src/components/_shared/severity/index.d.ts +21 -0
  69. package/dist/src/components/_shared/severity/index.d.ts.map +1 -0
  70. package/dist/src/components/_shared/severity/severity.types.d.ts +48 -0
  71. package/dist/src/components/_shared/severity/severity.types.d.ts.map +1 -0
  72. package/dist/src/components/_shared/severity/severityIcons.d.ts +45 -0
  73. package/dist/src/components/_shared/severity/severityIcons.d.ts.map +1 -0
  74. package/dist/src/components/_shared/severity/severityVariants.d.ts +22 -0
  75. package/dist/src/components/_shared/severity/severityVariants.d.ts.map +1 -0
  76. package/dist/src/index.d.ts +27 -2
  77. package/dist/src/index.d.ts.map +1 -1
  78. package/package.json +8 -7
  79. package/src/components/Alert/Alert.test.tsx +302 -0
  80. package/src/components/Alert/Alert.tsx +186 -0
  81. package/src/components/Alert/alert.types.ts +144 -0
  82. package/src/components/Alert/alert.variants.ts +71 -0
  83. package/src/components/Autocomplete/autocomplete.variants.ts +1 -1
  84. package/src/components/Avatar/Avatar.test.tsx +287 -0
  85. package/src/components/Avatar/Avatar.tsx +304 -0
  86. package/src/components/Avatar/avatar.types.ts +205 -0
  87. package/src/components/Avatar/avatar.variants.ts +194 -0
  88. package/src/components/Badge/Badge.test.tsx +385 -0
  89. package/src/components/Badge/Badge.tsx +174 -0
  90. package/src/components/Badge/badge.types.ts +154 -0
  91. package/src/components/Badge/badge.variants.ts +161 -0
  92. package/src/components/Box/Box.test.tsx +21 -0
  93. package/src/components/Box/Box.tsx +32 -3
  94. package/src/components/Box/box.types.ts +55 -0
  95. package/src/components/Button/Button.test.tsx +21 -0
  96. package/src/components/Button/Button.tsx +28 -27
  97. package/src/components/Button/button.types.ts +36 -0
  98. package/src/components/Card/Card.test.tsx +291 -0
  99. package/src/components/Card/Card.tsx +241 -0
  100. package/src/components/Card/card.types.ts +132 -0
  101. package/src/components/Chip/Chip.test.tsx +316 -0
  102. package/src/components/Chip/Chip.tsx +224 -0
  103. package/src/components/Chip/chip.types.ts +128 -0
  104. package/src/components/Chip/chip.variants.ts +173 -0
  105. package/src/components/DataGrid/visibility/ColumnVisibilityMenu.tsx +1 -1
  106. package/src/components/IconButton/IconButton.test.tsx +367 -0
  107. package/src/components/IconButton/IconButton.tsx +159 -0
  108. package/src/components/IconButton/iconButton.types.ts +106 -0
  109. package/src/components/IconButton/iconButton.variants.ts +31 -0
  110. package/src/components/LeftNav/leftNav.variants.ts +2 -2
  111. package/src/components/Menu/Menu.test.tsx +408 -0
  112. package/src/components/Menu/Menu.tsx +335 -0
  113. package/src/components/Menu/menu.types.ts +221 -0
  114. package/src/components/Menu/menu.variants.ts +132 -0
  115. package/src/components/Pagination/pagination.variants.ts +1 -1
  116. package/src/components/Snackbar/Snackbar.tsx +46 -28
  117. package/src/components/Snackbar/snackbar.types.ts +47 -3
  118. package/src/components/Snackbar/snackbar.variants.ts +29 -22
  119. package/src/components/Spinner/Spinner.test.tsx +199 -0
  120. package/src/components/Spinner/Spinner.tsx +158 -0
  121. package/src/components/Spinner/spinner.types.ts +113 -0
  122. package/src/components/Spinner/spinner.variants.ts +83 -0
  123. package/src/components/Table/cells/RenderChip.tsx +24 -87
  124. package/src/components/Table/cells/RowActionsMenu.tsx +1 -1
  125. package/src/components/TextField/TextField.test.tsx +5 -1
  126. package/src/components/_shared/severity/index.ts +33 -0
  127. package/src/components/_shared/severity/severity.types.ts +50 -0
  128. package/src/components/_shared/severity/severityIcons.tsx +104 -0
  129. package/src/components/_shared/severity/severityVariants.test.ts +136 -0
  130. package/src/components/_shared/severity/severityVariants.ts +115 -0
  131. package/src/index.ts +163 -1
  132. package/vite.config.ts +8 -0
  133. package/vitest.config.mts +8 -1
  134. package/LICENSE +0 -21
@@ -0,0 +1,208 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ /**
3
+ * Tailwind-variants recipe for `<Avatar>`.
4
+ *
5
+ * Axes:
6
+ * - `size` — 5 steps (xs/sm/md/lg/xl), maps to w/h spacing tokens
7
+ * + matching text-size for the initials inside.
8
+ * - `radius` — 7 steps (none/sm/md/lg/xl/2xl/full), same scale as
9
+ * `<Box rounded>`. `shape` prop in the component maps
10
+ * semantically: circle → full, rounded → lg, square → none.
11
+ * - `color` — 7 intents. Drives the FALLBACK bg+text only (image
12
+ * surface is independent of color).
13
+ *
14
+ * The `color` × `tone` combo is resolved at render time in
15
+ * `Avatar.tsx` via compound lookup — see the SOFT_TINT and TONE
16
+ * tables there. We do NOT expand the matrix exhaustively in this TV
17
+ * recipe (it would be 7 colors × 10 tones × 5 sizes = 350 rules; the
18
+ * runtime resolver keeps the recipe slim).
19
+ */
20
+ export declare const avatarVariants: import("tailwind-variants").TVReturnType<{
21
+ size: {
22
+ xs: {
23
+ root: string;
24
+ initials: string;
25
+ };
26
+ sm: {
27
+ root: string;
28
+ initials: string;
29
+ };
30
+ md: {
31
+ root: string;
32
+ initials: string;
33
+ };
34
+ lg: {
35
+ root: string;
36
+ initials: string;
37
+ };
38
+ xl: {
39
+ root: string;
40
+ initials: string;
41
+ };
42
+ };
43
+ radius: {
44
+ none: {
45
+ root: string;
46
+ };
47
+ sm: {
48
+ root: string;
49
+ };
50
+ md: {
51
+ root: string;
52
+ };
53
+ lg: {
54
+ root: string;
55
+ };
56
+ xl: {
57
+ root: string;
58
+ };
59
+ '2xl': {
60
+ root: string;
61
+ };
62
+ full: {
63
+ root: string;
64
+ };
65
+ };
66
+ }, {
67
+ /** Outer wrapper — sets dimensions + radius + ring + alignment. */
68
+ root: string[];
69
+ /** `<img>` slot — fills the root, object-cover for crop-to-square. */
70
+ img: string;
71
+ /** Initials text slot. */
72
+ initials: string;
73
+ /** Generic user icon SVG fallback. */
74
+ icon: string;
75
+ }, undefined, {
76
+ size: {
77
+ xs: {
78
+ root: string;
79
+ initials: string;
80
+ };
81
+ sm: {
82
+ root: string;
83
+ initials: string;
84
+ };
85
+ md: {
86
+ root: string;
87
+ initials: string;
88
+ };
89
+ lg: {
90
+ root: string;
91
+ initials: string;
92
+ };
93
+ xl: {
94
+ root: string;
95
+ initials: string;
96
+ };
97
+ };
98
+ radius: {
99
+ none: {
100
+ root: string;
101
+ };
102
+ sm: {
103
+ root: string;
104
+ };
105
+ md: {
106
+ root: string;
107
+ };
108
+ lg: {
109
+ root: string;
110
+ };
111
+ xl: {
112
+ root: string;
113
+ };
114
+ '2xl': {
115
+ root: string;
116
+ };
117
+ full: {
118
+ root: string;
119
+ };
120
+ };
121
+ }, {
122
+ /** Outer wrapper — sets dimensions + radius + ring + alignment. */
123
+ root: string[];
124
+ /** `<img>` slot — fills the root, object-cover for crop-to-square. */
125
+ img: string;
126
+ /** Initials text slot. */
127
+ initials: string;
128
+ /** Generic user icon SVG fallback. */
129
+ icon: string;
130
+ }, import("tailwind-variants").TVReturnType<{
131
+ size: {
132
+ xs: {
133
+ root: string;
134
+ initials: string;
135
+ };
136
+ sm: {
137
+ root: string;
138
+ initials: string;
139
+ };
140
+ md: {
141
+ root: string;
142
+ initials: string;
143
+ };
144
+ lg: {
145
+ root: string;
146
+ initials: string;
147
+ };
148
+ xl: {
149
+ root: string;
150
+ initials: string;
151
+ };
152
+ };
153
+ radius: {
154
+ none: {
155
+ root: string;
156
+ };
157
+ sm: {
158
+ root: string;
159
+ };
160
+ md: {
161
+ root: string;
162
+ };
163
+ lg: {
164
+ root: string;
165
+ };
166
+ xl: {
167
+ root: string;
168
+ };
169
+ '2xl': {
170
+ root: string;
171
+ };
172
+ full: {
173
+ root: string;
174
+ };
175
+ };
176
+ }, {
177
+ /** Outer wrapper — sets dimensions + radius + ring + alignment. */
178
+ root: string[];
179
+ /** `<img>` slot — fills the root, object-cover for crop-to-square. */
180
+ img: string;
181
+ /** Initials text slot. */
182
+ initials: string;
183
+ /** Generic user icon SVG fallback. */
184
+ icon: string;
185
+ }, undefined, unknown, unknown, undefined>>;
186
+ export type AvatarVariants = VariantProps<typeof avatarVariants>;
187
+ /**
188
+ * Default "soft" fallback treatment per intent — what you get when
189
+ * `tone` is omitted. Light tinted bg + dark text for legibility.
190
+ * Neutral row uses no `dark:` because the dashforgePreset() CSS-var
191
+ * swap auto-inverts neutral; color rows keep `dark:` for the
192
+ * intentional palette shift (palette colors don't auto-invert).
193
+ */
194
+ export declare const AVATAR_SOFT_FALLBACK: Record<string, string>;
195
+ /**
196
+ * Specific-tone resolver — when the consumer sets `tone={500}` (or
197
+ * any other value), this lookup builds the matching bg + text class.
198
+ *
199
+ * Text color logic:
200
+ * - tones 50-400 → dark text (uses the 900 step)
201
+ * - tones 500-900 → light text (uses the 50 step)
202
+ *
203
+ * Tailwind JIT requires literal class strings, so we enumerate them
204
+ * explicitly here. The bundle cost is ~70 lines, acceptable for the
205
+ * type-safety win of letting consumers pick any palette shade.
206
+ */
207
+ export declare const AVATAR_TONE_FALLBACK: Record<string, Record<number, string>>;
208
+ //# sourceMappingURL=avatar.variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Avatar/avatar.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEvB,mEAAmE;;IASnE,sEAAsE;;IAEtE,0BAA0B;;IAE1B,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAbtC,mEAAmE;;IASnE,sEAAsE;;IAEtE,0BAA0B;;IAE1B,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAbtC,mEAAmE;;IASnE,sEAAsE;;IAEtE,0BAA0B;;IAE1B,sCAAsC;;2CAwCxC,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqFvE,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { BadgeProps } from './badge.types.js';
2
+ /**
3
+ * `<Badge>` — anchored indicator overlaying an anchor element.
4
+ *
5
+ * Common patterns:
6
+ * - Notification count on a bell IconButton
7
+ * - Presence dot on an Avatar
8
+ * - "NEW" label on a Card or feature tile
9
+ * - Unsaved-changes indicator on a save button
10
+ *
11
+ * For inline standalone pills (status labels, tags, removable
12
+ * chips), use `<Chip>` instead — Chip and Badge are complementary
13
+ * primitives. Chip is interactive (`onClick`, `onDelete`,
14
+ * `selected`); Badge is passive overlay.
15
+ *
16
+ * Bridge integration (Sprint 4.4):
17
+ * - `access` — hide the badge for unauthorized subjects (anchor
18
+ * stays visible; wrap anchor in a separate Box `access` to gate
19
+ * it too)
20
+ * - `visibleWhen` — engine-reactive predicate
21
+ *
22
+ * The wrapped anchor element ALWAYS renders; only the floating
23
+ * badge dot/count is gated by `access`, `visibleWhen`, `invisible`,
24
+ * and content-resolution logic.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * // Notification count on bell
29
+ * <Badge content={unreadCount}>
30
+ * <IconButton aria-label="Notifications" variant="ghost">
31
+ * <BellIcon />
32
+ * </IconButton>
33
+ * </Badge>
34
+ *
35
+ * // Presence dot on avatar
36
+ * <Badge dot color="success" overlap="circular">
37
+ * <Avatar name="Maya Rodriguez" />
38
+ * </Badge>
39
+ *
40
+ * // Overflow
41
+ * <Badge content={1284} max={999}>
42
+ * <IconButton aria-label="Messages"><MailIcon /></IconButton>
43
+ * </Badge>
44
+ *
45
+ * // RBAC-gated
46
+ * <Badge
47
+ * content={adminQueueCount}
48
+ * access={{ resource: 'admin', action: 'read', onUnauthorized: 'hide' }}
49
+ * >
50
+ * <IconButton aria-label="Admin queue"><SettingsIcon /></IconButton>
51
+ * </Badge>
52
+ *
53
+ * // Engine-reactive
54
+ * <Badge
55
+ * dot color="warning"
56
+ * visibleWhen={(engine) => !!engine.getNode('unsavedChanges')?.value}
57
+ * >
58
+ * <IconButton aria-label="Save"><SaveIcon /></IconButton>
59
+ * </Badge>
60
+ * ```
61
+ */
62
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
63
+ //# sourceMappingURL=Badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAqCnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,eAAO,MAAM,KAAK,wGAqEhB,CAAC"}
@@ -0,0 +1,124 @@
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
+ /**
6
+ * Intent color — drives the badge background. Default is `danger`
7
+ * because the most common notification UX expects a red dot/count
8
+ * for "needs attention" affordance.
9
+ */
10
+ export type BadgeColor = 'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info';
11
+ /** 4 corner positions for the floating badge. */
12
+ export type BadgePlacement = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
13
+ /**
14
+ * Anchor shape:
15
+ * - `'rectangular'` (default) — badge sits at the bounding-box
16
+ * corner. Use for square-ish anchors like IconButton, Card.
17
+ * - `'circular'` — badge offset to align with the circular edge.
18
+ * Use for round anchors like Avatar.
19
+ */
20
+ export type BadgeOverlap = 'rectangular' | 'circular';
21
+ /**
22
+ * Per-slot className overrides for `<Badge>`.
23
+ */
24
+ export interface BadgeSlotProps {
25
+ /** Outer wrapper (relative-positioned, contains the anchor + badge). */
26
+ root?: {
27
+ className?: string;
28
+ };
29
+ /** The floating badge pill / dot itself. */
30
+ badge?: {
31
+ className?: string;
32
+ };
33
+ }
34
+ /**
35
+ * Props for `<Badge>` — anchored indicator (count / dot / short text).
36
+ *
37
+ * Wrapper-only mode: `<Badge>` always wraps an anchor element passed
38
+ * as `children`. For standalone inline pills (status labels, tags),
39
+ * use `<Chip>` — Badge and Chip are complementary, not interchangeable.
40
+ *
41
+ * Relationship with Chip:
42
+ * - `<Chip>` = inline pill (interactive — `onClick`, `onDelete`,
43
+ * `selected`). Standalone, no anchor.
44
+ * - `<Badge>` = anchored indicator (passive — small count / dot
45
+ * overlaid on top of another element).
46
+ */
47
+ export interface BadgeProps {
48
+ /** The anchor element (Avatar / IconButton / button / Card / custom). */
49
+ children: ReactNode;
50
+ /**
51
+ * Numeric or string content to display inside the badge.
52
+ * - `number` → formatted via `max` (overflow renders as `"N+"`)
53
+ * - `string` → rendered verbatim (e.g., `"NEW"`)
54
+ * - omitted + `dot=false` → no badge rendered (or only at zero if
55
+ * `showZero=true`)
56
+ */
57
+ content?: number | string;
58
+ /**
59
+ * Dot-only mode — small circle without content. When `true`,
60
+ * `content` and `max` are ignored.
61
+ */
62
+ dot?: boolean;
63
+ /**
64
+ * Overflow threshold for numeric `content`. Values above render
65
+ * as `{max}+`. Set to `-1` to disable overflow (always raw number).
66
+ * @default 99
67
+ */
68
+ max?: number;
69
+ /**
70
+ * Whether to render the badge when numeric `content` is `0`.
71
+ * Hidden by default — the typical notification UX is "no badge =
72
+ * nothing to see".
73
+ * @default false
74
+ */
75
+ showZero?: boolean;
76
+ /**
77
+ * Imperative hide — keeps the badge in the DOM but applies
78
+ * `display: none`. Use for opacity/scale fade animations without
79
+ * unmounting.
80
+ * @default false
81
+ */
82
+ invisible?: boolean;
83
+ /** @default 'danger' — typical "needs attention" notification color. */
84
+ color?: BadgeColor;
85
+ /** @default 'top-right' */
86
+ placement?: BadgePlacement;
87
+ /**
88
+ * Anchor shape — controls badge offset.
89
+ * - `'rectangular'` (default) sits at the bounding-box corner
90
+ * - `'circular'` offsets to align with the circular anchor edge
91
+ * (use with `<Avatar shape="circle">`)
92
+ * @default 'rectangular'
93
+ */
94
+ overlap?: BadgeOverlap;
95
+ /**
96
+ * White/neutral ring around the badge — visually separates from
97
+ * the anchor surface. Token-driven via `ring-neutral-50` which
98
+ * auto-inverts via the dashforgePreset CSS-var swap (no `dark:`
99
+ * needed).
100
+ * @default true
101
+ */
102
+ withRing?: boolean;
103
+ /**
104
+ * RBAC requirement — hides the badge for unauthorized subjects.
105
+ * The wrapped anchor element remains visible (use Box `access`
106
+ * to gate the anchor too).
107
+ *
108
+ * Use case: admin-only notification count, role-gated indicators.
109
+ */
110
+ access?: AccessRequirement;
111
+ /**
112
+ * Reactive visibility predicate. When `false`, the badge dot/count
113
+ * is not rendered (children always render). Use for state-driven
114
+ * indicators tied to engine values.
115
+ */
116
+ visibleWhen?: (engine: Engine) => boolean;
117
+ /** Root-element class shortcut. */
118
+ sx?: ClassValue;
119
+ /** Standard className — appended to the root via `cn()`. */
120
+ className?: string;
121
+ /** Per-slot overrides — root + badge. */
122
+ slotProps?: BadgeSlotProps;
123
+ }
124
+ //# sourceMappingURL=badge.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/badge.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;AAEzD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,SAAS,GACT,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,GACR,MAAM,CAAC;AAEX,iDAAiD;AACjD,MAAM,MAAM,cAAc,GACtB,WAAW,GACX,UAAU,GACV,cAAc,GACd,aAAa,CAAC;AAElB;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,UAAU,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,4CAA4C;IAC5C,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,UAAU;IAEzB,yEAAyE;IACzE,QAAQ,EAAE,SAAS,CAAC;IAGpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,wEAAwE;IACxE,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAG1C,mCAAmC;IACnC,EAAE,CAAC,EAAE,UAAU,CAAC;IAEhB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B"}
@@ -0,0 +1,262 @@
1
+ import { type VariantProps } from 'tailwind-variants';
2
+ /**
3
+ * Tailwind-variants recipe for `<Badge>`.
4
+ *
5
+ * Slot layout:
6
+ * - `root` — outer span (relative-positioned wrapper around the
7
+ * anchor). `inline-flex` so the wrapper shrinks to fit
8
+ * the anchor element.
9
+ * - `badge` — the floating absolute-positioned pill / dot. Two
10
+ * variants (`dot=true` → tiny circle, `dot=false` →
11
+ * pill with min-width to fit content).
12
+ *
13
+ * Color axis emits the `badge` background + text classes. The 7
14
+ * intents map to:
15
+ * - solid bg: `bg-{intent}-500` (vivid, attention-grabbing for
16
+ * notifications — different from Chip which uses 600 for solid
17
+ * because chip surface is larger; small badge needs the brighter
18
+ * mid-tone)
19
+ * - text: `text-white` for primary/secondary/success/warning/danger/
20
+ * info; `text-neutral-50` for neutral (auto-inverts via CSS-var
21
+ * swap, no `dark:` needed)
22
+ *
23
+ * Placement axis emits absolute-position + translate utilities:
24
+ * - top-right (default): `top-0 right-0 -translate-y-1/2 translate-x-1/2`
25
+ * - top-left: `top-0 left-0 -translate-y-1/2 -translate-x-1/2`
26
+ * - bottom-right: `bottom-0 right-0 translate-y-1/2 translate-x-1/2`
27
+ * - bottom-left: `bottom-0 left-0 translate-y-1/2 -translate-x-1/2`
28
+ *
29
+ * Overlap axis adds an extra inset for circular anchors so the
30
+ * badge sits along the round edge instead of the bounding box corner.
31
+ */
32
+ export declare const badgeVariants: import("tailwind-variants").TVReturnType<{
33
+ /**
34
+ * `dot=true` → tiny circle (8px), no content. The badge slot
35
+ * collapses to a fixed-size circle without the pill min-width.
36
+ */
37
+ dot: {
38
+ true: {
39
+ badge: string;
40
+ };
41
+ false: {
42
+ badge: string;
43
+ };
44
+ };
45
+ /** Whether the floating badge is hidden via `display: none`. */
46
+ invisible: {
47
+ true: {
48
+ badge: string;
49
+ };
50
+ };
51
+ /** Halo ring for visual separation from the anchor surface. */
52
+ withRing: {
53
+ true: {
54
+ badge: string;
55
+ };
56
+ };
57
+ /** 7 intents — drives the badge background + text colour. */
58
+ color: {
59
+ neutral: {
60
+ badge: string;
61
+ };
62
+ primary: {
63
+ badge: string;
64
+ };
65
+ secondary: {
66
+ badge: string;
67
+ };
68
+ success: {
69
+ badge: string;
70
+ };
71
+ warning: {
72
+ badge: string;
73
+ };
74
+ danger: {
75
+ badge: string;
76
+ };
77
+ info: {
78
+ badge: string;
79
+ };
80
+ };
81
+ placement: {
82
+ 'top-right': {
83
+ badge: string;
84
+ };
85
+ 'top-left': {
86
+ badge: string;
87
+ };
88
+ 'bottom-right': {
89
+ badge: string;
90
+ };
91
+ 'bottom-left': {
92
+ badge: string;
93
+ };
94
+ };
95
+ /**
96
+ * `overlap='circular'` adds an inward inset so the badge sits
97
+ * along the circular anchor edge instead of the bounding-box
98
+ * corner. The 14% offset is empirically tuned to match the
99
+ * standard avatar / round-button geometry (matches MUI's value).
100
+ */
101
+ overlap: {
102
+ rectangular: {};
103
+ circular: {};
104
+ };
105
+ }, {
106
+ root: string;
107
+ badge: string[];
108
+ }, undefined, {
109
+ /**
110
+ * `dot=true` → tiny circle (8px), no content. The badge slot
111
+ * collapses to a fixed-size circle without the pill min-width.
112
+ */
113
+ dot: {
114
+ true: {
115
+ badge: string;
116
+ };
117
+ false: {
118
+ badge: string;
119
+ };
120
+ };
121
+ /** Whether the floating badge is hidden via `display: none`. */
122
+ invisible: {
123
+ true: {
124
+ badge: string;
125
+ };
126
+ };
127
+ /** Halo ring for visual separation from the anchor surface. */
128
+ withRing: {
129
+ true: {
130
+ badge: string;
131
+ };
132
+ };
133
+ /** 7 intents — drives the badge background + text colour. */
134
+ color: {
135
+ neutral: {
136
+ badge: string;
137
+ };
138
+ primary: {
139
+ badge: string;
140
+ };
141
+ secondary: {
142
+ badge: string;
143
+ };
144
+ success: {
145
+ badge: string;
146
+ };
147
+ warning: {
148
+ badge: string;
149
+ };
150
+ danger: {
151
+ badge: string;
152
+ };
153
+ info: {
154
+ badge: string;
155
+ };
156
+ };
157
+ placement: {
158
+ 'top-right': {
159
+ badge: string;
160
+ };
161
+ 'top-left': {
162
+ badge: string;
163
+ };
164
+ 'bottom-right': {
165
+ badge: string;
166
+ };
167
+ 'bottom-left': {
168
+ badge: string;
169
+ };
170
+ };
171
+ /**
172
+ * `overlap='circular'` adds an inward inset so the badge sits
173
+ * along the circular anchor edge instead of the bounding-box
174
+ * corner. The 14% offset is empirically tuned to match the
175
+ * standard avatar / round-button geometry (matches MUI's value).
176
+ */
177
+ overlap: {
178
+ rectangular: {};
179
+ circular: {};
180
+ };
181
+ }, {
182
+ root: string;
183
+ badge: string[];
184
+ }, import("tailwind-variants").TVReturnType<{
185
+ /**
186
+ * `dot=true` → tiny circle (8px), no content. The badge slot
187
+ * collapses to a fixed-size circle without the pill min-width.
188
+ */
189
+ dot: {
190
+ true: {
191
+ badge: string;
192
+ };
193
+ false: {
194
+ badge: string;
195
+ };
196
+ };
197
+ /** Whether the floating badge is hidden via `display: none`. */
198
+ invisible: {
199
+ true: {
200
+ badge: string;
201
+ };
202
+ };
203
+ /** Halo ring for visual separation from the anchor surface. */
204
+ withRing: {
205
+ true: {
206
+ badge: string;
207
+ };
208
+ };
209
+ /** 7 intents — drives the badge background + text colour. */
210
+ color: {
211
+ neutral: {
212
+ badge: string;
213
+ };
214
+ primary: {
215
+ badge: string;
216
+ };
217
+ secondary: {
218
+ badge: string;
219
+ };
220
+ success: {
221
+ badge: string;
222
+ };
223
+ warning: {
224
+ badge: string;
225
+ };
226
+ danger: {
227
+ badge: string;
228
+ };
229
+ info: {
230
+ badge: string;
231
+ };
232
+ };
233
+ placement: {
234
+ 'top-right': {
235
+ badge: string;
236
+ };
237
+ 'top-left': {
238
+ badge: string;
239
+ };
240
+ 'bottom-right': {
241
+ badge: string;
242
+ };
243
+ 'bottom-left': {
244
+ badge: string;
245
+ };
246
+ };
247
+ /**
248
+ * `overlap='circular'` adds an inward inset so the badge sits
249
+ * along the circular anchor edge instead of the bounding-box
250
+ * corner. The 14% offset is empirically tuned to match the
251
+ * standard avatar / round-button geometry (matches MUI's value).
252
+ */
253
+ overlap: {
254
+ rectangular: {};
255
+ circular: {};
256
+ };
257
+ }, {
258
+ root: string;
259
+ badge: string[];
260
+ }, undefined, unknown, unknown, undefined>>;
261
+ export type BadgeVariants = VariantProps<typeof badgeVariants>;
262
+ //# sourceMappingURL=badge.variants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/badge.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,aAAa;IAkBtB;;;OAGG;;;;;;;;;IAWH,gEAAgE;;;;;;IAMhE,+DAA+D;;;;;;IAQ/D,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B7D;;;;;OAKG;;;;;;;;;IA7DH;;;OAGG;;;;;;;;;IAWH,gEAAgE;;;;;;IAMhE,+DAA+D;;;;;;IAQ/D,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B7D;;;;;OAKG;;;;;;;;;IA7DH;;;OAGG;;;;;;;;;IAWH,gEAAgE;;;;;;IAMhE,+DAA+D;;;;;;IAQ/D,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4B7D;;;;;OAKG;;;;;;;;2CA+CL,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,GAAG,kGAyCf,CAAC"}
1
+ {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,GAAG,kGAoEf,CAAC"}