@financedistrict/apps-ui 0.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 (136) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +119 -0
  3. package/dist/Radio-BYWz1n7p.d.cts +32 -0
  4. package/dist/Radio-BYWz1n7p.d.ts +32 -0
  5. package/dist/SelectTrigger-By0iPBI3.d.cts +78 -0
  6. package/dist/SelectTrigger-By0iPBI3.d.ts +78 -0
  7. package/dist/accordion.cjs +322 -0
  8. package/dist/accordion.d.cts +156 -0
  9. package/dist/accordion.d.ts +156 -0
  10. package/dist/accordion.js +2 -0
  11. package/dist/apps-ui.umd.js +1 -0
  12. package/dist/button.cjs +366 -0
  13. package/dist/button.d.cts +52 -0
  14. package/dist/button.d.ts +52 -0
  15. package/dist/button.js +3 -0
  16. package/dist/checkbox.cjs +74 -0
  17. package/dist/checkbox.d.cts +63 -0
  18. package/dist/checkbox.d.ts +63 -0
  19. package/dist/checkbox.js +2 -0
  20. package/dist/chunk-3RU7JMFE.js +27 -0
  21. package/dist/chunk-5TWRK4NW.js +783 -0
  22. package/dist/chunk-7EOSDFS3.js +9 -0
  23. package/dist/chunk-AIQ4UOGK.js +142 -0
  24. package/dist/chunk-B3MMGTPV.js +200 -0
  25. package/dist/chunk-DAHQYLUI.js +146 -0
  26. package/dist/chunk-DGBXADSS.js +1 -0
  27. package/dist/chunk-E6KPNTWW.js +295 -0
  28. package/dist/chunk-EOAB6G2D.js +149 -0
  29. package/dist/chunk-FAOVKDVM.js +32 -0
  30. package/dist/chunk-FV76Z4Z2.js +78 -0
  31. package/dist/chunk-GLTLBUZ7.js +285 -0
  32. package/dist/chunk-GTZFV43T.js +154 -0
  33. package/dist/chunk-HRGZNL4A.js +88 -0
  34. package/dist/chunk-IEVN3J2F.js +98 -0
  35. package/dist/chunk-IRS3T6LF.js +352 -0
  36. package/dist/chunk-IYYHCQXG.js +146 -0
  37. package/dist/chunk-JIXW3455.js +89 -0
  38. package/dist/chunk-N4VAP2GB.js +77 -0
  39. package/dist/chunk-SJ2ZRYVV.js +167 -0
  40. package/dist/chunk-SNU4YXOR.js +66 -0
  41. package/dist/chunk-TT6JQATV.js +99 -0
  42. package/dist/chunk-UPQ3ZPCO.js +66 -0
  43. package/dist/chunk-UVUSVFOH.js +264 -0
  44. package/dist/chunk-WJFPGGJB.js +255 -0
  45. package/dist/chunk-WXEBQA7A.js +371 -0
  46. package/dist/chunk-Y2O4YYZQ.js +184 -0
  47. package/dist/cut-corner.cjs +111 -0
  48. package/dist/cut-corner.d.cts +49 -0
  49. package/dist/cut-corner.d.ts +49 -0
  50. package/dist/cut-corner.js +1 -0
  51. package/dist/dialog.cjs +441 -0
  52. package/dist/dialog.d.cts +240 -0
  53. package/dist/dialog.d.ts +240 -0
  54. package/dist/dialog.js +3 -0
  55. package/dist/feature-card.cjs +182 -0
  56. package/dist/feature-card.d.cts +54 -0
  57. package/dist/feature-card.d.ts +54 -0
  58. package/dist/feature-card.js +2 -0
  59. package/dist/filter.cjs +873 -0
  60. package/dist/filter.d.cts +129 -0
  61. package/dist/filter.d.ts +129 -0
  62. package/dist/filter.js +6 -0
  63. package/dist/index.cjs +4583 -0
  64. package/dist/index.d.cts +29 -0
  65. package/dist/index.d.ts +29 -0
  66. package/dist/index.js +27 -0
  67. package/dist/inline-select.cjs +856 -0
  68. package/dist/inline-select.d.cts +92 -0
  69. package/dist/inline-select.d.ts +92 -0
  70. package/dist/inline-select.js +6 -0
  71. package/dist/input.cjs +263 -0
  72. package/dist/input.d.cts +157 -0
  73. package/dist/input.d.ts +157 -0
  74. package/dist/input.js +4 -0
  75. package/dist/panel.cjs +185 -0
  76. package/dist/panel.d.cts +103 -0
  77. package/dist/panel.d.ts +103 -0
  78. package/dist/panel.js +2 -0
  79. package/dist/property-grid.cjs +110 -0
  80. package/dist/property-grid.d.cts +56 -0
  81. package/dist/property-grid.d.ts +56 -0
  82. package/dist/property-grid.js +2 -0
  83. package/dist/radio.cjs +74 -0
  84. package/dist/radio.d.cts +39 -0
  85. package/dist/radio.d.ts +39 -0
  86. package/dist/radio.js +2 -0
  87. package/dist/scrollbar.cjs +34 -0
  88. package/dist/scrollbar.d.cts +35 -0
  89. package/dist/scrollbar.d.ts +35 -0
  90. package/dist/scrollbar.js +1 -0
  91. package/dist/search-bar.cjs +408 -0
  92. package/dist/search-bar.d.cts +42 -0
  93. package/dist/search-bar.d.ts +42 -0
  94. package/dist/search-bar.js +4 -0
  95. package/dist/select.cjs +998 -0
  96. package/dist/select.d.cts +357 -0
  97. package/dist/select.d.ts +357 -0
  98. package/dist/select.js +5 -0
  99. package/dist/selectable-feature-card.cjs +159 -0
  100. package/dist/selectable-feature-card.d.cts +74 -0
  101. package/dist/selectable-feature-card.d.ts +74 -0
  102. package/dist/selectable-feature-card.js +3 -0
  103. package/dist/sidebar-item.cjs +175 -0
  104. package/dist/sidebar-item.d.cts +75 -0
  105. package/dist/sidebar-item.d.ts +75 -0
  106. package/dist/sidebar-item.js +2 -0
  107. package/dist/switch.cjs +86 -0
  108. package/dist/switch.d.cts +72 -0
  109. package/dist/switch.d.ts +72 -0
  110. package/dist/switch.js +2 -0
  111. package/dist/table-cell.cjs +196 -0
  112. package/dist/table-cell.d.cts +76 -0
  113. package/dist/table-cell.d.ts +76 -0
  114. package/dist/table-cell.js +2 -0
  115. package/dist/table-title.cjs +34 -0
  116. package/dist/table-title.d.cts +16 -0
  117. package/dist/table-title.d.ts +16 -0
  118. package/dist/table-title.js +2 -0
  119. package/dist/tabs.cjs +299 -0
  120. package/dist/tabs.d.cts +116 -0
  121. package/dist/tabs.d.ts +116 -0
  122. package/dist/tabs.js +2 -0
  123. package/dist/toast.cjs +87 -0
  124. package/dist/toast.d.cts +48 -0
  125. package/dist/toast.d.ts +48 -0
  126. package/dist/toast.js +2 -0
  127. package/dist/token-input.cjs +415 -0
  128. package/dist/token-input.d.cts +90 -0
  129. package/dist/token-input.d.ts +90 -0
  130. package/dist/token-input.js +3 -0
  131. package/dist/tooltip.cjs +384 -0
  132. package/dist/tooltip.d.cts +142 -0
  133. package/dist/tooltip.d.ts +142 -0
  134. package/dist/tooltip.js +2 -0
  135. package/package.json +200 -0
  136. package/src/fonts.css +33 -0
