@cytario/design 9.7.0 → 9.8.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/index.css +1 -1
- package/dist/index.d.ts +184 -24
- package/dist/index.js +1820 -1123
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ButtonProps as ButtonProps$1, LinkProps as LinkProps$1, ToggleButtonProps as ToggleButtonProps$1, TextFieldProps, TextField, ColorField, SelectProps as SelectProps$1,
|
|
2
|
-
export { Key, RouterConfig, RouterProvider, Tab as UnstyledTab, TabList as UnstyledTabList, TabPanel as UnstyledTabPanel, Tabs as UnstyledTabs } from 'react-aria-components';
|
|
1
|
+
import { ButtonProps as ButtonProps$1, LinkProps as LinkProps$1, ToggleButtonProps as ToggleButtonProps$1, TextFieldProps, TextField, ColorField, SelectProps as SelectProps$1, CheckboxProps as CheckboxProps$1, SwitchFieldProps, RadioProps as RadioProps$1, RadioGroupProps as RadioGroupProps$1, LabelProps as LabelProps$1, SliderProps as SliderProps$1, Selection, PressEvent, PopoverProps as PopoverProps$1, TabProps as TabProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1, TabsProps as TabsProps$1, ToggleButtonGroupProps, Key } from 'react-aria-components';
|
|
2
|
+
export { Key, ListBox, ListBoxItem, RouterConfig, RouterProvider, Tab as UnstyledTab, TabList as UnstyledTabList, TabPanel as UnstyledTabPanel, Tabs as UnstyledTabs } from 'react-aria-components';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { ComponentType, HTMLAttributes, ReactNode, Ref, InputHTMLAttributes } from 'react';
|
|
6
6
|
import { LucideIcon, LucideProps } from 'lucide-react';
|
|
7
|
+
import { ColumnDefBase, FilterFn, RowSelectionState, OnChangeFn, SortingState, ColumnFiltersState, VisibilityState, ColumnSizingState } from '@tanstack/react-table';
|
|
8
|
+
import { StoreApi } from 'zustand';
|
|
7
9
|
|
|
8
10
|
type LogoProps = {
|
|
9
11
|
/** Override the wordmark fill (defaults to theme-driven --logo-fill) */
|
|
@@ -252,31 +254,189 @@ interface SelectProps extends Omit<SelectProps$1<SelectItem>, "children"> {
|
|
|
252
254
|
}
|
|
253
255
|
declare function Select({ label, items, placeholder, description, errorMessage, size, isDisabled, isRequired, className, renderItem, ...props }: SelectProps): react_jsx_runtime.JSX.Element;
|
|
254
256
|
|
|
255
|
-
type
|
|
256
|
-
interface
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
257
|
+
type ColumnBehavior = Pick<ColumnDefBase<unknown>, "enableResizing">;
|
|
258
|
+
interface ColumnSorting {
|
|
259
|
+
enableSorting?: boolean;
|
|
260
|
+
sortingFn?: "alphanumeric" | "datetime" | "basic" | "boolean";
|
|
261
|
+
}
|
|
262
|
+
interface ColumnSizing {
|
|
263
|
+
size: number;
|
|
264
|
+
minSize?: number;
|
|
265
|
+
maxSize?: number;
|
|
266
|
+
}
|
|
267
|
+
interface ColumnDisplay {
|
|
268
|
+
align?: "left" | "right" | "center";
|
|
269
|
+
monospace?: boolean;
|
|
270
|
+
ellipsis?: "left" | "middle" | "right";
|
|
271
|
+
copyable?: boolean;
|
|
272
|
+
}
|
|
273
|
+
interface ColumnFiltering {
|
|
274
|
+
enableColumnFilter?: boolean;
|
|
275
|
+
filterType?: "text" | "select";
|
|
276
|
+
filterPlaceholder?: string;
|
|
277
|
+
filterOptions?: {
|
|
278
|
+
label: string;
|
|
279
|
+
value: string;
|
|
280
|
+
}[];
|
|
281
|
+
filterRender?: (option: {
|
|
282
|
+
label: string;
|
|
283
|
+
value: string;
|
|
284
|
+
}) => ReactNode;
|
|
285
|
+
filterFn?: FilterFn<unknown>;
|
|
286
|
+
}
|
|
287
|
+
interface ColumnVisibility {
|
|
288
|
+
defaultVisible?: boolean;
|
|
289
|
+
anchor?: boolean;
|
|
290
|
+
}
|
|
291
|
+
interface ColumnConfig extends ColumnBehavior, ColumnSorting, ColumnSizing, ColumnDisplay, ColumnFiltering, ColumnVisibility {
|
|
292
|
+
id: string;
|
|
293
|
+
header: string;
|
|
261
294
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Maps column IDs to render functions. Each function receives the full typed
|
|
297
|
+
* row object and returns a ReactNode. Columns without a renderer display
|
|
298
|
+
* their raw accessor value.
|
|
299
|
+
*/
|
|
300
|
+
type CellRenderers<TData> = Partial<Record<string, (row: TData) => ReactNode>>;
|
|
301
|
+
interface TableProps<TData extends object> {
|
|
302
|
+
columns: ColumnConfig[];
|
|
303
|
+
data: TData[];
|
|
304
|
+
cellRenderers?: CellRenderers<TData>;
|
|
305
|
+
tableId?: string;
|
|
306
|
+
ariaLabel?: string;
|
|
307
|
+
enableRowSelection?: boolean;
|
|
308
|
+
rowSelection?: RowSelectionState;
|
|
309
|
+
onRowSelectionChange?: OnChangeFn<RowSelectionState>;
|
|
310
|
+
getRowId?: (row: TData) => string;
|
|
311
|
+
showFilters?: boolean;
|
|
312
|
+
/** Sorting used when the viewer has no persisted preference — defaults to
|
|
313
|
+
* the anchor column ascending. */
|
|
314
|
+
defaultSorting?: SortingState;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
declare function Table<TData extends object>({ columns, data, cellRenderers, tableId, ariaLabel, enableRowSelection, rowSelection, onRowSelectionChange, getRowId, showFilters, defaultSorting, }: TableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
318
|
+
|
|
319
|
+
interface UseColumnFiltersOptions {
|
|
320
|
+
tableId: string;
|
|
267
321
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
322
|
+
/**
|
|
323
|
+
* Manages column filter state via the per-table Zustand store (persisted to
|
|
324
|
+
* localStorage). Callers sharing a `tableId` — Table, Grid, Tree — all see
|
|
325
|
+
* the same filter state without prop drilling. This hook is the state layer
|
|
326
|
+
* that keeps filter UI unified across view modes.
|
|
327
|
+
*/
|
|
328
|
+
declare function useColumnFilters({ tableId }: UseColumnFiltersOptions): {
|
|
329
|
+
columnFilters: ColumnFiltersState;
|
|
330
|
+
setColumnFilters: OnChangeFn<ColumnFiltersState>;
|
|
331
|
+
resetFilters: () => void;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Manages column visibility state with persistence and anchor enforcement.
|
|
336
|
+
*
|
|
337
|
+
* Visibility is derived from (in priority order):
|
|
338
|
+
* 1. Stored preference (persisted across sessions)
|
|
339
|
+
* 2. Column's `defaultVisible` config (defaults to true if omitted)
|
|
340
|
+
* 3. Anchor columns are always forced visible
|
|
341
|
+
*/
|
|
342
|
+
declare function useColumnVisibility(columns: ColumnConfig[], tableId: string): {
|
|
343
|
+
columnVisibility: VisibilityState;
|
|
344
|
+
setColumnVisibility: OnChangeFn<VisibilityState>;
|
|
345
|
+
toggleableColumns: ColumnConfig[];
|
|
346
|
+
toggleColumn: (columnId: string) => void;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Manages column width state for a table with persistence.
|
|
351
|
+
*
|
|
352
|
+
* Column widths are derived from persisted values (if available) or fall back
|
|
353
|
+
* to the default sizes defined in column config. Width changes are automatically
|
|
354
|
+
* synced to the table's store for persistence across sessions.
|
|
355
|
+
*
|
|
356
|
+
* The index column always has a fixed width of 48px and is not persisted.
|
|
357
|
+
*/
|
|
358
|
+
declare function useColumnWidths(columns: ColumnConfig[], tableId: string): {
|
|
359
|
+
columnSizing: ColumnSizingState;
|
|
360
|
+
setColumnSizing: OnChangeFn<ColumnSizingState>;
|
|
361
|
+
resetWidths: () => void;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Manages sorting state for a table with persistence.
|
|
366
|
+
*
|
|
367
|
+
* When no stored sorting exists, falls back to `defaultSorting` — typically
|
|
368
|
+
* the anchor column ascending, or a newest-first default for views that
|
|
369
|
+
* list time-ordered entries.
|
|
370
|
+
*/
|
|
371
|
+
declare function useTableSorting(tableId: string, defaultSorting?: SortingState): {
|
|
372
|
+
sorting: SortingState;
|
|
373
|
+
setSorting: OnChangeFn<SortingState>;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
interface SelectionFooterProps {
|
|
377
|
+
selectedCount: number;
|
|
378
|
+
totalCount: number;
|
|
379
|
+
onReset: () => void;
|
|
380
|
+
children?: ReactNode;
|
|
273
381
|
}
|
|
274
|
-
declare function
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
382
|
+
declare function SelectionFooter({ selectedCount, totalCount, onReset, children, }: SelectionFooterProps): react_jsx_runtime.JSX.Element;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* "No results match your filters" empty state with a "Clear all filters"
|
|
386
|
+
* action. Shared by Table views when column filters exclude every row.
|
|
387
|
+
*/
|
|
388
|
+
declare function NoFilterResults({ tableId }: {
|
|
389
|
+
tableId: string;
|
|
390
|
+
}): react_jsx_runtime.JSX.Element;
|
|
391
|
+
|
|
392
|
+
interface TableStore {
|
|
393
|
+
tableId: string;
|
|
394
|
+
columnWidths: Record<string, number>;
|
|
395
|
+
sorting: SortingState;
|
|
396
|
+
columnVisibility: VisibilityState;
|
|
397
|
+
columnFilters: ColumnFiltersState;
|
|
398
|
+
setColumnWidth: (columnId: string, width: number) => void;
|
|
399
|
+
setSorting: (sorting: SortingState) => void;
|
|
400
|
+
setColumnVisibility: (visibility: VisibilityState) => void;
|
|
401
|
+
setColumnFilters: (filters: ColumnFiltersState) => void;
|
|
402
|
+
reset: () => void;
|
|
278
403
|
}
|
|
279
|
-
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Gets or creates a table store instance for the given tableId.
|
|
407
|
+
*
|
|
408
|
+
* Store instances are singletons - the same tableId always returns the same store.
|
|
409
|
+
* This ensures state persists across component unmounts and remounts.
|
|
410
|
+
*
|
|
411
|
+
* @param tableId - Unique identifier for the table
|
|
412
|
+
* @returns The table store instance for this tableId
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```tsx
|
|
416
|
+
* function MyTable() {
|
|
417
|
+
* const store = useTableStore("files-table");
|
|
418
|
+
* const columnWidths = store.getState().columnWidths;
|
|
419
|
+
* // ...
|
|
420
|
+
* }
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
declare function useTableStore(tableId: string): StoreApi<TableStore>;
|
|
424
|
+
/**
|
|
425
|
+
* Gets the table store instance for a given tableId without React hooks.
|
|
426
|
+
* Useful for accessing store outside of React components.
|
|
427
|
+
*
|
|
428
|
+
* @param tableId - Unique identifier for the table
|
|
429
|
+
* @returns The table store instance or undefined if not yet created
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```tsx
|
|
433
|
+
* const store = getTableStore("files-table");
|
|
434
|
+
* if (store) {
|
|
435
|
+
* store.getState().reset();
|
|
436
|
+
* }
|
|
437
|
+
* ```
|
|
438
|
+
*/
|
|
439
|
+
declare function getTableStore(tableId: string): StoreApi<TableStore> | undefined;
|
|
280
440
|
|
|
281
441
|
interface DialogProps {
|
|
282
442
|
isOpen: boolean;
|
|
@@ -847,4 +1007,4 @@ interface FormWizardNavProps {
|
|
|
847
1007
|
}
|
|
848
1008
|
declare function FormWizardNav({ onNext, isSubmitting, submitLabel, }: FormWizardNavProps): react_jsx_runtime.JSX.Element;
|
|
849
1009
|
|
|
850
|
-
export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, Banner, type BannerProps, type BannerVariant, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardProps,
|
|
1010
|
+
export { Badge, type BadgeColor, type BadgeProps, type BadgeSize, Banner, type BannerProps, type BannerVariant, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardProps, type CellRenderers, Checkbox, type CheckboxProps, type ColumnConfig, type DeltaFormat, DeltaIndicator, type DeltaIndicatorProps, type DeltaMode, Description, DescriptionList, type DescriptionListItemProps, type DescriptionListLayout, type DescriptionListProps, type DescriptionProps, type DescriptionSize, Dialog, type DialogProps, EmptyState, type EmptyStateProps, Fieldset, type FieldsetProps, FormWizard, type FormWizardContextValue, FormWizardNav, type FormWizardNavProps, FormWizardProgress, type FormWizardProgressProps, type FormWizardProps, H1, H2, H3, H4, H5, H6, Heading, type HeadingLevel, type HeadingProps, type HeadingSize, Icon, IconButton, IconButtonLink, type IconButtonLinkProps, type IconButtonProps, IconButtonToggle, type IconButtonToggleProps, type IconComponent, type IconName, type IconProps, type IconValue, Input, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, type LinkVariant, Logo, type LogoProps, Menu, MenuCheckboxItem, type MenuCheckboxItemProps, MenuHeader, type MenuHeaderProps, MenuItem, type MenuItemData, type MenuItemProps, type MenuProps, MenuSection, type MenuSectionProps, MenuSeparator, type MenuSeparatorProps, MetricCard, type MetricCardProps, type MetricCardSize, MetricText, type MetricTextProps, NoFilterResults, PathPill, type PathPillProps, Popover, PopoverContent, type PopoverContentProps, type PopoverProps, PopoverTrigger, type PopoverTriggerProps, ProgressBar, type ProgressBarProps, type ProgressBarSize, type ProgressBarVariant, Prose, type ProseProps, Radio, RadioButton, type RadioButtonProps, RadioGroup, type RadioGroupProps, type RadioProps, SectionHeader, type SectionHeaderProps, SegmentedControl, SegmentedControlItem, type SegmentedControlItemProps, type SegmentedControlProps, type SegmentedControlSelectionMode, type SegmentedControlSize, Select, type SelectItem, type SelectProps, SelectionFooter, type SelectionFooterProps, Slider, type SliderProps, Spinner, type SpinnerProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, type TableProps, Tabs, type TabsProps, type TabsSize, type TabsVariant, type ToastBridge, type ToastContextValue, type ToastData, type ToastPlacement, ToastProvider, type ToastProviderProps, type ToastVariant, ToggleButton, type ToggleButtonProps, type ToggleButtonSize, type ToggleButtonVariant, Tooltip, type TooltipProps, TruncatedText, type TruncatedTextProps, type UseContextMenuProps, type UseContextMenuResult, buttonBaseClass, createToastBridge, getTableStore, iconRegistry, pillColorFromName, selectedStyles, useColumnFilters, useColumnVisibility, useColumnWidths, useContextMenu, useFormWizard, useTableSorting, useTableStore, useToast, variantStyles };
|