@databricks/design-system 2.0.2 → 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 +19 -0
- package/dist/{WizardStepContentWrapper-DnwQIMN1.js → WizardStepContentWrapper-DsAS2ZAT.js} +600 -511
- package/dist/WizardStepContentWrapper-DsAS2ZAT.js.map +1 -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 +298 -200
- package/dist/index-dark.mitigated.css +298 -200
- package/dist/index.css +383 -271
- package/dist/index.js +230 -157
- package/dist/index.js.map +1 -1
- package/dist/index.mitigated.css +392 -280
- package/dist/patterns.js +3 -2
- package/dist/patterns.js.map +1 -1
- 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/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/index.d.ts +0 -1
- 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/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 +8 -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/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useComboboxState.d.ts +6 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useRestoreHighlightedOption.d.ts +18 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useTypeaheadComboboxContext.d.ts +2 -0
- package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/providers/TypeaheadComboboxContext.d.ts +6 -4
- 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 -1
- package/package.json +3 -2
- package/dist/WizardStepContentWrapper-DnwQIMN1.js.map +0 -1
- package/dist-types/design-system/Icon/AntdIcon.d.ts +0 -114
- package/dist-types/design-system/TypeaheadComboboxReactAria/hooks/useTypeaheadComboboxContext.d.ts +0 -2
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/CountBadge.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxAddButton.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxCheckboxItem.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxControls.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxFooter.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxInput.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxMenu.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxMenuItem.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxMultiSelectInput.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxRoot.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxSectionHeader.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxSelectedItem.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxSeparator.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/TypeaheadComboboxToggleButton.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/footerFocus.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/index.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useComboboxItems.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useComboboxStateProps.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useMultipleSelectionState.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useScrollOptionIntoView.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/hooks/useVirtualizedComboboxScroll.d.ts +0 -0
- /package/dist-types/design-system/{TypeaheadComboboxReactAria → TypeaheadComboboxV2}/index.d.ts +0 -0
package/dist/patterns.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-
|
|
1
|
+
export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-DsAS2ZAT.js';
|
|
2
2
|
import '@emotion/react/jsx-runtime';
|
|
3
3
|
import 'lodash/isUndefined';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '@emotion/react';
|
|
6
6
|
import 'antd';
|
|
7
7
|
import 'classnames';
|
|
8
|
-
import '@ant-design/icons';
|
|
9
8
|
import '@floating-ui/react';
|
|
10
9
|
import 'lodash/uniqueId';
|
|
11
10
|
import 'date-fns';
|
|
@@ -41,6 +40,8 @@ import 'lodash/isString';
|
|
|
41
40
|
import 'lodash/mapValues';
|
|
42
41
|
import '@radix-ui/react-accordion';
|
|
43
42
|
import '@radix-ui/react-tooltip-patch';
|
|
43
|
+
import 'lodash/kebabCase';
|
|
44
|
+
import '@ant-design/icons';
|
|
44
45
|
import 'lodash/random';
|
|
45
46
|
import 'lodash/times';
|
|
46
47
|
import '@radix-ui/react-context-menu';
|
package/dist/patterns.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"patterns.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -20,11 +20,11 @@ export interface ContextMenuContentProps extends RadixContextMenuContentProps {
|
|
|
20
20
|
minWidth?: number;
|
|
21
21
|
forceCloseOnEscape?: boolean;
|
|
22
22
|
}
|
|
23
|
-
export declare const Content: ({ children, minWidth, forceCloseOnEscape, onEscapeKeyDown, onKeyDown, ...childrenProps }: ContextMenuContentProps) => JSX.Element;
|
|
23
|
+
export declare const Content: ({ children, minWidth, forceCloseOnEscape, onEscapeKeyDown, onKeyDown, className, style, ...childrenProps }: ContextMenuContentProps) => JSX.Element;
|
|
24
24
|
export interface ContextMenuSubContentProps extends RadixContextMenuSubContentProps {
|
|
25
25
|
minWidth?: number;
|
|
26
26
|
}
|
|
27
|
-
export declare const SubContent: ({ children, minWidth, ...childrenProps }: ContextMenuSubContentProps) => JSX.Element;
|
|
27
|
+
export declare const SubContent: ({ children, minWidth, className, style, ...childrenProps }: ContextMenuSubContentProps) => JSX.Element;
|
|
28
28
|
export interface ContextMenuItemProps extends RadixContextMenuItemProps, AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnClick | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
29
29
|
disabledReason?: React.ReactNode;
|
|
30
30
|
}
|
|
@@ -6,9 +6,21 @@ import React from "react";
|
|
|
6
6
|
import type { DesignSystemFlags } from "../../flags";
|
|
7
7
|
import type { Theme } from "../../theme";
|
|
8
8
|
import type { ValidSemanticColors } from "../../theme/_generated/ValidSemanticColors";
|
|
9
|
+
/**
|
|
10
|
+
* Raw design-token overrides keyed by their `--db-*` custom-property name, e.g.
|
|
11
|
+
* `{ '--db-radius-md': '10px', '--db-space-lg': '20px' }`. Applied on top of `semanticColors`
|
|
12
|
+
* (which covers the `--db-color-*` family) and inherits down the DOM the same way, so a consumer
|
|
13
|
+
* can retheme non-color tokens (radius, spacing, …) for the whole subtree — including portaled
|
|
14
|
+
* surfaces, which re-apply this on their own outermost portal element.
|
|
15
|
+
*
|
|
16
|
+
* Keys are the full custom-property names because the family prefixes are not derivable from a
|
|
17
|
+
* single rule (unlike `semanticColors`, whose camelCase keys map cleanly to `--db-color-<kebab>`).
|
|
18
|
+
*/
|
|
19
|
+
export type DesignTokenOverrides = Partial<Record<`--db-${string}`, string>>;
|
|
9
20
|
export interface DesignSystemThemeProviderProps {
|
|
10
21
|
isDarkMode?: boolean;
|
|
11
22
|
semanticColors?: Record<ValidSemanticColors, string>;
|
|
23
|
+
designTokenOverrides?: DesignTokenOverrides;
|
|
12
24
|
}
|
|
13
25
|
export interface DesignSystemProviderProps {
|
|
14
26
|
/**
|
|
@@ -39,10 +51,20 @@ export interface DesignSystemProviderProps {
|
|
|
39
51
|
typography?: Partial<Theme["typography"]>;
|
|
40
52
|
spacing?: Partial<Theme["spacing"]>;
|
|
41
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Internal. When true, suppresses the `display: contents` token-scope wrapper this provider
|
|
56
|
+
* otherwise renders around its children. Set by `ApplyDesignSystemContextOverrides`: it only
|
|
57
|
+
* overrides context props and cannot change the token scope (no `isDarkMode`/`semanticColors`),
|
|
58
|
+
* so the scope is already established by an ancestor provider (in-tree) or re-applied on the
|
|
59
|
+
* portal root (Modal/Drawer/DropdownMenu each carry the scope class themselves). A second wrapper
|
|
60
|
+
* there would only add a redundant DOM node that breaks consumers' direct-child selectors.
|
|
61
|
+
*/
|
|
62
|
+
disableTokenScopeWrapper?: boolean;
|
|
42
63
|
}
|
|
43
64
|
export interface DuboisThemeContextType {
|
|
44
65
|
isDarkMode: boolean;
|
|
45
66
|
semanticColors?: Record<ValidSemanticColors, string>;
|
|
67
|
+
designTokenOverrides?: DesignTokenOverrides;
|
|
46
68
|
}
|
|
47
69
|
export interface DuboisContextType {
|
|
48
70
|
enableAnimation: boolean;
|
|
@@ -53,10 +75,32 @@ export interface DuboisContextType {
|
|
|
53
75
|
export declare const DesignSystemThemeContext: Context<DuboisThemeContextType>;
|
|
54
76
|
export declare const DesignSystemContext: Context<DuboisContextType>;
|
|
55
77
|
export declare const DU_BOIS_ENABLE_ANIMATION_CLASSNAME = "du-bois-enable-animation";
|
|
78
|
+
/**
|
|
79
|
+
* `data-testid` on the `display: contents` scope wrapper `DesignSystemProvider` renders around its
|
|
80
|
+
* children. The wrapper carries the theme-scope class / consumer token overrides but no visual box,
|
|
81
|
+
* so tests treat it as transparent: the shared `@databricks/testing-library` `render` returns
|
|
82
|
+
* `container` pointing inside this wrapper, so `container.firstChild` / emptiness assertions see the
|
|
83
|
+
* component's own output.
|
|
84
|
+
*/
|
|
85
|
+
export declare const DS_OVERRIDE_TOKENS_WRAPPER_TESTID = "ds-override-tokens-wrapper";
|
|
56
86
|
export declare const getAnimationCss: ((enableAnimation: boolean) => CSSObject) & MemoizedFunction;
|
|
57
87
|
type AntDConfigProviderPropsProps = Pick<AntDConfigProviderProps, "prefixCls" | "getPopupContainer" | "virtual">;
|
|
58
88
|
/** Only to be accessed by SupportsDuBoisThemes, except for special exceptions like tests and storybook. Ask in #dubois first if you need to use it. */
|
|
59
89
|
export declare const DesignSystemThemeProvider: React.FC<React.PropsWithChildren<DesignSystemThemeProviderProps>>;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the inline style that re-declares the consumer's design-token overrides as `--db-*` custom
|
|
92
|
+
* properties, or `undefined` when none are set. It merges the `semanticColors` override (emitted as
|
|
93
|
+
* `--db-color-<name>`) with any raw `designTokenOverrides` (already keyed by `--db-*` name) layered
|
|
94
|
+
* on top. The values inherit down the DOM, so setting this on a theme-scope element re-themes every
|
|
95
|
+
* native (plain-CSS) component below it.
|
|
96
|
+
*
|
|
97
|
+
* `DesignSystemProvider` applies this to the scope wrapper it renders around its children, which
|
|
98
|
+
* covers the whole in-tree subtree by inheritance. Portaled surfaces (Modal, Drawer, Popover,
|
|
99
|
+
* DropdownMenu, Notification, …) render outside that wrapper in the DOM, so each merges this style
|
|
100
|
+
* (plus `useDuboisThemeClass`) onto its own outermost portal element — context crosses React portals
|
|
101
|
+
* while DOM inheritance does not.
|
|
102
|
+
*/
|
|
103
|
+
export declare function useDesignTokenOverrideStyles(): React.CSSProperties | undefined;
|
|
60
104
|
export declare const DesignSystemProvider: React.FC<React.PropsWithChildren<DesignSystemProviderProps>>;
|
|
61
105
|
export declare const ApplyDesignSystemContextOverrides: React.FC<React.PropsWithChildren<DesignSystemProviderProps>>;
|
|
62
106
|
export declare const ApplyDesignSystemFlags: React.FC<React.PropsWithChildren<{
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import type { ColProps
|
|
2
|
-
import type { HTMLDataAttributes } from "../types";
|
|
3
|
-
export interface ColProps extends AntDColProps, HTMLDataAttributes {}
|
|
1
|
+
import type { ColProps } from "./types";
|
|
4
2
|
export declare const Col: React.FC<React.PropsWithChildren<ColProps>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
|
+
import type { ColProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Native flexbox implementation of the DuBois `Col` for the
|
|
5
|
+
* `databricks.fe.designsystem.useNativeGrid` migration. Reproduces antd's box model exactly — inline
|
|
6
|
+
* `%` flex-basis, `parseFlex`, and gutter padding taken from the enclosing `Row` via
|
|
7
|
+
* {@link NativeGridContext} — so consumer `padding`/`flex`/`margin` overrides compose
|
|
8
|
+
* identically to the antd variant on an identical single-`<div>` DOM.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NativeCol: ForwardRefExoticComponent<PropsWithoutRef<ColProps> & RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Context } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Resolved horizontal/vertical gutter (in px) shared from a native `Row` to its
|
|
4
|
+
* native `Col` children — the same channel AntD's grid uses (`antd/es/grid/RowContext`).
|
|
5
|
+
* The `Row` applies negative margins from these values and each `Col` applies the
|
|
6
|
+
* matching padding, so the two stay in lockstep. `[0, 0]` means "no gutter".
|
|
7
|
+
*/
|
|
8
|
+
export interface NativeGridGutter {
|
|
9
|
+
gutter: [number, number];
|
|
10
|
+
}
|
|
11
|
+
export declare const NativeGridContext: Context<NativeGridGutter>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
|
+
import type { RowProps } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Native flexbox implementation of the DuBois `Row` for the
|
|
5
|
+
* `databricks.fe.designsystem.useNativeGrid` migration. Reproduces antd's box model exactly — a flex
|
|
6
|
+
* container whose horizontal gutter is a negative Row margin with matching padding on each child
|
|
7
|
+
* `Col` (via {@link NativeGridContext}), and whose vertical gutter is a flex `row-gap` on the Row.
|
|
8
|
+
* Preserves the DuBois
|
|
9
|
+
* `gutter` default of {@link ROW_GUTTER_SIZE} (8) — antd's own default is 0, but 75% of `<Row>`
|
|
10
|
+
* usages rely on the DuBois 8 default, so it must be applied here (the flag-gated `Row` no longer
|
|
11
|
+
* injects it as a prop default).
|
|
12
|
+
*/
|
|
13
|
+
export declare const NativeRow: ForwardRefExoticComponent<PropsWithoutRef<RowProps> & RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
export declare const ROW_GUTTER_SIZE = 8;
|
|
1
|
+
import { ROW_GUTTER_SIZE } from "./rowConstants";
|
|
2
|
+
import type { RowProps } from "./types";
|
|
3
|
+
export { ROW_GUTTER_SIZE };
|
|
5
4
|
export declare const Row: React.FC<React.PropsWithChildren<RowProps>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSObject } from "@emotion/react";
|
|
2
|
+
import type { ColSize, ColSpanType, FlexType } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Mirrors antd/es/grid/col.js `parseFlex`: a bare number becomes a grow/shrink/auto triple, a bare
|
|
5
|
+
* length becomes a fixed basis, anything else is passed through unchanged. Note the length regex
|
|
6
|
+
* requires a unit, so a unitless `0` (like `auto`/`none`) intentionally falls through as-is — kept
|
|
7
|
+
* deliberately to stay 1:1 with antd for backwards compatibility.
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseFlex(flex: FlexType): string;
|
|
10
|
+
/**
|
|
11
|
+
* Coerces an antd span/offset/order/push/pull value to a finite number, or `undefined`. antd types
|
|
12
|
+
* these as `number | string`; in practice they are the integers 0–24. Non-numeric values are
|
|
13
|
+
* dropped (antd would route those through its class-name path, which the compat classes still cover).
|
|
14
|
+
*/
|
|
15
|
+
export declare function toNum(value: ColSpanType | undefined): number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Converts a 24-column grid span into flexbox properties, mirroring antd's grid box model.
|
|
18
|
+
* @param span - number of columns to span (0–24); `0` hides the column (`display: none`).
|
|
19
|
+
*/
|
|
20
|
+
export declare function spanToBasis(span: number): CSSObject;
|
|
21
|
+
export declare function normalizeSize(value: ColSpanType | ColSize | undefined): ColSize | undefined;
|
|
22
|
+
export declare function sizeStyles(size: ColSize): CSSObject;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default horizontal gutter (px) for `Row`. NOTE this diverges from AntD's own default of `0`:
|
|
3
|
+
* DuBois has always defaulted `Row` to `8`, and ~75% of `<Row>` usages rely on it, so both the
|
|
4
|
+
* AntD-backed `Row` and the native `NativeRow` must apply it. Kept in its own module so both
|
|
5
|
+
* variants (and the flag-gated `Row`) share one source without an import cycle.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ROW_GUTTER_SIZE = 8;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ResponsiveSize } from "./gridConstants";
|
|
2
|
+
import type { HTMLDataAttributes } from "../types";
|
|
3
|
+
export type ColSpanType = number | string;
|
|
4
|
+
export type FlexType = number | "none" | "auto" | string;
|
|
5
|
+
/** Per-breakpoint responsive value for a `Col` (`{ flex, span, order, offset, push, pull }`). */
|
|
6
|
+
export interface ColSize {
|
|
7
|
+
flex?: FlexType;
|
|
8
|
+
span?: ColSpanType;
|
|
9
|
+
order?: ColSpanType;
|
|
10
|
+
offset?: ColSpanType;
|
|
11
|
+
push?: ColSpanType;
|
|
12
|
+
pull?: ColSpanType;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* DuBois `Col` props. Owns antd's 24-column `ColProps` surface rather than extending it, so the
|
|
16
|
+
* native-flexbox grid migration (`databricks.fe.designsystem.useNativeGrid`) isn't coupled to antd's
|
|
17
|
+
* types. The shape is kept identical to antd's `ColProps` so consumers and the AntD-backed `Col`
|
|
18
|
+
* wrapper are unaffected.
|
|
19
|
+
*/
|
|
20
|
+
export interface ColProps extends React.HTMLAttributes<HTMLDivElement>, HTMLDataAttributes {
|
|
21
|
+
span?: ColSpanType;
|
|
22
|
+
order?: ColSpanType;
|
|
23
|
+
offset?: ColSpanType;
|
|
24
|
+
push?: ColSpanType;
|
|
25
|
+
pull?: ColSpanType;
|
|
26
|
+
xs?: ColSpanType | ColSize;
|
|
27
|
+
sm?: ColSpanType | ColSize;
|
|
28
|
+
md?: ColSpanType | ColSize;
|
|
29
|
+
lg?: ColSpanType | ColSize;
|
|
30
|
+
xl?: ColSpanType | ColSize;
|
|
31
|
+
xxl?: ColSpanType | ColSize;
|
|
32
|
+
prefixCls?: string;
|
|
33
|
+
flex?: FlexType;
|
|
34
|
+
}
|
|
35
|
+
/** One gutter axis: a px number, or a per-breakpoint map (antd's `Gutter`). */
|
|
36
|
+
export type Gutter = number | Partial<Record<ResponsiveSize, number>>;
|
|
37
|
+
/**
|
|
38
|
+
* DuBois `Row` props. Owns antd's `RowProps` surface rather than extending it, so the native-flexbox
|
|
39
|
+
* grid migration (`databricks.fe.designsystem.useNativeGrid`) isn't coupled to antd's types. The
|
|
40
|
+
* shape is kept identical to antd's `RowProps` so consumers and the AntD-backed `Row` wrapper are
|
|
41
|
+
* unaffected.
|
|
42
|
+
*/
|
|
43
|
+
export interface RowProps extends React.HTMLAttributes<HTMLDivElement>, HTMLDataAttributes {
|
|
44
|
+
gutter?: Gutter | [Gutter, Gutter];
|
|
45
|
+
align?: "top" | "middle" | "bottom" | "stretch";
|
|
46
|
+
justify?: "start" | "end" | "center" | "space-around" | "space-between";
|
|
47
|
+
prefixCls?: string;
|
|
48
|
+
wrap?: boolean;
|
|
49
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useDesignSystemTheme, WithDesignSystemThemeHoc } from "./useDesignSystemTheme";
|
|
1
|
+
export { useDesignSystemTheme, useDuboisThemeClass, WithDesignSystemThemeHoc } from "./useDesignSystemTheme";
|
|
2
2
|
export { useDesignSystemFlags } from "./useDesignSystemFlags";
|
|
3
3
|
export { useThemedStyles } from "./useThemedStyles";
|
|
4
4
|
export type { DesignSystemHocProps, DesignSystemThemeInterface } from "./useDesignSystemTheme";
|
|
@@ -14,14 +14,14 @@ export declare function getClassNamePrefix(theme: Theme): string;
|
|
|
14
14
|
export declare function getPrefixedClassNameFromTheme(theme: Theme, className: string | null | undefined): string;
|
|
15
15
|
/**
|
|
16
16
|
* Returns the theme-scope class for the current context: `du-bois-dark` in dark
|
|
17
|
-
* mode, `du-bois-light` otherwise.
|
|
17
|
+
* mode, `du-bois-light` otherwise. The `.du-bois-*` rule declares the `--db-color-*`
|
|
18
|
+
* tokens, so any element carrying this class becomes a resolution scope for the
|
|
19
|
+
* native (plain-CSS, token-driven) components below it.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
* so
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* trees, and forced-theme subtrees / portaled content resolve correctly because
|
|
24
|
-
* the class rides React context, not DOM ancestry. See DUBOIS-448.
|
|
21
|
+
* `DesignSystemProvider` puts this on the scope wrapper it renders around its
|
|
22
|
+
* children, so in-tree native components inherit the tokens without self-scoping.
|
|
23
|
+
* Use it to re-establish that scope on content that renders OUTSIDE that wrapper —
|
|
24
|
+
* i.e. portaled surfaces (context crosses React portals, DOM inheritance does not).
|
|
25
25
|
*/
|
|
26
26
|
export declare function useDuboisThemeClass(): string;
|
|
27
27
|
export declare function useDesignSystemTheme(): DesignSystemThemeInterface;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EllipsisOutlined as AntEllipsisOutlined } from "@ant-design/icons";
|
|
2
|
+
import type { ComponentType } from "react";
|
|
3
|
+
/** Props type for all the antd built-in icons are the same, so pick any one */
|
|
4
|
+
type AntdIconProps = React.ComponentProps<typeof AntEllipsisOutlined>;
|
|
5
|
+
/**
|
|
6
|
+
* The icon components' props are picked from React's HTMLProps, which, in React 17, include
|
|
7
|
+
* `onPointerEnterCapture` and `onPointerLeaveCapture`, but in React 18 do not. Hence, instead of
|
|
8
|
+
* these props being optional, they are now `unknown` and thus must be declared on a component
|
|
9
|
+
* instance, unless we specifically remove them from the props interface.
|
|
10
|
+
*/
|
|
11
|
+
type IconPropsWithoutPointerEvents = Omit<AntdIconProps, "onPointerEnterCapture" | "onPointerLeaveCapture">;
|
|
12
|
+
/**
|
|
13
|
+
* Antd built-in icons used by the design system's own legacy components, with an interface that has
|
|
14
|
+
* been made compatible with the React 18 types by removing the props that are no longer present on
|
|
15
|
+
* the React DOM types.
|
|
16
|
+
*
|
|
17
|
+
* These are deliberately NOT reëxported from the design system's public API: product code should
|
|
18
|
+
* use Du Bois icons from `__generated/icons`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LegacyEllipsisOutlined: ComponentType<IconPropsWithoutPointerEvents>;
|
|
21
|
+
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
2
|
import type { ButtonProps } from "../Button";
|
|
3
|
+
/**
|
|
4
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
5
|
+
* @deprecated
|
|
6
|
+
*/
|
|
3
7
|
export declare const TypeaheadComboboxAddButton: ForwardRefExoticComponent<PropsWithoutRef<ButtonProps> & RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { UseComboboxReturnValue } from "downshift";
|
|
2
2
|
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
3
3
|
import { type TypeaheadComboboxMenuItemProps } from "./TypeaheadComboboxMenuItem";
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
4
8
|
export interface TypeaheadComboboxCheckboxItemProps<T> extends TypeaheadComboboxMenuItemProps<T> {
|
|
5
9
|
comboboxState: UseComboboxReturnValue<T>;
|
|
6
10
|
selectedItems: T[];
|
|
7
11
|
selectedMatcher?: (a: T, b: T) => boolean;
|
|
8
12
|
_type?: string;
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
10
18
|
export declare const TypeaheadComboboxCheckboxItem: ForwardRefExoticComponent<PropsWithoutRef<TypeaheadComboboxCheckboxItemProps<any>> & RefAttributes<HTMLLIElement>>;
|
|
11
19
|
export default TypeaheadComboboxCheckboxItem;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import type { FunctionComponent } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
2
6
|
export interface TypeaheadComboboxFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
7
|
/**
|
|
4
8
|
* DO NOT USE, INTERNAL USE ONLY
|
|
5
9
|
*/
|
|
6
10
|
_type?: string;
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
14
|
+
* @deprecated
|
|
15
|
+
*/
|
|
8
16
|
export declare const DuboisTypeaheadComboboxFooter: FunctionComponent<TypeaheadComboboxFooterProps>;
|
|
17
|
+
/**
|
|
18
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
19
|
+
* @deprecated
|
|
20
|
+
*/
|
|
9
21
|
export declare const TypeaheadComboboxFooter: FunctionComponent<TypeaheadComboboxFooterProps>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from "react";
|
|
2
2
|
import type { ComboboxStateAnalyticsReturnValue } from "./hooks";
|
|
3
3
|
import type { InputProps } from "../Input";
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
4
8
|
export interface TypeaheadComboboxInputProps<T> extends Omit<InputProps, "componentId" | "analyticsEvents"> {
|
|
5
9
|
comboboxState: ComboboxStateAnalyticsReturnValue<T>;
|
|
6
10
|
allowClear?: boolean;
|
|
@@ -10,4 +14,8 @@ export interface TypeaheadComboboxInputProps<T> extends Omit<InputProps, "compon
|
|
|
10
14
|
/** When true, replaces the dropdown toggle button with a spinner to indicate async loading. */
|
|
11
15
|
loading?: boolean;
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
19
|
+
* @deprecated
|
|
20
|
+
*/
|
|
13
21
|
export declare const TypeaheadComboboxInput: ForwardRefExoticComponent<PropsWithoutRef<Omit<TypeaheadComboboxInputProps<any>, "componentId" | "analyticsEvents">> & RefAttributes<HTMLDivElement | null>>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { UseComboboxReturnValue } from "downshift";
|
|
2
2
|
import type { ForwardRefExoticComponent, HTMLAttributes, PropsWithoutRef, ReactNode, RefAttributes } from "react";
|
|
3
3
|
import React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
6
|
+
* @deprecated
|
|
7
|
+
*/
|
|
4
8
|
export interface TypeaheadComboboxMenuProps<T> extends HTMLAttributes<HTMLUListElement> {
|
|
5
9
|
comboboxState: UseComboboxReturnValue<T>;
|
|
6
10
|
loading?: boolean;
|
|
@@ -15,4 +19,8 @@ export interface TypeaheadComboboxMenuProps<T> extends HTMLAttributes<HTMLUListE
|
|
|
15
19
|
children?: ReactNode;
|
|
16
20
|
matchTriggerWidth?: boolean;
|
|
17
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
24
|
+
* @deprecated
|
|
25
|
+
*/
|
|
18
26
|
export declare const TypeaheadComboboxMenu: ForwardRefExoticComponent<PropsWithoutRef<TypeaheadComboboxMenuProps<any>> & RefAttributes<HTMLElement | null>>;
|
|
@@ -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>;
|
|
@@ -28,4 +32,8 @@ export interface TypeaheadComboboxMultiSelectInputProps<T> extends TypeaheadComb
|
|
|
28
32
|
*/
|
|
29
33
|
size?: "middle";
|
|
30
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
37
|
+
* @deprecated
|
|
38
|
+
*/
|
|
31
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 {};
|
|
@@ -15,6 +15,11 @@ interface BaseComboboxStateProps<T> extends AnalyticsEventValueChangeNoPiiFlagPr
|
|
|
15
15
|
*/
|
|
16
16
|
isItemDisabled?: (item: T) => boolean;
|
|
17
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;
|
|
18
23
|
initialInputValue?: string;
|
|
19
24
|
initialSelectedItem?: T;
|
|
20
25
|
formValue?: T;
|
|
@@ -63,6 +68,7 @@ export interface ComboboxStateValue<T> {
|
|
|
63
68
|
onView: (value: any) => void;
|
|
64
69
|
firstOnViewValue?: string;
|
|
65
70
|
multiSelect: boolean;
|
|
71
|
+
showAllOptionsOnOpen: boolean;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
68
74
|
* Backs the Du Bois TypeaheadCombobox (react-aria variant) by wrapping react-aria's
|
|
@@ -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;
|
|
@@ -6,9 +6,11 @@ import { type InputHTMLAttributes, type MutableRefObject, type RefObject } from
|
|
|
6
6
|
import type { DesignSystemEventProviderAnalyticsEventTypes } from "../../DesignSystemEventProvider/DesignSystemEventProvider";
|
|
7
7
|
import type { AnalyticsEventProps } from "../../types";
|
|
8
8
|
import type { WrappedItem } from "../hooks/useComboboxItems";
|
|
9
|
-
export interface
|
|
9
|
+
export interface TypeaheadComboboxV2ContextType extends AnalyticsEventProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange | DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
10
10
|
isInsideTypeaheadCombobox: boolean;
|
|
11
11
|
multiSelect: boolean;
|
|
12
|
+
/** Single-select only: whether the menu opens showing all options (filtering begins on type). */
|
|
13
|
+
showAllOptionsOnOpen: boolean;
|
|
12
14
|
/** Null outside of a Root. */
|
|
13
15
|
comboBoxState: ComboBoxState<WrappedItem<unknown>, SelectionMode> | null;
|
|
14
16
|
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
@@ -36,10 +38,10 @@ export interface TypeaheadComboboxReactAriaContextType extends AnalyticsEventPro
|
|
|
36
38
|
removeByKey: (key: Key) => void;
|
|
37
39
|
clearSelection: () => void;
|
|
38
40
|
}
|
|
39
|
-
export declare const
|
|
41
|
+
export declare const TypeaheadComboboxV2Context: React.Context<TypeaheadComboboxV2ContextType>;
|
|
40
42
|
interface ProviderProps {
|
|
41
43
|
children: React.ReactNode;
|
|
42
|
-
value: Omit<
|
|
44
|
+
value: Omit<TypeaheadComboboxV2ContextType, "triggerWidth" | "setTriggerWidth">;
|
|
43
45
|
}
|
|
44
|
-
export declare const
|
|
46
|
+
export declare const TypeaheadComboboxV2ContextProvider: ({ children, value }: ProviderProps) => JSX.Element;
|
|
45
47
|
export {};
|