package/dist/tabs.cjs ADDED
@@ -0,0 +1,299 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var clsx = require('clsx');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+
29
+ // src/tabs/Tabs.tsx
30
+ function cn(...inputs) {
31
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
32
+ }
33
+ var tabsRootVariants = classVarianceAuthority.cva(["flex flex-col"]);
34
+ var tabsListVariants = classVarianceAuthority.cva(["inline-flex items-center"]);
35
+ var tabsTriggerVariants = classVarianceAuthority.cva(
36
+ [
37
+ "group inline-flex cursor-pointer items-center justify-center gap-1 px-2 py-2.5",
38
+ "body-03-medium border-b-2 transition-colors",
39
+ "outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
40
+ "[&_svg]:size-4 [&_svg]:shrink-0",
41
+ "disabled:cursor-not-allowed"
42
+ ],
43
+ {
44
+ variants: {
45
+ selected: {
46
+ true: "border-card-brand-border-accent text-foreground-accent",
47
+ false: "border-transparent text-foreground"
48
+ },
49
+ disabled: {
50
+ true: "text-foreground-muted",
51
+ false: ""
52
+ }
53
+ },
54
+ compoundVariants: [
55
+ // Unselected + enabled: faint underline on hover, purple text+underline
56
+ // while pressed (Figma hover / active states).
57
+ {
58
+ selected: false,
59
+ disabled: false,
60
+ className: "hover:border-card-brand-border active:border-card-brand-border-accent active:text-foreground-accent"
61
+ },
62
+ // Selected + disabled: the underline drops from accent to the faint token
63
+ // (Figma disabled-selected). Wins over the accent border from
64
+ // `selected:true` because compound variants are appended last.
65
+ {
66
+ selected: true,
67
+ disabled: true,
68
+ className: "border-card-brand-border"
69
+ }
70
+ ],
71
+ defaultVariants: {
72
+ selected: false,
73
+ disabled: false
74
+ }
75
+ }
76
+ );
77
+ var tabsContentVariants = classVarianceAuthority.cva([
78
+ "outline-none focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
79
+ ]);
80
+ var TabsContext = React__namespace.createContext(null);
81
+ function useTabsContext(part) {
82
+ const context = React__namespace.useContext(TabsContext);
83
+ if (context === null) {
84
+ throw new Error(`${part} must be used within <Tabs.Root>`);
85
+ }
86
+ return context;
87
+ }
88
+ function setRef(ref, node) {
89
+ if (typeof ref === "function") ref(node);
90
+ else if (ref) ref.current = node;
91
+ }
92
+ function TabsRoot({
93
+ value: valueProp,
94
+ defaultValue,
95
+ onValueChange,
96
+ className,
97
+ children,
98
+ ref,
99
+ ...props
100
+ }) {
101
+ const isControlled = valueProp !== void 0;
102
+ const [uncontrolledValue, setUncontrolledValue] = React__namespace.useState(defaultValue);
103
+ const value = isControlled ? valueProp : uncontrolledValue;
104
+ const select = (next) => {
105
+ if (!isControlled) setUncontrolledValue(next);
106
+ onValueChange?.(next);
107
+ };
108
+ const baseId = React__namespace.useId();
109
+ const getTriggerId = (tabValue) => `${baseId}-tab-${tabValue}`;
110
+ const getPanelId = (tabValue) => `${baseId}-panel-${tabValue}`;
111
+ const [triggers, setTriggers] = React__namespace.useState([]);
112
+ const registerTrigger = React__namespace.useCallback((registration) => {
113
+ setTriggers((prev) => {
114
+ const existing = prev.findIndex((t) => t.value === registration.value);
115
+ if (existing === -1) return [...prev, registration];
116
+ const next = [...prev];
117
+ next[existing] = registration;
118
+ return next;
119
+ });
120
+ }, []);
121
+ const unregisterTrigger = React__namespace.useCallback((tabValue) => {
122
+ setTriggers((prev) => prev.filter((t) => t.value !== tabValue));
123
+ }, []);
124
+ const domOrdered = [...triggers].sort(
125
+ (a, b) => a.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
126
+ );
127
+ const firstEnabled = domOrdered.find((t) => !t.disabled)?.value;
128
+ const tabStopValue = value ?? firstEnabled;
129
+ const onTriggerKeyDown = (event) => {
130
+ if (!["ArrowRight", "ArrowLeft", "Home", "End"].includes(event.key)) return;
131
+ const enabled = domOrdered.filter((t) => !t.disabled);
132
+ if (enabled.length === 0) return;
133
+ const currentIndex = enabled.findIndex(
134
+ (t) => t.node === event.currentTarget
135
+ );
136
+ if (currentIndex === -1) return;
137
+ event.preventDefault();
138
+ let nextIndex = currentIndex;
139
+ switch (event.key) {
140
+ case "ArrowRight":
141
+ nextIndex = (currentIndex + 1) % enabled.length;
142
+ break;
143
+ case "ArrowLeft":
144
+ nextIndex = (currentIndex - 1 + enabled.length) % enabled.length;
145
+ break;
146
+ case "Home":
147
+ nextIndex = 0;
148
+ break;
149
+ case "End":
150
+ nextIndex = enabled.length - 1;
151
+ break;
152
+ }
153
+ const target = enabled[nextIndex];
154
+ if (!target) return;
155
+ target.node.focus();
156
+ select(target.value);
157
+ };
158
+ const contextValue = {
159
+ value,
160
+ select,
161
+ tabStopValue,
162
+ registerTrigger,
163
+ unregisterTrigger,
164
+ onTriggerKeyDown,
165
+ getTriggerId,
166
+ getPanelId
167
+ };
168
+ return /* @__PURE__ */ jsxRuntime.jsx(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
169
+ "div",
170
+ {
171
+ ref,
172
+ "data-slot": "tabs",
173
+ className: cn(tabsRootVariants(), className),
174
+ ...props,
175
+ children
176
+ }
177
+ ) });
178
+ }
179
+ function TabsList({ className, children, ref, ...props }) {
180
+ useTabsContext("Tabs.List");
181
+ return /* @__PURE__ */ jsxRuntime.jsx(
182
+ "div",
183
+ {
184
+ ref,
185
+ role: "tablist",
186
+ "data-slot": "tabs-list",
187
+ className: cn(tabsListVariants(), className),
188
+ ...props,
189
+ children
190
+ }
191
+ );
192
+ }
193
+ function TabsTrigger({
194
+ value,
195
+ disabled = false,
196
+ className,
197
+ children,
198
+ onClick,
199
+ onKeyDown,
200
+ ref,
201
+ ...props
202
+ }) {
203
+ const {
204
+ value: selectedValue,
205
+ select,
206
+ tabStopValue,
207
+ registerTrigger,
208
+ unregisterTrigger,
209
+ onTriggerKeyDown,
210
+ getTriggerId,
211
+ getPanelId
212
+ } = useTabsContext("Tabs.Trigger");
213
+ const selected = value === selectedValue;
214
+ const triggerId = getTriggerId(value);
215
+ const panelId = getPanelId(value);
216
+ const buttonRef = React__namespace.useRef(null);
217
+ const setButtonRef = (node) => {
218
+ buttonRef.current = node;
219
+ setRef(ref, node);
220
+ };
221
+ React__namespace.useEffect(() => {
222
+ const node = buttonRef.current;
223
+ if (!node) return;
224
+ registerTrigger({ value, disabled, node });
225
+ return () => unregisterTrigger(value);
226
+ }, [registerTrigger, unregisterTrigger, value, disabled]);
227
+ return /* @__PURE__ */ jsxRuntime.jsx(
228
+ "button",
229
+ {
230
+ ...props,
231
+ ref: setButtonRef,
232
+ type: "button",
233
+ role: "tab",
234
+ id: triggerId,
235
+ "data-slot": "tabs-trigger",
236
+ "data-state": selected ? "active" : "inactive",
237
+ "data-disabled": disabled || void 0,
238
+ "aria-selected": selected,
239
+ "aria-controls": selected ? panelId : void 0,
240
+ tabIndex: value === tabStopValue ? 0 : -1,
241
+ disabled,
242
+ className: cn(tabsTriggerVariants({ selected, disabled }), className),
243
+ onClick: (event) => {
244
+ onClick?.(event);
245
+ if (!event.defaultPrevented) select(value);
246
+ },
247
+ onKeyDown: (event) => {
248
+ onKeyDown?.(event);
249
+ if (!event.defaultPrevented) onTriggerKeyDown(event);
250
+ },
251
+ children
252
+ }
253
+ );
254
+ }
255
+ function TabsContent({
256
+ value,
257
+ className,
258
+ children,
259
+ ref,
260
+ ...props
261
+ }) {
262
+ const {
263
+ value: selectedValue,
264
+ getTriggerId,
265
+ getPanelId
266
+ } = useTabsContext("Tabs.Content");
267
+ if (value !== selectedValue) return null;
268
+ return /* @__PURE__ */ jsxRuntime.jsx(
269
+ "div",
270
+ {
271
+ ref,
272
+ role: "tabpanel",
273
+ id: getPanelId(value),
274
+ "aria-labelledby": getTriggerId(value),
275
+ "data-slot": "tabs-content",
276
+ "data-state": "active",
277
+ tabIndex: 0,
278
+ className: cn(tabsContentVariants(), className),
279
+ ...props,
280
+ children
281
+ }
282
+ );
283
+ }
284
+ var Tabs = {
285
+ Root: TabsRoot,
286
+ List: TabsList,
287
+ Trigger: TabsTrigger,
288
+ Content: TabsContent
289
+ };
290
+
291
+ exports.Tabs = Tabs;
292
+ exports.TabsContent = TabsContent;
293
+ exports.TabsList = TabsList;
294
+ exports.TabsRoot = TabsRoot;
295
+ exports.TabsTrigger = TabsTrigger;
296
+ exports.tabsContentVariants = tabsContentVariants;
297
+ exports.tabsListVariants = tabsListVariants;
298
+ exports.tabsRootVariants = tabsRootVariants;
299
+ exports.tabsTriggerVariants = tabsTriggerVariants;
@@ -0,0 +1,116 @@
1
+ import * as React from 'react';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+
4
+ interface TabsRootProps extends Omit<React.ComponentProps<"div">, "defaultValue"> {
5
+ /** Controlled selected value. Pair with `onValueChange`. */
6
+ value?: string;
7
+ /**
8
+ * Uncontrolled initial value. Ignored when `value` is provided. If both are
9
+ * omitted, no tab is selected initially (all panels hidden).
10
+ */
11
+ defaultValue?: string;
12
+ /** Called with the next value whenever selection changes. */
13
+ onValueChange?: (value: string) => void;
14
+ }
15
+ /**
16
+ * State owner + context provider for the compound `Tabs`. Renders a plain
17
+ * `<div>` (no landmark role). Owns the single-`string` selection model
18
+ * (controlled via `value`/`onValueChange`, or uncontrolled via `defaultValue`),
19
+ * the roving tab-stop computation, and the arrow-key handler with automatic
20
+ * activation. Forwards `ref` to the container.
21
+ */
22
+ declare function TabsRoot({ value: valueProp, defaultValue, onValueChange, className, children, ref, ...props }: TabsRootProps): React.JSX.Element;
23
+ interface TabsListProps extends React.ComponentProps<"div"> {
24
+ }
25
+ /**
26
+ * The horizontal row of triggers — `role="tablist"`. Provide an accessible name
27
+ * via `aria-label` or `aria-labelledby` when there is no visible label.
28
+ * Forwards `ref` to the tablist.
29
+ */
30
+ declare function TabsList({ className, children, ref, ...props }: TabsListProps): React.JSX.Element;
31
+ interface TabsTriggerProps extends React.ComponentProps<"button"> {
32
+ /** **Required.** Ties the tab to its panel (and to the selection model). */
33
+ value: string;
34
+ }
35
+ /**
36
+ * One tab — `role="tab"`, a native `<button type="button">`. `children` is the
37
+ * label (and any leading icon, which inherits the per-state text color via
38
+ * `currentColor`). Wires `aria-selected`, roving `tabIndex`, and — only while
39
+ * its panel is mounted — `aria-controls`. Composes the consumer's
40
+ * `onClick`/`onKeyDown` (theirs runs first; the built-in behaviour is skipped
41
+ * if they call `preventDefault`). Forwards `ref` to the button.
42
+ */
43
+ declare function TabsTrigger({ value, disabled, className, children, onClick, onKeyDown, ref, ...props }: TabsTriggerProps): React.JSX.Element;
44
+ interface TabsContentProps extends React.ComponentProps<"div"> {
45
+ /** **Required.** Matches the `value` of the trigger this panel belongs to. */
46
+ value: string;
47
+ }
48
+ /**
49
+ * A tab panel — `role="tabpanel"`, labelled by its trigger. Rendered **only
50
+ * when its tab is selected**; inactive panels are unmounted, so their content
51
+ * leaves the a11y tree and tab order (matching `Accordion.Content`). It is a
52
+ * focus stop (`tabIndex=0`) so keyboard users can reach its content. Forwards
53
+ * `ref` to the panel.
54
+ */
55
+ declare function TabsContent({ value, className, children, ref, ...props }: TabsContentProps): React.JSX.Element | null;
56
+ /**
57
+ * Compound underline-indicator `Tabs` (WAI-ARIA Tabs pattern, single selection,
58
+ * horizontal, automatic activation). Assemble from its namespaced parts:
59
+ *
60
+ * ```tsx
61
+ * <Tabs.Root defaultValue="overview">
62
+ * <Tabs.List aria-label="Account sections">
63
+ * <Tabs.Trigger value="overview">Overview</Tabs.Trigger>
64
+ * <Tabs.Trigger value="activity">Activity</Tabs.Trigger>
65
+ * </Tabs.List>
66
+ * <Tabs.Content value="overview">…</Tabs.Content>
67
+ * <Tabs.Content value="activity">…</Tabs.Content>
68
+ * </Tabs.Root>
69
+ * ```
70
+ */
71
+ declare const Tabs: {
72
+ Root: typeof TabsRoot;
73
+ List: typeof TabsList;
74
+ Trigger: typeof TabsTrigger;
75
+ Content: typeof TabsContent;
76
+ };
77
+
78
+ /**
79
+ * Tabs styling — the Figma `tab` component (node `906-78043`), an
80
+ * underline-indicator tab. Binds ONLY to the semantic token layer (never
81
+ * primitives, never mode plumbing); theme switching is automatic via `.dark`,
82
+ * so no `dark:` variants are needed.
83
+ *
84
+ * Only the trigger carries visual state (text color + underline). The state ×
85
+ * selected matrix from the spec is expressed as two `cva` axes (`selected`,
86
+ * `disabled`) plus compound variants for the hover/active interactions and the
87
+ * disabled-selected underline.
88
+ */
89
+ /** Root container — a plain vertical stack (tablist above, panel below). */
90
+ declare const tabsRootVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
91
+ /**
92
+ * The tablist row. `inline-flex items-center` with NO `gap` — the tabs sit
93
+ * adjacent and each carries its own horizontal padding (Figma shows no
94
+ * full-width bottom-border track; the indicator is per-tab).
95
+ */
96
+ declare const tabsListVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
97
+ /**
98
+ * One trigger (`role="tab"`). Base holds the layout, type, the transparent
99
+ * baseline underline (`border-b-2`, colored per state so all tabs keep the same
100
+ * height with no layout shift), and the focus ring. Per repo TW4 precedent the
101
+ * ring needs `outline-solid`. Corners are square (no radius) — the tab and its
102
+ * focus ring have sharp corners. The ring is offset outward so it frames the
103
+ * tab clear of the underline.
104
+ */
105
+ declare const tabsTriggerVariants: (props?: ({
106
+ selected?: boolean | null | undefined;
107
+ disabled?: boolean | null | undefined;
108
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
109
+ /**
110
+ * The tabpanel (`role="tabpanel"`). Content is arbitrary (no forced type
111
+ * style); the panel is a focus stop (`tabIndex=0`) so it shows the same
112
+ * `:focus-visible` ring as the triggers.
113
+ */
114
+ declare const tabsContentVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
115
+
116
+ export { Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsRoot, type TabsRootProps, TabsTrigger, type TabsTriggerProps, tabsContentVariants, tabsListVariants, tabsRootVariants, tabsTriggerVariants };
package/dist/tabs.d.ts ADDED
@@ -0,0 +1,116 @@
1
+ import * as React from 'react';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+
4
+ interface TabsRootProps extends Omit<React.ComponentProps<"div">, "defaultValue"> {
5
+ /** Controlled selected value. Pair with `onValueChange`. */
6
+ value?: string;
7
+ /**
8
+ * Uncontrolled initial value. Ignored when `value` is provided. If both are
9
+ * omitted, no tab is selected initially (all panels hidden).
10
+ */
11
+ defaultValue?: string;
12
+ /** Called with the next value whenever selection changes. */
13
+ onValueChange?: (value: string) => void;
14
+ }
15
+ /**
16
+ * State owner + context provider for the compound `Tabs`. Renders a plain
17
+ * `<div>` (no landmark role). Owns the single-`string` selection model
18
+ * (controlled via `value`/`onValueChange`, or uncontrolled via `defaultValue`),
19
+ * the roving tab-stop computation, and the arrow-key handler with automatic
20
+ * activation. Forwards `ref` to the container.
21
+ */
22
+ declare function TabsRoot({ value: valueProp, defaultValue, onValueChange, className, children, ref, ...props }: TabsRootProps): React.JSX.Element;
23
+ interface TabsListProps extends React.ComponentProps<"div"> {
24
+ }
25
+ /**
26
+ * The horizontal row of triggers — `role="tablist"`. Provide an accessible name
27
+ * via `aria-label` or `aria-labelledby` when there is no visible label.
28
+ * Forwards `ref` to the tablist.
29
+ */
30
+ declare function TabsList({ className, children, ref, ...props }: TabsListProps): React.JSX.Element;
31
+ interface TabsTriggerProps extends React.ComponentProps<"button"> {
32
+ /** **Required.** Ties the tab to its panel (and to the selection model). */
33
+ value: string;
34
+ }
35
+ /**
36
+ * One tab — `role="tab"`, a native `<button type="button">`. `children` is the
37
+ * label (and any leading icon, which inherits the per-state text color via
38
+ * `currentColor`). Wires `aria-selected`, roving `tabIndex`, and — only while
39
+ * its panel is mounted — `aria-controls`. Composes the consumer's
40
+ * `onClick`/`onKeyDown` (theirs runs first; the built-in behaviour is skipped
41
+ * if they call `preventDefault`). Forwards `ref` to the button.
42
+ */
43
+ declare function TabsTrigger({ value, disabled, className, children, onClick, onKeyDown, ref, ...props }: TabsTriggerProps): React.JSX.Element;
44
+ interface TabsContentProps extends React.ComponentProps<"div"> {
45
+ /** **Required.** Matches the `value` of the trigger this panel belongs to. */
46
+ value: string;
47
+ }
48
+ /**
49
+ * A tab panel — `role="tabpanel"`, labelled by its trigger. Rendered **only
50
+ * when its tab is selected**; inactive panels are unmounted, so their content
51
+ * leaves the a11y tree and tab order (matching `Accordion.Content`). It is a
52
+ * focus stop (`tabIndex=0`) so keyboard users can reach its content. Forwards
53
+ * `ref` to the panel.
54
+ */
55
+ declare function TabsContent({ value, className, children, ref, ...props }: TabsContentProps): React.JSX.Element | null;
56
+ /**
57
+ * Compound underline-indicator `Tabs` (WAI-ARIA Tabs pattern, single selection,
58
+ * horizontal, automatic activation). Assemble from its namespaced parts:
59
+ *
60
+ * ```tsx
61
+ * <Tabs.Root defaultValue="overview">
62
+ * <Tabs.List aria-label="Account sections">
63
+ * <Tabs.Trigger value="overview">Overview</Tabs.Trigger>
64
+ * <Tabs.Trigger value="activity">Activity</Tabs.Trigger>
65
+ * </Tabs.List>
66
+ * <Tabs.Content value="overview">…</Tabs.Content>
67
+ * <Tabs.Content value="activity">…</Tabs.Content>
68
+ * </Tabs.Root>
69
+ * ```
70
+ */
71
+ declare const Tabs: {
72
+ Root: typeof TabsRoot;
73
+ List: typeof TabsList;
74
+ Trigger: typeof TabsTrigger;
75
+ Content: typeof TabsContent;
76
+ };
77
+
78
+ /**
79
+ * Tabs styling — the Figma `tab` component (node `906-78043`), an
80
+ * underline-indicator tab. Binds ONLY to the semantic token layer (never
81
+ * primitives, never mode plumbing); theme switching is automatic via `.dark`,
82
+ * so no `dark:` variants are needed.
83
+ *
84
+ * Only the trigger carries visual state (text color + underline). The state ×
85
+ * selected matrix from the spec is expressed as two `cva` axes (`selected`,
86
+ * `disabled`) plus compound variants for the hover/active interactions and the
87
+ * disabled-selected underline.
88
+ */
89
+ /** Root container — a plain vertical stack (tablist above, panel below). */
90
+ declare const tabsRootVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
91
+ /**
92
+ * The tablist row. `inline-flex items-center` with NO `gap` — the tabs sit
93
+ * adjacent and each carries its own horizontal padding (Figma shows no
94
+ * full-width bottom-border track; the indicator is per-tab).
95
+ */
96
+ declare const tabsListVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
97
+ /**
98
+ * One trigger (`role="tab"`). Base holds the layout, type, the transparent
99
+ * baseline underline (`border-b-2`, colored per state so all tabs keep the same
100
+ * height with no layout shift), and the focus ring. Per repo TW4 precedent the
101
+ * ring needs `outline-solid`. Corners are square (no radius) — the tab and its
102
+ * focus ring have sharp corners. The ring is offset outward so it frames the
103
+ * tab clear of the underline.
104
+ */
105
+ declare const tabsTriggerVariants: (props?: ({
106
+ selected?: boolean | null | undefined;
107
+ disabled?: boolean | null | undefined;
108
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
109
+ /**
110
+ * The tabpanel (`role="tabpanel"`). Content is arbitrary (no forced type
111
+ * style); the panel is a focus stop (`tabIndex=0`) so it shows the same
112
+ * `:focus-visible` ring as the triggers.
113
+ */
114
+ declare const tabsContentVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
115
+
116
+ export { Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsRoot, type TabsRootProps, TabsTrigger, type TabsTriggerProps, tabsContentVariants, tabsListVariants, tabsRootVariants, tabsTriggerVariants };
package/dist/tabs.js ADDED
@@ -0,0 +1,2 @@
1
+ export { Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, tabsContentVariants, tabsListVariants, tabsRootVariants, tabsTriggerVariants } from './chunk-UVUSVFOH.js';
2
+ import './chunk-7EOSDFS3.js';
package/dist/toast.cjs ADDED
@@ -0,0 +1,87 @@
1
+ 'use strict';
2
+
3
+ var react = require('@phosphor-icons/react');
4
+ var clsx = require('clsx');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var classVarianceAuthority = require('class-variance-authority');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ // src/toast/Toast.tsx
10
+ function cn(...inputs) {
11
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
12
+ }
13
+ var toastVariants = classVarianceAuthority.cva(
14
+ "flex items-center gap-4 rounded-sm bg-card-reversed-background px-5 py-4"
15
+ );
16
+ var toastIconVariants = classVarianceAuthority.cva(
17
+ "flex shrink-0 items-center [&_svg]:size-5 [&_svg]:shrink-0",
18
+ {
19
+ variants: {
20
+ variation: {
21
+ success: "text-success-primary-foreground",
22
+ error: "text-destructive-primary-foreground"
23
+ }
24
+ },
25
+ defaultVariants: { variation: "success" }
26
+ }
27
+ );
28
+ var toastCloseVariants = classVarianceAuthority.cva([
29
+ "flex shrink-0 cursor-pointer items-center rounded-xs text-card-reversed-foreground-muted",
30
+ "transition-colors hover:text-card-reversed-foreground",
31
+ "[&_svg]:size-5 [&_svg]:shrink-0",
32
+ "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-solid focus-visible:outline-focus"
33
+ ]);
34
+ var STATUS_ICON = {
35
+ success: react.CheckCircleIcon,
36
+ error: react.XCircleIcon
37
+ };
38
+ function Toast({
39
+ variation = "success",
40
+ children,
41
+ onClose,
42
+ className,
43
+ ref,
44
+ ...props
45
+ }) {
46
+ const StatusIcon = STATUS_ICON[variation];
47
+ return /* @__PURE__ */ jsxRuntime.jsxs(
48
+ "div",
49
+ {
50
+ "data-slot": "toast",
51
+ role: variation === "error" ? "alert" : "status",
52
+ className: cn(toastVariants(), className),
53
+ ref,
54
+ ...props,
55
+ children: [
56
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
57
+ /* @__PURE__ */ jsxRuntime.jsx(
58
+ "span",
59
+ {
60
+ "data-slot": "toast-icon",
61
+ "aria-hidden": "true",
62
+ className: toastIconVariants({ variation }),
63
+ children: /* @__PURE__ */ jsxRuntime.jsx(StatusIcon, { weight: "fill" })
64
+ }
65
+ ),
66
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "body-03 min-w-0 flex-1 text-card-reversed-foreground", children })
67
+ ] }),
68
+ onClose && /* @__PURE__ */ jsxRuntime.jsx(
69
+ "button",
70
+ {
71
+ type: "button",
72
+ "data-slot": "toast-close",
73
+ "aria-label": "Dismiss",
74
+ className: toastCloseVariants(),
75
+ onClick: onClose,
76
+ children: /* @__PURE__ */ jsxRuntime.jsx(react.XIcon, { weight: "regular" })
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ );
82
+ }
83
+
84
+ exports.Toast = Toast;
85
+ exports.toastCloseVariants = toastCloseVariants;
86
+ exports.toastIconVariants = toastIconVariants;
87
+ exports.toastVariants = toastVariants;
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
+
4
+ interface ToastProps extends Omit<React.ComponentProps<"div">, "children"> {
5
+ /**
6
+ * Status. `success` → a polite `role="status"` region; `error` → an
7
+ * assertive `role="alert"` region. Also selects the leading icon + its color.
8
+ */
9
+ variation?: "success" | "error";
10
+ /** The message body (`body-03`). */
11
+ children: React.ReactNode;
12
+ /**
13
+ * Dismiss handler. When provided, the trailing close button is rendered and
14
+ * wired to it; omit it for a toast with no close affordance.
15
+ */
16
+ onClose?: () => void;
17
+ /** Ref forwarded to the root element. */
18
+ ref?: React.Ref<HTMLDivElement>;
19
+ }
20
+ /**
21
+ * Toast — the Figma `Toast` (node `5020:2203`). A presentational dark
22
+ * notification chip: a leading status icon, a message, and an optional close
23
+ * button. It is a live region (`role="status"` for success, `role="alert"` for
24
+ * error) so it announces when mounted; positioning, stacking, and auto-dismiss
25
+ * are the consumer's concern (there is no toast manager here).
26
+ */
27
+ declare function Toast({ variation, children, onClose, className, ref, ...props }: ToastProps): React.JSX.Element;
28
+
29
+ /**
30
+ * Toast styling — the Figma `Toast` (node `5020:2203`). Binds ONLY to the
31
+ * semantic token layer (never primitives); theme switching is automatic via
32
+ * `.dark`, so no `dark:` variants. The surface is the fixed dark "reversed"
33
+ * card, so the root is not variation-dependent — only the leading status
34
+ * icon's color changes with `variation`.
35
+ */
36
+ /** Root row — dark reversed surface; identical for both variations. */
37
+ declare const toastVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
38
+ /** Leading 20px status icon slot; color per variation. */
39
+ declare const toastIconVariants: (props?: ({
40
+ variation?: "error" | "success" | null | undefined;
41
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
42
+ /**
43
+ * Trailing close button — muted, brightens on hover; shared ADR-0010 focus
44
+ * ring (`rounded-xs` so the ring follows the small hit area).
45
+ */
46
+ declare const toastCloseVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
47
+
48
+ export { Toast, type ToastProps, toastCloseVariants, toastIconVariants, toastVariants };