@tensor_1/react 2.3.0 → 2.4.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/components/NavFavourites.d.ts +61 -0
- package/dist/components/NavFavourites.js +352 -0
- package/dist/components/StarButton.d.ts +31 -0
- package/dist/components/StarButton.js +43 -0
- package/dist/index.cjs +506 -113
- package/dist/index.d.cts +86 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -262,6 +262,91 @@ interface SubNavItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
262
262
|
}
|
|
263
263
|
declare function SubNavItem({ active, as: Tag, children, className, ...props }: SubNavItemProps): react.JSX.Element;
|
|
264
264
|
|
|
265
|
+
interface StarButtonProps {
|
|
266
|
+
/** Pinned state — drives the filled, warning-toned, always-visible look via `data-on`. */
|
|
267
|
+
pinned: boolean;
|
|
268
|
+
/** Item label, interpolated into the accessible name. */
|
|
269
|
+
label: string;
|
|
270
|
+
/**
|
|
271
|
+
* Accessible-name template carrying a `{label}` placeholder. ONE state model:
|
|
272
|
+
* a STATIC name ("Add {label} to favourites") plus `aria-pressed` reflecting
|
|
273
|
+
* the pinned state — never a dynamic Pin/Remove name AND `aria-pressed` (that
|
|
274
|
+
* double-encodes the state). Defaults to `Add {label} to favourites`.
|
|
275
|
+
*/
|
|
276
|
+
addLabel?: string;
|
|
277
|
+
/** Called with the next pinned state when the control is activated. */
|
|
278
|
+
onToggle: (next: boolean) => void;
|
|
279
|
+
/** Extra classes — e.g. consumer-owned reveal triggers when the row is not a `.uix-navitem`. */
|
|
280
|
+
className?: string;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Controlled pin/unpin star for a nav item. UIx owns the look (the
|
|
284
|
+
* `.uix-navitem__star` contract: reveal-on-hover inside a `.uix-navitem`,
|
|
285
|
+
* warning-toned fill when pinned); the consumer owns the pinned state.
|
|
286
|
+
*
|
|
287
|
+
* Reveal-on-hover is opacity-only (zeroed under `prefers-reduced-motion`).
|
|
288
|
+
* When the star lives outside a `.uix-navitem` row, pass reveal triggers via
|
|
289
|
+
* `className`.
|
|
290
|
+
*/
|
|
291
|
+
declare function StarButton({ pinned, label, addLabel, onToggle, className, }: StarButtonProps): react.JSX.Element;
|
|
292
|
+
|
|
293
|
+
interface NavFavouriteItem {
|
|
294
|
+
/** Stable identity used for reorder + remove (consumers typically pass the href). */
|
|
295
|
+
readonly id: string;
|
|
296
|
+
/** Display label, interpolated into the per-row remove / options accessible names. */
|
|
297
|
+
readonly label: string;
|
|
298
|
+
/** The destination control, rendered by the consumer so routing + link styling stay app-owned. */
|
|
299
|
+
readonly link: ReactNode;
|
|
300
|
+
}
|
|
301
|
+
interface NavFavouritesLabels {
|
|
302
|
+
/** Disclosure header, e.g. "Favourites". */
|
|
303
|
+
readonly heading: string;
|
|
304
|
+
/** Shown when there are no favourites. */
|
|
305
|
+
readonly empty: string;
|
|
306
|
+
readonly moveUp: string;
|
|
307
|
+
readonly moveDown: string;
|
|
308
|
+
/** Per-row remove action template with a `{label}` placeholder, e.g. "Remove {label} from favourites". */
|
|
309
|
+
readonly remove: string;
|
|
310
|
+
/** Per-row overflow-trigger accessible-name template with `{label}`. Defaults to "{label} favourite options". */
|
|
311
|
+
readonly options?: string;
|
|
312
|
+
}
|
|
313
|
+
interface NavFavouritesProps {
|
|
314
|
+
/** The already-resolved favourites, in display order. */
|
|
315
|
+
items: ReadonlyArray<NavFavouriteItem>;
|
|
316
|
+
collapsed?: boolean;
|
|
317
|
+
onToggleCollapsed?: () => void;
|
|
318
|
+
/** Called with the id of the favourite to unpin. */
|
|
319
|
+
onRemove: (id: string) => void;
|
|
320
|
+
/** Called with the full new id order after a move. */
|
|
321
|
+
onReorder: (orderedIds: string[]) => void;
|
|
322
|
+
labels: NavFavouritesLabels;
|
|
323
|
+
/** Optional telemetry hook emitted as `data-empty-reason` on the empty-state node. */
|
|
324
|
+
emptyReason?: string;
|
|
325
|
+
className?: string;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Controlled Favourites disclosure for a sidebar nav (UIx owns the look + the
|
|
329
|
+
* APG interaction contract; the consumer owns the favourites list + persistence).
|
|
330
|
+
*
|
|
331
|
+
* An ARIA disclosure exactly like a collapsible nav group: a header button with
|
|
332
|
+
* `aria-expanded`/`aria-controls`, the region always rendered with a stable id
|
|
333
|
+
* and toggled via `hidden`, focus pulled to the header before collapse.
|
|
334
|
+
*
|
|
335
|
+
* Each row carries the consumer-rendered destination link plus:
|
|
336
|
+
* - an overflow menu (APG menu-button: button + `aria-haspopup="menu"` +
|
|
337
|
+
* `aria-expanded`; Up/Down roving focus; Escape returns focus to the
|
|
338
|
+
* trigger) with Move up / Move down / Remove,
|
|
339
|
+
* - Alt+ArrowUp / Alt+ArrowDown accelerators on the focused row so moves
|
|
340
|
+
* chain without re-opening the menu.
|
|
341
|
+
*
|
|
342
|
+
* Focus management:
|
|
343
|
+
* - after Remove, focus moves to the adjacent favourite, or to the header
|
|
344
|
+
* when the list empties,
|
|
345
|
+
* - after Move up/down, focus stays on the moved row's control in its new
|
|
346
|
+
* position.
|
|
347
|
+
*/
|
|
348
|
+
declare function NavFavourites({ items, collapsed, onToggleCollapsed, onRemove, onReorder, labels, emptyReason, className, }: NavFavouritesProps): react.JSX.Element;
|
|
349
|
+
|
|
265
350
|
type AlertTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
266
351
|
interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
267
352
|
tone?: AlertTone;
|
|
@@ -573,4 +658,4 @@ interface TreeProps extends Omit<HTMLAttributes<HTMLUListElement>, 'onSelect' |
|
|
|
573
658
|
}
|
|
574
659
|
declare function Tree({ nodes, expanded: controlledExpanded, defaultExpanded, selected, onToggle, onSelect, className, ...props }: TreeProps): react.JSX.Element;
|
|
575
660
|
|
|
576
|
-
export { Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps, Comment, type CommentProps, Comments, type CommentsProps, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListItem, type DescriptionListProps, DetailLayout, type DetailLayoutProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, Field, type FieldProps, Input, InputGroup, type InputGroupProps, type InputProps, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, type KanbanProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, LoadingState, type LoadingStateProps, Modal, type ModalProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, Note, type NoteProps, type NoteTone, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, Peek, type PeekProps, type PillTone, type PillTreatment, Popover, type PopoverProps, Progress, type ProgressProps, Prose, type ProseProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectProps, Sidebar, type SidebarProps, SidebarSection, type SidebarSectionProps, Skeleton, type SkeletonProps, type SortDirection, Spinner, type SpinnerProps, Stat, type StatProps, type StatTrend, StatusPill, type StatusPillProps, SubNavItem, type SubNavItemProps, Switch, type SwitchProps, Tab, type TabProps, Table, type TableDensity, type TableProps, TableWrap, type TableWrapProps, Tabs, type TabsProps, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Timeline, TimelineItem, type TimelineItemProps, type TimelineProps, Toast, type ToastProps, type ToastTone, Toaster, type ToasterProps, Tooltip, type TooltipProps, Tr, type TrProps, Tree, type TreeNodeData, type TreeNodeProps, type TreeProps, UserChip, type UserChipProps, cx, useDialog };
|
|
661
|
+
export { Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, Card, type CardProps, Checkbox, type CheckboxProps, CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps, Comment, type CommentProps, Comments, type CommentsProps, DescriptionItem, type DescriptionItemProps, DescriptionList, type DescriptionListItem, type DescriptionListProps, DetailLayout, type DetailLayoutProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, Field, type FieldProps, Input, InputGroup, type InputGroupProps, type InputProps, Kanban, KanbanCard, type KanbanCardProps, KanbanColumn, type KanbanColumnProps, type KanbanProps, Label, type LabelProps, List, ListItem, type ListItemProps, type ListProps, LoadingState, type LoadingStateProps, Modal, type ModalProps, type NavFavouriteItem, NavFavourites, type NavFavouritesLabels, type NavFavouritesProps, NavGroup, type NavGroupProps, NavItem, type NavItemProps, Note, type NoteProps, type NoteTone, PageHeader, type PageHeaderProps, Pagination, type PaginationProps, Peek, type PeekProps, type PillTone, type PillTreatment, Popover, type PopoverProps, Progress, type ProgressProps, Prose, type ProseProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectProps, Sidebar, type SidebarProps, SidebarSection, type SidebarSectionProps, Skeleton, type SkeletonProps, type SortDirection, Spinner, type SpinnerProps, StarButton, type StarButtonProps, Stat, type StatProps, type StatTrend, StatusPill, type StatusPillProps, SubNavItem, type SubNavItemProps, Switch, type SwitchProps, Tab, type TabProps, Table, type TableDensity, type TableProps, TableWrap, type TableWrapProps, Tabs, type TabsProps, Td, type TdProps, Textarea, type TextareaProps, Th, type ThProps, Timeline, TimelineItem, type TimelineItemProps, type TimelineProps, Toast, type ToastProps, type ToastTone, Toaster, type ToasterProps, Tooltip, type TooltipProps, Tr, type TrProps, Tree, type TreeNodeData, type TreeNodeProps, type TreeProps, UserChip, type UserChipProps, cx, useDialog };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { DescriptionItem, DescriptionItemProps, DescriptionList, DescriptionList
|
|
|
19
19
|
export { Tab, TabProps, Tabs, TabsProps } from './components/Tabs.js';
|
|
20
20
|
export { AppShell, AppShellProps } from './components/AppShell.js';
|
|
21
21
|
export { NavGroup, NavGroupProps, NavItem, NavItemProps, Sidebar, SidebarProps, SidebarSection, SidebarSectionProps, SubNavItem, SubNavItemProps } from './components/Sidebar.js';
|
|
22
|
+
export { StarButton, StarButtonProps } from './components/StarButton.js';
|
|
23
|
+
export { NavFavouriteItem, NavFavourites, NavFavouritesLabels, NavFavouritesProps } from './components/NavFavourites.js';
|
|
22
24
|
export { Alert, AlertProps, AlertTone } from './components/Alert.js';
|
|
23
25
|
export { Spinner, SpinnerProps } from './components/Spinner.js';
|
|
24
26
|
export { Toast, ToastProps, ToastTone, Toaster, ToasterProps } from './components/Toast.js';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,8 @@ import { DescriptionList, DescriptionItem } from "./components/DescriptionList.j
|
|
|
19
19
|
import { Tabs, Tab } from "./components/Tabs.js";
|
|
20
20
|
import { AppShell } from "./components/AppShell.js";
|
|
21
21
|
import { Sidebar, SidebarSection, NavItem, NavGroup, SubNavItem } from "./components/Sidebar.js";
|
|
22
|
+
import { StarButton } from "./components/StarButton.js";
|
|
23
|
+
import { NavFavourites } from "./components/NavFavourites.js";
|
|
22
24
|
import { Alert } from "./components/Alert.js";
|
|
23
25
|
import { Spinner } from "./components/Spinner.js";
|
|
24
26
|
import { Toast, Toaster } from "./components/Toast.js";
|
|
@@ -69,6 +71,7 @@ export {
|
|
|
69
71
|
ListItem,
|
|
70
72
|
LoadingState,
|
|
71
73
|
Modal,
|
|
74
|
+
NavFavourites,
|
|
72
75
|
NavGroup,
|
|
73
76
|
NavItem,
|
|
74
77
|
Note,
|
|
@@ -85,6 +88,7 @@ export {
|
|
|
85
88
|
SidebarSection,
|
|
86
89
|
Skeleton,
|
|
87
90
|
Spinner,
|
|
91
|
+
StarButton,
|
|
88
92
|
Stat,
|
|
89
93
|
StatusPill,
|
|
90
94
|
SubNavItem,
|