@databricks/design-system 2.0.0 → 2.0.2

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.
Files changed (61) hide show
  1. package/AGENTS.md +473 -0
  2. package/CHANGELOG.md +5 -0
  3. package/README.md +5 -3
  4. package/dist/{WizardStepContentWrapper-Dvdj_FRA.js → WizardStepContentWrapper-DnwQIMN1.js} +787 -193
  5. package/dist/WizardStepContentWrapper-DnwQIMN1.js.map +1 -0
  6. package/dist/dubois-colors.less +2 -0
  7. package/dist/index-dark.css +10 -319
  8. package/dist/index-dark.mitigated.css +10 -319
  9. package/dist/index.css +61 -279
  10. package/dist/index.js +1809 -155
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mitigated.css +61 -279
  13. package/dist/patterns.js +10 -1
  14. package/dist/patterns.js.map +1 -1
  15. package/dist-types/design-system/Button/Button.d.ts +2 -2
  16. package/dist-types/design-system/Drawer/DrawerContext.d.ts +9 -0
  17. package/dist-types/design-system/FormV2/RHFAdapters.d.ts +8 -8
  18. package/dist-types/design-system/Grid/Col.d.ts +2 -2
  19. package/dist-types/design-system/Grid/Row.d.ts +2 -2
  20. package/dist-types/design-system/Icon/__generated/icons/FlowsIcon.d.ts +4 -0
  21. package/dist-types/design-system/Icon/__generated/icons/LakewatchAlertIcon.d.ts +4 -0
  22. package/dist-types/design-system/Icon/__generated/icons/LakewatchDatasourceIcon.d.ts +4 -0
  23. package/dist-types/design-system/Icon/__generated/icons/LakewatchDetectionRuleIcon.d.ts +4 -0
  24. package/dist-types/design-system/Icon/__generated/icons/LakewatchParserIcon.d.ts +4 -0
  25. package/dist-types/design-system/Icon/__generated/icons/index.d.ts +5 -0
  26. package/dist-types/design-system/LegacyTooltip/index.d.ts +0 -1
  27. package/dist-types/design-system/Skeleton/TitleSkeleton.d.ts +9 -3
  28. package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +2 -0
  29. package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMultiSelectInput.d.ts +9 -0
  30. package/dist-types/design-system/TypeaheadComboboxReactAria/CountBadge.d.ts +6 -0
  31. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxAddButton.d.ts +3 -0
  32. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxCheckboxItem.d.ts +10 -0
  33. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxControls.d.ts +11 -0
  34. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxFooter.d.ts +2 -0
  35. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxInput.d.ts +9 -0
  36. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxMenu.d.ts +17 -0
  37. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxMenuItem.d.ts +16 -0
  38. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxMultiSelectInput.d.ts +18 -0
  39. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxRoot.d.ts +17 -0
  40. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxSectionHeader.d.ts +1 -0
  41. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxSelectedItem.d.ts +11 -0
  42. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxSeparator.d.ts +1 -0
  43. package/dist-types/design-system/TypeaheadComboboxReactAria/TypeaheadComboboxToggleButton.d.ts +4 -0
  44. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/footerFocus.d.ts +13 -0
  45. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/index.d.ts +4 -0
  46. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useComboboxItems.d.ts +32 -0
  47. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useComboboxState.d.ts +75 -0
  48. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useComboboxStateProps.d.ts +36 -0
  49. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useMultipleSelectionState.d.ts +25 -0
  50. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useScrollOptionIntoView.d.ts +11 -0
  51. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useTypeaheadComboboxContext.d.ts +2 -0
  52. package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useVirtualizedComboboxScroll.d.ts +36 -0
  53. package/dist-types/design-system/TypeaheadComboboxReactAria/index.d.ts +13 -0
  54. package/dist-types/design-system/TypeaheadComboboxReactAria/providers/TypeaheadComboboxContext.d.ts +45 -0
  55. package/dist-types/design-system/Typography/titleLevel.d.ts +11 -0
  56. package/dist-types/design-system/index.d.ts +1 -0
  57. package/dist-types/design-system/utils/useMediaQuery.d.ts +4 -1
  58. package/dist-types/theme/_generated/ValidSemanticColors.d.ts +2 -1
  59. package/package.json +14 -3
  60. package/dist/WizardStepContentWrapper-Dvdj_FRA.js.map +0 -1
  61. package/dist-types/design-system/LegacyTooltip/LegacyInfoTooltip.d.ts +0 -16
