@databricks/design-system 2.0.5 → 2.0.7
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/AGENTS.md +239 -166
- package/CHANGELOG.md +47 -0
- package/design-guidance/docs/README.md +40 -0
- package/design-guidance/docs/review-contract.md +22 -0
- package/design-guidance/docs/tokens.md +35 -0
- package/design-guidance/docs/voice.md +40 -0
- package/design-guidance/skills/dbui-build-screen.md +24 -0
- package/design-guidance/skills/dbui-check-ecosystem.md +21 -0
- package/design-guidance/skills/dbui-check-guidelines.md +29 -0
- package/design-guidance/skills/dbui-check-principles.md +26 -0
- package/design-guidance/skills/dbui-check-voice.md +17 -0
- package/design-guidance/skills/dbui-pick-component.md +23 -0
- package/design-guidance/skills/dbui-pick-icon.md +23 -0
- package/design-guidance/skills/dbui-review.md +30 -0
- package/design-guidance/skills/dbui-validate.md +23 -0
- package/dist/{RHFControlledTypeaheadComboboxV2-DsH-nIEk.js → RHFControlledTypeaheadComboboxV2-nSSYj16I.js} +5 -5
- package/dist/{RHFControlledTypeaheadComboboxV2-DsH-nIEk.js.map → RHFControlledTypeaheadComboboxV2-nSSYj16I.js.map} +1 -1
- package/dist/{WizardStepContentWrapper-Bq1wm0V7.js → WizardStepContentWrapper-bbh_CoIf.js} +644 -679
- package/dist/WizardStepContentWrapper-bbh_CoIf.js.map +1 -0
- package/dist/dubois-colors.less +1 -1
- package/dist/icon-metadata.json +2069 -0
- package/dist/{index-BRAVZg-S.js → index-CUCuUviS.js} +350 -139
- package/dist/index-CUCuUviS.js.map +1 -0
- package/dist/index-dark.css +593 -191
- package/dist/index-dark.mitigated.css +623 -208
- package/dist/index.css +1536 -1049
- package/dist/index.js +4 -4
- package/dist/index.mitigated.css +1566 -1066
- package/dist/patterns.js +3 -3
- package/dist-types/design-system/Alert/Alert.d.ts +21 -4
- package/dist-types/design-system/Button/Button.d.ts +2 -1
- package/dist-types/design-system/Drawer/Drawer.d.ts +3 -1
- package/dist-types/design-system/Icon/AntdIcon.d.ts +3 -0
- package/dist-types/design-system/Icon/Icon.d.ts +20 -6
- package/dist-types/design-system/Icon/NativeIcon.d.ts +3 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/SlidesIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/index.d.ts +2 -0
- package/dist-types/design-system/Icon/index.d.ts +1 -0
- package/dist-types/design-system/Icon/utils.d.ts +1 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +0 -2
- package/dist-types/design-system/_shared_/Tabs/styles.d.ts +2 -3
- package/dist-types/design-system/index.d.ts +0 -1
- package/dist-types/design-system/utils/safex.d.ts +4 -2
- package/dist-types/theme/generalVariables.d.ts +0 -1
- package/dist-types/~patterns/Wizard/WizardModal.d.ts +1 -1
- package/package.json +8 -5
- package/setup.mjs +586 -0
- package/dist/WizardStepContentWrapper-Bq1wm0V7.js.map +0 -1
- package/dist/index-BRAVZg-S.js.map +0 -1
- package/dist-types/design-system/LegacyTooltip/LegacyTooltip.d.ts +0 -47
- package/dist-types/design-system/LegacyTooltip/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.7 (2026-09-17T20:28:50Z)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- New `SlidesIcon` component available for import from `@databricks/design-system`.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- `Button`: replaced the boolean `useNativeButtonOverride` prop with a tri-state `forceMode` prop. Values: `'native'` (default — always uses the native implementation), `'legacy-antd'` (always uses the AntD implementation), or `'flag'` (defers to the `databricks.fe.designsystem.useNativeButton` SAFE flag). Existing callsites should add `forceMode="flag"` to preserve current flag-gated behavior.
|
|
12
|
+
- `LegacyForm.Item`: the label help icon now renders as the Du Bois `InfoSmallIcon` instead of AntD's `QuestionCircleOutlined`. A caller-supplied tooltip icon still takes precedence.
|
|
13
|
+
- Design-system `safex` and `serverSideSafe` wrappers now accept an optional `testDefault` argument for controlling flag values in Jest and `UiTestServer` fallback paths.
|
|
14
|
+
- `AlertProps` no longer references AntD types on its public surface.
|
|
15
|
+
|
|
16
|
+
### Deprecated
|
|
17
|
+
|
|
18
|
+
- `theme.general.iconfontCssPrefix` has been removed from the theme object.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- `Switch` (native/Radix variant): the track no longer collapses to zero width when a host app's legacy `input[type='checkbox']` CSS reset is present (e.g. Bootstrap).
|
|
23
|
+
- `Notification` (Radix Toast): toast close buttons are now clickable while a modal is open, and the empty toast viewport band no longer blocks clicks to content beneath it.
|
|
24
|
+
- `TypeaheadCombobox` (v1 multi-select): clear and chevron controls are now vertically centered within the tag row.
|
|
25
|
+
- `LegacySelect`: the dropdown chevron no longer shifts out of alignment when rendered with a native `.db-icon` element.
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
|
|
29
|
+
- `LegacyTooltip` has been removed from `@databricks/design-system`. Use `Tooltip` instead.
|
|
30
|
+
|
|
31
|
+
## 2.0.6 (2026-09-15T18:10:12Z)
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- `LakewatchIcon` product mark added to the icon registry; render via `<LakewatchIcon />`.
|
|
35
|
+
- `getIconClassName()` utility exported from the package; returns a CSS selector matching both the legacy AntD (`.anticon`) and native (`.db-icon`) icon wrappers.
|
|
36
|
+
- `Icon` accepts a new `forceNativeIcon` prop to opt an individual instance into the native icon implementation independent of the server-side flag.
|
|
37
|
+
- `--db-ai-gradient-*` color tokens are now available for AI-colored icon styling.
|
|
38
|
+
- `--db-popup-*` and `--db-list-*` CSS token families are now included in the package stylesheet.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- v2 design token names: `press`/`pressed` state tokens have been renamed — use `active` (CSS `:active`) and `selected` (checked/pressed control state) in place of `press`/`pressed` in any `--db-*` token names you reference directly.
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
- `Drawer`: the `du-bois-dark` theme class is now preserved when a consumer-provided `className` is also present, restoring correct dark-mode token resolution.
|
|
45
|
+
- Native `Button` (under `useNativeButton`): loading spinner animation duration corrected from 8 seconds to 1 second.
|
|
46
|
+
- Native `Button` (under `useNativeButton`): disabled border is now correctly shown on buttons that are both `disabled` and `loading`.
|
|
47
|
+
- Native `Checkbox.Group` (under `useNativeCheckbox`): top spacing between a `FormUI.Label` and a `Checkbox.Group` is restored to match the legacy AntD layout.
|
|
48
|
+
- Native `Radio.Group` (under `useNativeRadio`): top spacing between a `FormUI.Label` and a `Radio.Group` is restored to match the legacy AntD layout.
|
|
49
|
+
|
|
3
50
|
## 2.0.5 (2026-09-10T17:52:39Z)
|
|
4
51
|
|
|
5
52
|
### Added
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Agent workflows for Du Bois
|
|
2
|
+
|
|
3
|
+
These workflows guide component and icon selection, screen building, validation,
|
|
4
|
+
and design review with `@databricks/design-system`.
|
|
5
|
+
|
|
6
|
+
Read the package's `AGENTS.md` first. In Universe, read `js/docs/design-system/README.md`
|
|
7
|
+
and the consuming application's instructions first; those remain authoritative for
|
|
8
|
+
component usage, styling, localization, and testing. Use these workflows alongside the
|
|
9
|
+
Du Bois usage skill.
|
|
10
|
+
|
|
11
|
+
## Choose a workflow
|
|
12
|
+
|
|
13
|
+
| Task | Read |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| Select a component | [Pick a component](../skills/dbui-pick-component.md) |
|
|
16
|
+
| Select an icon | [Pick an icon](../skills/dbui-pick-icon.md) |
|
|
17
|
+
| Implement a screen | [Build a screen](../skills/dbui-build-screen.md) |
|
|
18
|
+
| Check implementation | [Validate](../skills/dbui-validate.md) |
|
|
19
|
+
| Review a design | [Review](../skills/dbui-review.md) |
|
|
20
|
+
| Review copy only | [Voice](../skills/dbui-check-voice.md) |
|
|
21
|
+
| Review UX behavior | [Guidelines](../skills/dbui-check-guidelines.md) |
|
|
22
|
+
| Review design intent | [Principles](../skills/dbui-check-principles.md) |
|
|
23
|
+
| Review platform fit | [Ecosystem](../skills/dbui-check-ecosystem.md) |
|
|
24
|
+
|
|
25
|
+
Open the relevant Markdown file in your coding agent. Use your agent's supported
|
|
26
|
+
configuration to reference these Markdown instructions. In npm installations they live under
|
|
27
|
+
`node_modules/@databricks/design-system/design-guidance/`.
|
|
28
|
+
|
|
29
|
+
## Sources and boundaries
|
|
30
|
+
|
|
31
|
+
The installed package's `dist-types/index.d.ts` and referenced declarations define
|
|
32
|
+
available exports and props. In Universe, component source and Storybook MDX are the
|
|
33
|
+
API reference. Verify component names and props against these sources.
|
|
34
|
+
|
|
35
|
+
Verify terminology against current product guidance. Ecosystem checks require evidence supplied by the
|
|
36
|
+
project; confidential platform context is not distributed in this package.
|
|
37
|
+
|
|
38
|
+
Component recipes remain in existing usage documentation. CSS token authoring is
|
|
39
|
+
explained in Universe's `design-system/src/design-tokens/README.md`; this workflow's
|
|
40
|
+
[Token selection](tokens.md) explains how to find those tokens as a consumer.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Review output
|
|
2
|
+
|
|
3
|
+
Every specialist check reports:
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
CHECK: standards | guidelines | voice | principles | ecosystem
|
|
7
|
+
STATUS: complete | partial | skipped — reason
|
|
8
|
+
|
|
9
|
+
FIX
|
|
10
|
+
- <location>: <observed problem>; <evidence and consequence>; <specific correction>
|
|
11
|
+
IMPROVE
|
|
12
|
+
- <location>: <tradeoff>; <suggested change>
|
|
13
|
+
WORKING
|
|
14
|
+
- <location>: <specific successful behavior>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Leave sections empty when there are no findings. `FIX` requires an observed defect or
|
|
18
|
+
an applicable requirement and evidence. `IMPROVE` is a design judgment, not a policy
|
|
19
|
+
violation. Cite source lines, visible UI, a reproduced interaction, or supplied
|
|
20
|
+
requirements. State what could not be checked; a screenshot cannot prove keyboard
|
|
21
|
+
behavior, actual permissions, or runtime token values. Do not invent findings to fill
|
|
22
|
+
sections or describe an unrun check as passing.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Token selection
|
|
2
|
+
|
|
3
|
+
Du Bois has two theming systems. Existing product code may read `theme.*` through
|
|
4
|
+
`useDesignSystemTheme()` and style through Emotion. Follow the application's
|
|
5
|
+
instructions for that code. New CSS token authoring uses `--db-*` variables from
|
|
6
|
+
`design-system/src/design-tokens/`, not the legacy `src/tokens-groups/` catalog.
|
|
7
|
+
Do not migrate an application's styling system as a side effect of building a screen.
|
|
8
|
+
|
|
9
|
+
## Find a token
|
|
10
|
+
|
|
11
|
+
In Universe, read `design-system/src/design-tokens/README.md` and search
|
|
12
|
+
`design-system/src/design-tokens/system-tokens/*.css`. The system → family → component
|
|
13
|
+
chain defines meaning and override boundaries. A custom application surface consumes
|
|
14
|
+
system semantics; authoring a library component follows the component-tier rules.
|
|
15
|
+
|
|
16
|
+
In an npm installation, import the public `@databricks/design-system/index.css` and,
|
|
17
|
+
for dark mode, `@databricks/design-system/index-dark.css` as described in `AGENTS.md`.
|
|
18
|
+
Those built styles include the CSS tokens. Search the installed `dist/index.css` for
|
|
19
|
+
an exact declaration before using it. Source-only paths such as `all-styles.css` are
|
|
20
|
+
not part of the published API.
|
|
21
|
+
|
|
22
|
+
Prefer semantic names such as `--db-surface-base` to their backing primitive color.
|
|
23
|
+
Do not invent token names, flatten aliases into hex values, or add fallback literals
|
|
24
|
+
that hide missing styles. Use component props before overriding component tokens.
|
|
25
|
+
|
|
26
|
+
## Verify the result
|
|
27
|
+
|
|
28
|
+
Check light and dark provider modes, including portaled content. CSS aliases resolve
|
|
29
|
+
where they are declared; a custom alias defined only on `:root` can retain a light
|
|
30
|
+
value inside a dark subtree. Follow the token README's scoping rules when defining
|
|
31
|
+
aliases. Use existing typography components and scales; rem-based tokens can scale
|
|
32
|
+
with the root font size, but legacy pixel values do not automatically do so.
|
|
33
|
+
|
|
34
|
+
Emotion remains a peer dependency for current Du Bois components. Choosing plain CSS
|
|
35
|
+
for application-owned styles does not make the library independent of Emotion.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Product voice and tone
|
|
2
|
+
|
|
3
|
+
Apply current product terminology, localization requirements, and accessibility
|
|
4
|
+
guidance when using these editorial defaults.
|
|
5
|
+
This is a review aid, not a replacement for those sources.
|
|
6
|
+
|
|
7
|
+
| Principle | Prefer | Avoid |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| Clear over clever | Query sample data | Unleash insights |
|
|
10
|
+
| Direct and concise | Delete catalog | Click here to delete the catalog |
|
|
11
|
+
| Honest about capability | Runs on serverless compute | Blazing-fast compute |
|
|
12
|
+
| Respect the reader | Review affected objects before deleting | Oops, careful |
|
|
13
|
+
|
|
14
|
+
Use sentence case except established product names and acronyms. Prefer active verbs
|
|
15
|
+
and American spelling in English copy. Avoid marketing filler, emoji, and exclamation
|
|
16
|
+
marks in ordinary product messages. Preserve intentional product-specific language.
|
|
17
|
+
|
|
18
|
+
| Context | What the copy should provide |
|
|
19
|
+
| --- | --- |
|
|
20
|
+
| Navigation and titles | A stable name matching the destination or task |
|
|
21
|
+
| Button | The action and object; describe progress while working |
|
|
22
|
+
| Empty state | What is absent and a useful next step |
|
|
23
|
+
| No results | What was searched or filtered and how to broaden it |
|
|
24
|
+
| Success | What completed and any useful result |
|
|
25
|
+
| Error | What happened, a known cause, and a feasible recovery action |
|
|
26
|
+
| Permission denied | The required access and a valid route to request it |
|
|
27
|
+
| Destructive confirmation | The affected objects, scope, and whether recovery is possible |
|
|
28
|
+
| Tooltip | Relevant information beyond the visible label |
|
|
29
|
+
|
|
30
|
+
Do not invent a cause, permission requirement, count, or recovery promise to make a
|
|
31
|
+
message sound complete. Do not say an action is irreversible if it can be undone.
|
|
32
|
+
Action labels should be specific where needed; conventional labels such as Cancel are
|
|
33
|
+
not automatically defects. Avoid treating editorial preferences as mechanical bans.
|
|
34
|
+
|
|
35
|
+
Review accessible names as well as visible strings. Icon-only controls need meaningful
|
|
36
|
+
names. Labels must survive truncation and translation. Use the project's localization
|
|
37
|
+
and date/number formatters rather than concatenating strings or forcing ISO dates into
|
|
38
|
+
all UI. Alt text should convey the image's purpose, not meet an arbitrary character quota.
|
|
39
|
+
|
|
40
|
+
Verify product names against current product guidance.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-build-screen
|
|
3
|
+
description: Build a Du Bois screen from a brief, screenshot, or Figma design.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Build a screen
|
|
7
|
+
|
|
8
|
+
1. Identify the task, user, and states from the supplied brief. State assumptions;
|
|
9
|
+
ask only for missing decisions that block useful implementation.
|
|
10
|
+
2. Inspect the consuming application's existing page layout and routing. Reuse its
|
|
11
|
+
shell and shared components. In Universe, search `@databricks/web-shared` and
|
|
12
|
+
Storybook patterns before constructing layout.
|
|
13
|
+
3. Map each region with [Pick a component](dbui-pick-component.md) and each icon with
|
|
14
|
+
[Pick an icon](dbui-pick-icon.md). Verify Figma variants against actual props.
|
|
15
|
+
4. Follow the app's styling convention and [Token selection](../docs/tokens.md).
|
|
16
|
+
Preserve component states and geometry through props rather than CSS overrides.
|
|
17
|
+
5. Implement the full applicable state set: loading, populated, empty, filtered-empty,
|
|
18
|
+
error, denied, and disabled. Distinguish unavailable data from a genuine zero.
|
|
19
|
+
Read [Voice](../docs/voice.md) for labels, recovery, and confirmation text.
|
|
20
|
+
6. Run [Validate](dbui-validate.md). Exercise the main journey and relevant keyboard,
|
|
21
|
+
theme, responsive, and overflow behavior using the project's test workflow.
|
|
22
|
+
|
|
23
|
+
Report the implemented journey, checks performed, and unresolved gaps. For a design
|
|
24
|
+
critique beyond implementation correctness, use [Review](dbui-review.md).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-check-ecosystem
|
|
3
|
+
description: Check platform fit against project-provided evidence and skip unsupported claims.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Check ecosystem fit
|
|
7
|
+
|
|
8
|
+
Read relevant product requirements, architecture, permission models, and neighboring
|
|
9
|
+
flows supplied by the project. In Universe, follow the applicable platform documentation
|
|
10
|
+
instructions. Use project-provided context for platform-specific decisions.
|
|
11
|
+
|
|
12
|
+
If no reliable context is available, return `STATUS: skipped — no platform evidence
|
|
13
|
+
available`. With partial context, state the limits. Do not replace missing facts with
|
|
14
|
+
generic assumptions about Databricks permissions, availability, or product naming.
|
|
15
|
+
|
|
16
|
+
Check whether the design matches object scope, access requirements, supported actions,
|
|
17
|
+
credential ownership, and existing capabilities. Separate facts from open questions.
|
|
18
|
+
For each correction cite the supplied source and explain the actual mismatch. Do not copy
|
|
19
|
+
confidential evidence into published guidance or expose sensitive details in a report.
|
|
20
|
+
|
|
21
|
+
Return the [review contract](../docs/review-contract.md) with `CHECK: ecosystem`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-check-guidelines
|
|
3
|
+
description: Review the UX behaviors relevant to a Du Bois surface.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Check guidelines
|
|
7
|
+
|
|
8
|
+
Select the topics relevant to the task; do not generate a finding for every row.
|
|
9
|
+
Use these questions to evaluate the design in context.
|
|
10
|
+
|
|
11
|
+
| Topic | Question |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Status | Does long-running work show progress, completion, and a way to return? |
|
|
14
|
+
| Errors | Does the error describe the problem and a feasible next step? |
|
|
15
|
+
| States | Are empty, loading, filtered-empty, denied, and failed distinguishable? |
|
|
16
|
+
| Tables | Can users find, compare, inspect, and act on the data needed for this task? |
|
|
17
|
+
| Filtering | Is the active scope visible, with a way to clear it? |
|
|
18
|
+
| Lineage | Does the graph explain relevant relationships and direction? |
|
|
19
|
+
| Editors | Can users make, inspect, and recover from small changes? |
|
|
20
|
+
| AI output | Can users recognize uncertainty, inspect sources, and handle wrong answers? |
|
|
21
|
+
| Keyboard | Does the interaction follow its component's keyboard contract? |
|
|
22
|
+
| Structure | Can a user arriving by deep link understand context and continue? |
|
|
23
|
+
| Consequence | Is the effect and scope clear before a consequential action? |
|
|
24
|
+
| Charts | Are units, limits, missing data, and exclusions apparent? |
|
|
25
|
+
| Explanation | Is unfamiliar information available where a decision needs it? |
|
|
26
|
+
|
|
27
|
+
For each relevant topic, cite the actual surface behavior and practical consequence.
|
|
28
|
+
Use `FIX` for demonstrated defects or misleading behavior, `IMPROVE` for a tradeoff.
|
|
29
|
+
Return the [review contract](../docs/review-contract.md) with `CHECK: guidelines`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-check-principles
|
|
3
|
+
description: Review design intent and consequential decisions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Check principles
|
|
7
|
+
|
|
8
|
+
Use these principles to explain design tradeoffs:
|
|
9
|
+
|
|
10
|
+
- Built for people accountable for the data: make scope, sources, and consequences clear.
|
|
11
|
+
- Calm carries the work: reserve attention for meaningful change and decisions.
|
|
12
|
+
- Clear over clever, honest over hype: prefer verifiable capability to promises.
|
|
13
|
+
- Every element earns its place: identify what a decoration or control contributes.
|
|
14
|
+
- Learned once, true everywhere: compare with actual neighboring product patterns.
|
|
15
|
+
- Easy the first time, fast the thousandth: preserve discovery and efficient repeat use.
|
|
16
|
+
|
|
17
|
+
Check agency, accountability, custody, fairness, and access where relevant. Look for
|
|
18
|
+
surprising commitments, unverifiable claims, hidden data boundaries, manipulative choices,
|
|
19
|
+
and inaccessible routes to a task. Require evidence before calling these defects.
|
|
20
|
+
|
|
21
|
+
These are design questions, not blanket restrictions on automation or permission models.
|
|
22
|
+
Previously authorized automation can be appropriate; permission checks may intentionally
|
|
23
|
+
prevent an action. A primary destructive button in `DangerModal` is not inherently a dark
|
|
24
|
+
pattern. Evaluate intent, authorization, reversibility, and clear consequences together.
|
|
25
|
+
|
|
26
|
+
Return the [review contract](../docs/review-contract.md) with `CHECK: principles`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-check-voice
|
|
3
|
+
description: Review user-facing copy for clarity, consistency, and appropriate tone.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Check voice
|
|
7
|
+
|
|
8
|
+
Read [Voice and tone](../docs/voice.md). Extract visible copy and accessible strings:
|
|
9
|
+
labels, placeholders, tooltips, headings, errors, toasts, and empty states. Skip internal
|
|
10
|
+
identifiers and telemetry keys. Check terminology against supplied current product guidance.
|
|
11
|
+
|
|
12
|
+
Propose exact replacements for unclear actions, inconsistent names, unsupported claims,
|
|
13
|
+
missing units, and errors without a feasible next step. Distinguish editorial suggestions
|
|
14
|
+
from defects that mislead the user. Do not invent product capabilities to improve wording.
|
|
15
|
+
|
|
16
|
+
Review layout only where text loses its meaning through truncation or inaccessible naming.
|
|
17
|
+
Return the [review contract](../docs/review-contract.md) with `CHECK: voice`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-pick-component
|
|
3
|
+
description: Select a Du Bois component for a UI task without guessing exports or props.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pick a component
|
|
7
|
+
|
|
8
|
+
1. Describe the interaction: selecting a value, running an action, navigating, or
|
|
9
|
+
revealing content. Search the existing `AGENTS.md` selection tables; in Universe,
|
|
10
|
+
use `js/docs/design-system/components.md` and the consuming app's shared components.
|
|
11
|
+
2. Prefer the documented composite: `DangerModal` for destructive confirmation,
|
|
12
|
+
`InfoTooltip` for an info affordance, `DropdownMenu` for actions. A value picker
|
|
13
|
+
instead needs a selection component such as `SimpleSelect` or `DialogCombobox`.
|
|
14
|
+
3. Verify the export and props in the installed `dist-types` declarations. In Universe,
|
|
15
|
+
also read `js/packages/du-bois/src/primitives/<Component>/<Component>.mdx` and source.
|
|
16
|
+
Import named exports from `@databricks/design-system`.
|
|
17
|
+
4. When translating Figma, inspect the component's Code Connect mapping if available.
|
|
18
|
+
Nested layers may be slots or children, not new public components or Boolean props.
|
|
19
|
+
5. If there is a gap, describe what you searched and compose the nearest supported
|
|
20
|
+
primitives. Do not invent an export, duplicate a shared widget, or add a dependency.
|
|
21
|
+
|
|
22
|
+
Return the selected component, why it fits, the verified import, and any relevant
|
|
23
|
+
composition or accessibility requirement. Use [Pick an icon](dbui-pick-icon.md) for glyphs.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-pick-icon
|
|
3
|
+
description: Find a Du Bois icon by meaning and verify its exported name.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pick an icon
|
|
7
|
+
|
|
8
|
+
1. Identify whether the icon represents an object, action, state, or control chrome.
|
|
9
|
+
2. In Universe, read `design-system/src/design-system/Icon/CLAUDE.md`, then search
|
|
10
|
+
`icon-metadata.json` in that directory and `design-system/src/assets/icons/aliases.json`
|
|
11
|
+
by concept and synonyms. Follow the classification and description when present.
|
|
12
|
+
3. In an installed package, search `dist/icon-metadata.json` for classifications,
|
|
13
|
+
descriptions, and product areas. This file is also exported as
|
|
14
|
+
`@databricks/design-system/icon-metadata.json`. Check `dist-types/design-system/Icon/`
|
|
15
|
+
and the root declarations for available names. For icons without metadata, use an
|
|
16
|
+
existing product example or ask for design input when the distinction matters.
|
|
17
|
+
4. Verify the exact named export before importing from `@databricks/design-system`.
|
|
18
|
+
Use a verified catalog icon; if none fits, report the gap.
|
|
19
|
+
5. Use the component's icon prop where available. Give an icon-only control an
|
|
20
|
+
accessible name; a tooltip alone does not supply one. Let the component size and
|
|
21
|
+
color its icon instead of overriding the glyph to match a screenshot.
|
|
22
|
+
|
|
23
|
+
Return the export, meaning, and source evidence. If nothing fits, report the gap.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-review
|
|
3
|
+
description: Review a Du Bois design through standards, UX, voice, principles, and platform fit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review a design
|
|
7
|
+
|
|
8
|
+
State the user, task, maturity, and surface inferred from the supplied input. Use existing
|
|
9
|
+
context; clarify only consequential uncertainty. A brief or screenshot permits different
|
|
10
|
+
checks from runnable code. State which inputs and interactions are actually available.
|
|
11
|
+
|
|
12
|
+
Run the relevant checks, each with that same scope:
|
|
13
|
+
|
|
14
|
+
- [Standards](dbui-validate.md): API and implementation correctness.
|
|
15
|
+
- [Guidelines](dbui-check-guidelines.md): task behavior.
|
|
16
|
+
- [Voice](dbui-check-voice.md): user-facing copy.
|
|
17
|
+
- [Principles](dbui-check-principles.md): intent and consequential decisions.
|
|
18
|
+
- [Ecosystem](dbui-check-ecosystem.md): platform fit where evidence is available.
|
|
19
|
+
|
|
20
|
+
Run sequentially, or delegate independent checks if the user's instructions and agent
|
|
21
|
+
capabilities permit it. Do not require a specific tool, model, or parallel agent facility.
|
|
22
|
+
Each check uses the [review contract](../docs/review-contract.md); report failed or skipped
|
|
23
|
+
checks honestly instead of treating them as a pass.
|
|
24
|
+
|
|
25
|
+
Deduplicate findings about the same root problem. Lead with consequential `FIX` items,
|
|
26
|
+
then useful `IMPROVE` suggestions and specific `WORKING` observations. Preserve evidence,
|
|
27
|
+
locations, and concrete next steps. Resolve disagreements against the actual API and
|
|
28
|
+
requirements; a stylistic preference does not override correct component behavior.
|
|
29
|
+
|
|
30
|
+
Review alone does not authorize changing files, posting comments, or taking external actions.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dbui-validate
|
|
3
|
+
description: Check Du Bois usage and run the consuming project’s existing checks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Validate implementation
|
|
7
|
+
|
|
8
|
+
Read the existing component, accessibility, and pitfalls guidance first: package
|
|
9
|
+
`AGENTS.md`, or `js/docs/design-system/` in Universe. Check the bespoke composition and
|
|
10
|
+
styling closely, including named exports, real props, `componentId`, labels, and tokens.
|
|
11
|
+
Generated code and use of a library component do not prove the composition is correct.
|
|
12
|
+
|
|
13
|
+
Run the consuming project's registered lint, formatting, type, and relevant test
|
|
14
|
+
commands. In Universe, follow its `CLAUDE.md` and `TESTING.md`; use the required UI test
|
|
15
|
+
workflow when authoring UI tests. Linters cover only their configured rules and can
|
|
16
|
+
have false positives.
|
|
17
|
+
|
|
18
|
+
Verify interactions in the rendered surface when available: keyboard focus, activation,
|
|
19
|
+
Escape and focus restoration, loading/error/empty branches, light/dark mode, and layout
|
|
20
|
+
at the supported widths. A screenshot-only review must mark runtime checks as unverified.
|
|
21
|
+
|
|
22
|
+
Use the [review contract](../docs/review-contract.md) with `CHECK: standards`. Separate
|
|
23
|
+
observed failures from recommendations, and include check failures or unavailable checks.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from '@emotion/react/jsx-runtime';
|
|
2
2
|
import React__default, { useRef, useCallback } from 'react';
|
|
3
3
|
import { useController } from 'react-hook-form';
|
|
4
|
-
import { u as useComboboxState, T as TypeaheadComboboxRoot, a as TypeaheadComboboxMultiSelectInput, b as TypeaheadComboboxMenu, c as TypeaheadComboboxInput } from './index-
|
|
5
|
-
import './WizardStepContentWrapper-
|
|
4
|
+
import { u as useComboboxState, T as TypeaheadComboboxRoot, a as TypeaheadComboboxMultiSelectInput, b as TypeaheadComboboxMenu, c as TypeaheadComboboxInput } from './index-CUCuUviS.js';
|
|
5
|
+
import './WizardStepContentWrapper-bbh_CoIf.js';
|
|
6
6
|
import '@react-aria/listbox';
|
|
7
7
|
import 'classnames';
|
|
8
8
|
import '@emotion/react';
|
|
@@ -18,6 +18,8 @@ import '@floating-ui/dom';
|
|
|
18
18
|
import 'react-dom';
|
|
19
19
|
import '@radix-ui/react-hover-card';
|
|
20
20
|
import '@radix-ui/react-toast';
|
|
21
|
+
import '@radix-ui/react-slider';
|
|
22
|
+
import '@radix-ui/react-toolbar';
|
|
21
23
|
import '@react-aria/combobox';
|
|
22
24
|
import '@react-aria/overlays';
|
|
23
25
|
import '@react-aria/utils';
|
|
@@ -53,12 +55,10 @@ import '@radix-ui/react-navigation-menu';
|
|
|
53
55
|
import '@radix-ui/react-radio-group';
|
|
54
56
|
import '@radix-ui/react-progress';
|
|
55
57
|
import 'react-resizable';
|
|
56
|
-
import '@radix-ui/react-slider';
|
|
57
58
|
import '@radix-ui/react-scroll-area';
|
|
58
59
|
import '@radix-ui/react-tabs';
|
|
59
60
|
import 'lodash/debounce';
|
|
60
61
|
import '@radix-ui/react-toggle';
|
|
61
|
-
import '@radix-ui/react-toolbar';
|
|
62
62
|
|
|
63
63
|
function RHFControlledTypeaheadComboboxV2({ name, control, rules, allItems, itemToString, matcher, getKey, allowNewValue, children, validationState, inputProps, menuProps, onInputChange, componentId, analyticsEvents, valueHasNoPii, preventUnsetOnBlur, ...props }) {
|
|
64
64
|
const { field } = useController({
|
|
@@ -169,4 +169,4 @@ function RHFControlledMultiSelectTypeaheadComboboxV2({ name, control, rules, all
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
export { RHFControlledMultiSelectTypeaheadComboboxV2, RHFControlledTypeaheadComboboxV2 };
|
|
172
|
-
//# sourceMappingURL=RHFControlledTypeaheadComboboxV2-
|
|
172
|
+
//# sourceMappingURL=RHFControlledTypeaheadComboboxV2-nSSYj16I.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RHFControlledTypeaheadComboboxV2-DsH-nIEk.js","sources":["../src/design-system/FormV2/RHFControlledTypeaheadComboboxV2.tsx"],"sourcesContent":["import type { Key } from '@react-types/shared';\nimport type { HTMLAttributes } from 'react';\nimport React, { useCallback, useRef } from 'react';\nimport type { Control, FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';\nimport { useController } from 'react-hook-form';\n\nimport type { DesignSystemEventProviderAnalyticsEventTypes } from '../DesignSystemEventProvider';\nimport {\n TypeaheadComboboxInput as TypeaheadComboboxV2Input,\n TypeaheadComboboxMenu as TypeaheadComboboxV2Menu,\n TypeaheadComboboxMultiSelectInput as TypeaheadComboboxV2MultiSelectInput,\n TypeaheadComboboxRoot as TypeaheadComboboxV2Root,\n useComboboxState as useComboboxStateV2,\n} from '../TypeaheadComboboxV2';\nimport type { TypeaheadComboboxInputProps as TypeaheadComboboxV2InputProps } from '../TypeaheadComboboxV2/TypeaheadComboboxInput';\nimport type { TypeaheadComboboxMenuProps as TypeaheadComboboxV2MenuProps } from '../TypeaheadComboboxV2/TypeaheadComboboxMenu';\nimport type { TypeaheadComboboxMultiSelectInputProps as TypeaheadComboboxV2MultiSelectInputProps } from '../TypeaheadComboboxV2/TypeaheadComboboxMultiSelectInput';\nimport type { TypeaheadComboboxRootProps as TypeaheadComboboxV2RootProps } from '../TypeaheadComboboxV2/TypeaheadComboboxRoot';\nimport type { ComboboxStateValue } from '../TypeaheadComboboxV2/hooks/useComboboxState';\nimport type { AnalyticsEventValueChangeNoPiiFlagProps, ValidationState } from '../types';\n\n// This file holds the react-aria TypeaheadComboboxV2 RHF adapters, split out of RHFAdapters.tsx so the\n// (broadly imported) RHFControlledComponents barrel does not statically pull the react-aria combobox\n// subtree into the common chunk. RHFAdapters.tsx React.lazy-imports these, so the ~175KB subtree only\n// loads on pages that actually render a V2 typeahead.\n\n// These props are omitted, as `useController` handles them. (Mirrors RHFAdapters.tsx.)\ntype OmittedOriginalProps = 'name' | 'onChange' | 'onBlur' | 'value' | 'defaultValue' | 'checked';\n\nexport interface RHFControlledTypeaheadComboboxV2Props<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>\n extends\n Omit<\n TypeaheadComboboxV2RootProps<TFieldValues[TName]>,\n OmittedOriginalProps | 'comboboxState' | 'componentId' | 'children'\n >,\n UseControllerProps<TFieldValues, TName>,\n AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange> {\n control: Control<TFieldValues, any>;\n name: TName;\n // The react-aria hook owns filtering, so children render `comboboxState.filteredItems` rather than\n // receiving a consumer-maintained `items` list (the key API change from the legacy adapter).\n children: (renderProps: { comboboxState: ComboboxStateValue<Required<TFieldValues>[TName]> }) => React.ReactNode;\n validationState?: ValidationState;\n allItems: Required<TFieldValues>[TName][];\n itemToString: (item: Required<TFieldValues>[TName]) => string;\n matcher?: (item: Required<TFieldValues>[TName], query: string) => boolean;\n getKey?: (item: Required<TFieldValues>[TName]) => Key;\n /* Whether to allow the input value to not match any options in the list. For this to work, the item type (T) must be a string.\n * Defaults to false.\n */\n allowNewValue?: boolean;\n inputProps?: Partial<Omit<TypeaheadComboboxV2InputProps, 'componentId'>>;\n menuProps?: Partial<TypeaheadComboboxV2MenuProps>;\n onInputChange?: (inputValue: string) => void;\n /** @deprecated No-op under react-aria; accepted for source-compat while migrating off the legacy adapter. */\n preventUnsetOnBlur?: boolean;\n}\n\nexport function RHFControlledTypeaheadComboboxV2<\n TFieldValues extends FieldValues,\n TName extends FieldPath<TFieldValues>,\n>({\n name,\n control,\n rules,\n allItems,\n itemToString,\n matcher,\n getKey,\n allowNewValue,\n children,\n validationState,\n inputProps,\n menuProps,\n onInputChange,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n preventUnsetOnBlur,\n ...props\n}: RHFControlledTypeaheadComboboxV2Props<TFieldValues, TName> &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element {\n const { field } = useController<TFieldValues, TName>({\n name,\n control,\n rules,\n });\n\n const comboboxState = useComboboxStateV2({\n allItems,\n itemToString,\n getKey,\n matcher,\n allowNewValue,\n formValue: field.value,\n formOnChange: field.onChange,\n formOnBlur: field.onBlur,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n preventUnsetOnBlur,\n // react-aria owns the input value; surface changes through the 'input' state event so the legacy\n // `onInputChange` contract keeps working without making the input value a controlled prop.\n onStateChange: onInputChange\n ? (change) => {\n if (change.type === 'input') {\n onInputChange(change.inputValue);\n }\n }\n : undefined,\n });\n\n return (\n <TypeaheadComboboxV2Root {...props} comboboxState={comboboxState}>\n <TypeaheadComboboxV2Input {...inputProps} validationState={validationState} ref={field.ref} />\n <TypeaheadComboboxV2Menu {...menuProps}>{children({ comboboxState })}</TypeaheadComboboxV2Menu>\n </TypeaheadComboboxV2Root>\n );\n}\n\nexport interface RHFControlledMultiSelectTypeaheadComboboxV2Props<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>\n extends\n Omit<\n TypeaheadComboboxV2RootProps<TFieldValues>,\n OmittedOriginalProps | 'comboboxState' | 'componentId' | 'children'\n >,\n UseControllerProps<TFieldValues, TName>,\n AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange> {\n control: Control<any, TFieldValues>;\n // Required override because the full array is the field value, but TName implies a scalar property.\n name: any;\n children: (renderProps: {\n comboboxState: ComboboxStateValue<TFieldValues>;\n selectedItems: TFieldValues[];\n }) => React.ReactNode;\n validationState?: ValidationState;\n allItems: TFieldValues[];\n itemToString: (item: TFieldValues) => string;\n matcher?: (item: TFieldValues, query: string) => boolean;\n getKey?: (item: TFieldValues) => Key;\n inputProps?: Partial<\n Omit<\n TypeaheadComboboxV2MultiSelectInputProps<TFieldValues>,\n 'selectedItems' | 'setSelectedItems' | 'getSelectedItemLabel'\n >\n >;\n menuProps?: Partial<TypeaheadComboboxV2MenuProps>;\n onInputChange?: (inputValue: string) => void;\n}\n\nexport function RHFControlledMultiSelectTypeaheadComboboxV2<TFieldValues extends FieldValues>({\n name,\n control,\n rules,\n allItems,\n itemToString,\n matcher,\n getKey,\n children,\n validationState,\n inputProps,\n menuProps,\n onInputChange,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n ...props\n}: RHFControlledMultiSelectTypeaheadComboboxV2Props<TFieldValues> &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element {\n const { field } = useController({\n name,\n control,\n rules,\n });\n\n // The array field value IS the selection — drive it straight from RHF, no local mirror. `getKey`\n // must be stable across renders (react-aria keys options by it) so memoize on field.value identity.\n const selectedItems = React.useMemo<TFieldValues[]>(() => field.value ?? [], [field.value]);\n const selectedItemsRef = useRef(selectedItems);\n selectedItemsRef.current = selectedItems;\n\n // The hook always calls this with a concrete array on a selection commit, but the setter type also\n // permits an updater function — resolve it against the latest selection so both shapes are correct.\n const setSelectedItems = useCallback<React.Dispatch<React.SetStateAction<TFieldValues[]>>>(\n (next) => {\n const resolved = typeof next === 'function' ? next(selectedItemsRef.current) : next;\n field.onChange(resolved);\n },\n [field],\n );\n\n const comboboxState = useComboboxStateV2<TFieldValues>({\n allItems,\n itemToString,\n getKey,\n matcher,\n multiSelect: true,\n // Multi-select drives the form through selectedItems/setSelectedItems (above), not the single-select\n // form bridge: formValue/formOnChange/formOnBlur are single-value props, and passing the array field\n // value as formValue would feed itemToString an array (breaking the input filter).\n selectedItems,\n setSelectedItems,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n onStateChange: onInputChange\n ? (change) => {\n if (change.type === 'input') {\n onInputChange(change.inputValue);\n }\n }\n : undefined,\n });\n\n return (\n <TypeaheadComboboxV2Root {...props} comboboxState={comboboxState}>\n <TypeaheadComboboxV2MultiSelectInput\n {...inputProps}\n selectedItems={selectedItems}\n setSelectedItems={setSelectedItems}\n getSelectedItemLabel={itemToString}\n validationState={validationState}\n ref={field.ref}\n />\n <TypeaheadComboboxV2Menu {...menuProps}>\n {children({\n comboboxState,\n selectedItems,\n })}\n </TypeaheadComboboxV2Menu>\n </TypeaheadComboboxV2Root>\n );\n}\n"],"names":["RHFControlledTypeaheadComboboxV2","name","control","rules","allItems","itemToString","matcher","getKey","allowNewValue","children","validationState","inputProps","menuProps","onInputChange","componentId","analyticsEvents","valueHasNoPii","preventUnsetOnBlur","props","field","useController","comboboxState","useComboboxStateV2","formValue","value","formOnChange","onChange","formOnBlur","onBlur","onStateChange","change","type","inputValue","undefined","_jsxs","TypeaheadComboboxV2Root","_jsx","TypeaheadComboboxV2Input","ref","TypeaheadComboboxV2Menu","RHFControlledMultiSelectTypeaheadComboboxV2","selectedItems","React","useMemo","selectedItemsRef","useRef","current","setSelectedItems","useCallback","next","resolved","multiSelect","TypeaheadComboboxV2MultiSelectInput","getSelectedItemLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DO,SAASA,gCAAAA,CAGd,EACAC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,YAAY,EACZC,OAAO,EACPC,MAAM,EACNC,aAAa,EACbC,QAAQ,EACRC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,aAAa,EACbC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,kBAAkB,EAClB,GAAGC,KAAAA,EAE6C,EAAA;AAChD,IAAA,MAAM,EAAEC,KAAK,EAAE,GAAGC,aAAAA,CAAmC;AACnDnB,QAAAA,IAAAA;AACAC,QAAAA,OAAAA;AACAC,QAAAA;AACF,KAAA,CAAA;AAEA,IAAA,MAAMkB,gBAAgBC,gBAAAA,CAAmB;AACvClB,QAAAA,QAAAA;AACAC,QAAAA,YAAAA;AACAE,QAAAA,MAAAA;AACAD,QAAAA,OAAAA;AACAE,QAAAA,aAAAA;AACAe,QAAAA,SAAAA,EAAWJ,MAAMK,KAAK;AACtBC,QAAAA,YAAAA,EAAcN,MAAMO,QAAQ;AAC5BC,QAAAA,UAAAA,EAAYR,MAAMS,MAAM;AACxBd,QAAAA,WAAAA;AACAC,QAAAA,eAAAA;AACAC,QAAAA,aAAAA;AACAC,QACA;;AAEAY,QAAAA,aAAAA,EAAehB,gBACX,CAACiB,MAAAA,GAAAA;YACC,IAAIA,MAAAA,CAAOC,IAAI,KAAK,OAAA,EAAS;AAC3BlB,gBAAAA,aAAAA,CAAciB,OAAOE,UAAU,CAAA;AACjC,YAAA;QACF,CAAA,GACAC;AACN,KAAA,CAAA;AAEA,IAAA,qBACEC,IAAA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AAAC/B,QAAAA;AAAM,KAAA,CAAA;AAGT,IAAA,MAAME,gBAAgBC,gBAAAA,CAAiC;AACrDlB,QAAAA,QAAAA;AACAC,QAAAA,YAAAA;AACAE,QAAAA,MAAAA;AACAD,QAAAA,OAAAA;QACA6C,WAAAA,EAAa,IAAA;;;;AAIbV,QAAAA,aAAAA;AACAM,QAAAA,gBAAAA;AACAjC,QAAAA,WAAAA;AACAC,QAAAA,eAAAA;AACAC,QAAAA,aAAAA;AACAa,QAAAA,aAAAA,EAAehB,gBACX,CAACiB,MAAAA,GAAAA;YACC,IAAIA,MAAAA,CAAOC,IAAI,KAAK,OAAA,EAAS;AAC3BlB,gBAAAA,aAAAA,CAAciB,OAAOE,UAAU,CAAA;AACjC,YAAA;QACF,CAAA,GACAC;AACN,KAAA,CAAA;AAEA,IAAA,qBACEC,IAAA,CAACC,qBAAAA,EAAAA;AAAyB,QAAA,GAAGjB,KAAK;QAAEG,aAAAA,EAAeA,aAAAA;;0BACjDe,GAAA,CAACgB,iCAAAA,EAAAA;AACE,gBAAA,GAAGzC,UAAU;gBACd8B,aAAAA,EAAeA,aAAAA;gBACfM,gBAAAA,EAAkBA,gBAAAA;gBAClBM,oBAAAA,EAAsBhD,YAAAA;gBACtBK,eAAAA,EAAiBA,eAAAA;AACjB4B,gBAAAA,GAAAA,EAAKnB,MAAMmB;;0BAEbF,GAAA,CAACG,qBAAAA,EAAAA;AAAyB,gBAAA,GAAG3B,SAAS;0BACnCH,QAAAA,CAAS;AACRY,oBAAAA,aAAAA;AACAoB,oBAAAA;AACF,iBAAA;;;;AAIR;;;;"}
|
|
1
|
+
{"version":3,"file":"RHFControlledTypeaheadComboboxV2-nSSYj16I.js","sources":["../src/design-system/FormV2/RHFControlledTypeaheadComboboxV2.tsx"],"sourcesContent":["import type { Key } from '@react-types/shared';\nimport type { HTMLAttributes } from 'react';\nimport React, { useCallback, useRef } from 'react';\nimport type { Control, FieldPath, FieldValues, UseControllerProps } from 'react-hook-form';\nimport { useController } from 'react-hook-form';\n\nimport type { DesignSystemEventProviderAnalyticsEventTypes } from '../DesignSystemEventProvider';\nimport {\n TypeaheadComboboxInput as TypeaheadComboboxV2Input,\n TypeaheadComboboxMenu as TypeaheadComboboxV2Menu,\n TypeaheadComboboxMultiSelectInput as TypeaheadComboboxV2MultiSelectInput,\n TypeaheadComboboxRoot as TypeaheadComboboxV2Root,\n useComboboxState as useComboboxStateV2,\n} from '../TypeaheadComboboxV2';\nimport type { TypeaheadComboboxInputProps as TypeaheadComboboxV2InputProps } from '../TypeaheadComboboxV2/TypeaheadComboboxInput';\nimport type { TypeaheadComboboxMenuProps as TypeaheadComboboxV2MenuProps } from '../TypeaheadComboboxV2/TypeaheadComboboxMenu';\nimport type { TypeaheadComboboxMultiSelectInputProps as TypeaheadComboboxV2MultiSelectInputProps } from '../TypeaheadComboboxV2/TypeaheadComboboxMultiSelectInput';\nimport type { TypeaheadComboboxRootProps as TypeaheadComboboxV2RootProps } from '../TypeaheadComboboxV2/TypeaheadComboboxRoot';\nimport type { ComboboxStateValue } from '../TypeaheadComboboxV2/hooks/useComboboxState';\nimport type { AnalyticsEventValueChangeNoPiiFlagProps, ValidationState } from '../types';\n\n// This file holds the react-aria TypeaheadComboboxV2 RHF adapters, split out of RHFAdapters.tsx so the\n// (broadly imported) RHFControlledComponents barrel does not statically pull the react-aria combobox\n// subtree into the common chunk. RHFAdapters.tsx React.lazy-imports these, so the ~175KB subtree only\n// loads on pages that actually render a V2 typeahead.\n\n// These props are omitted, as `useController` handles them. (Mirrors RHFAdapters.tsx.)\ntype OmittedOriginalProps = 'name' | 'onChange' | 'onBlur' | 'value' | 'defaultValue' | 'checked';\n\nexport interface RHFControlledTypeaheadComboboxV2Props<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>\n extends\n Omit<\n TypeaheadComboboxV2RootProps<TFieldValues[TName]>,\n OmittedOriginalProps | 'comboboxState' | 'componentId' | 'children'\n >,\n UseControllerProps<TFieldValues, TName>,\n AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange> {\n control: Control<TFieldValues, any>;\n name: TName;\n // The react-aria hook owns filtering, so children render `comboboxState.filteredItems` rather than\n // receiving a consumer-maintained `items` list (the key API change from the legacy adapter).\n children: (renderProps: { comboboxState: ComboboxStateValue<Required<TFieldValues>[TName]> }) => React.ReactNode;\n validationState?: ValidationState;\n allItems: Required<TFieldValues>[TName][];\n itemToString: (item: Required<TFieldValues>[TName]) => string;\n matcher?: (item: Required<TFieldValues>[TName], query: string) => boolean;\n getKey?: (item: Required<TFieldValues>[TName]) => Key;\n /* Whether to allow the input value to not match any options in the list. For this to work, the item type (T) must be a string.\n * Defaults to false.\n */\n allowNewValue?: boolean;\n inputProps?: Partial<Omit<TypeaheadComboboxV2InputProps, 'componentId'>>;\n menuProps?: Partial<TypeaheadComboboxV2MenuProps>;\n onInputChange?: (inputValue: string) => void;\n /** @deprecated No-op under react-aria; accepted for source-compat while migrating off the legacy adapter. */\n preventUnsetOnBlur?: boolean;\n}\n\nexport function RHFControlledTypeaheadComboboxV2<\n TFieldValues extends FieldValues,\n TName extends FieldPath<TFieldValues>,\n>({\n name,\n control,\n rules,\n allItems,\n itemToString,\n matcher,\n getKey,\n allowNewValue,\n children,\n validationState,\n inputProps,\n menuProps,\n onInputChange,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n preventUnsetOnBlur,\n ...props\n}: RHFControlledTypeaheadComboboxV2Props<TFieldValues, TName> &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element {\n const { field } = useController<TFieldValues, TName>({\n name,\n control,\n rules,\n });\n\n const comboboxState = useComboboxStateV2({\n allItems,\n itemToString,\n getKey,\n matcher,\n allowNewValue,\n formValue: field.value,\n formOnChange: field.onChange,\n formOnBlur: field.onBlur,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n preventUnsetOnBlur,\n // react-aria owns the input value; surface changes through the 'input' state event so the legacy\n // `onInputChange` contract keeps working without making the input value a controlled prop.\n onStateChange: onInputChange\n ? (change) => {\n if (change.type === 'input') {\n onInputChange(change.inputValue);\n }\n }\n : undefined,\n });\n\n return (\n <TypeaheadComboboxV2Root {...props} comboboxState={comboboxState}>\n <TypeaheadComboboxV2Input {...inputProps} validationState={validationState} ref={field.ref} />\n <TypeaheadComboboxV2Menu {...menuProps}>{children({ comboboxState })}</TypeaheadComboboxV2Menu>\n </TypeaheadComboboxV2Root>\n );\n}\n\nexport interface RHFControlledMultiSelectTypeaheadComboboxV2Props<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>\n extends\n Omit<\n TypeaheadComboboxV2RootProps<TFieldValues>,\n OmittedOriginalProps | 'comboboxState' | 'componentId' | 'children'\n >,\n UseControllerProps<TFieldValues, TName>,\n AnalyticsEventValueChangeNoPiiFlagProps<DesignSystemEventProviderAnalyticsEventTypes.OnValueChange> {\n control: Control<any, TFieldValues>;\n // Required override because the full array is the field value, but TName implies a scalar property.\n name: any;\n children: (renderProps: {\n comboboxState: ComboboxStateValue<TFieldValues>;\n selectedItems: TFieldValues[];\n }) => React.ReactNode;\n validationState?: ValidationState;\n allItems: TFieldValues[];\n itemToString: (item: TFieldValues) => string;\n matcher?: (item: TFieldValues, query: string) => boolean;\n getKey?: (item: TFieldValues) => Key;\n inputProps?: Partial<\n Omit<\n TypeaheadComboboxV2MultiSelectInputProps<TFieldValues>,\n 'selectedItems' | 'setSelectedItems' | 'getSelectedItemLabel'\n >\n >;\n menuProps?: Partial<TypeaheadComboboxV2MenuProps>;\n onInputChange?: (inputValue: string) => void;\n}\n\nexport function RHFControlledMultiSelectTypeaheadComboboxV2<TFieldValues extends FieldValues>({\n name,\n control,\n rules,\n allItems,\n itemToString,\n matcher,\n getKey,\n children,\n validationState,\n inputProps,\n menuProps,\n onInputChange,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n ...props\n}: RHFControlledMultiSelectTypeaheadComboboxV2Props<TFieldValues> &\n Omit<HTMLAttributes<HTMLDivElement>, 'children'>): JSX.Element {\n const { field } = useController({\n name,\n control,\n rules,\n });\n\n // The array field value IS the selection — drive it straight from RHF, no local mirror. `getKey`\n // must be stable across renders (react-aria keys options by it) so memoize on field.value identity.\n const selectedItems = React.useMemo<TFieldValues[]>(() => field.value ?? [], [field.value]);\n const selectedItemsRef = useRef(selectedItems);\n selectedItemsRef.current = selectedItems;\n\n // The hook always calls this with a concrete array on a selection commit, but the setter type also\n // permits an updater function — resolve it against the latest selection so both shapes are correct.\n const setSelectedItems = useCallback<React.Dispatch<React.SetStateAction<TFieldValues[]>>>(\n (next) => {\n const resolved = typeof next === 'function' ? next(selectedItemsRef.current) : next;\n field.onChange(resolved);\n },\n [field],\n );\n\n const comboboxState = useComboboxStateV2<TFieldValues>({\n allItems,\n itemToString,\n getKey,\n matcher,\n multiSelect: true,\n // Multi-select drives the form through selectedItems/setSelectedItems (above), not the single-select\n // form bridge: formValue/formOnChange/formOnBlur are single-value props, and passing the array field\n // value as formValue would feed itemToString an array (breaking the input filter).\n selectedItems,\n setSelectedItems,\n componentId,\n analyticsEvents,\n valueHasNoPii,\n onStateChange: onInputChange\n ? (change) => {\n if (change.type === 'input') {\n onInputChange(change.inputValue);\n }\n }\n : undefined,\n });\n\n return (\n <TypeaheadComboboxV2Root {...props} comboboxState={comboboxState}>\n <TypeaheadComboboxV2MultiSelectInput\n {...inputProps}\n selectedItems={selectedItems}\n setSelectedItems={setSelectedItems}\n getSelectedItemLabel={itemToString}\n validationState={validationState}\n ref={field.ref}\n />\n <TypeaheadComboboxV2Menu {...menuProps}>\n {children({\n comboboxState,\n selectedItems,\n })}\n </TypeaheadComboboxV2Menu>\n </TypeaheadComboboxV2Root>\n );\n}\n"],"names":["RHFControlledTypeaheadComboboxV2","name","control","rules","allItems","itemToString","matcher","getKey","allowNewValue","children","validationState","inputProps","menuProps","onInputChange","componentId","analyticsEvents","valueHasNoPii","preventUnsetOnBlur","props","field","useController","comboboxState","useComboboxStateV2","formValue","value","formOnChange","onChange","formOnBlur","onBlur","onStateChange","change","type","inputValue","undefined","_jsxs","TypeaheadComboboxV2Root","_jsx","TypeaheadComboboxV2Input","ref","TypeaheadComboboxV2Menu","RHFControlledMultiSelectTypeaheadComboboxV2","selectedItems","React","useMemo","selectedItemsRef","useRef","current","setSelectedItems","useCallback","next","resolved","multiSelect","TypeaheadComboboxV2MultiSelectInput","getSelectedItemLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DO,SAASA,gCAAAA,CAGd,EACAC,IAAI,EACJC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,YAAY,EACZC,OAAO,EACPC,MAAM,EACNC,aAAa,EACbC,QAAQ,EACRC,eAAe,EACfC,UAAU,EACVC,SAAS,EACTC,aAAa,EACbC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,kBAAkB,EAClB,GAAGC,KAAAA,EAE6C,EAAA;AAChD,IAAA,MAAM,EAAEC,KAAK,EAAE,GAAGC,aAAAA,CAAmC;AACnDnB,QAAAA,IAAAA;AACAC,QAAAA,OAAAA;AACAC,QAAAA;AACF,KAAA,CAAA;AAEA,IAAA,MAAMkB,gBAAgBC,gBAAAA,CAAmB;AACvClB,QAAAA,QAAAA;AACAC,QAAAA,YAAAA;AACAE,QAAAA,MAAAA;AACAD,QAAAA,OAAAA;AACAE,QAAAA,aAAAA;AACAe,QAAAA,SAAAA,EAAWJ,MAAMK,KAAK;AACtBC,QAAAA,YAAAA,EAAcN,MAAMO,QAAQ;AAC5BC,QAAAA,UAAAA,EAAYR,MAAMS,MAAM;AACxBd,QAAAA,WAAAA;AACAC,QAAAA,eAAAA;AACAC,QAAAA,aAAAA;AACAC,QACA;;AAEAY,QAAAA,aAAAA,EAAehB,gBACX,CAACiB,MAAAA,GAAAA;YACC,IAAIA,MAAAA,CAAOC,IAAI,KAAK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