@databricks/design-system 2.0.1 → 2.0.3
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/CHANGELOG.md +24 -0
- package/dist/{WizardStepContentWrapper-CFCTOSm8.js → WizardStepContentWrapper-DsAS2ZAT.js} +1356 -686
- package/dist/WizardStepContentWrapper-DsAS2ZAT.js.map +1 -0
- package/dist/dubois-colors.less +2 -0
- package/dist/fonts/dm-mono/DMMono-Regular.woff2 +0 -0
- package/dist/fonts/dm-mono/dm-mono.css +11 -0
- package/dist/index-dark.css +305 -516
- package/dist/index-dark.mitigated.css +305 -516
- package/dist/index.css +438 -544
- package/dist/index.js +1971 -244
- package/dist/index.js.map +1 -1
- package/dist/index.mitigated.css +447 -553
- package/dist/patterns.js +12 -2
- package/dist/patterns.js.map +1 -1
- package/dist-types/design-system/Button/Button.d.ts +2 -2
- package/dist-types/design-system/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist-types/design-system/DesignSystemProvider/DesignSystemProvider.d.ts +44 -0
- package/dist-types/design-system/Drawer/DrawerContext.d.ts +9 -0
- package/dist-types/design-system/FormV2/RHFAdapters.d.ts +8 -8
- package/dist-types/design-system/Grid/Col.d.ts +1 -3
- package/dist-types/design-system/Grid/NativeCol.d.ts +10 -0
- package/dist-types/design-system/Grid/NativeGridContext.d.ts +11 -0
- package/dist-types/design-system/Grid/NativeRow.d.ts +13 -0
- package/dist-types/design-system/Grid/Row.d.ts +3 -4
- package/dist-types/design-system/Grid/grid-styling.d.ts +22 -0
- package/dist-types/design-system/Grid/gridConstants.d.ts +2 -0
- package/dist-types/design-system/Grid/index.d.ts +1 -0
- package/dist-types/design-system/Grid/rowConstants.d.ts +7 -0
- package/dist-types/design-system/Grid/types.d.ts +49 -0
- package/dist-types/design-system/Hooks/index.d.ts +1 -1
- package/dist-types/design-system/Hooks/useDesignSystemTheme.d.ts +7 -7
- package/dist-types/design-system/Icon/LegacyAntDIcon.d.ts +21 -0
- package/dist-types/design-system/Icon/__generated/icons/FlowsIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchAlertIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchDatasourceIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchDetectionRuleIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchParserIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/index.d.ts +5 -0
- package/dist-types/design-system/Icon/index.d.ts +0 -1
- package/dist-types/design-system/LegacyTooltip/index.d.ts +0 -1
- package/dist-types/design-system/Skeleton/TitleSkeleton.d.ts +9 -3
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxAddButton.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxCheckboxItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +2 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxFooter.d.ts +12 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMenu.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMenuItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMultiSelectInput.d.ts +17 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSectionHeader.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSeparator.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxToggleButton.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts +8 -0
- package/dist-types/design-system/TypeaheadComboboxV2/CountBadge.d.ts +6 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxAddButton.d.ts +3 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxCheckboxItem.d.ts +10 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxControls.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxFooter.d.ts +2 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxInput.d.ts +9 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMenu.d.ts +17 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMenuItem.d.ts +16 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMultiSelectInput.d.ts +18 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxRoot.d.ts +17 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSectionHeader.d.ts +1 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSelectedItem.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSeparator.d.ts +1 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxToggleButton.d.ts +4 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/footerFocus.d.ts +13 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/index.d.ts +4 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxItems.d.ts +32 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxState.d.ts +81 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxStateProps.d.ts +36 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useMultipleSelectionState.d.ts +25 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useRestoreHighlightedOption.d.ts +18 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useScrollOptionIntoView.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useTypeaheadComboboxContext.d.ts +2 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useVirtualizedComboboxScroll.d.ts +36 -0
- package/dist-types/design-system/TypeaheadComboboxV2/index.d.ts +13 -0
- package/dist-types/design-system/TypeaheadComboboxV2/providers/TypeaheadComboboxContext.d.ts +47 -0
- package/dist-types/design-system/Typography/titleLevel.d.ts +11 -0
- package/dist-types/design-system/_shared_/Menu/index.d.ts +1 -1
- package/dist-types/design-system/fonts.d.ts +1 -0
- package/dist-types/design-system/index.d.ts +1 -0
- package/dist-types/design-system/utils/useMediaQuery.d.ts +4 -1
- package/dist-types/theme/_generated/ValidSemanticColors.d.ts +2 -1
- package/package.json +14 -3
- package/dist/WizardStepContentWrapper-CFCTOSm8.js.map +0 -1
- package/dist-types/design-system/Icon/AntdIcon.d.ts +0 -114
- package/dist-types/design-system/LegacyTooltip/LegacyInfoTooltip.d.ts +0 -16
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { css } from "@emotion/react";
|
|
2
2
|
import type { UseComboboxReturnValue } from "downshift";
|
|
3
3
|
import type { Theme } from "../../theme";
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
4
8
|
export interface TypeaheadComboboxMenuItemProps<T> extends React.HTMLAttributes<HTMLElement> {
|
|
5
9
|
item: T;
|
|
6
10
|
/**
|
|
@@ -22,6 +26,10 @@ export interface TypeaheadComboboxMenuItemProps<T> extends React.HTMLAttributes<
|
|
|
22
26
|
_type?: string;
|
|
23
27
|
}
|
|
24
28
|
export declare const getMenuItemStyles: (theme: Theme, isHighlighted: boolean, disabled?: boolean) => ReturnType<typeof css>;
|
|
29
|
+
/**
|
|
30
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
31
|
+
* @deprecated
|
|
32
|
+
*/
|
|
25
33
|
export declare const TypeaheadComboboxMenuItem: <T>(props: TypeaheadComboboxMenuItemProps<T> & {
|
|
26
34
|
ref?: React.Ref<HTMLLIElement>;
|
|
27
35
|
}) => JSX.Element;
|
|
@@ -2,6 +2,10 @@ import type { UseMultipleSelectionReturnValue } from "downshift";
|
|
|
2
2
|
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
3
3
|
import type { TypeaheadComboboxInputProps } from "./TypeaheadComboboxInput";
|
|
4
4
|
import type { ComboboxStateAnalyticsReturnValue } from "./hooks";
|
|
5
|
+
/**
|
|
6
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
5
9
|
export interface TypeaheadComboboxMultiSelectInputProps<T> extends TypeaheadComboboxInputProps<T> {
|
|
6
10
|
comboboxState: ComboboxStateAnalyticsReturnValue<T>;
|
|
7
11
|
multipleSelectionState: UseMultipleSelectionReturnValue<T>;
|
|
@@ -18,5 +22,18 @@ export interface TypeaheadComboboxMultiSelectInputProps<T> extends TypeaheadComb
|
|
|
18
22
|
width?: string | number;
|
|
19
23
|
maxHeight?: string | number;
|
|
20
24
|
disableTooltip?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Height of the control while its tags fit on one row; extra rows grow it either way.
|
|
27
|
+
* Omitted is 36px, `'middle'` is 32px — the height of `Input`, `Button` and a middle
|
|
28
|
+
* `DialogComboboxTrigger`.
|
|
29
|
+
*
|
|
30
|
+
* Narrows the inherited `ButtonSize`: `'small'` (24px) is unreachable because a tag row
|
|
31
|
+
* is itself 24px tall.
|
|
32
|
+
*/
|
|
33
|
+
size?: "middle";
|
|
21
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
37
|
+
* @deprecated
|
|
38
|
+
*/
|
|
22
39
|
export declare const TypeaheadComboboxMultiSelectInput: ForwardRefExoticComponent<PropsWithoutRef<TypeaheadComboboxMultiSelectInputProps<any>> & RefAttributes<HTMLInputElement>>;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ComboboxStateAnalyticsReturnValue } from "./hooks";
|
|
3
|
+
/**
|
|
4
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
3
7
|
export interface TypeaheadComboboxRootProps<T> extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
8
|
comboboxState: ComboboxStateAnalyticsReturnValue<T>;
|
|
5
9
|
multiSelect?: boolean;
|
|
6
10
|
floatingStrategy?: "absolute" | "fixed";
|
|
7
11
|
children: React.ReactNode;
|
|
8
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
15
|
+
* @deprecated
|
|
16
|
+
*/
|
|
9
17
|
export declare const TypeaheadComboboxRoot: React.FC<React.PropsWithChildren<TypeaheadComboboxRootProps<any>>>;
|
|
10
18
|
export default TypeaheadComboboxRoot;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { type SerializedStyles } from "@emotion/react";
|
|
2
2
|
import type { UseMultipleSelectionGetSelectedItemPropsOptions } from "downshift";
|
|
3
3
|
import type { Theme } from "../../theme";
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
4
8
|
export interface TypeaheadComboboxSelectedItemProps<T> {
|
|
5
9
|
label: React.ReactNode;
|
|
6
10
|
item: any;
|
|
@@ -9,4 +13,8 @@ export interface TypeaheadComboboxSelectedItemProps<T> {
|
|
|
9
13
|
disabled?: boolean;
|
|
10
14
|
}
|
|
11
15
|
export declare const getSelectedItemStyles: (theme: Theme, disabled?: boolean) => SerializedStyles;
|
|
16
|
+
/**
|
|
17
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
12
20
|
export declare const TypeaheadComboboxSelectedItem: React.FC<React.PropsWithChildren<any>>;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
2
|
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
3
7
|
export interface DownshiftToggleButtonProps {
|
|
4
8
|
id: string;
|
|
5
9
|
onClick: (e: React.SyntheticEvent) => void;
|
|
@@ -8,5 +12,9 @@ export interface DownshiftToggleButtonProps {
|
|
|
8
12
|
interface TypeaheadComboboxToggleButtonProps extends DownshiftToggleButtonProps {
|
|
9
13
|
disabled?: boolean;
|
|
10
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
17
|
+
* @deprecated
|
|
18
|
+
*/
|
|
11
19
|
export declare const TypeaheadComboboxToggleButton: ForwardRefExoticComponent<PropsWithoutRef<TypeaheadComboboxToggleButtonProps> & RefAttributes<HTMLButtonElement>>;
|
|
12
20
|
export {};
|
|
@@ -43,9 +43,17 @@ export type ComboboxStateAnalyticsReturnValue<T> = UseComboboxReturnValue<T> & A
|
|
|
43
43
|
onView: (value: any) => void;
|
|
44
44
|
firstOnViewValue?: string;
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
46
50
|
export declare function useComboboxState<T>({ allItems, items, itemToString, onIsOpenChange, allowNewValue, formValue, formOnChange, formOnBlur, componentId, valueHasNoPii, analyticsEvents, matcher, preventUnsetOnBlur, selectedMatcher, ...props }: UseComboboxStateProps<T>): ComboboxStateAnalyticsReturnValue<T>;
|
|
47
51
|
interface AnalyticsConfig extends AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
48
52
|
itemToString?: (item: any) => string;
|
|
49
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
56
|
+
* @deprecated
|
|
57
|
+
*/
|
|
50
58
|
export declare function useMultipleSelectionState<T>(selectedItems: T[], setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>, { componentId, analyticsEvents, valueHasNoPii, itemToString }: AnalyticsConfig): UseMultipleSelectionReturnValue<T>;
|
|
51
59
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface CountBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
2
|
+
countStartAt?: number;
|
|
3
|
+
totalCount: number;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const CountBadge: ({ countStartAt, totalCount, disabled, ...restProps }: CountBadgeProps) => JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TypeaheadComboboxMenuItemProps } from "./TypeaheadComboboxMenuItem";
|
|
2
|
+
export interface TypeaheadComboboxCheckboxItemProps<T> extends TypeaheadComboboxMenuItemProps<T> {
|
|
3
|
+
/** Custom equality check for "is this item in selectedItems"; falls back to context key lookup. */
|
|
4
|
+
selectedMatcher?: (a: T, b: T) => boolean;
|
|
5
|
+
/** Required for `selectedMatcher` to function — kept for API parity with the original. */
|
|
6
|
+
selectedItems?: T[];
|
|
7
|
+
}
|
|
8
|
+
export declare const TypeaheadComboboxCheckboxItem: <T>(props: TypeaheadComboboxCheckboxItemProps<T> & {
|
|
9
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
10
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface TypeaheadComboboxControlsProps {
|
|
2
|
+
showClearSelectionButton?: boolean;
|
|
3
|
+
showComboboxToggleButton?: boolean;
|
|
4
|
+
handleClear?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
/** When true, renders as an inline flex container for use inside AntD's suffix slot. */
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const TypeaheadComboboxControls: ({ showClearSelectionButton, showComboboxToggleButton, handleClear, disabled, loading, inline, className }: TypeaheadComboboxControlsProps) => JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
import type { InputProps } from "../Input";
|
|
3
|
+
export interface TypeaheadComboboxInputProps extends Omit<InputProps, "componentId" | "analyticsEvents"> {
|
|
4
|
+
allowClear?: boolean;
|
|
5
|
+
showComboboxToggleButton?: boolean;
|
|
6
|
+
/** When true, replaces the dropdown toggle button with a spinner. */
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const TypeaheadComboboxInput: ForwardRefExoticComponent<TypeaheadComboboxInputProps & RefAttributes<HTMLInputElement | null>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, HTMLAttributes, ReactNode, Ref, RefAttributes } from "react";
|
|
2
|
+
export interface TypeaheadComboboxMenuProps extends HTMLAttributes<HTMLUListElement> {
|
|
3
|
+
loading?: boolean;
|
|
4
|
+
emptyText?: string | ReactNode;
|
|
5
|
+
width?: number | string;
|
|
6
|
+
minWidth?: number | string;
|
|
7
|
+
maxWidth?: number | string;
|
|
8
|
+
minHeight?: number | string;
|
|
9
|
+
maxHeight?: number | string;
|
|
10
|
+
/** For react-virtual integration: pass `virtualizer.getTotalSize()` (or `totalSize`). */
|
|
11
|
+
listWrapperHeight?: number;
|
|
12
|
+
/** For react-virtual integration: ref to the scrollable parent (the listbox `<ul>`). Merged with the listbox ref. */
|
|
13
|
+
virtualizerRef?: Ref<HTMLUListElement>;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
matchTriggerWidth?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const TypeaheadComboboxMenu: ForwardRefExoticComponent<TypeaheadComboboxMenuProps & RefAttributes<HTMLElement | null>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SerializedStyles } from "@emotion/react";
|
|
2
|
+
import type { Theme } from "../../theme";
|
|
3
|
+
export interface TypeaheadComboboxMenuItemProps<T> extends React.HTMLAttributes<HTMLLIElement> {
|
|
4
|
+
item: T;
|
|
5
|
+
/** Kept for API parity with the original; not consumed by react-aria's useOption. */
|
|
6
|
+
index?: number;
|
|
7
|
+
textOverflowMode?: "ellipsis" | "multiline";
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
disabledReason?: React.ReactNode;
|
|
10
|
+
hintContent?: React.ReactNode;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const getMenuItemStyles: (theme: Theme, isHighlighted: boolean, disabled?: boolean) => SerializedStyles;
|
|
14
|
+
export declare const TypeaheadComboboxMenuItem: <T>(props: TypeaheadComboboxMenuItemProps<T> & {
|
|
15
|
+
ref?: React.Ref<HTMLLIElement>;
|
|
16
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ValidationState } from "../types";
|
|
2
|
+
export interface TypeaheadComboboxMultiSelectInputProps<T> extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
selectedItems: T[];
|
|
4
|
+
setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>;
|
|
5
|
+
getSelectedItemLabel: (item: T) => React.ReactNode;
|
|
6
|
+
allowClear?: boolean;
|
|
7
|
+
showComboboxToggleButton?: boolean;
|
|
8
|
+
loading?: boolean;
|
|
9
|
+
/** Tag overflow threshold: number (default 20) or 'responsive' to fit naturally on one line. */
|
|
10
|
+
showTagAfterValueCount?: number | "responsive";
|
|
11
|
+
width?: string | number;
|
|
12
|
+
maxHeight?: string | number;
|
|
13
|
+
disableTooltip?: boolean;
|
|
14
|
+
validationState?: ValidationState;
|
|
15
|
+
}
|
|
16
|
+
export declare const TypeaheadComboboxMultiSelectInput: <T>(props: TypeaheadComboboxMultiSelectInputProps<T> & {
|
|
17
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
18
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
import type { ComboboxStateValue } from "./hooks/useComboboxState";
|
|
3
|
+
export interface TypeaheadComboboxRootProps<T> extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Result of `useComboboxState({...})`. */
|
|
5
|
+
comboboxState: ComboboxStateValue<T>;
|
|
6
|
+
"aria-label"?: string;
|
|
7
|
+
/**
|
|
8
|
+
* When true (the default), Tab from the input moves DOM focus into the footer's first focusable
|
|
9
|
+
* control (menu stays open), and Shift+Tab / Escape from the footer returns focus to the input.
|
|
10
|
+
* Makes a real footer <button> keyboard/SR-reachable. A footer with no focusable control (e.g. a
|
|
11
|
+
* text-only footer) is unaffected — Tab falls through to the normal commit-and-close. Set to false
|
|
12
|
+
* only to opt a combobox out and keep the input as the sole tab stop.
|
|
13
|
+
*/
|
|
14
|
+
footerFocusable?: boolean;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const TypeaheadComboboxRoot: ForwardRefExoticComponent<TypeaheadComboboxRootProps<any> & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TypeaheadComboboxSectionHeader: ({ children, ...props }: React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SerializedStyles } from "@emotion/react";
|
|
2
|
+
import type { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
3
|
+
import type { Theme } from "../../theme";
|
|
4
|
+
export interface TypeaheadComboboxSelectedItemProps {
|
|
5
|
+
label: React.ReactNode;
|
|
6
|
+
/** The raw selected item — used to look up its key in the context's `itemsByKey`. */
|
|
7
|
+
item: unknown;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const getSelectedItemStyles: (theme: Theme, disabled?: boolean) => SerializedStyles;
|
|
11
|
+
export declare const TypeaheadComboboxSelectedItem: ForwardRefExoticComponent<TypeaheadComboboxSelectedItemProps & RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TypeaheadComboboxSeparator: (props: React.HTMLAttributes<HTMLDivElement>) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus the first tabbable control in `container`. Returns true only if focus actually moved onto a
|
|
3
|
+
* control inside `container` — react-aria skips non-visible/inert nodes and `.focus()` on them is a
|
|
4
|
+
* no-op, so we confirm against the resulting element rather than assuming a query match succeeded.
|
|
5
|
+
*/
|
|
6
|
+
export declare function focusFirstFocusable(container: HTMLElement | null): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Step focus to the adjacent tabbable control within `container`, starting from the currently focused
|
|
9
|
+
* element. Returns true if focus moved to another control in `container`; false when there is none in
|
|
10
|
+
* that direction (Shift+Tab from the first control, or forward Tab from the last) — the caller's cue
|
|
11
|
+
* to return focus to the input instead of letting it escape the popover.
|
|
12
|
+
*/
|
|
13
|
+
export declare function focusAdjacentFocusable(container: HTMLElement | null, direction: "next" | "previous"): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Key } from "@react-types/shared";
|
|
2
|
+
export type WrappedItem<T> = {
|
|
3
|
+
id: Key;
|
|
4
|
+
value: T;
|
|
5
|
+
};
|
|
6
|
+
/** JSON-encode a list of items by their display strings (the multi-select analytics value shape). */
|
|
7
|
+
export declare const mapItemsToString: <T>(items: T[], itemToString: (item: T | null) => string) => string;
|
|
8
|
+
interface UseComboboxItemsParams<T> {
|
|
9
|
+
allItems: T[];
|
|
10
|
+
itemToString?: (item: T) => string;
|
|
11
|
+
getKey?: (item: T) => Key;
|
|
12
|
+
}
|
|
13
|
+
export interface ComboboxItems<T> {
|
|
14
|
+
itemToString: (item: T | null | undefined) => string;
|
|
15
|
+
getKey: (item: T) => Key;
|
|
16
|
+
wrappedItems: WrappedItem<T>[];
|
|
17
|
+
itemsByKey: Map<Key, T>;
|
|
18
|
+
/**
|
|
19
|
+
* textValue → every item sharing that display string. react-aria's `defaultFilter` receives only
|
|
20
|
+
* the display string (not the key), so items that map to the same `itemToString` are
|
|
21
|
+
* indistinguishable to the filter; the custom-matcher path matches the label if any backing item
|
|
22
|
+
* matches.
|
|
23
|
+
*/
|
|
24
|
+
itemsByTextValue: Map<string, T[]>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Item ↔ key/string mapping for the TypeaheadCombobox: resolves each item's display string and
|
|
28
|
+
* key, wraps items for react-aria's collection, and builds the key/text lookup maps. Warns in dev
|
|
29
|
+
* when two items collapse to the same key.
|
|
30
|
+
*/
|
|
31
|
+
export declare function useComboboxItems<T>({ allItems, itemToString: itemToStringProp, getKey: getKeyProp }: UseComboboxItemsParams<T>): ComboboxItems<T>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ComboBoxState, SelectionMode } from "@react-stately/combobox";
|
|
2
|
+
import type { Key } from "@react-types/shared";
|
|
3
|
+
import { type WrappedItem } from "./useComboboxItems";
|
|
4
|
+
import { DesignSystemEventProviderAnalyticsEventTypes } from "../../DesignSystemEventProvider";
|
|
5
|
+
import type { AnalyticsEventValueChangeNoPiiFlagProps } from "../../types";
|
|
6
|
+
interface BaseComboboxStateProps<T> extends AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
7
|
+
allItems: T[];
|
|
8
|
+
itemToString?: (item: T) => string;
|
|
9
|
+
getKey?: (item: T) => Key;
|
|
10
|
+
matcher?: (item: T, lowerCasedInputValue: string) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Predicate marking items the user cannot select. react-aria enforces non-selection via the
|
|
13
|
+
* state's `disabledKeys`, so disabled must be declared here (a `<MenuItem isDisabled>` only
|
|
14
|
+
* styles the row — it can't block selection on its own).
|
|
15
|
+
*/
|
|
16
|
+
isItemDisabled?: (item: T) => boolean;
|
|
17
|
+
allowNewValue?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Single-select only: open the menu showing the full option list (even with a value selected), and
|
|
20
|
+
* filter only once the user types. Multi-select clears the input on select, so it is unaffected.
|
|
21
|
+
*/
|
|
22
|
+
showAllOptionsOnOpen?: boolean;
|
|
23
|
+
initialInputValue?: string;
|
|
24
|
+
initialSelectedItem?: T;
|
|
25
|
+
formValue?: T;
|
|
26
|
+
formOnChange?: (value: T | null) => void;
|
|
27
|
+
formOnBlur?: (value: T | null) => void;
|
|
28
|
+
onStateChange?: (change: {
|
|
29
|
+
type: "select" | "input" | "open" | "close";
|
|
30
|
+
selectedItem: T | null;
|
|
31
|
+
inputValue: string;
|
|
32
|
+
}) => void;
|
|
33
|
+
onIsOpenChange?: (isOpen: boolean) => void;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated No-op under react-aria. Blur never clears the selection (it only re-syncs the
|
|
36
|
+
* input text), and closing on blur is required for non-modal popover dismissal, so this flag
|
|
37
|
+
* is ignored. Kept only for source compatibility with the original API.
|
|
38
|
+
*/
|
|
39
|
+
preventUnsetOnBlur?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface SingleSelectComboboxStateProps<T> extends BaseComboboxStateProps<T> {
|
|
42
|
+
multiSelect?: false;
|
|
43
|
+
}
|
|
44
|
+
export interface MultiSelectComboboxStateProps<T> extends BaseComboboxStateProps<T> {
|
|
45
|
+
multiSelect: true;
|
|
46
|
+
selectedItems: T[];
|
|
47
|
+
setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>;
|
|
48
|
+
}
|
|
49
|
+
export type UseComboboxStateProps<T> = SingleSelectComboboxStateProps<T> | MultiSelectComboboxStateProps<T>;
|
|
50
|
+
export interface ComboboxStateValue<T> {
|
|
51
|
+
state: ComboBoxState<WrappedItem<T>, SelectionMode>;
|
|
52
|
+
itemsByKey: Map<Key, T>;
|
|
53
|
+
getKeyForItem: (item: T) => Key;
|
|
54
|
+
itemToString: (item: T | null | undefined) => string;
|
|
55
|
+
selectedItems: T[];
|
|
56
|
+
selectedKeys: Set<Key>;
|
|
57
|
+
/** Items remaining after react-aria's `defaultFilter` runs against the current `state.inputValue`. */
|
|
58
|
+
filteredItems: T[];
|
|
59
|
+
removeItem: (item: T) => void;
|
|
60
|
+
removeByKey: (key: Key) => void;
|
|
61
|
+
clearSelection: () => void;
|
|
62
|
+
isSelected: (item: T) => boolean;
|
|
63
|
+
/** Fire the consumer's `formOnBlur` on a genuine input blur (wired onto the input by `Root`). */
|
|
64
|
+
onInputBlur: () => void;
|
|
65
|
+
componentId: string;
|
|
66
|
+
analyticsEvents?: DesignSystemEventProviderAnalyticsEventTypes[];
|
|
67
|
+
valueHasNoPii?: boolean;
|
|
68
|
+
onView: (value: any) => void;
|
|
69
|
+
firstOnViewValue?: string;
|
|
70
|
+
multiSelect: boolean;
|
|
71
|
+
showAllOptionsOnOpen: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Backs the Du Bois TypeaheadCombobox (react-aria variant) by wrapping react-aria's
|
|
75
|
+
* `useComboBoxState`. Handles single- and multi-select modes, item↔key mapping, filtering
|
|
76
|
+
* (default substring match or a custom `matcher`), selection helpers (`removeItem`,
|
|
77
|
+
* `clearSelection`, `isSelected`), form `onChange`/`onBlur` bridging, and analytics wiring.
|
|
78
|
+
* The returned object is what the `Root`/`Input`/`Menu` subtree consumes via context.
|
|
79
|
+
*/
|
|
80
|
+
export declare function useComboboxState<T>(props: UseComboboxStateProps<T>): ComboboxStateValue<T>;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComboBoxState, ComboBoxStateOptions, SelectionMode } from "@react-stately/combobox";
|
|
2
|
+
import type { MutableRefObject } from "react";
|
|
3
|
+
import { type ComboboxItems, type WrappedItem } from "./useComboboxItems";
|
|
4
|
+
interface UseComboboxStatePropsParams<T> {
|
|
5
|
+
items: ComboboxItems<T>;
|
|
6
|
+
multiSelect: boolean;
|
|
7
|
+
matcher?: (item: T, lowerCasedInputValue: string) => boolean;
|
|
8
|
+
isItemDisabled?: (item: T) => boolean;
|
|
9
|
+
allowNewValue: boolean;
|
|
10
|
+
initialInputValue?: string;
|
|
11
|
+
initialSelectedItem?: T;
|
|
12
|
+
formValue?: T;
|
|
13
|
+
formOnChange?: (value: T | null) => void;
|
|
14
|
+
onStateChange?: (change: {
|
|
15
|
+
type: "select" | "input" | "open" | "close";
|
|
16
|
+
selectedItem: T | null;
|
|
17
|
+
inputValue: string;
|
|
18
|
+
}) => void;
|
|
19
|
+
onIsOpenChange?: (isOpen: boolean) => void;
|
|
20
|
+
/** Controlled selected items for multi-select; null for single-select. */
|
|
21
|
+
externalSelectedItems: T[] | null;
|
|
22
|
+
/** Setter for controlled multi-select; null for single-select. */
|
|
23
|
+
externalSetSelectedItems: React.Dispatch<React.SetStateAction<T[]>> | null;
|
|
24
|
+
/** Live ref to the created state, so the selection handler can imperatively clear the input. */
|
|
25
|
+
stateRef: MutableRefObject<ComboBoxState<WrappedItem<T>, SelectionMode> | null>;
|
|
26
|
+
onValueChange?: (value: string) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Assembles the `ComboBoxStateOptions` passed to react-aria's `useComboBoxState`: the filter, the
|
|
30
|
+
* disabled-keys set, the controlled/uncontrolled selection value, the initial (uncontrolled) input
|
|
31
|
+
* text, and the selection/input/open change handlers (including analytics + multi-select
|
|
32
|
+
* input-reset). Kept separate from `useComboboxState` so the wiring into react-aria is isolated
|
|
33
|
+
* from the selection helpers the hook derives afterward.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useComboboxStateProps<T>({ items, multiSelect, matcher, isItemDisabled, allowNewValue, initialInputValue, initialSelectedItem, formValue, formOnChange, onStateChange, onIsOpenChange, externalSelectedItems, externalSetSelectedItems, stateRef, onValueChange }: UseComboboxStatePropsParams<T>): ComboBoxStateOptions<WrappedItem<T>, SelectionMode>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Key } from "@react-types/shared";
|
|
2
|
+
import { DesignSystemEventProviderAnalyticsEventTypes } from "../../DesignSystemEventProvider";
|
|
3
|
+
import type { AnalyticsEventValueChangeNoPiiFlagProps } from "../../types";
|
|
4
|
+
export interface UseMultipleSelectionStateConfig<T> extends AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
5
|
+
itemToString?: (item: T) => string;
|
|
6
|
+
getKey?: (item: T) => Key;
|
|
7
|
+
}
|
|
8
|
+
export interface MultipleSelectionStateReturn<T> {
|
|
9
|
+
selectedItems: T[];
|
|
10
|
+
/** Stable Set of keys for currently-selected items — used by CheckboxItem to render the checked state quickly. */
|
|
11
|
+
selectedKeys: Set<Key>;
|
|
12
|
+
addItem: (item: T) => void;
|
|
13
|
+
removeItem: (item: T) => void;
|
|
14
|
+
removeByKey: (key: Key) => void;
|
|
15
|
+
clear: () => void;
|
|
16
|
+
/** Lookup helper. */
|
|
17
|
+
isSelected: (item: T) => boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Companion hook to `useComboboxState` in multi-select mode. Returns chip-management helpers
|
|
21
|
+
* keyed off the consumer-owned `selectedItems` array, plus analytics wiring. Mostly redundant —
|
|
22
|
+
* the state hook already exposes `removeItem`/`removeByKey`/`clearSelection` — but kept for API
|
|
23
|
+
* parity with the original.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useMultipleSelectionState<T>(selectedItems: T[], setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>, { componentId, analyticsEvents, valueHasNoPii, itemToString, getKey }: UseMultipleSelectionStateConfig<T>): MultipleSelectionStateReturn<T>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComboBoxState, SelectionMode } from "@react-stately/combobox";
|
|
2
|
+
import type { WrappedItem } from "./useComboboxItems";
|
|
3
|
+
/**
|
|
4
|
+
* Keeps an option highlighted while the menu is open so Enter commits it, matching the original
|
|
5
|
+
* downshift variant's `defaultHighlightedIndex: 0`. react-aria clears the focused key on every input
|
|
6
|
+
* change (useComboBoxState: "Clear focused key when input value changes"), and its `commit()` only
|
|
7
|
+
* selects when `focusedKey != null` — so without this, typing leaves nothing highlighted and Enter
|
|
8
|
+
* falls through to commitValue(), selecting nothing.
|
|
9
|
+
*
|
|
10
|
+
* Only re-focuses when nothing is focused, so arrowing or hovering to another option sticks and we
|
|
11
|
+
* merely restore the default after react-aria drops it. Keyed on the collection so it re-runs as
|
|
12
|
+
* filtering narrows the list. Skipped when `allowNewValue`: there Enter commits the typed text, so
|
|
13
|
+
* pre-highlighting an option would hijack it and select the option instead.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRestoreHighlightedOption<T>(state: ComboBoxState<WrappedItem<T>, SelectionMode>, { allowNewValue, showAllOptionsOnOpen }: {
|
|
16
|
+
allowNewValue: boolean;
|
|
17
|
+
showAllOptionsOnOpen: boolean;
|
|
18
|
+
}): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Scrolls the focused option into view while the combobox is open. react-aria keeps DOM focus on
|
|
4
|
+
* the input (options are highlighted via `aria-activedescendant`), so the listbox does not get
|
|
5
|
+
* native focus scrolling for the active option. Shared by the menu item and checkbox item.
|
|
6
|
+
*
|
|
7
|
+
* This handles the non-virtualized path in full, and final-pixel alignment for a virtualized row
|
|
8
|
+
* once it is mounted. It cannot reach an option that isn't rendered — under virtualization the
|
|
9
|
+
* consumer additionally wires `useVirtualizedComboboxScroll`, which mounts the off-screen row first.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useScrollOptionIntoView(itemRef: RefObject<HTMLElement | null>, isFocused: boolean, isOpen: boolean): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComboBoxState, SelectionMode } from "@react-stately/combobox";
|
|
2
|
+
import type { Key } from "@react-types/shared";
|
|
3
|
+
import type { WrappedItem } from "./useComboboxItems";
|
|
4
|
+
interface UseVirtualizedComboboxScrollParams<T> {
|
|
5
|
+
/** The react-aria combobox state (`comboboxState.state`). */
|
|
6
|
+
state: ComboBoxState<WrappedItem<T>, SelectionMode>;
|
|
7
|
+
/** Post-filter items, index-aligned with the react-virtual `size`. */
|
|
8
|
+
filteredItems: T[];
|
|
9
|
+
/** Same key resolver the combobox uses (`comboboxState.getKeyForItem`). */
|
|
10
|
+
getKey: (item: T) => Key;
|
|
11
|
+
/**
|
|
12
|
+
* The react-virtual (v2) / TanStack Virtual (v3) instance. Only `scrollToIndex` is used, typed
|
|
13
|
+
* structurally so the design-system does not couple to a specific virtualization library version.
|
|
14
|
+
*/
|
|
15
|
+
virtualizer: {
|
|
16
|
+
scrollToIndex: (index: number) => void;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Scrolls the virtually-focused option into view when it is NOT currently rendered. Under
|
|
21
|
+
* virtualization only a window of options is in the DOM, so react-aria's own scroll-into-view (and
|
|
22
|
+
* our per-item `useScrollOptionIntoView`) can't reach an option that hasn't mounted — arrowing past
|
|
23
|
+
* the rendered window would otherwise appear to do nothing. This bridges react-aria's
|
|
24
|
+
* `selectionManager.focusedKey` to the consumer's virtualizer so the row mounts and scrolls in.
|
|
25
|
+
*
|
|
26
|
+
* Consumer-invoked (the consumer owns the virtualizer instance).
|
|
27
|
+
*
|
|
28
|
+
* The effect keys ONLY on `focusedKey`/`isOpen` — i.e. it runs when the *active option* changes,
|
|
29
|
+
* not on every render. This is essential: `useVirtual` returns a new `virtualizer` object on every
|
|
30
|
+
* render and re-renders on every scroll frame, so depending on it would re-fire `scrollToIndex` on
|
|
31
|
+
* each scroll tick and fight the user's scrollbar drag. The mutable inputs are read through a ref
|
|
32
|
+
* instead. Hovering an option also moves `focusedKey`, but a hovered option is by definition already
|
|
33
|
+
* rendered/visible, so `scrollToIndex` (align "auto") is a no-op for it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useVirtualizedComboboxScroll<T>({ state, filteredItems, getKey, virtualizer }: UseVirtualizedComboboxScrollParams<T>): void;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { TypeaheadComboboxRoot } from "./TypeaheadComboboxRoot";
|
|
2
|
+
export { TypeaheadComboboxMenu } from "./TypeaheadComboboxMenu";
|
|
3
|
+
export { TypeaheadComboboxMenuItem } from "./TypeaheadComboboxMenuItem";
|
|
4
|
+
export { TypeaheadComboboxCheckboxItem } from "./TypeaheadComboboxCheckboxItem";
|
|
5
|
+
export { TypeaheadComboboxInput } from "./TypeaheadComboboxInput";
|
|
6
|
+
export { TypeaheadComboboxMultiSelectInput } from "./TypeaheadComboboxMultiSelectInput";
|
|
7
|
+
export { TypeaheadComboboxSectionHeader } from "./TypeaheadComboboxSectionHeader";
|
|
8
|
+
export { TypeaheadComboboxSelectedItem } from "./TypeaheadComboboxSelectedItem";
|
|
9
|
+
export { TypeaheadComboboxSeparator } from "./TypeaheadComboboxSeparator";
|
|
10
|
+
export { TypeaheadComboboxToggleButton } from "./TypeaheadComboboxToggleButton";
|
|
11
|
+
export { TypeaheadComboboxFooter } from "./TypeaheadComboboxFooter";
|
|
12
|
+
export { TypeaheadComboboxAddButton } from "./TypeaheadComboboxAddButton";
|
|
13
|
+
export * from "./hooks";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { AriaButtonProps } from "@react-aria/button";
|
|
2
|
+
import type { AriaListBoxOptions } from "@react-aria/listbox";
|
|
3
|
+
import type { ComboBoxState, SelectionMode } from "@react-stately/combobox";
|
|
4
|
+
import type { Key } from "@react-types/shared";
|
|
5
|
+
import { type InputHTMLAttributes, type MutableRefObject, type RefObject } from "react";
|
|
6
|
+
import type { DesignSystemEventProviderAnalyticsEventTypes } from "../../DesignSystemEventProvider/DesignSystemEventProvider";
|
|
7
|
+
import type { AnalyticsEventProps } from "../../types";
|
|
8
|
+
import type { WrappedItem } from "../hooks/useComboboxItems";
|
|
9
|
+
export interface TypeaheadComboboxV2ContextType extends AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
10
|
+
isInsideTypeaheadCombobox: boolean;
|
|
11
|
+
multiSelect: boolean;
|
|
12
|
+
/** Single-select only: whether the menu opens showing all options (filtering begins on type). */
|
|
13
|
+
showAllOptionsOnOpen: boolean;
|
|
14
|
+
/** Null outside of a Root. */
|
|
15
|
+
comboBoxState: ComboBoxState<WrappedItem<unknown>, SelectionMode> | null;
|
|
16
|
+
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
17
|
+
/** `AriaListBoxOptions` (input to `useListBox`), not DOM-spreadable. */
|
|
18
|
+
listBoxProps: AriaListBoxOptions<WrappedItem<unknown>>;
|
|
19
|
+
buttonProps: AriaButtonProps;
|
|
20
|
+
inputRef: MutableRefObject<HTMLInputElement | null>;
|
|
21
|
+
listBoxRef: RefObject<HTMLUListElement>;
|
|
22
|
+
popoverRef: MutableRefObject<HTMLDivElement | null>;
|
|
23
|
+
buttonRef: MutableRefObject<HTMLButtonElement | null>;
|
|
24
|
+
triggerRef: MutableRefObject<HTMLDivElement | null>;
|
|
25
|
+
/**
|
|
26
|
+
* PROTOTYPE (DUBOIS-455, "Option A"): opt-in that lets DOM focus genuinely move from the input to
|
|
27
|
+
* the footer and back, so a real footer <button> is keyboard/SR-reachable. Off by default; the
|
|
28
|
+
* default combobox keeps the input as the sole tab stop. See the FooterFocusMove debug story.
|
|
29
|
+
*/
|
|
30
|
+
footerFocusable: boolean;
|
|
31
|
+
/** Set by the footer when `footerFocusable` — the popover node holding the footer's controls. */
|
|
32
|
+
footerRef: MutableRefObject<HTMLDivElement | null>;
|
|
33
|
+
triggerWidth: number | undefined;
|
|
34
|
+
setTriggerWidth: (width: number) => void;
|
|
35
|
+
itemsByKey: Map<Key, unknown>;
|
|
36
|
+
getKeyForItem: (item: unknown) => Key;
|
|
37
|
+
itemToString: (item: unknown) => string;
|
|
38
|
+
removeByKey: (key: Key) => void;
|
|
39
|
+
clearSelection: () => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const TypeaheadComboboxV2Context: React.Context<TypeaheadComboboxV2ContextType>;
|
|
42
|
+
interface ProviderProps {
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
value: Omit<TypeaheadComboboxV2ContextType, "triggerWidth" | "setTriggerWidth">;
|
|
45
|
+
}
|
|
46
|
+
export declare const TypeaheadComboboxV2ContextProvider: ({ children, value }: ProviderProps) => JSX.Element;
|
|
47
|
+
export {};
|