@@ -18,5 +18,14 @@ export interface TypeaheadComboboxMultiSelectInputProps<T> extends TypeaheadComb
18
18
  width?: string | number;
19
19
  maxHeight?: string | number;
20
20
  disableTooltip?: boolean;
21
+ /**
22
+ * Height of the control while its tags fit on one row; extra rows grow it either way.
23
+ * Omitted is 36px, `'middle'` is 32px — the height of `Input`, `Button` and a middle
24
+ * `DialogComboboxTrigger`.
25
+ *
26
+ * Narrows the inherited `ButtonSize`: `'small'` (24px) is unreachable because a tag row
27
+ * is itself 24px tall.
28
+ */
29
+ size?: "middle";
21
30
  }
22
31
  export declare const TypeaheadComboboxMultiSelectInput: ForwardRefExoticComponent<PropsWithoutRef<TypeaheadComboboxMultiSelectInputProps<any>> & RefAttributes<HTMLInputElement>>;
@@ -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,3 @@
1
+ import type { ForwardRefExoticComponent, RefAttributes } from "react";
2
+ import type { ButtonProps } from "../Button";
3
+ export declare const TypeaheadComboboxAddButton: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>;
@@ -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,2 @@
1
+ export type TypeaheadComboboxFooterProps = React.HTMLAttributes<HTMLDivElement>;
2
+ export declare const TypeaheadComboboxFooter: ({ children, onKeyDown, ...restProps }: TypeaheadComboboxFooterProps) => 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,4 @@
1
+ export interface TypeaheadComboboxToggleButtonProps {
2
+ disabled?: boolean;
3
+ }
4
+ export declare const TypeaheadComboboxToggleButton: ({ disabled }: TypeaheadComboboxToggleButtonProps) => 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,4 @@
1
+ export * from "./useComboboxState";
2
+ export * from "./useMultipleSelectionState";
3
+ export * from "./useTypeaheadComboboxContext";
4
+ export * from "./useVirtualizedComboboxScroll";
@@ -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,75 @@
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
+ initialInputValue?: string;
19
+ initialSelectedItem?: T;
20
+ formValue?: T;
21
+ formOnChange?: (value: T | null) => void;
22
+ formOnBlur?: (value: T | null) => void;
23
+ onStateChange?: (change: {
24
+ type: "select" | "input" | "open" | "close";
25
+ selectedItem: T | null;
26
+ inputValue: string;
27
+ }) => void;
28
+ onIsOpenChange?: (isOpen: boolean) => void;
29
+ /**
30
+ * @deprecated No-op under react-aria. Blur never clears the selection (it only re-syncs the
31
+ * input text), and closing on blur is required for non-modal popover dismissal, so this flag
32
+ * is ignored. Kept only for source compatibility with the original API.
33
+ */
34
+ preventUnsetOnBlur?: boolean;
35
+ }
36
+ export interface SingleSelectComboboxStateProps<T> extends BaseComboboxStateProps<T> {
37
+ multiSelect?: false;
38
+ }
39
+ export interface MultiSelectComboboxStateProps<T> extends BaseComboboxStateProps<T> {
40
+ multiSelect: true;
41
+ selectedItems: T[];
42
+ setSelectedItems: React.Dispatch<React.SetStateAction<T[]>>;
43
+ }
44
+ export type UseComboboxStateProps<T> = SingleSelectComboboxStateProps<T> | MultiSelectComboboxStateProps<T>;
45
+ export interface ComboboxStateValue<T> {
46
+ state: ComboBoxState<WrappedItem<T>, SelectionMode>;
47
+ itemsByKey: Map<Key, T>;
48
+ getKeyForItem: (item: T) => Key;
49
+ itemToString: (item: T | null | undefined) => string;
50
+ selectedItems: T[];
51
+ selectedKeys: Set<Key>;
52
+ /** Items remaining after react-aria's `defaultFilter` runs against the current `state.inputValue`. */
53
+ filteredItems: T[];
54
+ removeItem: (item: T) => void;
55
+ removeByKey: (key: Key) => void;
56
+ clearSelection: () => void;
57
+ isSelected: (item: T) => boolean;
58
+ /** Fire the consumer's `formOnBlur` on a genuine input blur (wired onto the input by `Root`). */
59
+ onInputBlur: () => void;
60
+ componentId: string;
61
+ analyticsEvents?: DesignSystemEventProviderAnalyticsEventTypes[];
62
+ valueHasNoPii?: boolean;
63
+ onView: (value: any) => void;
64
+ firstOnViewValue?: string;
65
+ multiSelect: boolean;
66
+ }
67
+ /**
68
+ * Backs the Du Bois TypeaheadCombobox (react-aria variant) by wrapping react-aria's
69
+ * `useComboBoxState`. Handles single- and multi-select modes, item↔key mapping, filtering
70
+ * (default substring match or a custom `matcher`), selection helpers (`removeItem`,
71
+ * `clearSelection`, `isSelected`), form `onChange`/`onBlur` bridging, and analytics wiring.
72
+ * The returned object is what the `Root`/`Input`/`Menu` subtree consumes via context.
73
+ */
74
+ export declare function useComboboxState<T>(props: UseComboboxStateProps<T>): ComboboxStateValue<T>;
75
+ 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,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,2 @@
1
+ import type { TypeaheadComboboxReactAriaContextType } from "../providers/TypeaheadComboboxContext";
2
+ export declare const useTypeaheadComboboxReactAriaContext: () => TypeaheadComboboxReactAriaContextType;
@@ -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,45 @@
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 TypeaheadComboboxReactAriaContextType extends AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
10
+ isInsideTypeaheadCombobox: boolean;
11
+ multiSelect: boolean;
12
+ /** Null outside of a Root. */
13
+ comboBoxState: ComboBoxState<WrappedItem<unknown>, SelectionMode> | null;
14
+ inputProps: InputHTMLAttributes<HTMLInputElement>;
15
+ /** `AriaListBoxOptions` (input to `useListBox`), not DOM-spreadable. */
16
+ listBoxProps: AriaListBoxOptions<WrappedItem<unknown>>;
17
+ buttonProps: AriaButtonProps;
18
+ inputRef: MutableRefObject<HTMLInputElement | null>;
19
+ listBoxRef: RefObject<HTMLUListElement>;
20
+ popoverRef: MutableRefObject<HTMLDivElement | null>;
21
+ buttonRef: MutableRefObject<HTMLButtonElement | null>;
22
+ triggerRef: MutableRefObject<HTMLDivElement | null>;
23
+ /**
24
+ * PROTOTYPE (DUBOIS-455, "Option A"): opt-in that lets DOM focus genuinely move from the input to
25
+ * the footer and back, so a real footer <button> is keyboard/SR-reachable. Off by default; the
26
+ * default combobox keeps the input as the sole tab stop. See the FooterFocusMove debug story.
27
+ */
28
+ footerFocusable: boolean;
29
+ /** Set by the footer when `footerFocusable` — the popover node holding the footer's controls. */
30
+ footerRef: MutableRefObject<HTMLDivElement | null>;
31
+ triggerWidth: number | undefined;
32
+ setTriggerWidth: (width: number) => void;
33
+ itemsByKey: Map<Key, unknown>;
34
+ getKeyForItem: (item: unknown) => Key;
35
+ itemToString: (item: unknown) => string;
36
+ removeByKey: (key: Key) => void;
37
+ clearSelection: () => void;
38
+ }
39
+ export declare const TypeaheadComboboxReactAriaContext: React.Context<TypeaheadComboboxReactAriaContextType>;
40
+ interface ProviderProps {
41
+ children: React.ReactNode;
42
+ value: Omit<TypeaheadComboboxReactAriaContextType, "triggerWidth" | "setTriggerWidth">;
43
+ }
44
+ export declare const TypeaheadComboboxReactAriaContextProvider: ({ children, value }: ProviderProps) => JSX.Element;
45
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { Typography as AntDTypography } from "antd";
2
+ import type { ComponentProps } from "react";
3
+ type AntDTitleProps = ComponentProps<(typeof AntDTypography)["Title"]>;
4
+ export type TypographyTitleLevel = NonNullable<AntDTitleProps["level"]>;
5
+ type TypographyTitleFontSizeToken = "fontSizeXxl" | "fontSizeXl" | "fontSizeLg" | "fontSizeMd";
6
+ type TypographyTitleLineHeightToken = "lineHeightXxl" | "lineHeightXl" | "lineHeightLg" | "lineHeightMd";
7
+ export declare const TYPOGRAPHY_TITLE_TOKENS_BY_LEVEL: Record<TypographyTitleLevel, {
8
+ fontSize: TypographyTitleFontSizeToken;
9
+ lineHeight: TypographyTitleLineHeightToken;
10
+ }>;
11
+ export {};
@@ -74,5 +74,6 @@ export * from "./Tooltip";
74
74
  export * from "./Tree";
