@hex-core/components 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +451 -0
- package/dist/attachment.d.ts +4 -0
- package/dist/attachment.js +157 -0
- package/dist/attachment.js.map +1 -0
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/dropzone.js +46 -44
- package/dist/dropzone.js.map +1 -1
- package/dist/empty.d.ts +3 -0
- package/dist/empty.js +94 -0
- package/dist/empty.js.map +1 -0
- package/dist/error-state.d.ts +3 -0
- package/dist/error-state.js +67 -0
- package/dist/error-state.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +843 -46
- package/dist/index.js.map +1 -1
- package/dist/loading.d.ts +3 -0
- package/dist/loading.js +80 -0
- package/dist/loading.js.map +1 -0
- package/dist/schemas.d.ts +7 -0
- package/dist/schemas.js +802 -2
- package/dist/schemas.js.map +1 -1
- package/dist/tag.d.ts +3 -0
- package/dist/tag.js +107 -0
- package/dist/tag.js.map +1 -0
- package/dist/toolbar.d.ts +8 -0
- package/dist/toolbar.js +120 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tree.d.ts +3 -0
- package/dist/tree.js +275 -0
- package/dist/tree.js.map +1 -0
- package/package.json +2 -1
|
@@ -51,6 +51,7 @@ import { toast } from 'sonner';
|
|
|
51
51
|
import { Toaster as Toaster_2 } from 'sonner';
|
|
52
52
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
53
53
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
54
|
+
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
|
|
54
55
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
55
56
|
import { VariantProps } from 'class-variance-authority';
|
|
56
57
|
|
|
@@ -179,6 +180,76 @@ declare const aspectRatioSchema: ComponentSchemaDefinition;
|
|
|
179
180
|
export { aspectRatioSchema }
|
|
180
181
|
export { aspectRatioSchema as aspectRatioSchema_alias_1 }
|
|
181
182
|
|
|
183
|
+
/**
|
|
184
|
+
* A file / image attachment thumbnail with an optional remove affordance
|
|
185
|
+
* and optional upload-progress overlay. Composes with the existing
|
|
186
|
+
* `Composer` AI primitive (drop into Composer's children slot to render
|
|
187
|
+
* as part of the message draft).
|
|
188
|
+
*
|
|
189
|
+
* Auto-detects the visual variant: image MIME + `preview` URL → image
|
|
190
|
+
* thumbnail; everything else → typed file icon with name + size.
|
|
191
|
+
*
|
|
192
|
+
* Distinct from {@link Dropzone} (the upload-input affordance) and
|
|
193
|
+
* static {@link Card} previews (no remove/progress UI).
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```tsx
|
|
197
|
+
* <Attachment
|
|
198
|
+
* file={{ name: "screenshot.png", size: 124000, type: "image/png", preview: objectUrl }}
|
|
199
|
+
* onRemove={() => removeFromDraft("screenshot.png")}
|
|
200
|
+
* />
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
declare function Attachment({ className, variant, file, onRemove, progress, ref, ...props }: AttachmentProps): JSX.Element;
|
|
204
|
+
export { Attachment }
|
|
205
|
+
export { Attachment as Attachment_alias_1 }
|
|
206
|
+
|
|
207
|
+
/** A file-shaped attachment metadata object accepted by `<Attachment>`. */
|
|
208
|
+
declare interface AttachmentFile {
|
|
209
|
+
/** Display name. */
|
|
210
|
+
name: string;
|
|
211
|
+
/** Bytes. Used to render a human-readable size. */
|
|
212
|
+
size: number;
|
|
213
|
+
/** MIME type. Drives the auto-detected `variant`. */
|
|
214
|
+
type: string;
|
|
215
|
+
/**
|
|
216
|
+
* Optional preview URL for images. When `type` starts with `image/`
|
|
217
|
+
* AND `preview` is set, the attachment renders a thumbnail; otherwise
|
|
218
|
+
* it falls back to a typed file icon + name + size.
|
|
219
|
+
*/
|
|
220
|
+
preview?: string;
|
|
221
|
+
}
|
|
222
|
+
export { AttachmentFile }
|
|
223
|
+
export { AttachmentFile as AttachmentFile_alias_1 }
|
|
224
|
+
|
|
225
|
+
declare interface AttachmentProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "onProgress">, VariantProps<typeof attachmentVariants> {
|
|
226
|
+
/** Forwarded ref onto the root element. */
|
|
227
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
228
|
+
/** Native `File` OR a metadata object. */
|
|
229
|
+
file: File | AttachmentFile;
|
|
230
|
+
/** Click handler for the remove button. When provided, a × button overlays the attachment. */
|
|
231
|
+
onRemove?: () => void;
|
|
232
|
+
/**
|
|
233
|
+
* Upload progress in `[0, 1)`. Values `>= 1` (or `undefined`) hide the
|
|
234
|
+
* progressbar — pass `undefined` once the upload completes. Internally
|
|
235
|
+
* scaled to `aria-valuenow` on a 0–100 progressbar so AT engines
|
|
236
|
+
* announce "42 percent" rather than "0.42 of 1."
|
|
237
|
+
*/
|
|
238
|
+
progress?: number;
|
|
239
|
+
}
|
|
240
|
+
export { AttachmentProps }
|
|
241
|
+
export { AttachmentProps as AttachmentProps_alias_1 }
|
|
242
|
+
|
|
243
|
+
declare const attachmentSchema: ComponentSchemaDefinition;
|
|
244
|
+
export { attachmentSchema }
|
|
245
|
+
export { attachmentSchema as attachmentSchema_alias_1 }
|
|
246
|
+
|
|
247
|
+
declare const attachmentVariants: (props?: ({
|
|
248
|
+
variant?: "file" | "image" | null | undefined;
|
|
249
|
+
} & ClassProp) | undefined) => string;
|
|
250
|
+
export { attachmentVariants }
|
|
251
|
+
export { attachmentVariants as attachmentVariants_alias_1 }
|
|
252
|
+
|
|
182
253
|
/** Root container for an avatar (image + fallback). */
|
|
183
254
|
declare const Avatar: React_2.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React_2.RefAttributes<HTMLSpanElement>, "ref"> & React_2.RefAttributes<HTMLSpanElement>>;
|
|
184
255
|
export { Avatar }
|
|
@@ -1340,6 +1411,120 @@ declare const dropzoneSchema: ComponentSchemaDefinition;
|
|
|
1340
1411
|
export { dropzoneSchema }
|
|
1341
1412
|
export { dropzoneSchema as dropzoneSchema_alias_1 }
|
|
1342
1413
|
|
|
1414
|
+
/**
|
|
1415
|
+
* A "zero-state" surface for lists, dashboards, and search results that have
|
|
1416
|
+
* no content to show. Use to explain *why* the slot is empty and *what to do*
|
|
1417
|
+
* next; pair the `action` slot with a button that creates the missing record.
|
|
1418
|
+
*
|
|
1419
|
+
* Distinct from {@link Loading} (transient, has a measurable wait) and
|
|
1420
|
+
* {@link ErrorState} (something failed and may need a retry). If you're
|
|
1421
|
+
* thinking "show a message because the request just hasn't returned yet,"
|
|
1422
|
+
* reach for `Loading` — Empty is for "the request returned, and there's
|
|
1423
|
+
* nothing to show."
|
|
1424
|
+
*
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```tsx
|
|
1427
|
+
* <Empty
|
|
1428
|
+
* icon={<InboxIcon />}
|
|
1429
|
+
* title="No messages yet"
|
|
1430
|
+
* description="When someone sends you a message, it'll show up here."
|
|
1431
|
+
* action={<Button>Compose</Button>}
|
|
1432
|
+
* />
|
|
1433
|
+
* ```
|
|
1434
|
+
*
|
|
1435
|
+
* @returns A region landmark labeled by the title.
|
|
1436
|
+
*/
|
|
1437
|
+
declare function Empty({ className, size, icon, title, description, action, titleAs, ref, ...props }: EmptyProps): JSX.Element;
|
|
1438
|
+
export { Empty }
|
|
1439
|
+
export { Empty as Empty_alias_1 }
|
|
1440
|
+
|
|
1441
|
+
declare interface EmptyProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof emptyVariants> {
|
|
1442
|
+
/** Forwarded ref onto the root region element. */
|
|
1443
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
1444
|
+
/** Optional icon (typically an `<svg>`) rendered in a circular muted container. */
|
|
1445
|
+
icon?: React_2.ReactNode;
|
|
1446
|
+
/** Required heading copy. Becomes the region's accessible name via `aria-labelledby`. */
|
|
1447
|
+
title: React_2.ReactNode;
|
|
1448
|
+
/** Optional supporting copy that explains why the slot is empty + what to do next. */
|
|
1449
|
+
description?: React_2.ReactNode;
|
|
1450
|
+
/** Optional call-to-action — typically a `<Button>` that creates the missing record. */
|
|
1451
|
+
action?: React_2.ReactNode;
|
|
1452
|
+
/** Heading level for the title — pick to match surrounding hierarchy (default `h3`). */
|
|
1453
|
+
titleAs?: EmptyTitleAs;
|
|
1454
|
+
}
|
|
1455
|
+
export { EmptyProps }
|
|
1456
|
+
export { EmptyProps as EmptyProps_alias_1 }
|
|
1457
|
+
|
|
1458
|
+
declare const emptySchema: ComponentSchemaDefinition;
|
|
1459
|
+
export { emptySchema }
|
|
1460
|
+
export { emptySchema as emptySchema_alias_1 }
|
|
1461
|
+
|
|
1462
|
+
/** Heading element used to render the Empty title. Defaults to `h3`. */
|
|
1463
|
+
declare type EmptyTitleAs = "h2" | "h3" | "h4" | "h5" | "h6" | "p";
|
|
1464
|
+
|
|
1465
|
+
declare const emptyVariants: (props?: ({
|
|
1466
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
1467
|
+
} & ClassProp) | undefined) => string;
|
|
1468
|
+
export { emptyVariants }
|
|
1469
|
+
export { emptyVariants as emptyVariants_alias_1 }
|
|
1470
|
+
|
|
1471
|
+
/**
|
|
1472
|
+
* A surface for rendering a failed-fetch / failed-action state. Visually
|
|
1473
|
+
* similar to {@link Empty} but ships with a destructive-tone bias and
|
|
1474
|
+
* mounts with `role="alert"` so screen readers announce the failure on
|
|
1475
|
+
* first render.
|
|
1476
|
+
*
|
|
1477
|
+
* Distinct from {@link Empty} (request returned, no items) and
|
|
1478
|
+
* {@link Loading} (request still in flight). For inline form-field
|
|
1479
|
+
* errors, use Form's `<FormMessage>` instead. For blocking destructive
|
|
1480
|
+
* confirmations, use AlertDialog.
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```tsx
|
|
1484
|
+
* <ErrorState
|
|
1485
|
+
* icon={<AlertCircleIcon />}
|
|
1486
|
+
* title="Couldn't load messages"
|
|
1487
|
+
* message="The server didn't respond. Check your connection and try again."
|
|
1488
|
+
* action={<Button onClick={refetch}>Retry</Button>}
|
|
1489
|
+
* />
|
|
1490
|
+
* ```
|
|
1491
|
+
*
|
|
1492
|
+
* @returns A `role="alert"` region with an optional action slot.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function ErrorState({ className, variant, icon, title, message, action, ref, ...props }: ErrorStateProps): JSX.Element;
|
|
1495
|
+
export { ErrorState }
|
|
1496
|
+
export { ErrorState as ErrorState_alias_1 }
|
|
1497
|
+
|
|
1498
|
+
declare interface ErrorStateProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof errorStateVariants> {
|
|
1499
|
+
/** Forwarded ref onto the alert region. */
|
|
1500
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
1501
|
+
/** Optional icon (typically an alert / x-circle SVG). */
|
|
1502
|
+
icon?: React_2.ReactNode;
|
|
1503
|
+
/** Optional heading copy. Falls back to a generic "Something went wrong" if omitted. */
|
|
1504
|
+
title?: React_2.ReactNode;
|
|
1505
|
+
/** Required body copy explaining what failed. */
|
|
1506
|
+
message: React_2.ReactNode;
|
|
1507
|
+
/**
|
|
1508
|
+
* Optional call-to-action — typically a `<Button>` with `onClick={refetch}`.
|
|
1509
|
+
* Slot pattern (matching `Empty.action`) so consumers control the button's
|
|
1510
|
+
* variant / loading state / asChild composition without ErrorState
|
|
1511
|
+
* re-implementing those concerns.
|
|
1512
|
+
*/
|
|
1513
|
+
action?: React_2.ReactNode;
|
|
1514
|
+
}
|
|
1515
|
+
export { ErrorStateProps }
|
|
1516
|
+
export { ErrorStateProps as ErrorStateProps_alias_1 }
|
|
1517
|
+
|
|
1518
|
+
declare const errorStateSchema: ComponentSchemaDefinition;
|
|
1519
|
+
export { errorStateSchema }
|
|
1520
|
+
export { errorStateSchema as errorStateSchema_alias_1 }
|
|
1521
|
+
|
|
1522
|
+
declare const errorStateVariants: (props?: ({
|
|
1523
|
+
variant?: "default" | "destructive" | null | undefined;
|
|
1524
|
+
} & ClassProp) | undefined) => string;
|
|
1525
|
+
export { errorStateVariants }
|
|
1526
|
+
export { errorStateVariants as errorStateVariants_alias_1 }
|
|
1527
|
+
|
|
1343
1528
|
/**
|
|
1344
1529
|
* Hierarchical tree view for files, folders, settings sections, or any nested
|
|
1345
1530
|
* navigation. Built on the WAI-ARIA tree pattern: `role="tree"` root,
|
|
@@ -1665,6 +1850,30 @@ export { labelSchema as labelSchema_alias_1 }
|
|
|
1665
1850
|
|
|
1666
1851
|
declare const labelVariants: (props?: ClassProp | undefined) => string;
|
|
1667
1852
|
|
|
1853
|
+
/**
|
|
1854
|
+
* A composed loading-placeholder pattern for lists, cards, and stacks.
|
|
1855
|
+
* Renders N {@link Skeleton} rows pre-arranged for the chosen layout —
|
|
1856
|
+
* Skeleton is the atom (one shaped pulse), Loading is the molecule
|
|
1857
|
+
* (the canonical pattern most surfaces want).
|
|
1858
|
+
*
|
|
1859
|
+
* Distinct from {@link Empty} (request returned, no items) and
|
|
1860
|
+
* {@link ErrorState} (request failed). If you need a single shaped
|
|
1861
|
+
* pulse for a specific element (an avatar circle, a heading line),
|
|
1862
|
+
* reach for `Skeleton` directly. If the wait has a measurable
|
|
1863
|
+
* percent-done, reach for `Progress` instead.
|
|
1864
|
+
*
|
|
1865
|
+
* @example
|
|
1866
|
+
* ```tsx
|
|
1867
|
+
* <Loading rows={5} variant="list" />
|
|
1868
|
+
* ```
|
|
1869
|
+
*
|
|
1870
|
+
* @returns A `role="status"` region with `aria-live="polite"` and the
|
|
1871
|
+
* announced label (default "Loading…") rendered sr-only.
|
|
1872
|
+
*/
|
|
1873
|
+
declare function Loading({ className, variant, rows, label, ref, ...props }: LoadingProps): JSX.Element;
|
|
1874
|
+
export { Loading }
|
|
1875
|
+
export { Loading as Loading_alias_1 }
|
|
1876
|
+
|
|
1668
1877
|
/**
|
|
1669
1878
|
* Renders an animated loading indicator with optional label.
|
|
1670
1879
|
* @param props - variant + label
|
|
@@ -1701,6 +1910,32 @@ declare const loadingIndicatorVariants: (props?: ({
|
|
|
1701
1910
|
export { loadingIndicatorVariants }
|
|
1702
1911
|
export { loadingIndicatorVariants as loadingIndicatorVariants_alias_1 }
|
|
1703
1912
|
|
|
1913
|
+
declare interface LoadingProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "role">, VariantProps<typeof loadingVariants> {
|
|
1914
|
+
/** Forwarded ref onto the status region. */
|
|
1915
|
+
ref?: React_2.Ref<HTMLDivElement>;
|
|
1916
|
+
/**
|
|
1917
|
+
* Number of placeholder rows to render. Each row may contain multiple
|
|
1918
|
+
* Skeleton elements depending on `variant` — `list` emits 1 Skeleton
|
|
1919
|
+
* per row; `card` emits 3 (heading + 2 body lines); `stack` emits 3
|
|
1920
|
+
* (avatar + 2 text lines). Default 3.
|
|
1921
|
+
*/
|
|
1922
|
+
rows?: number;
|
|
1923
|
+
/** Optional sr-only label that screen readers announce. Default "Loading…". */
|
|
1924
|
+
label?: string;
|
|
1925
|
+
}
|
|
1926
|
+
export { LoadingProps }
|
|
1927
|
+
export { LoadingProps as LoadingProps_alias_1 }
|
|
1928
|
+
|
|
1929
|
+
declare const loadingSchema: ComponentSchemaDefinition;
|
|
1930
|
+
export { loadingSchema }
|
|
1931
|
+
export { loadingSchema as loadingSchema_alias_1 }
|
|
1932
|
+
|
|
1933
|
+
declare const loadingVariants: (props?: ({
|
|
1934
|
+
variant?: "list" | "card" | "stack" | null | undefined;
|
|
1935
|
+
} & ClassProp) | undefined) => string;
|
|
1936
|
+
export { loadingVariants }
|
|
1937
|
+
export { loadingVariants as loadingVariants_alias_1 }
|
|
1938
|
+
|
|
1704
1939
|
/**
|
|
1705
1940
|
* Renders streaming-safe markdown.
|
|
1706
1941
|
* @param props - children string + optional Streamdown overrides
|
|
@@ -2832,6 +3067,58 @@ declare const TabsTrigger: React_2.ForwardRefExoticComponent<Omit<TabsPrimitive.
|
|
|
2832
3067
|
export { TabsTrigger }
|
|
2833
3068
|
export { TabsTrigger as TabsTrigger_alias_1 }
|
|
2834
3069
|
|
|
3070
|
+
/**
|
|
3071
|
+
* An interactive tag / chip primitive — Badge with an optional dismiss
|
|
3072
|
+
* affordance. Mirrors {@link Badge}'s CVA variants so the visual sibling
|
|
3073
|
+
* is obvious; adds a built-in close button when `onRemove` is provided.
|
|
3074
|
+
*
|
|
3075
|
+
* For non-interactive labels (status indicators, counts) use {@link Badge}
|
|
3076
|
+
* directly. For "click to filter" state-bearing chips, use Toggle or
|
|
3077
|
+
* ToggleGroup — Tag is for "this token represents a value the user can
|
|
3078
|
+
* dismiss" (filters, multi-select selections, draft attachments).
|
|
3079
|
+
*
|
|
3080
|
+
* @example
|
|
3081
|
+
* ```tsx
|
|
3082
|
+
* <Tag variant="secondary" onRemove={() => removeFilter("urgent")}>
|
|
3083
|
+
* Urgent
|
|
3084
|
+
* </Tag>
|
|
3085
|
+
* ```
|
|
3086
|
+
*
|
|
3087
|
+
* @returns A span containing the label + optional icon + optional close button.
|
|
3088
|
+
*/
|
|
3089
|
+
declare function Tag({ className, variant, icon, onRemove, removeLabel, children, ref, ...props }: TagProps): JSX.Element;
|
|
3090
|
+
export { Tag }
|
|
3091
|
+
export { Tag as Tag_alias_1 }
|
|
3092
|
+
|
|
3093
|
+
declare interface TagProps extends Omit<React_2.HTMLAttributes<HTMLSpanElement>, "onRemove">, VariantProps<typeof tagVariants> {
|
|
3094
|
+
/** Forwarded ref onto the root span element. */
|
|
3095
|
+
ref?: React_2.Ref<HTMLSpanElement>;
|
|
3096
|
+
/** Optional leading icon (`<svg>` or component). Sized 12×12. */
|
|
3097
|
+
icon?: React_2.ReactNode;
|
|
3098
|
+
/**
|
|
3099
|
+
* Click handler for the close button. When provided, an inline ✕ button
|
|
3100
|
+
* is rendered after the children with an `aria-label` derived from the
|
|
3101
|
+
* children's string content (or a generic "Remove" if no string can be
|
|
3102
|
+
* extracted). Pass undefined for a non-interactive Tag — at that point,
|
|
3103
|
+
* prefer Badge directly.
|
|
3104
|
+
*/
|
|
3105
|
+
onRemove?: () => void;
|
|
3106
|
+
/** Override the auto-derived `aria-label` on the close button. */
|
|
3107
|
+
removeLabel?: string;
|
|
3108
|
+
}
|
|
3109
|
+
export { TagProps }
|
|
3110
|
+
export { TagProps as TagProps_alias_1 }
|
|
3111
|
+
|
|
3112
|
+
declare const tagSchema: ComponentSchemaDefinition;
|
|
3113
|
+
export { tagSchema }
|
|
3114
|
+
export { tagSchema as tagSchema_alias_1 }
|
|
3115
|
+
|
|
3116
|
+
declare const tagVariants: (props?: ({
|
|
3117
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
3118
|
+
} & ClassProp) | undefined) => string;
|
|
3119
|
+
export { tagVariants }
|
|
3120
|
+
export { tagVariants as tagVariants_alias_1 }
|
|
3121
|
+
|
|
2835
3122
|
declare const Textarea: React_2.ForwardRefExoticComponent<TextareaProps & React_2.RefAttributes<HTMLTextAreaElement>>;
|
|
2836
3123
|
export { Textarea }
|
|
2837
3124
|
export { Textarea as Textarea_alias_1 }
|
|
@@ -2999,6 +3286,91 @@ declare const toggleVariants: (props?: ({
|
|
|
2999
3286
|
export { toggleVariants }
|
|
3000
3287
|
export { toggleVariants as toggleVariants_alias_1 }
|
|
3001
3288
|
|
|
3289
|
+
/**
|
|
3290
|
+
* Root toolbar element. Wraps Radix `Toolbar.Root` with the canonical
|
|
3291
|
+
* Hex Core token + visual styling. Pass children consisting of
|
|
3292
|
+
* `ToolbarButton`, `ToolbarToggleGroup`, `ToolbarSeparator`, and
|
|
3293
|
+
* `ToolbarLink` — Radix handles arrow-key roving focus across them
|
|
3294
|
+
* automatically.
|
|
3295
|
+
*
|
|
3296
|
+
* @example
|
|
3297
|
+
* ```tsx
|
|
3298
|
+
* <Toolbar aria-label="Editor controls">
|
|
3299
|
+
* <ToolbarButton onClick={onUndo}>Undo</ToolbarButton>
|
|
3300
|
+
* <ToolbarButton onClick={onRedo}>Redo</ToolbarButton>
|
|
3301
|
+
* <ToolbarSeparator />
|
|
3302
|
+
* <ToolbarToggleGroup type="single" defaultValue="left">
|
|
3303
|
+
* <ToolbarToggleItem value="left">Left</ToolbarToggleItem>
|
|
3304
|
+
* <ToolbarToggleItem value="center">Center</ToolbarToggleItem>
|
|
3305
|
+
* <ToolbarToggleItem value="right">Right</ToolbarToggleItem>
|
|
3306
|
+
* </ToolbarToggleGroup>
|
|
3307
|
+
* </Toolbar>
|
|
3308
|
+
* ```
|
|
3309
|
+
*/
|
|
3310
|
+
declare function Toolbar({ className, orientation, ref, ...props }: ToolbarProps): JSX.Element;
|
|
3311
|
+
export { Toolbar }
|
|
3312
|
+
export { Toolbar as Toolbar_alias_1 }
|
|
3313
|
+
|
|
3314
|
+
/** A push button inside the toolbar. */
|
|
3315
|
+
declare function ToolbarButton({ className, ref, ...props }: React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.Button> & {
|
|
3316
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.Button>>;
|
|
3317
|
+
}): JSX.Element;
|
|
3318
|
+
export { ToolbarButton }
|
|
3319
|
+
export { ToolbarButton as ToolbarButton_alias_1 }
|
|
3320
|
+
|
|
3321
|
+
/** A link inside the toolbar — renders an `<a>` with toolbar focus semantics. */
|
|
3322
|
+
declare function ToolbarLink({ className, ref, ...props }: React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.Link> & {
|
|
3323
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.Link>>;
|
|
3324
|
+
}): JSX.Element;
|
|
3325
|
+
export { ToolbarLink }
|
|
3326
|
+
export { ToolbarLink as ToolbarLink_alias_1 }
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* Toolbar root props. `aria-label` is required — Radix Toolbar.Root
|
|
3330
|
+
* mounts as a `role="toolbar"` landmark, and AT users will hear an
|
|
3331
|
+
* unlabelled "toolbar" landmark when no visible heading sits adjacent.
|
|
3332
|
+
* If a visible heading IS present, pair it via `aria-labelledby` instead.
|
|
3333
|
+
*/
|
|
3334
|
+
declare interface ToolbarProps extends Omit<React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.Root>, "aria-label"> {
|
|
3335
|
+
/** Forwarded ref onto the Radix `Toolbar.Root`. */
|
|
3336
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.Root>>;
|
|
3337
|
+
/** Required accessible name for the toolbar landmark. */
|
|
3338
|
+
"aria-label": string;
|
|
3339
|
+
}
|
|
3340
|
+
export { ToolbarProps }
|
|
3341
|
+
export { ToolbarProps as ToolbarProps_alias_1 }
|
|
3342
|
+
|
|
3343
|
+
declare const toolbarSchema: ComponentSchemaDefinition;
|
|
3344
|
+
export { toolbarSchema }
|
|
3345
|
+
export { toolbarSchema as toolbarSchema_alias_1 }
|
|
3346
|
+
|
|
3347
|
+
/** A vertical (or horizontal, in vertical toolbars) divider. */
|
|
3348
|
+
declare function ToolbarSeparator({ className, ref, ...props }: React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.Separator> & {
|
|
3349
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.Separator>>;
|
|
3350
|
+
}): JSX.Element;
|
|
3351
|
+
export { ToolbarSeparator }
|
|
3352
|
+
export { ToolbarSeparator as ToolbarSeparator_alias_1 }
|
|
3353
|
+
|
|
3354
|
+
/** A group of mutually-exclusive (`type='single'`) or independent (`type='multiple'`) toggle items. */
|
|
3355
|
+
declare function ToolbarToggleGroup({ className, ref, ...props }: React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.ToggleGroup> & {
|
|
3356
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.ToggleGroup>>;
|
|
3357
|
+
}): JSX.Element;
|
|
3358
|
+
export { ToolbarToggleGroup }
|
|
3359
|
+
export { ToolbarToggleGroup as ToolbarToggleGroup_alias_1 }
|
|
3360
|
+
|
|
3361
|
+
/** Individual toggle item — exposes `data-state="on"` for the on style. */
|
|
3362
|
+
declare function ToolbarToggleItem({ className, ref, ...props }: React_2.ComponentPropsWithoutRef<typeof ToolbarPrimitive.ToggleItem> & {
|
|
3363
|
+
ref?: React_2.Ref<React_2.ElementRef<typeof ToolbarPrimitive.ToggleItem>>;
|
|
3364
|
+
}): JSX.Element;
|
|
3365
|
+
export { ToolbarToggleItem }
|
|
3366
|
+
export { ToolbarToggleItem as ToolbarToggleItem_alias_1 }
|
|
3367
|
+
|
|
3368
|
+
declare const toolbarVariants: (props?: ({
|
|
3369
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
3370
|
+
} & ClassProp) | undefined) => string;
|
|
3371
|
+
export { toolbarVariants }
|
|
3372
|
+
export { toolbarVariants as toolbarVariants_alias_1 }
|
|
3373
|
+
|
|
3002
3374
|
/**
|
|
3003
3375
|
* Renders a tool-invocation card with collapsible details.
|
|
3004
3376
|
* @param props - tool name, state, optional args/result
|
|
@@ -3074,6 +3446,85 @@ declare const TooltipTrigger: React_2.ForwardRefExoticComponent<TooltipPrimitive
|
|
|
3074
3446
|
export { TooltipTrigger }
|
|
3075
3447
|
export { TooltipTrigger as TooltipTrigger_alias_1 }
|
|
3076
3448
|
|
|
3449
|
+
/**
|
|
3450
|
+
* Generic hierarchical list with roving-tabindex keyboard navigation —
|
|
3451
|
+
* arrow keys move focus, → expands, ← collapses, Home / End jump to
|
|
3452
|
+
* first / last visible row, Enter / Space activates the focused node.
|
|
3453
|
+
*
|
|
3454
|
+
* Distinct from {@link FileTree} (which adds folder/file icon-by-extension
|
|
3455
|
+
* logic baked in) and {@link Accordion} (two-level groupings without
|
|
3456
|
+
* item-selection semantics).
|
|
3457
|
+
*
|
|
3458
|
+
* @example
|
|
3459
|
+
* ```tsx
|
|
3460
|
+
* <Tree
|
|
3461
|
+
* aria-label="Org chart"
|
|
3462
|
+
* data={[
|
|
3463
|
+
* { id: "ceo", label: "CEO", children: [
|
|
3464
|
+
* { id: "cto", label: "CTO", children: [
|
|
3465
|
+
* { id: "eng-lead", label: "Eng Lead" },
|
|
3466
|
+
* ]},
|
|
3467
|
+
* { id: "cmo", label: "CMO" },
|
|
3468
|
+
* ]},
|
|
3469
|
+
* ]}
|
|
3470
|
+
* defaultExpanded={["ceo"]}
|
|
3471
|
+
* onSelect={(id) => console.log(id)}
|
|
3472
|
+
* />
|
|
3473
|
+
* ```
|
|
3474
|
+
*/
|
|
3475
|
+
declare function Tree({ data, defaultExpanded, expanded: expandedProp, onExpandedChange, selected: selectedProp, onSelect, "aria-label": ariaLabel, className, ref, }: TreeProps): JSX.Element;
|
|
3476
|
+
export { Tree }
|
|
3477
|
+
export { Tree as Tree_alias_1 }
|
|
3478
|
+
|
|
3479
|
+
/**
|
|
3480
|
+
* One node in a Tree. Generic — the shape is content-agnostic so consumers
|
|
3481
|
+
* can render org charts, taxonomy pickers, navigation trees, etc.
|
|
3482
|
+
*
|
|
3483
|
+
* For filesystem-shaped data (with file-extension icon logic baked in),
|
|
3484
|
+
* prefer {@link FileTree} instead.
|
|
3485
|
+
*/
|
|
3486
|
+
declare interface TreeNode {
|
|
3487
|
+
/** Stable unique id used as React key + ARIA target. */
|
|
3488
|
+
id: string;
|
|
3489
|
+
/** Display name. */
|
|
3490
|
+
label: React_2.ReactNode;
|
|
3491
|
+
/** Nested children. Presence (even empty array) marks the node as a parent. */
|
|
3492
|
+
children?: TreeNode[];
|
|
3493
|
+
/** Optional icon (default: a chevron + dot). */
|
|
3494
|
+
icon?: React_2.ReactNode;
|
|
3495
|
+
/** Disable selection + expand toggle. */
|
|
3496
|
+
disabled?: boolean;
|
|
3497
|
+
}
|
|
3498
|
+
export { TreeNode }
|
|
3499
|
+
export { TreeNode as TreeNode_alias_1 }
|
|
3500
|
+
|
|
3501
|
+
declare interface TreeProps {
|
|
3502
|
+
/** Forwarded ref onto the root `<ul role="tree">`. */
|
|
3503
|
+
ref?: React_2.Ref<HTMLUListElement>;
|
|
3504
|
+
/** Root nodes. */
|
|
3505
|
+
data: TreeNode[];
|
|
3506
|
+
/** Uncontrolled initial expanded ids. */
|
|
3507
|
+
defaultExpanded?: string[];
|
|
3508
|
+
/** Controlled expanded ids. */
|
|
3509
|
+
expanded?: string[];
|
|
3510
|
+
/** Fired when expanded set changes (array of ids). */
|
|
3511
|
+
onExpandedChange?: (ids: string[]) => void;
|
|
3512
|
+
/** Controlled selected node id. */
|
|
3513
|
+
selected?: string;
|
|
3514
|
+
/** Fired when the user activates a node (click, Enter, or Space). */
|
|
3515
|
+
onSelect?: (id: string) => void;
|
|
3516
|
+
/** Required accessible name. */
|
|
3517
|
+
"aria-label": string;
|
|
3518
|
+
/** Optional additional class names. */
|
|
3519
|
+
className?: string;
|
|
3520
|
+
}
|
|
3521
|
+
export { TreeProps }
|
|
3522
|
+
export { TreeProps as TreeProps_alias_1 }
|
|
3523
|
+
|
|
3524
|
+
declare const treeSchema: ComponentSchemaDefinition;
|
|
3525
|
+
export { treeSchema }
|
|
3526
|
+
export { treeSchema as treeSchema_alias_1 }
|
|
3527
|
+
|
|
3077
3528
|
/**
|
|
3078
3529
|
* Hook that returns the current field's id, name, error, and derived aria ids.
|
|
3079
3530
|
* Must be called inside a FormField + FormItem subtree.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AttachmentFile_alias_1 as AttachmentFile } from './_tsup-dts-rollup.js';
|
|
2
|
+
export { AttachmentProps_alias_1 as AttachmentProps } from './_tsup-dts-rollup.js';
|
|
3
|
+
export { Attachment_alias_1 as Attachment } from './_tsup-dts-rollup.js';
|
|
4
|
+
export { attachmentVariants_alias_1 as attachmentVariants } from './_tsup-dts-rollup.js';
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function cn(...inputs) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
10
|
+
var attachmentVariants = cva(
|
|
11
|
+
[
|
|
12
|
+
"group/attachment relative inline-flex items-center gap-[var(--gap-sm,0.5rem)] rounded-md border border-border bg-card",
|
|
13
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out"
|
|
14
|
+
].join(" "),
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
variant: {
|
|
18
|
+
file: "px-[var(--space-3,0.75rem)] py-[var(--space-2,0.5rem)] max-w-xs",
|
|
19
|
+
image: "p-0 overflow-hidden"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: { variant: "file" }
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
function formatSize(bytes) {
|
|
26
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
27
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
28
|
+
if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
29
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
30
|
+
}
|
|
31
|
+
function detectVariant(file) {
|
|
32
|
+
const preview = "preview" in file ? file.preview : void 0;
|
|
33
|
+
const isImage = file.type.startsWith("image/");
|
|
34
|
+
return isImage && preview ? "image" : "file";
|
|
35
|
+
}
|
|
36
|
+
function resolvePreview(file) {
|
|
37
|
+
return "preview" in file ? file.preview : void 0;
|
|
38
|
+
}
|
|
39
|
+
function Attachment({
|
|
40
|
+
className,
|
|
41
|
+
variant,
|
|
42
|
+
file,
|
|
43
|
+
onRemove,
|
|
44
|
+
progress,
|
|
45
|
+
ref,
|
|
46
|
+
...props
|
|
47
|
+
}) {
|
|
48
|
+
const preview = resolvePreview(file);
|
|
49
|
+
const detected = detectVariant(file);
|
|
50
|
+
const resolvedVariant = variant === "image" && !preview ? "file" : variant ?? detected;
|
|
51
|
+
const showProgress = typeof progress === "number" && progress >= 0 && progress < 1;
|
|
52
|
+
const progressPercent = showProgress ? Math.round(progress * 100) : 0;
|
|
53
|
+
return /* @__PURE__ */ jsxs(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
ref,
|
|
57
|
+
className: cn(attachmentVariants({ variant: resolvedVariant }), className),
|
|
58
|
+
...props,
|
|
59
|
+
children: [
|
|
60
|
+
resolvedVariant === "image" && preview ? (
|
|
61
|
+
// Intentional plain <img> (not next/image) — Attachment is
|
|
62
|
+
// framework-agnostic. Consumers can swap in next/image at the
|
|
63
|
+
// callsite when they want optimization.
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
"img",
|
|
66
|
+
{
|
|
67
|
+
src: preview,
|
|
68
|
+
alt: file.name,
|
|
69
|
+
className: "block h-20 w-20 object-cover"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
|
+
/* @__PURE__ */ jsx(FileIcon, { className: "h-5 w-5 shrink-0 text-muted-foreground" }),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
75
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium text-foreground", children: file.name }),
|
|
76
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: formatSize(file.size) })
|
|
77
|
+
] })
|
|
78
|
+
] }),
|
|
79
|
+
showProgress ? /* @__PURE__ */ jsx(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
role: "progressbar",
|
|
83
|
+
"aria-valuemin": 0,
|
|
84
|
+
"aria-valuemax": 100,
|
|
85
|
+
"aria-valuenow": progressPercent,
|
|
86
|
+
"aria-label": `Uploading ${file.name}`,
|
|
87
|
+
className: "absolute inset-x-0 bottom-0 h-1 overflow-hidden rounded-b-md bg-muted",
|
|
88
|
+
children: /* @__PURE__ */ jsx(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: "h-full bg-primary transition-[width] duration-[var(--duration-normal,200ms)] ease-out",
|
|
92
|
+
style: { width: `${progressPercent}%` }
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
) : null,
|
|
97
|
+
onRemove ? /* @__PURE__ */ jsx(
|
|
98
|
+
"button",
|
|
99
|
+
{
|
|
100
|
+
type: "button",
|
|
101
|
+
onClick: onRemove,
|
|
102
|
+
"aria-label": `Remove ${file.name}`,
|
|
103
|
+
className: cn(
|
|
104
|
+
"absolute -right-2 -top-2 inline-flex h-5 w-5 items-center justify-center rounded-full",
|
|
105
|
+
"bg-card border border-border text-foreground shadow-sm",
|
|
106
|
+
"transition-all duration-[var(--duration-normal,200ms)] ease-out",
|
|
107
|
+
"hover:bg-accent hover:scale-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",
|
|
108
|
+
"active:scale-90"
|
|
109
|
+
),
|
|
110
|
+
children: /* @__PURE__ */ jsxs(
|
|
111
|
+
"svg",
|
|
112
|
+
{
|
|
113
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
114
|
+
viewBox: "0 0 24 24",
|
|
115
|
+
fill: "none",
|
|
116
|
+
stroke: "currentColor",
|
|
117
|
+
strokeWidth: "2.5",
|
|
118
|
+
strokeLinecap: "round",
|
|
119
|
+
strokeLinejoin: "round",
|
|
120
|
+
className: "size-3",
|
|
121
|
+
"aria-hidden": "true",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
124
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
) : null
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
function FileIcon(props) {
|
|
135
|
+
return /* @__PURE__ */ jsxs(
|
|
136
|
+
"svg",
|
|
137
|
+
{
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
viewBox: "0 0 24 24",
|
|
140
|
+
fill: "none",
|
|
141
|
+
stroke: "currentColor",
|
|
142
|
+
strokeWidth: "2",
|
|
143
|
+
strokeLinecap: "round",
|
|
144
|
+
strokeLinejoin: "round",
|
|
145
|
+
"aria-hidden": "true",
|
|
146
|
+
...props,
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
149
|
+
/* @__PURE__ */ jsx("polyline", { points: "14 2 14 8 20 8" })
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { Attachment, attachmentVariants };
|
|
156
|
+
//# sourceMappingURL=attachment.js.map
|
|
157
|
+
//# sourceMappingURL=attachment.js.map
|