@classic-homes/theme-react 0.4.3 → 0.5.1
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 +0 -7
- package/dist/index.d.mts +42 -13
- package/dist/index.d.ts +42 -13
- package/dist/index.js +396 -309
- package/dist/index.mjs +430 -344
- package/package.json +9 -5
package/dist/index.css
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
right: 0;
|
|
19
19
|
height: 2px;
|
|
20
20
|
background: transparent;
|
|
21
|
-
transition: background-color 0.15s ease;
|
|
22
21
|
}
|
|
23
22
|
.resize-handle--top {
|
|
24
23
|
top: 2px;
|
|
@@ -45,7 +44,6 @@
|
|
|
45
44
|
bottom: 0;
|
|
46
45
|
width: 2px;
|
|
47
46
|
background: transparent;
|
|
48
|
-
transition: background-color 0.15s ease;
|
|
49
47
|
}
|
|
50
48
|
.resize-handle--left {
|
|
51
49
|
left: 2px;
|
|
@@ -85,11 +83,6 @@
|
|
|
85
83
|
width: 10px;
|
|
86
84
|
height: 10px;
|
|
87
85
|
border: 2px solid transparent !important;
|
|
88
|
-
transition:
|
|
89
|
-
border-top-color 0.15s ease,
|
|
90
|
-
border-right-color 0.15s ease,
|
|
91
|
-
border-bottom-color 0.15s ease,
|
|
92
|
-
border-left-color 0.15s ease;
|
|
93
86
|
}
|
|
94
87
|
.resize-handle--top-left {
|
|
95
88
|
top: 2px;
|
package/dist/index.d.mts
CHANGED
|
@@ -84,6 +84,7 @@ interface PasswordInputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputE
|
|
|
84
84
|
}
|
|
85
85
|
declare const PasswordInput: React$1.ForwardRefExoticComponent<PasswordInputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
86
86
|
|
|
87
|
+
declare const labelVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
87
88
|
declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
|
|
88
89
|
|
|
89
90
|
declare const badgeVariants: (props?: ({
|
|
@@ -176,6 +177,8 @@ declare const DialogOverlay: React$1.ForwardRefExoticComponent<Omit<React$1.Deta
|
|
|
176
177
|
declare const DialogContent: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & DialogPrimitive.DialogContentProps & {
|
|
177
178
|
/** Dialog size - controls max-width (default: 'md') */
|
|
178
179
|
size?: DialogSize;
|
|
180
|
+
/** Render a built-in close button in the top-right corner (default: false) */
|
|
181
|
+
showClose?: boolean;
|
|
179
182
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
180
183
|
declare const DialogHeader: {
|
|
181
184
|
({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
@@ -274,6 +277,12 @@ interface SortableHandleProps {
|
|
|
274
277
|
'aria-describedby': string;
|
|
275
278
|
'aria-pressed': boolean;
|
|
276
279
|
'data-sortable-handle': string;
|
|
280
|
+
/**
|
|
281
|
+
* `touch-action: none`, so a touch drag moves the item instead of panning the
|
|
282
|
+
* page (a pan cancels the pointer and aborts the drag). Merge it into any
|
|
283
|
+
* style of your own on the handle.
|
|
284
|
+
*/
|
|
285
|
+
style: React$1.CSSProperties;
|
|
277
286
|
onPointerDown: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
278
287
|
onPointerMove: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
279
288
|
onPointerUp: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
@@ -458,7 +467,10 @@ interface StudioCanvasProps {
|
|
|
458
467
|
toolbar?: React$1.ReactNode;
|
|
459
468
|
/** Accessible name of the canvas region (default: "Canvas") */
|
|
460
469
|
label?: string;
|
|
461
|
-
/**
|
|
470
|
+
/**
|
|
471
|
+
* Clicked on the backdrop, outside any item: usually clears the selection.
|
|
472
|
+
* Also called on Escape pressed inside the canvas (outside a text field).
|
|
473
|
+
*/
|
|
462
474
|
onBackgroundClick?: () => void;
|
|
463
475
|
frameClassName?: string;
|
|
464
476
|
className?: string;
|
|
@@ -486,6 +498,8 @@ interface StudioCanvasItemProps {
|
|
|
486
498
|
invalid?: boolean;
|
|
487
499
|
/** Where the "+" sits: centred on the item's bottom edge, or in the left gutter beside it */
|
|
488
500
|
insertPlacement?: 'center' | 'gutter';
|
|
501
|
+
/** Toolbar straddling the top edge (default) or wholly above the item, for items edited in place. */
|
|
502
|
+
toolbarPlacement?: 'edge' | 'above';
|
|
489
503
|
className?: string;
|
|
490
504
|
}
|
|
491
505
|
/**
|
|
@@ -496,7 +510,7 @@ interface StudioCanvasItemProps {
|
|
|
496
510
|
* scrolls it into view; picking it on the canvas does not. `insertPlacement=
|
|
497
511
|
* "gutter"` puts the "+" in the left margin, clear of text edited in place.
|
|
498
512
|
*/
|
|
499
|
-
declare function StudioCanvasItem({ children, selected, onSelect, label, toolbar, onInsert, insertLabel, invalid, insertPlacement, className, }: StudioCanvasItemProps): React$1.JSX.Element;
|
|
513
|
+
declare function StudioCanvasItem({ children, selected, onSelect, label, toolbar, onInsert, insertLabel, invalid, insertPlacement, toolbarPlacement, className, }: StudioCanvasItemProps): React$1.JSX.Element;
|
|
500
514
|
|
|
501
515
|
interface StudioInspectorTab {
|
|
502
516
|
id: string;
|
|
@@ -733,6 +747,16 @@ interface UseDataPanelOptions {
|
|
|
733
747
|
initialExpanded?: boolean;
|
|
734
748
|
constraints?: PanelConstraints;
|
|
735
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* State for a controlled DataPanel: feed `mode`, `edge` and `isExpanded` (and
|
|
752
|
+
* their setters) to the panel's controlled props.
|
|
753
|
+
*
|
|
754
|
+
* With `persistKey`, the hook persists only mode, edge and expanded state, and
|
|
755
|
+
* merges them into what is stored under that key. DataPanel itself owns and
|
|
756
|
+
* persists its size, position, variant and tab offset, so pass it the same
|
|
757
|
+
* `persistKey` and neither overwrites the other. The returned size/position
|
|
758
|
+
* values are read from storage on mount but are not fed back to the panel.
|
|
759
|
+
*/
|
|
736
760
|
declare function useDataPanel(options?: UseDataPanelOptions): {
|
|
737
761
|
mode: PanelMode;
|
|
738
762
|
setMode: (newMode: PanelMode) => void;
|
|
@@ -1148,6 +1172,7 @@ declare function useArrowNavigation(options?: UseArrowNavigationOptions): {
|
|
|
1148
1172
|
onFocus: (event: React.FocusEvent) => void;
|
|
1149
1173
|
};
|
|
1150
1174
|
getItemProps: (index: number) => {
|
|
1175
|
+
'data-arrow-nav-item': boolean;
|
|
1151
1176
|
tabIndex: number;
|
|
1152
1177
|
onFocus: () => void;
|
|
1153
1178
|
};
|
|
@@ -1165,6 +1190,11 @@ interface UseRovingTabindexOptions {
|
|
|
1165
1190
|
/** Callback when active index changes */
|
|
1166
1191
|
onIndexChange?: (index: number) => void;
|
|
1167
1192
|
}
|
|
1193
|
+
/** Item handlers of your own, called before the hook's own */
|
|
1194
|
+
interface RovingItemHandlers {
|
|
1195
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
1196
|
+
onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
|
|
1197
|
+
}
|
|
1168
1198
|
/**
|
|
1169
1199
|
* Hook implementing roving tabindex pattern for composite widgets.
|
|
1170
1200
|
*
|
|
@@ -1179,16 +1209,15 @@ interface UseRovingTabindexOptions {
|
|
|
1179
1209
|
* @example
|
|
1180
1210
|
* ```tsx
|
|
1181
1211
|
* function Toolbar() {
|
|
1182
|
-
* const {
|
|
1212
|
+
* const { containerProps, getItemProps } = useRovingTabindex();
|
|
1183
1213
|
*
|
|
1214
|
+
* // containerProps carries the arrow-key handler; without it only Tab works.
|
|
1215
|
+
* // Pass your own item handlers to getItemProps so they are composed, not
|
|
1216
|
+
* // replaced.
|
|
1184
1217
|
* return (
|
|
1185
|
-
* <div role="toolbar">
|
|
1218
|
+
* <div role="toolbar" {...containerProps}>
|
|
1186
1219
|
* {tools.map((tool, i) => (
|
|
1187
|
-
* <button
|
|
1188
|
-
* key={tool.id}
|
|
1189
|
-
* data-roving-tabindex-item
|
|
1190
|
-
* {...getItemProps(i)}
|
|
1191
|
-
* >
|
|
1220
|
+
* <button key={tool.id} {...getItemProps(i, { onClick: () => tool.run() })}>
|
|
1192
1221
|
* {tool.label}
|
|
1193
1222
|
* </button>
|
|
1194
1223
|
* ))}
|
|
@@ -1202,12 +1231,12 @@ declare function useRovingTabindex(options?: UseRovingTabindexOptions): {
|
|
|
1202
1231
|
ref: (node: HTMLElement | null) => void;
|
|
1203
1232
|
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
1204
1233
|
};
|
|
1205
|
-
getItemProps: (index: number) => {
|
|
1234
|
+
getItemProps: (index: number, handlers?: RovingItemHandlers) => {
|
|
1206
1235
|
'data-roving-tabindex-item': boolean;
|
|
1207
1236
|
tabIndex: number;
|
|
1208
1237
|
ref: (node: HTMLElement | null) => void;
|
|
1209
|
-
onClick: () => void;
|
|
1210
|
-
onFocus: () => void;
|
|
1238
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
1239
|
+
onFocus: (event: React.FocusEvent<HTMLElement>) => void;
|
|
1211
1240
|
};
|
|
1212
1241
|
activeIndex: number;
|
|
1213
1242
|
setActiveIndex: (index: number) => void;
|
|
@@ -1412,4 +1441,4 @@ declare function useClickOutside<T extends HTMLElement>(ref: React$1.RefObject<T
|
|
|
1412
1441
|
*/
|
|
1413
1442
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1414
1443
|
|
|
1415
|
-
export { type ArrowNavigationOrientation, Avatar, AvatarFallback, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, DataPanel, DataPanelContent, type DataPanelContentProps, DataPanelFooter, type DataPanelFooterProps, DataPanelHeader, type DataPanelProps, DataPanelTab, type DataPanelTabProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, type InputProps, InsertPalette, type InsertPaletteGroup, type InsertPaletteItem, type InsertPaletteProps, IssuesButton, type IssuesButtonProps, Label, LiveRegion, type LiveRegionProps, LoadingLogo, type LoadingLogoProps, LoadingOverlay, type LoadingOverlayProps, LoadingPage, type LoadingPageProps, LoadingSection, type LoadingSectionProps, PageHeader, type PageHeaderProps, PasswordInput, type PasswordInputProps, ProgressBar, type ProgressBarProps, type SaveState, SaveStatus, type SaveStatusProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, type SortableHandleProps, type SortableItemContext, SortableList, type SortableListProps, Spinner, type SpinnerProps, Studio, StudioBar, type StudioBarProps, StudioCanvas, StudioCanvasItem, type StudioCanvasItemProps, type StudioCanvasProps, type StudioContextValue, StudioInspector, type StudioInspectorProps, StudioInspectorSection, type StudioInspectorSectionProps, type StudioInspectorTab, type StudioIssue, type StudioLayout, type StudioMenuItem, type StudioMode, StudioOutline, type StudioOutlineEntry, type StudioOutlineProps, StudioPage, type StudioPageProps, type StudioProps, Switch, type SwitchProps, type UseAnnounceOptions, type UseAnnounceReturn, type UseArrowNavigationOptions, type UseClickOutsideOptions, type UseEscapeKeyOptions, type UseFocusRefOptions, type UseFocusTrapOptions, type UseRovingTabindexOptions, badgeVariants, buttonVariants, cn, pageHeaderActionsVariants, pageHeaderContainerVariants, pageHeaderSubtitleVariants, pageHeaderTitleVariants, progressBarVariants, skeletonVariants, spinnerVariants, useAnnounce, useArrowNavigation, useClickOutside, useDataPanel, useEscapeKey, useFocusRef, useFocusTrap, useReducedMotion, useRovingTabindex, useStudio };
|
|
1444
|
+
export { type ArrowNavigationOrientation, Avatar, AvatarFallback, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, type CardTitleProps, DataPanel, DataPanelContent, type DataPanelContentProps, DataPanelFooter, type DataPanelFooterProps, DataPanelHeader, type DataPanelHeaderProps, type DataPanelProps, DataPanelTab, type DataPanelTabProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, type DialogSize, DialogTitle, DialogTrigger, Input, type InputProps, InsertPalette, type InsertPaletteGroup, type InsertPaletteItem, type InsertPaletteProps, IssuesButton, type IssuesButtonProps, Label, LiveRegion, type LiveRegionProps, LoadingLogo, type LoadingLogoProps, LoadingOverlay, type LoadingOverlayProps, LoadingPage, type LoadingPageProps, LoadingSection, type LoadingSectionProps, PageHeader, type PageHeaderProps, PasswordInput, type PasswordInputProps, ProgressBar, type ProgressBarProps, type SaveState, SaveStatus, type SaveStatusProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, type SortableHandleProps, type SortableItemContext, SortableList, type SortableListProps, Spinner, type SpinnerProps, Studio, StudioBar, type StudioBarProps, StudioCanvas, StudioCanvasItem, type StudioCanvasItemProps, type StudioCanvasProps, type StudioContextValue, StudioInspector, type StudioInspectorProps, StudioInspectorSection, type StudioInspectorSectionProps, type StudioInspectorTab, type StudioIssue, type StudioLayout, type StudioMenuItem, type StudioMode, StudioOutline, type StudioOutlineEntry, type StudioOutlineProps, StudioPage, type StudioPageProps, type StudioProps, Switch, type SwitchProps, type UseAnnounceOptions, type UseAnnounceReturn, type UseArrowNavigationOptions, type UseClickOutsideOptions, type UseDataPanelOptions, type UseEscapeKeyOptions, type UseFocusRefOptions, type UseFocusTrapOptions, type UseRovingTabindexOptions, badgeVariants, buttonVariants, cn, labelVariants, pageHeaderActionsVariants, pageHeaderContainerVariants, pageHeaderSubtitleVariants, pageHeaderTitleVariants, progressBarVariants, skeletonVariants, spinnerVariants, useAnnounce, useArrowNavigation, useClickOutside, useDataPanel, useEscapeKey, useFocusRef, useFocusTrap, useReducedMotion, useRovingTabindex, useStudio };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ interface PasswordInputProps extends Omit<React$1.InputHTMLAttributes<HTMLInputE
|
|
|
84
84
|
}
|
|
85
85
|
declare const PasswordInput: React$1.ForwardRefExoticComponent<PasswordInputProps & React$1.RefAttributes<HTMLInputElement>>;
|
|
86
86
|
|
|
87
|
+
declare const labelVariants: (props?: class_variance_authority_types.ClassProp | undefined) => string;
|
|
87
88
|
declare const Label: React$1.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React$1.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React$1.RefAttributes<HTMLLabelElement>>;
|
|
88
89
|
|
|
89
90
|
declare const badgeVariants: (props?: ({
|
|
@@ -176,6 +177,8 @@ declare const DialogOverlay: React$1.ForwardRefExoticComponent<Omit<React$1.Deta
|
|
|
176
177
|
declare const DialogContent: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & DialogPrimitive.DialogContentProps & {
|
|
177
178
|
/** Dialog size - controls max-width (default: 'md') */
|
|
178
179
|
size?: DialogSize;
|
|
180
|
+
/** Render a built-in close button in the top-right corner (default: false) */
|
|
181
|
+
showClose?: boolean;
|
|
179
182
|
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
180
183
|
declare const DialogHeader: {
|
|
181
184
|
({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): React$1.JSX.Element;
|
|
@@ -274,6 +277,12 @@ interface SortableHandleProps {
|
|
|
274
277
|
'aria-describedby': string;
|
|
275
278
|
'aria-pressed': boolean;
|
|
276
279
|
'data-sortable-handle': string;
|
|
280
|
+
/**
|
|
281
|
+
* `touch-action: none`, so a touch drag moves the item instead of panning the
|
|
282
|
+
* page (a pan cancels the pointer and aborts the drag). Merge it into any
|
|
283
|
+
* style of your own on the handle.
|
|
284
|
+
*/
|
|
285
|
+
style: React$1.CSSProperties;
|
|
277
286
|
onPointerDown: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
278
287
|
onPointerMove: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
279
288
|
onPointerUp: (event: React$1.PointerEvent<HTMLElement>) => void;
|
|
@@ -458,7 +467,10 @@ interface StudioCanvasProps {
|
|
|
458
467
|
toolbar?: React$1.ReactNode;
|
|
459
468
|
/** Accessible name of the canvas region (default: "Canvas") */
|
|
460
469
|
label?: string;
|
|
461
|
-
/**
|
|
470
|
+
/**
|
|
471
|
+
* Clicked on the backdrop, outside any item: usually clears the selection.
|
|
472
|
+
* Also called on Escape pressed inside the canvas (outside a text field).
|
|
473
|
+
*/
|
|
462
474
|
onBackgroundClick?: () => void;
|
|
463
475
|
frameClassName?: string;
|
|
464
476
|
className?: string;
|
|
@@ -486,6 +498,8 @@ interface StudioCanvasItemProps {
|
|
|
486
498
|
invalid?: boolean;
|
|
487
499
|
/** Where the "+" sits: centred on the item's bottom edge, or in the left gutter beside it */
|
|
488
500
|
insertPlacement?: 'center' | 'gutter';
|
|
501
|
+
/** Toolbar straddling the top edge (default) or wholly above the item, for items edited in place. */
|
|
502
|
+
toolbarPlacement?: 'edge' | 'above';
|
|
489
503
|
className?: string;
|
|
490
504
|
}
|
|
491
505
|
/**
|
|
@@ -496,7 +510,7 @@ interface StudioCanvasItemProps {
|
|
|
496
510
|
* scrolls it into view; picking it on the canvas does not. `insertPlacement=
|
|
497
511
|
* "gutter"` puts the "+" in the left margin, clear of text edited in place.
|
|
498
512
|
*/
|
|
499
|
-
declare function StudioCanvasItem({ children, selected, onSelect, label, toolbar, onInsert, insertLabel, invalid, insertPlacement, className, }: StudioCanvasItemProps): React$1.JSX.Element;
|
|
513
|
+
declare function StudioCanvasItem({ children, selected, onSelect, label, toolbar, onInsert, insertLabel, invalid, insertPlacement, toolbarPlacement, className, }: StudioCanvasItemProps): React$1.JSX.Element;
|
|
500
514
|
|
|
501
515
|
interface StudioInspectorTab {
|
|
502
516
|
id: string;
|
|
@@ -733,6 +747,16 @@ interface UseDataPanelOptions {
|
|
|
733
747
|
initialExpanded?: boolean;
|
|
734
748
|
constraints?: PanelConstraints;
|
|
735
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* State for a controlled DataPanel: feed `mode`, `edge` and `isExpanded` (and
|
|
752
|
+
* their setters) to the panel's controlled props.
|
|
753
|
+
*
|
|
754
|
+
* With `persistKey`, the hook persists only mode, edge and expanded state, and
|
|
755
|
+
* merges them into what is stored under that key. DataPanel itself owns and
|
|
756
|
+
* persists its size, position, variant and tab offset, so pass it the same
|
|
757
|
+
* `persistKey` and neither overwrites the other. The returned size/position
|
|
758
|
+
* values are read from storage on mount but are not fed back to the panel.
|
|
759
|
+
*/
|
|
736
760
|
declare function useDataPanel(options?: UseDataPanelOptions): {
|
|
737
761
|
mode: PanelMode;
|
|
738
762
|
setMode: (newMode: PanelMode) => void;
|
|
@@ -1148,6 +1172,7 @@ declare function useArrowNavigation(options?: UseArrowNavigationOptions): {
|
|
|
1148
1172
|
onFocus: (event: React.FocusEvent) => void;
|
|
1149
1173
|
};
|
|
1150
1174
|
getItemProps: (index: number) => {
|
|
1175
|
+
'data-arrow-nav-item': boolean;
|
|
1151
1176
|
tabIndex: number;
|
|
1152
1177
|
onFocus: () => void;
|
|
1153
1178
|
};
|
|
@@ -1165,6 +1190,11 @@ interface UseRovingTabindexOptions {
|
|
|
1165
1190
|
/** Callback when active index changes */
|
|
1166
1191
|
onIndexChange?: (index: number) => void;
|
|
1167
1192
|
}
|
|
1193
|
+
/** Item handlers of your own, called before the hook's own */
|
|
1194
|
+
interface RovingItemHandlers {
|
|
1195
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
1196
|
+
onFocus?: (event: React.FocusEvent<HTMLElement>) => void;
|
|
1197
|
+
}
|
|
1168
1198
|
/**
|
|
1169
1199
|
* Hook implementing roving tabindex pattern for composite widgets.
|
|
1170
1200
|
*
|
|
@@ -1179,16 +1209,15 @@ interface UseRovingTabindexOptions {
|
|
|
1179
1209
|
* @example
|
|
1180
1210
|
* ```tsx
|
|
1181
1211
|
* function Toolbar() {
|
|
1182
|
-
* const {
|
|
1212
|
+
* const { containerProps, getItemProps } = useRovingTabindex();
|
|
1183
1213
|
*
|
|
1214
|
+
* // containerProps carries the arrow-key handler; without it only Tab works.
|
|
1215
|
+
* // Pass your own item handlers to getItemProps so they are composed, not
|
|
1216
|
+
* // replaced.
|
|
1184
1217
|
* return (
|
|
1185
|
-
* <div role="toolbar">
|
|
1218
|
+
* <div role="toolbar" {...containerProps}>
|
|
1186
1219
|
* {tools.map((tool, i) => (
|
|
1187
|
-
* <button
|
|
1188
|
-
* key={tool.id}
|
|
1189
|
-
* data-roving-tabindex-item
|
|
1190
|
-
* {...getItemProps(i)}
|
|
1191
|
-
* >
|
|
1220
|
+
* <button key={tool.id} {...getItemProps(i, { onClick: () => tool.run() })}>
|
|
1192
1221
|
* {tool.label}
|
|
1193
1222
|
* </button>
|
|
1194
1223
|
* ))}
|
|
@@ -1202,12 +1231,12 @@ declare function useRovingTabindex(options?: UseRovingTabindexOptions): {
|
|
|
1202
1231
|
ref: (node: HTMLElement | null) => void;
|
|
1203
1232
|
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
1204
1233
|
};
|
|
1205
|
-
getItemProps: (index: number) => {
|
|
1234
|
+
getItemProps: (index: number, handlers?: RovingItemHandlers) => {
|
|
1206
1235
|
'data-roving-tabindex-item': boolean;
|
|
1207
1236
|
tabIndex: number;
|
|
1208
1237
|
ref: (node: HTMLElement | null) => void;
|
|
1209
|
-
onClick: () => void;
|
|
1210
|
-
onFocus: () => void;
|
|
1238
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
1239
|
+
onFocus: (event: React.FocusEvent<HTMLElement>) => void;
|
|
1211
1240
|
};
|
|
1212
1241
|
activeIndex: number;
|
|
1213
1242
|
setActiveIndex: (index: number) => void;
|
|
@@ -1412,4 +1441,4 @@ declare function useClickOutside<T extends HTMLElement>(ref: React$1.RefObject<T
|
|
|
1412
1441
|
*/
|
|
1413
1442
|
declare function cn(...inputs: ClassValue[]): string;
|
|
1414
1443
|
|
|
1415
|
-
export { type ArrowNavigationOrientation, Avatar, AvatarFallback, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, DataPanel, DataPanelContent, type DataPanelContentProps, DataPanelFooter, type DataPanelFooterProps, DataPanelHeader, type DataPanelProps, DataPanelTab, type DataPanelTabProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, type InputProps, InsertPalette, type InsertPaletteGroup, type InsertPaletteItem, type InsertPaletteProps, IssuesButton, type IssuesButtonProps, Label, LiveRegion, type LiveRegionProps, LoadingLogo, type LoadingLogoProps, LoadingOverlay, type LoadingOverlayProps, LoadingPage, type LoadingPageProps, LoadingSection, type LoadingSectionProps, PageHeader, type PageHeaderProps, PasswordInput, type PasswordInputProps, ProgressBar, type ProgressBarProps, type SaveState, SaveStatus, type SaveStatusProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, type SortableHandleProps, type SortableItemContext, SortableList, type SortableListProps, Spinner, type SpinnerProps, Studio, StudioBar, type StudioBarProps, StudioCanvas, StudioCanvasItem, type StudioCanvasItemProps, type StudioCanvasProps, type StudioContextValue, StudioInspector, type StudioInspectorProps, StudioInspectorSection, type StudioInspectorSectionProps, type StudioInspectorTab, type StudioIssue, type StudioLayout, type StudioMenuItem, type StudioMode, StudioOutline, type StudioOutlineEntry, type StudioOutlineProps, StudioPage, type StudioPageProps, type StudioProps, Switch, type SwitchProps, type UseAnnounceOptions, type UseAnnounceReturn, type UseArrowNavigationOptions, type UseClickOutsideOptions, type UseEscapeKeyOptions, type UseFocusRefOptions, type UseFocusTrapOptions, type UseRovingTabindexOptions, badgeVariants, buttonVariants, cn, pageHeaderActionsVariants, pageHeaderContainerVariants, pageHeaderSubtitleVariants, pageHeaderTitleVariants, progressBarVariants, skeletonVariants, spinnerVariants, useAnnounce, useArrowNavigation, useClickOutside, useDataPanel, useEscapeKey, useFocusRef, useFocusTrap, useReducedMotion, useRovingTabindex, useStudio };
|
|
1444
|
+
export { type ArrowNavigationOrientation, Avatar, AvatarFallback, AvatarImage, type AvatarImageProps, type AvatarProps, Badge, type BadgeProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, type CardTitleProps, DataPanel, DataPanelContent, type DataPanelContentProps, DataPanelFooter, type DataPanelFooterProps, DataPanelHeader, type DataPanelHeaderProps, type DataPanelProps, DataPanelTab, type DataPanelTabProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, type DialogSize, DialogTitle, DialogTrigger, Input, type InputProps, InsertPalette, type InsertPaletteGroup, type InsertPaletteItem, type InsertPaletteProps, IssuesButton, type IssuesButtonProps, Label, LiveRegion, type LiveRegionProps, LoadingLogo, type LoadingLogoProps, LoadingOverlay, type LoadingOverlayProps, LoadingPage, type LoadingPageProps, LoadingSection, type LoadingSectionProps, PageHeader, type PageHeaderProps, PasswordInput, type PasswordInputProps, ProgressBar, type ProgressBarProps, type SaveState, SaveStatus, type SaveStatusProps, Separator, type SeparatorProps, Sheet, type SheetProps, Skeleton, type SkeletonProps, SkipLink, type SkipLinkProps, type SortableHandleProps, type SortableItemContext, SortableList, type SortableListProps, Spinner, type SpinnerProps, Studio, StudioBar, type StudioBarProps, StudioCanvas, StudioCanvasItem, type StudioCanvasItemProps, type StudioCanvasProps, type StudioContextValue, StudioInspector, type StudioInspectorProps, StudioInspectorSection, type StudioInspectorSectionProps, type StudioInspectorTab, type StudioIssue, type StudioLayout, type StudioMenuItem, type StudioMode, StudioOutline, type StudioOutlineEntry, type StudioOutlineProps, StudioPage, type StudioPageProps, type StudioProps, Switch, type SwitchProps, type UseAnnounceOptions, type UseAnnounceReturn, type UseArrowNavigationOptions, type UseClickOutsideOptions, type UseDataPanelOptions, type UseEscapeKeyOptions, type UseFocusRefOptions, type UseFocusTrapOptions, type UseRovingTabindexOptions, badgeVariants, buttonVariants, cn, labelVariants, pageHeaderActionsVariants, pageHeaderContainerVariants, pageHeaderSubtitleVariants, pageHeaderTitleVariants, progressBarVariants, skeletonVariants, spinnerVariants, useAnnounce, useArrowNavigation, useClickOutside, useDataPanel, useEscapeKey, useFocusRef, useFocusTrap, useReducedMotion, useRovingTabindex, useStudio };
|