75
75
  export * from "./TreeGrid";
76
76
  export * from "./TypeaheadCombobox";
77
+ export * as TypeaheadComboboxReactAria from "./TypeaheadComboboxReactAria";
77
78
  export * from "./Typography";
78
79
  export * from "./utils";
@@ -8,7 +8,10 @@ interface useMediaQueryProps {
8
8
  /**
9
9
  * The default value to return if the hook is being run on the server (default is `false`).
10
10
  * options.defaultValue: The default value to return if the hook is being run on the server (default is `false`).
11
- * options.initializeWithValue: If `true` (default), the hook will initialize reading the media query. In SSR, you should set it to `false`, returning `options.defaultValue` or `false` initially.
11
+ * options.initializeWithValue: When `true`, the hook reads the media query synchronously for the
12
+ * initial render. Defaults to falsy here (unlike upstream usehooks-ts): the initial value is
13
+ * `options.defaultValue` / `false`, then corrected in a layout effect — which is SSR-safe. Set
14
+ * `true` to opt into eager initialization on the client.
12
15
  */
13
16
  options?: boolean | UseMediaQueryOptions;
14
17
  }
@@ -79,5 +79,6 @@ export declare enum ValidSemanticColors {
79
79
  TextValidationDanger = "textValidationDanger",
80
80
  TextValidationSuccess = "textValidationSuccess",
81
81
  TextValidationWarning = "textValidationWarning",
82
- TooltipBackgroundTooltip = "tooltipBackgroundTooltip"
82
+ TooltipBackgroundTooltip = "tooltipBackgroundTooltip",
83
+ TooltipTextTooltip = "tooltipTextTooltip"
83
84
  }
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/design-system",
3
- "oxfmt": true,
4
- "version": "2.0.0",
3
+ "version": "2.0.2",
5
4
  "description": "DuBois Design System",
6
5
  "keywords": [],
7
6
  "license": "ISC",
@@ -47,6 +46,8 @@
47
46
  "*.css"
48
47
  ],
49
48
  "files": [
49
+ "/AGENTS.md",
50
+ "/CHANGELOG.md",
50
51
  "dist",
51
52
  "dist-types",
52
53
  "test-utils"
@@ -84,6 +85,7 @@
84
85
  "devDependencies": {
85
86
  "@databricks/config-eslint": "1.0.0",
86
87
  "@databricks/config-jest": "1.0.0",
88
+ "@databricks/config-oxlint": "1.0.0",
87
89
  "@databricks/config-prettier": "1.0.0",
88
90
  "@databricks/db-lint": "1.0.0",
89
91
  "@databricks/pkgr": "1.0.0",
@@ -147,7 +149,16 @@
147
149
  "@radix-ui/react-toast": "1.1.5",
148
150
  "@radix-ui/react-toggle": "1.0.3",
149
151
  "@radix-ui/react-toolbar": "1.0.4",
150
- "@radix-ui/react-tooltip-patch": "patch:@radix-ui/react-tooltip@npm%3A1.0.7#../js/yarn/patches/@radix-ui-react-tooltip-npm-1.0.7-c7378e5c03.patch",
152
+ "@radix-ui/react-tooltip-patch": "npm:@radix-ui/react-tooltip@^1.0.7",
153
+ "@react-aria/button": "^3.13.4",
154
+ "@react-aria/combobox": "^3.14.0",
155
+ "@react-aria/focus": "^3.21.4",
156
+ "@react-aria/i18n": "^3.12.13",
157
+ "@react-aria/listbox": "^3.15.0",
158
+ "@react-aria/overlays": "^3.30.0",
159
+ "@react-aria/utils": "^3.33.0",
160
+ "@react-stately/collections": "^3.12.8",
161
+ "@react-stately/combobox": "^3.12.0",
151
162
  "@testing-library/dom": "^10.4.0",
152
163
  "@testing-library/react": "^16.1.0",
153
164
  "@testing-library/user-event": "^14.5.2",