@databricks/design-system 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/{WizardStepContentWrapper-CFCTOSm8.js → WizardStepContentWrapper-DsAS2ZAT.js} +1356 -686
- package/dist/WizardStepContentWrapper-DsAS2ZAT.js.map +1 -0
- package/dist/dubois-colors.less +2 -0
- package/dist/fonts/dm-mono/DMMono-Regular.woff2 +0 -0
- package/dist/fonts/dm-mono/dm-mono.css +11 -0
- package/dist/index-dark.css +305 -516
- package/dist/index-dark.mitigated.css +305 -516
- package/dist/index.css +438 -544
- package/dist/index.js +1971 -244
- package/dist/index.js.map +1 -1
- package/dist/index.mitigated.css +447 -553
- package/dist/patterns.js +12 -2
- package/dist/patterns.js.map +1 -1
- package/dist-types/design-system/Button/Button.d.ts +2 -2
- package/dist-types/design-system/ContextMenu/ContextMenu.d.ts +2 -2
- package/dist-types/design-system/DesignSystemProvider/DesignSystemProvider.d.ts +44 -0
- package/dist-types/design-system/Drawer/DrawerContext.d.ts +9 -0
- package/dist-types/design-system/FormV2/RHFAdapters.d.ts +8 -8
- package/dist-types/design-system/Grid/Col.d.ts +1 -3
- package/dist-types/design-system/Grid/NativeCol.d.ts +10 -0
- package/dist-types/design-system/Grid/NativeGridContext.d.ts +11 -0
- package/dist-types/design-system/Grid/NativeRow.d.ts +13 -0
- package/dist-types/design-system/Grid/Row.d.ts +3 -4
- package/dist-types/design-system/Grid/grid-styling.d.ts +22 -0
- package/dist-types/design-system/Grid/gridConstants.d.ts +2 -0
- package/dist-types/design-system/Grid/index.d.ts +1 -0
- package/dist-types/design-system/Grid/rowConstants.d.ts +7 -0
- package/dist-types/design-system/Grid/types.d.ts +49 -0
- package/dist-types/design-system/Hooks/index.d.ts +1 -1
- package/dist-types/design-system/Hooks/useDesignSystemTheme.d.ts +7 -7
- package/dist-types/design-system/Icon/LegacyAntDIcon.d.ts +21 -0
- package/dist-types/design-system/Icon/__generated/icons/FlowsIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchAlertIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchDatasourceIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchDetectionRuleIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/LakewatchParserIcon.d.ts +4 -0
- package/dist-types/design-system/Icon/__generated/icons/index.d.ts +5 -0
- package/dist-types/design-system/Icon/index.d.ts +0 -1
- package/dist-types/design-system/LegacyTooltip/index.d.ts +0 -1
- package/dist-types/design-system/Skeleton/TitleSkeleton.d.ts +9 -3
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxAddButton.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxCheckboxItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxControls.d.ts +2 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxFooter.d.ts +12 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxInput.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMenu.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMenuItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxMultiSelectInput.d.ts +17 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSectionHeader.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxSeparator.d.ts +4 -0
- package/dist-types/design-system/TypeaheadCombobox/TypeaheadComboboxToggleButton.d.ts +8 -0
- package/dist-types/design-system/TypeaheadCombobox/hooks/downshiftHookWrappers.d.ts +8 -0
- package/dist-types/design-system/TypeaheadComboboxV2/CountBadge.d.ts +6 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxAddButton.d.ts +3 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxCheckboxItem.d.ts +10 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxControls.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxFooter.d.ts +2 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxInput.d.ts +9 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMenu.d.ts +17 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMenuItem.d.ts +16 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxMultiSelectInput.d.ts +18 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxRoot.d.ts +17 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSectionHeader.d.ts +1 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSelectedItem.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxSeparator.d.ts +1 -0
- package/dist-types/design-system/TypeaheadComboboxV2/TypeaheadComboboxToggleButton.d.ts +4 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/footerFocus.d.ts +13 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/index.d.ts +4 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxItems.d.ts +32 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxState.d.ts +81 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useComboboxStateProps.d.ts +36 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useMultipleSelectionState.d.ts +25 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useRestoreHighlightedOption.d.ts +18 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useScrollOptionIntoView.d.ts +11 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useTypeaheadComboboxContext.d.ts +2 -0
- package/dist-types/design-system/TypeaheadComboboxV2/hooks/useVirtualizedComboboxScroll.d.ts +36 -0
- package/dist-types/design-system/TypeaheadComboboxV2/index.d.ts +13 -0
- package/dist-types/design-system/TypeaheadComboboxV2/providers/TypeaheadComboboxContext.d.ts +47 -0
- package/dist-types/design-system/Typography/titleLevel.d.ts +11 -0
- package/dist-types/design-system/_shared_/Menu/index.d.ts +1 -1
- package/dist-types/design-system/fonts.d.ts +1 -0
- package/dist-types/design-system/index.d.ts +1 -0
- package/dist-types/design-system/utils/useMediaQuery.d.ts +4 -1
- package/dist-types/theme/_generated/ValidSemanticColors.d.ts +2 -1
- package/package.json +14 -3
- package/dist/WizardStepContentWrapper-CFCTOSm8.js.map +0 -1
- package/dist-types/design-system/Icon/AntdIcon.d.ts +0 -114
- package/dist-types/design-system/LegacyTooltip/LegacyInfoTooltip.d.ts +0 -16
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { p as primitiveColors, d as DesignSystemEventProvider, e as useDesignSystemContext, f as useDesignSystemTheme, I as InfoFillIcon, C as CheckCircleFillIcon, g as WarningFillIcon, h as DangerFillIcon, i as DesignSystemEventProviderAnalyticsEventTypes, j as useDesignSystemEventComponentCallbacks, k as DesignSystemEventProviderComponentTypes, l as DesignSystemEventProviderComponentSubTypeMap, m as useNotifyOnFirstView, n as useStableUuidV4, B as Button, T as Typography, o as ChevronDownIcon, q as ChevronRightIcon, r as DesignSystemAntDConfigProvider, s as CloseSmallIcon, t as addDebugOutlineIfEnabled, v as Modal, w as getAnimationCss, x as token, S as ShapeTokens, y as getDarkModePortalStyles,
|
|
2
|
-
export { a_ as AccessDeniedGraphic, a$ as Accordion, b0 as AccordionPanel, b1 as AlignCenterIcon, b2 as AlignJustifyIcon, b3 as AlignLeftIcon, b4 as AlignRightIcon, b5 as AlignVerticalBottomIcon, b6 as AlignVerticalCenterIcon, b7 as AlignVerticalTopIcon, b8 as AppIcon, b9 as ApplyDesignSystemContextOverrides, ba as ApplyDesignSystemFlags, bb as ArrowDownDotIcon, bc as ArrowDownFillIcon, bd as ArrowDownIcon, be as ArrowInIcon, bf as ArrowInTableIcon, bg as ArrowLeftIcon, bh as ArrowOutTableIcon, bi as ArrowOverIcon, bj as ArrowRightIcon, bk as ArrowUpDotIcon, bl as ArrowUpFillIcon, bm as ArrowUpIcon, bn as ArrowsCollapseIcon, bo as ArrowsConnectIcon, bp as ArrowsExpandIcon, bq as ArrowsUpDownIcon, br as AssistantIcon, bs as AtIcon, bt as Auth0Graphic, bu as Auth0GraphicLarge, bv as AzHorizontalIcon, bw as AzVerticalIcon, bx as BANNER_MAX_HEIGHT, by as BANNER_MIN_HEIGHT, bz as BackupIcon, bA as BadgeCodeIcon, bB as BadgeCodeOffIcon, bC as Banner, bD as BarChartIcon, bE as BarGroupedIcon, bF as BarStackedIcon, bG as BarStackedPercentageIcon, bH as BarsAscendingHorizontalIcon, bI as BarsAscendingVerticalIcon, bJ as BarsDescendingHorizontalIcon, bK as BarsDescendingVerticalIcon, bL as BeakerIcon, bM as BinaryIcon, bN as BlockQuoteIcon, bO as BoldIcon, bP as BookIcon, bQ as BookmarkFillIcon, bR as BookmarkIcon, bS as BooksIcon, bT as BracketsCheckIcon, bU as BracketsCurlyIcon, bV as BracketsErrorIcon, bW as BracketsSquareIcon, bX as BracketsXIcon, bY as BranchCheckIcon, bZ as BranchIcon, b_ as BranchResetIcon, b$ as BriefcaseFillIcon, c0 as BriefcaseIcon, c1 as BrushIcon, c2 as BugIcon, c3 as CalendarClockIcon, c4 as CalendarEventIcon, c5 as CalendarIcon, c6 as CalendarRangeIcon, c7 as CalendarSyncIcon, c8 as CameraIcon, c9 as CapitalizeIcon, ca as CaretDownSquareIcon, cb as CaretUpSquareIcon, cc as CatalogCloudIcon, cd as CatalogGearIcon, ce as CatalogHomeIcon, cf as CatalogIcon, cg as CatalogOffIcon, ch as CatalogSharedIcon, ci as CatalogUserHomeIcon, cj as CellsSquareIcon, ck as CertifiedFillIcon, cl as CertifiedFillSmallIcon, cm as CertifiedIcon, cn as ChainIcon, co as ChartLineIcon, cp as CheckCircleBadgeIcon, cq as CheckCircleSmallIcon, cr as CheckIcon, cs as CheckLineIcon, ct as CheckSmallIcon, cu as CheckboxIcon, cv as ChecklistIcon, cw as ChevronDoubleDownIcon, cx as ChevronDoubleLeftIcon, cy as ChevronDoubleLeftOffIcon, cz as ChevronDoubleRightIcon, cA as ChevronDoubleRightOffIcon, cB as ChevronDoubleUpIcon, cC as ChevronLeftIcon, cD as ChevronUpIcon, cE as ChipIcon, cF as CircleOffLargeIcon, cG as CircleOutlineLargeIcon, cH as ClipboardIcon, cI as ClockIcon, cJ as ClockKeyIcon, cK as ClockOffIcon, cL as CloudCheckIcon, cM as CloudDatabaseIcon, cN as CloudDownloadIcon, cO as CloudIcon, cP as CloudKeyIcon, cQ as CloudModelIcon, cR as CloudOffIcon, cS as CloudUploadIcon, cT as CodeIcon, cU as ColorFillIcon, cV as ColorVars, cW as ColumnIcon, cX as ColumnSplitIcon, cY as ColumnTagIcon, cZ as ColumnsIcon, c_ as CommandIcon, c$ as CommandPaletteIcon, d0 as CompassIcon, d1 as ComponentFinderContext, d2 as ConnectIcon, d3 as Content, d4 as ContextMenu, d5 as CopyIcon, d6 as CreditCardIcon, d7 as CursorClickIcon, d8 as CursorIcon, d9 as CursorPagination, da as CursorTypeIcon, db as CustomAppIcon, dc as DagHorizontalIcon, dd as DagIcon, de as DagVerticalIcon, df as DangerModal, dg as DangerSmallIcon, dh as DashIcon, di as DashboardCodeIcon, dj as DashboardIcon, dk as DataIcon, dl as DataMaskiingGraphic, dm as DatabaseClockIcon, dn as DatabaseIcon, dp as DatabaseImportIcon, dq as DatePicker, dr as DecimalIcon, ds as DeprecatedIcon, dt as DeprecatedSmallIcon, du as DesignSystemContext, dv as DesignSystemEventProviderComponentSubTypes, dw as DesignSystemProvider, dx as DesignSystemThemeContext, dy as DesignSystemThemeProvider, dz as DialogComboboxCountBadge, dA as DialogComboboxCustomButtonTriggerWrapper, dB as DialogComboboxSectionHeader, D as DocumentationSidebar, dC as DollarIcon, dD as DomainCirclesThree, dE as DomainsIcon, dF as DotsCircleIcon, dG as DownloadIcon, dH as DragIcon, dI as Drawer, dJ as DropdownMenu, dK as Empty, dL as EmptyDashboardGraphic, dM as ErdIcon, dN as ExpandLessIcon, dO as ExpandMoreIcon, F as FIXED_VERTICAL_STEPPER_WIDTH, dP as FaceFrownIcon, dQ as FaceNeutralIcon, dR as FaceSmileIcon, dS as FileCodeIcon, dT as FileCubeIcon, dU as FileDocumentIcon, dV as FileIcon, dW as FileImageIcon, dX as FileLockIcon, dY as FileModelIcon, dZ as FileNewIcon, d_ as FilePipelineIcon, d$ as FilterFillIcon, e0 as FilterIcon, e1 as FlagPointerIcon, e2 as FloatIcon, e3 as FlowIcon, e4 as FolderBranchFillIcon, e5 as FolderBranchIcon, e6 as FolderCloudFilledIcon, e7 as FolderCloudIcon, e8 as FolderCubeIcon, e9 as FolderCubeOutlineIcon, ea as FolderFillIcon, eb as FolderHomeIcon, ec as FolderIcon, ed as FolderNewIcon, ee as FolderNodeIcon, ef as FolderOpenBranchIcon, eg as FolderOpenCloudIcon, eh as FolderOpenCubeIcon, ei as FolderOpenIcon, ej as FolderOpenPipelineIcon, ek as FolderOutlinePipelineIcon, el as FolderSolidPipelineIcon, em as FontIcon, en as ForkHorizontalIcon, eo as ForkIcon, ep as Form, eq as FormContextResetBoundary, er as FullscreenExitIcon, es as FullscreenIcon, et as FunctionIcon, eu as FunctionInputIcon, ev as GavelIcon, ew as GearFillIcon, ex as GearIcon, ey as GenieCodeIcon, ez as GenieDeepResearchIcon, eA as GiftIcon, eB as GitCommitIcon, eC as GitMergeIcon, eD as GitRebaseIcon, eE as GlobeIcon, eF as Graphic, eG as GridDashIcon, eH as GridIcon, eI as GroupIcon, eJ as H1Icon, eK as H2Icon, eL as H3Icon, eM as H4Icon, eN as H5Icon, eO as H6Icon, eP as HashIcon, eQ as HistoryIcon, eR as HomeIcon, eS as Icon, eT as ImageIcon, eU as IndentDecreaseIcon, eV as IndentIncreaseIcon, eW as InfinityIcon, eX as InfoBookIcon, eY as InfoIcon, eZ as InfoTooltip, e_ as IngestionIcon, e$ as ItalicIcon, f0 as JoinOperatorIcon, f1 as KeyIcon, f2 as KeyboardIcon, f3 as LakebaseCatalogIcon, f4 as LakebaseIcon, f5 as LakeflowDesignerIcon, f6 as LayerGraphIcon, f7 as LayerIcon, f8 as Layout, f9 as LeafIcon, fa as LegacyAppstoreOutlined, fb as LegacyArrowUpOutlined, fc as LegacyBookOutlined, fd as LegacyBugOutlined, fe as LegacyCheckCircleFilled, ff as LegacyCheckCircleOutlined, fg as LegacyClockCircleFilled, fh as LegacyClockCircleOutlined, fi as LegacyCloseCircleFilled, fj as LegacyCloseOutlined, fk as LegacyCodeOutlined, fl as LegacyCommentOutlined, fm as LegacyCopyOutlined, fn as LegacyDatabaseOutlined, fo as LegacyDeleteOutlined, fp as LegacyDownOutlined, fq as LegacyEditOutlined, fr as LegacyEllipsisOutlined, fs as LegacyExclamationCircleOutlined, ft as LegacyEyeOutlined, fu as LegacyFileOutlined, fv as LegacyFileTextOutlined, fw as LegacyFilterOutlined, fx as LegacyFlagOutlined, fy as LegacyFolderOpenOutlined, fz as LegacyFolderOutlined, fA as LegacyForm, fB as LegacyFormDubois, fC as LegacyFullscreenOutlined, fD as LegacyGithubOutlined, fE as LegacyHourglassOutlined, fF as LegacyLinkOutlined, fG as LegacyLoadingOutlined, fH as LegacyNotificationOutlined, fI as LegacyOptGroup, fJ as LegacyOption, fK as LegacyPauseCircleFilled, fL as LegacyPlayCircleOutlined, fM as LegacyPlusOutlined, fN as LegacyQuestionCircleOutlined, fO as LegacyReloadOutlined, fP as LegacyRightOutlined, fQ as LegacyRocketOutlined, fR as LegacySearchOutlined, fS as LegacySelectOptGroup, fT as LegacySelectOption, fU as LegacySendOutlined, fV as LegacySettingOutlined, fW as LegacySlackOutlined, fX as LegacySwapOutlined, fY as LegacySyncOutlined, fZ as LegacyTable, f_ as LegacyUpOutlined, f$ as LegacyVideoCameraOutlined, g0 as LetterFormatIcon, g1 as LettersIcon, g2 as LettersNumbersIcon, g3 as LibrariesIcon, g4 as LifesaverIcon, g5 as LightbulbIcon, g6 as LightningCircleFillIcon, g7 as LightningIcon, g8 as LinearLineIcon, g9 as LinkIcon, ga as LinkOffIcon, gb as ListBorderIcon, gc as ListClearIcon, gd as ListIcon, ge as ListNumberIcon, gf as Listbox, gg as LoadingIcon, gh as LoadingStateContext, gi as LockFillIcon, gj as LockIcon, gk as LockShareIcon, gl as LockUnlockedIcon, gm as LoopIcon, gn as LowercaseIcon, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, go as MailIcon, gp as MapIcon, gq as MarkdownIcon, gr as McpIcon, gs as MeasureIcon, gt as MegaphoneIcon, gu as MenuIcon, gv as MinusCircleFillIcon, gw as MinusCircleIcon, gx as MinusCircleSmallIcon, gy as MissingBranchGraphic, gz as MissingGraphic, gA as ModelsIcon, gB as MonotoneLineIcon, gC as MonthPickerGrid, gD as MoonIcon, gE as Nav, gF as NavButton, gG as NavigationMenu, gH as NeonProjectIcon, gI as NewChatIcon, gJ as NewTabIcon, gK as NewWindowIcon, gL as NoCaseIcon, gM as NoIcon, gN as NotebookIcon, gO as NotebookPipelineIcon, gP as NotificationIcon, gQ as NotificationOffIcon, gR as NumberFormatIcon, gS as NumbersIcon, gT as OfficeIcon, gU as OntologyIcon, gV as OutageGraphic, gW as Overflow, gX as OverflowHorizontalIcon, gY as OverflowIcon, gZ as PageBottomIcon, g_ as PageFirstIcon, g$ as PageIcon, h0 as PageLastIcon, h1 as PageTopIcon, h2 as Pagination, h3 as Panel, h4 as PanelBody, h5 as PanelDockedIcon, h6 as PanelFloatingIcon, h7 as PanelHeader, h8 as PanelHeaderButtons, h9 as PanelHeaderTitle, ha as PaperclipIcon, hb as PassFailChecklistIcon, hc as PauseIcon, hd as PencilFillIcon, he as PencilIcon, hf as PencilSparkleIcon, hg as PieChartIcon, hh as PillControl, hi as PinCancelIcon, hj as PinFillIcon, hk as PinIcon, hl as PipelineCodeIcon, hm as PipelineCubeIcon, hn as PipelineIcon, ho as PivotOperatorIcon, hp as PlayCircleFillIcon, hq as PlayCircleIcon, hr as PlayDoubleIcon, hs as PlayIcon, ht as PlayMultipleIcon, hu as PlugIcon, hv as PlusCircleFillIcon, hw as PlusCircleIcon, hx as PlusCircleSmallIcon, hy as PlusMinusSquareIcon, hz as Popover, hA as PositionBottomIcon, hB as PositionLeftIcon, hC as PositionRightIcon, hD as PositionTopIcon, hE as PreviewCard, hF as Progress, hG as PullRequestIcon, hH as PuzzleIcon, hI as QueryEditorIcon, hJ as QueryIcon, hK as QuestionMarkFillIcon, hL as QuestionMarkIcon, hM as RadioIcon, hN as RadioTile, hO as RangePicker, hP as ReaderModeIcon, hQ as RedoIcon, hR as RefreshIcon, hS as RefreshPlayIcon, hT as RefreshXIcon, hU as ReplyIcon, hV as ResizeIcon, hW as RhfForm, hX as RichTextIcon, hY as RobotIcon, hZ as RocketIcon, h_ as RowsIcon, h$ as RunIcon, i0 as RunningIcon, i1 as SMALL_BUTTON_HEIGHT, i2 as SaveClockIcon, i3 as SaveIcon, i4 as SchemaIcon, i5 as SchoolIcon, i6 as SearchDataIcon, i7 as SegmentedControlButton, i8 as SegmentedControlGroup, i9 as SelectContext, ia as SelectContextProvider, ib as SelectOptionGroup, ic as SendIcon, id as ShareIcon, ie as ShareNodesIcon, ig as ShieldCheckIcon, ih as ShieldIcon, ii as ShieldOffIcon, ij as ShortcutIcon, ik as Sidebar, il as SidebarAutoIcon, im as SidebarClosedIcon, io as SidebarCollapseIcon, ip as SidebarExpandIcon, iq as SidebarIcon, ir as SidebarOpenIcon, is as SidebarSyncIcon, it as SimpleSelect, iu as SimpleSelectOption, iv as SimpleSelectOptionGroup, iw as SlashSquareIcon, ix as Slider, iy as SlidersIcon, iz as SnippetIcon, iA as SortCustomHorizontalIcon, iB as SortCustomVerticalIcon, iC as SortHorizontalAscendingIcon, iD as SortHorizontalDescendingIcon, iE as SortLetterHorizontalAscendingIcon, iF as SortLetterHorizontalDescendingIcon, iG as SortLetterUnsortedIcon, iH as SortLetterVerticalAscendingIcon, iI as SortLetterVerticalDescendingIcon, iJ as Spacer, iK as SparkleDoubleFillIcon, iL as SparkleFillIcon, iM as SparkleIcon, iN as SparkleRectangleIcon, iO as SpeechBubbleIcon, iP as SpeechBubblePlusIcon, iQ as SpeechBubbleQuestionMarkFillIcon, iR as SpeechBubbleQuestionMarkIcon, iS as SpeechBubbleStarIcon, iT as SpeedometerIcon, iU as Spinner, iV as SplitButton, iW as SqlIcon, iX as StarFillIcon, iY as StarIcon, iZ as StepAfterLineIcon, i_ as StepBeforeLineIcon, i$ as Stepper, j0 as StopCircleFillIcon, j1 as StopCircleIcon, j2 as StopIcon, j3 as StoredProcedureIcon, j4 as StorefrontIcon, j5 as StreamIcon, j6 as StrikeThroughIcon, j7 as SunIcon, j8 as SyncIcon, j9 as SyncSmallIcon, ja as SyncToFileIcon, jb as TableAsteriskIcon, jc as TableClockIcon, jd as TableCombineIcon, je as TableGlassesIcon, jf as TableGlobeIcon, jg as TableIcon, jh as TableLightningIcon, ji as TableMeasureIcon, jj as TableModelIcon, jk as TableReportIcon, jl as TableStreamIcon, jm as TableVectorIcon, jn as TableViewIcon, jo as Tabs, jp as Tag, jq as TagColumnIcon, jr as TagIcon, js as TagTableIcon, jt as TargetIcon, ju as TerminalIcon, jv as TextBoxIcon, jw as TextColorIcon, jx as TextIcon, jy as TextJustifyIcon, jz as TextUnderlineIcon, jA as ThreeDotsIcon, jB as ThumbsDownFilledIcon, jC as ThumbsDownIcon, jD as ThumbsUpFilledIcon, jE as ThumbsUpIcon, jF as ToggleButton, jG as TokenIcon, jH as Toolbar, jI as TrashIcon, jJ as Tree, jK as TreeIcon, jL as TrendingFillIcon, jM as TrendingIcon, jN as TriangleIcon, jO as TypeaheadComboboxCheckboxItem, jP as TypeaheadComboboxFooter, jQ as TypeaheadComboboxMenuItem, jR as TypeaheadComboboxMultiSelectStateChangeTypes, jS as TypeaheadComboboxStateChangeTypes, jT as UnderlineIcon, jU as UndoIcon, jV as UploadIcon, jW as UppercaseIcon, jX as UsageOverageGraphic, jY as UsageSpikeGraphic, jZ as UsbIcon, j_ as UserBadgeIcon, j$ as UserCircleIcon, k0 as UserGroupFillIcon, k1 as UserGroupIcon, k2 as UserIcon, k3 as UserKeyIconIcon, k4 as UserShieldIcon, k5 as UserSparkleIcon, k6 as UserTeamIcon, k7 as VisibleFillIcon, k8 as VisibleIcon, k9 as VisibleOffIcon, ka as WithDesignSystemThemeHoc, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, kb as WorkflowCodeIcon, kc as WorkflowCubeIcon, kd as WorkflowsIcon, ke as WorkspacesIcon, kf as WrenchIcon, kg as WrenchSparkleIcon, kh as XCircleFillIcon, ki as XCircleIcon, kj as YearPickerGrid, kk as ZaHorizontalIcon, kl as ZaVerticalIcon, km as ZeroOpsIcon, kn as ZeroOpsOutlineIcon, ko as ZoomInIcon, kp as ZoomMarqueeSelection, kq as ZoomOutIcon, kr as ZoomToFitIcon, ks as __INTERNAL_DO_NOT_USE__FormItem, kt as __INTERNAL_DO_NOT_USE__Group, ku as __INTERNAL_DO_NOT_USE__HorizontalGroup, kv as __INTERNAL_DO_NOT_USE__VerticalGroup, kw as __INTERNAL_DO_NOT_USE__wrapLegacyFormRules, kx as augmentWithDataComponentProps, ky as dialogComboboxLookAheadKeyDown, kz as getBottomOnlyShadowScrollStyles, kA as getButtonEmotionStyles, kB as getComboboxOptionLabelStyles, kC as getDatePickerQuickActionBasic, kD as getDialogComboboxOptionLabelWidth, kE as getHorizontalTabShadowStyles, kF as getInputStyles, kG as getKeyboardNavigationFunctions, kH as getMemoizedButtonEmotionStyles, kI as getPaginationEmotionStyles, kJ as getPanelContainmentStyle, kK as getRadioStyles, kL as getRangeQuickActionsBasic, kM as getShadowScrollStyles, kN as getTypographyColor, kO as getVirtualListScrollbarStyles, kP as getVirtualListScrollbarThumbColor, kQ as getVirtualizedComboboxMenuItemStyles, kR as getWrapperStyle, kS as highlightFirstNonDisabledOption, kT as isOptionDisabled, kU as resetTabIndexToFocusedElement, kV as setImplicitContextGetter, kW as skipHideIconButtonActionClassName, kX as themeMemoKey, kY as useAntDConfigProviderContext, kZ as useCallbackOnEnter, k_ as useComponentFinderContext, k$ as useDesignSystemEventSuppressInteractionContext, l0 as useFormContext, l1 as useRadioGroupContext, l2 as useRadixModalContext, u as useWizardCurrentStep } from './WizardStepContentWrapper-CFCTOSm8.js';
|
|
1
|
+
import { p as primitiveColors, d as DesignSystemEventProvider, e as useDesignSystemContext, f as useDesignSystemTheme, I as InfoFillIcon, C as CheckCircleFillIcon, g as WarningFillIcon, h as DangerFillIcon, i as DesignSystemEventProviderAnalyticsEventTypes, j as useDesignSystemEventComponentCallbacks, k as DesignSystemEventProviderComponentTypes, l as DesignSystemEventProviderComponentSubTypeMap, m as useNotifyOnFirstView, n as useStableUuidV4, B as Button, T as Typography, o as ChevronDownIcon, q as ChevronRightIcon, r as DesignSystemAntDConfigProvider, s as CloseSmallIcon, t as addDebugOutlineIfEnabled, v as Modal, w as getAnimationCss, x as token, S as ShapeTokens, y as getDarkModePortalStyles, z as useModalContext, R as Root$1, A as Trigger, E as InfoSmallIcon, G as Content, H as Arrow, J as Tooltip, K as SparkleDoubleIcon, O as OverflowPopover, L as LoadingState, N as visuallyHidden, P as genSkeletonAnimatedColor, Q as getOffsets, U as DesignSystemEventSuppressInteractionProviderContext, V as DesignSystemEventSuppressInteractionTrueContextValue, X as tableStyles, Y as repeatingElementsStyles, Z as tableClassNames, _ as hideIconButtonRowStyles, $ as hideIconButtonActionCellClassName, a0 as safex, a1 as TitleSkeleton, a2 as useDialogComboboxContext, a3 as PlusIcon, a4 as importantify, a5 as getComboboxOptionItemWrapperStyles, a6 as getFooterStyles, a7 as useDialogComboboxOptionListContext, a8 as generateUuidV4, a9 as getContentOptions, aa as findHighlightedOption, ab as highlightOption, ac as Input, ad as SearchIcon, ae as EmptyResults, af as findClosestOptionSibling, ag as DialogComboboxOptionListCheckboxItem, ah as DialogComboboxOptionListSelectItem, ai as DialogComboboxOptionListContextProvider, aj as LoadingSpinner, ak as DialogComboboxOptionList, al as useUniqueId, am as TypeaheadComboboxContextProvider, an as useTypeaheadComboboxContext, ao as useDuboisThemeClass, ap as useDesignTokenOverrideStyles, aq as getComboboxContentWrapperStyles, ar as ClearSelectionButton, as as TypeaheadComboboxSelectedItem, at as CountBadge, au as getValidationStateColor, av as SectionHeader, aw as useComboboxState$1, ax as useMultipleSelectionState$1, ay as Radio, az as Checkbox, aA as DialogCombobox, aB as DialogComboboxTrigger, aC as DialogComboboxContent, aD as Select, aE as SelectTrigger, aF as SelectContent, aG as SelectOption, aH as LegacySelect, aI as WarningIcon, aJ as CheckCircleIcon, aK as DangerIcon, aL as Hint, aM as Title$1, aN as CloseIcon, aO as RestoreAntDDefaultClsPrefix, aP as AccessibleContainer, aQ as DU_BOIS_ENABLE_ANIMATION_CLASSNAME, aR as CircleOffIcon, aS as CircleOutlineIcon, aT as CircleIcon, aU as shimExports, aV as SortAscendingIcon, aW as SortDescendingIcon, aX as SortUnsortedIcon, aY as MinusSquareIcon, aZ as PlusSquareIcon, a_ as TypeaheadComboboxV2ContextProvider, a$ as useTypeaheadComboboxV2Context, b0 as useRadixModalContext, b1 as useIsomorphicLayoutEffect, b2 as useScrollOptionIntoView, b3 as InfoTooltip, b4 as getInfoIconStyles, b5 as HintRow, b6 as getCheckboxStyles, b7 as getMenuItemStyles, b8 as TypeaheadComboboxSelectedItem$1, b9 as CountBadge$1, ba as TypeaheadComboboxMenuItem } from './WizardStepContentWrapper-DsAS2ZAT.js';
|
|
2
|
+
export { bb as AccessDeniedGraphic, bc as Accordion, bd as AccordionPanel, be as AlignCenterIcon, bf as AlignJustifyIcon, bg as AlignLeftIcon, bh as AlignRightIcon, bi as AlignVerticalBottomIcon, bj as AlignVerticalCenterIcon, bk as AlignVerticalTopIcon, bl as AppIcon, bm as ApplyDesignSystemContextOverrides, bn as ApplyDesignSystemFlags, bo as ArrowDownDotIcon, bp as ArrowDownFillIcon, bq as ArrowDownIcon, br as ArrowInIcon, bs as ArrowInTableIcon, bt as ArrowLeftIcon, bu as ArrowOutTableIcon, bv as ArrowOverIcon, bw as ArrowRightIcon, bx as ArrowUpDotIcon, by as ArrowUpFillIcon, bz as ArrowUpIcon, bA as ArrowsCollapseIcon, bB as ArrowsConnectIcon, bC as ArrowsExpandIcon, bD as ArrowsUpDownIcon, bE as AssistantIcon, bF as AtIcon, bG as Auth0Graphic, bH as Auth0GraphicLarge, bI as AzHorizontalIcon, bJ as AzVerticalIcon, bK as BANNER_MAX_HEIGHT, bL as BANNER_MIN_HEIGHT, bM as BackupIcon, bN as BadgeCodeIcon, bO as BadgeCodeOffIcon, bP as Banner, bQ as BarChartIcon, bR as BarGroupedIcon, bS as BarStackedIcon, bT as BarStackedPercentageIcon, bU as BarsAscendingHorizontalIcon, bV as BarsAscendingVerticalIcon, bW as BarsDescendingHorizontalIcon, bX as BarsDescendingVerticalIcon, bY as BeakerIcon, bZ as BinaryIcon, b_ as BlockQuoteIcon, b$ as BoldIcon, c0 as BookIcon, c1 as BookmarkFillIcon, c2 as BookmarkIcon, c3 as BooksIcon, c4 as BracketsCheckIcon, c5 as BracketsCurlyIcon, c6 as BracketsErrorIcon, c7 as BracketsSquareIcon, c8 as BracketsXIcon, c9 as BranchCheckIcon, ca as BranchIcon, cb as BranchResetIcon, cc as BriefcaseFillIcon, cd as BriefcaseIcon, ce as BrushIcon, cf as BugIcon, cg as CalendarClockIcon, ch as CalendarEventIcon, ci as CalendarIcon, cj as CalendarRangeIcon, ck as CalendarSyncIcon, cl as CameraIcon, cm as CapitalizeIcon, cn as CaretDownSquareIcon, co as CaretUpSquareIcon, cp as CatalogCloudIcon, cq as CatalogGearIcon, cr as CatalogHomeIcon, cs as CatalogIcon, ct as CatalogOffIcon, cu as CatalogSharedIcon, cv as CatalogUserHomeIcon, cw as CellsSquareIcon, cx as CertifiedFillIcon, cy as CertifiedFillSmallIcon, cz as CertifiedIcon, cA as ChainIcon, cB as ChartLineIcon, cC as CheckCircleBadgeIcon, cD as CheckCircleSmallIcon, cE as CheckIcon, cF as CheckLineIcon, cG as CheckSmallIcon, cH as CheckboxIcon, cI as ChecklistIcon, cJ as ChevronDoubleDownIcon, cK as ChevronDoubleLeftIcon, cL as ChevronDoubleLeftOffIcon, cM as ChevronDoubleRightIcon, cN as ChevronDoubleRightOffIcon, cO as ChevronDoubleUpIcon, cP as ChevronLeftIcon, cQ as ChevronUpIcon, cR as ChipIcon, cS as CircleOffLargeIcon, cT as CircleOutlineLargeIcon, cU as ClipboardIcon, cV as ClockIcon, cW as ClockKeyIcon, cX as ClockOffIcon, cY as CloudCheckIcon, cZ as CloudDatabaseIcon, c_ as CloudDownloadIcon, c$ as CloudIcon, d0 as CloudKeyIcon, d1 as CloudModelIcon, d2 as CloudOffIcon, d3 as CloudUploadIcon, d4 as CodeIcon, d5 as ColorFillIcon, d6 as ColorVars, d7 as ColumnIcon, d8 as ColumnSplitIcon, d9 as ColumnTagIcon, da as ColumnsIcon, db as CommandIcon, dc as CommandPaletteIcon, dd as CompassIcon, de as ComponentFinderContext, df as ConnectIcon, dg as Content, dh as ContextMenu, di as CopyIcon, dj as CreditCardIcon, dk as CursorClickIcon, dl as CursorIcon, dm as CursorPagination, dn as CursorTypeIcon, dp as CustomAppIcon, dq as DS_OVERRIDE_TOKENS_WRAPPER_TESTID, dr as DagHorizontalIcon, ds as DagIcon, dt as DagVerticalIcon, du as DangerModal, dv as DangerSmallIcon, dw as DashIcon, dx as DashboardCodeIcon, dy as DashboardIcon, dz as DataIcon, dA as DataMaskiingGraphic, dB as DatabaseClockIcon, dC as DatabaseIcon, dD as DatabaseImportIcon, dE as DatePicker, dF as DecimalIcon, dG as DeprecatedIcon, dH as DeprecatedSmallIcon, dI as DesignSystemContext, dJ as DesignSystemEventProviderComponentSubTypes, dK as DesignSystemProvider, dL as DesignSystemThemeContext, dM as DesignSystemThemeProvider, dN as DialogComboboxCountBadge, dO as DialogComboboxCustomButtonTriggerWrapper, dP as DialogComboboxSectionHeader, D as DocumentationSidebar, dQ as DollarIcon, dR as DomainCirclesThree, dS as DomainsIcon, dT as DotsCircleIcon, dU as DownloadIcon, dV as DragIcon, dW as Drawer, dX as DropdownMenu, dY as Empty, dZ as EmptyDashboardGraphic, d_ as ErdIcon, d$ as ExpandLessIcon, e0 as ExpandMoreIcon, F as FIXED_VERTICAL_STEPPER_WIDTH, e1 as FaceFrownIcon, e2 as FaceNeutralIcon, e3 as FaceSmileIcon, e4 as FileCodeIcon, e5 as FileCubeIcon, e6 as FileDocumentIcon, e7 as FileIcon, e8 as FileImageIcon, e9 as FileLockIcon, ea as FileModelIcon, eb as FileNewIcon, ec as FilePipelineIcon, ed as FilterFillIcon, ee as FilterIcon, ef as FlagPointerIcon, eg as FloatIcon, eh as FlowIcon, ei as FlowsIcon, ej as FolderBranchFillIcon, ek as FolderBranchIcon, el as FolderCloudFilledIcon, em as FolderCloudIcon, en as FolderCubeIcon, eo as FolderCubeOutlineIcon, ep as FolderFillIcon, eq as FolderHomeIcon, er as FolderIcon, es as FolderNewIcon, et as FolderNodeIcon, eu as FolderOpenBranchIcon, ev as FolderOpenCloudIcon, ew as FolderOpenCubeIcon, ex as FolderOpenIcon, ey as FolderOpenPipelineIcon, ez as FolderOutlinePipelineIcon, eA as FolderSolidPipelineIcon, eB as FontIcon, eC as ForkHorizontalIcon, eD as ForkIcon, eE as Form, eF as FormContextResetBoundary, eG as FullscreenExitIcon, eH as FullscreenIcon, eI as FunctionIcon, eJ as FunctionInputIcon, eK as GavelIcon, eL as GearFillIcon, eM as GearIcon, eN as GenieCodeIcon, eO as GenieDeepResearchIcon, eP as GiftIcon, eQ as GitCommitIcon, eR as GitMergeIcon, eS as GitRebaseIcon, eT as GlobeIcon, eU as Graphic, eV as GridDashIcon, eW as GridIcon, eX as GroupIcon, eY as H1Icon, eZ as H2Icon, e_ as H3Icon, e$ as H4Icon, f0 as H5Icon, f1 as H6Icon, f2 as HashIcon, f3 as HistoryIcon, f4 as HomeIcon, f5 as Icon, f6 as ImageIcon, f7 as IndentDecreaseIcon, f8 as IndentIncreaseIcon, f9 as InfinityIcon, fa as InfoBookIcon, fb as InfoIcon, fc as IngestionIcon, fd as ItalicIcon, fe as JoinOperatorIcon, ff as KeyIcon, fg as KeyboardIcon, fh as LakebaseCatalogIcon, fi as LakebaseIcon, fj as LakeflowDesignerIcon, fk as LakewatchAlertIcon, fl as LakewatchDatasourceIcon, fm as LakewatchDetectionRuleIcon, fn as LakewatchParserIcon, fo as LayerGraphIcon, fp as LayerIcon, fq as Layout, fr as LeafIcon, fs as LegacyForm, ft as LegacyFormDubois, fu as LegacyOptGroup, fv as LegacyOption, fw as LegacySelectOptGroup, fx as LegacySelectOption, fy as LegacyTable, fz as LegacyTooltip, fA as LetterFormatIcon, fB as LettersIcon, fC as LettersNumbersIcon, fD as LibrariesIcon, fE as LifesaverIcon, fF as LightbulbIcon, fG as LightningCircleFillIcon, fH as LightningIcon, fI as LinearLineIcon, fJ as LinkIcon, fK as LinkOffIcon, fL as ListBorderIcon, fM as ListClearIcon, fN as ListIcon, fO as ListNumberIcon, fP as Listbox, fQ as LoadingIcon, fR as LoadingStateContext, fS as LockFillIcon, fT as LockIcon, fU as LockShareIcon, fV as LockUnlockedIcon, fW as LoopIcon, fX as LowercaseIcon, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, fY as MailIcon, fZ as MapIcon, f_ as MarkdownIcon, f$ as McpIcon, g0 as MeasureIcon, g1 as MegaphoneIcon, g2 as MenuIcon, g3 as MinusCircleFillIcon, g4 as MinusCircleIcon, g5 as MinusCircleSmallIcon, g6 as MissingBranchGraphic, g7 as MissingGraphic, g8 as ModelsIcon, g9 as MonotoneLineIcon, ga as MonthPickerGrid, gb as MoonIcon, gc as Nav, gd as NavButton, ge as NavigationMenu, gf as NeonProjectIcon, gg as NewChatIcon, gh as NewTabIcon, gi as NewWindowIcon, gj as NoCaseIcon, gk as NoIcon, gl as NotebookIcon, gm as NotebookPipelineIcon, gn as NotificationIcon, go as NotificationOffIcon, gp as NumberFormatIcon, gq as NumbersIcon, gr as OfficeIcon, gs as OntologyIcon, gt as OutageGraphic, gu as Overflow, gv as OverflowHorizontalIcon, gw as OverflowIcon, gx as PageBottomIcon, gy as PageFirstIcon, gz as PageIcon, gA as PageLastIcon, gB as PageTopIcon, gC as Pagination, gD as Panel, gE as PanelBody, gF as PanelDockedIcon, gG as PanelFloatingIcon, gH as PanelHeader, gI as PanelHeaderButtons, gJ as PanelHeaderTitle, gK as PaperclipIcon, gL as PassFailChecklistIcon, gM as PauseIcon, gN as PencilFillIcon, gO as PencilIcon, gP as PencilSparkleIcon, gQ as PieChartIcon, gR as PillControl, gS as PinCancelIcon, gT as PinFillIcon, gU as PinIcon, gV as PipelineCodeIcon, gW as PipelineCubeIcon, gX as PipelineIcon, gY as PivotOperatorIcon, gZ as PlayCircleFillIcon, g_ as PlayCircleIcon, g$ as PlayDoubleIcon, h0 as PlayIcon, h1 as PlayMultipleIcon, h2 as PlugIcon, h3 as PlusCircleFillIcon, h4 as PlusCircleIcon, h5 as PlusCircleSmallIcon, h6 as PlusMinusSquareIcon, h7 as Popover, h8 as PositionBottomIcon, h9 as PositionLeftIcon, ha as PositionRightIcon, hb as PositionTopIcon, hc as PreviewCard, hd as Progress, he as PullRequestIcon, hf as PuzzleIcon, hg as QueryEditorIcon, hh as QueryIcon, hi as QuestionMarkFillIcon, hj as QuestionMarkIcon, hk as RadioIcon, hl as RadioTile, hm as RangePicker, hn as ReaderModeIcon, ho as RedoIcon, hp as RefreshIcon, hq as RefreshPlayIcon, hr as RefreshXIcon, hs as ReplyIcon, ht as ResizeIcon, hu as RhfForm, hv as RichTextIcon, hw as RobotIcon, hx as RocketIcon, hy as RowsIcon, hz as RunIcon, hA as RunningIcon, hB as SMALL_BUTTON_HEIGHT, hC as SaveClockIcon, hD as SaveIcon, hE as SchemaIcon, hF as SchoolIcon, hG as SearchDataIcon, hH as SegmentedControlButton, hI as SegmentedControlGroup, hJ as SelectContext, hK as SelectContextProvider, hL as SelectOptionGroup, hM as SendIcon, hN as ShareIcon, hO as ShareNodesIcon, hP as ShieldCheckIcon, hQ as ShieldIcon, hR as ShieldOffIcon, hS as ShortcutIcon, hT as Sidebar, hU as SidebarAutoIcon, hV as SidebarClosedIcon, hW as SidebarCollapseIcon, hX as SidebarExpandIcon, hY as SidebarIcon, hZ as SidebarOpenIcon, h_ as SidebarSyncIcon, h$ as SimpleSelect, i0 as SimpleSelectOption, i1 as SimpleSelectOptionGroup, i2 as SlashSquareIcon, i3 as Slider, i4 as SlidersIcon, i5 as SnippetIcon, i6 as SortCustomHorizontalIcon, i7 as SortCustomVerticalIcon, i8 as SortHorizontalAscendingIcon, i9 as SortHorizontalDescendingIcon, ia as SortLetterHorizontalAscendingIcon, ib as SortLetterHorizontalDescendingIcon, ic as SortLetterUnsortedIcon, id as SortLetterVerticalAscendingIcon, ie as SortLetterVerticalDescendingIcon, ig as Spacer, ih as SparkleDoubleFillIcon, ii as SparkleFillIcon, ij as SparkleIcon, ik as SparkleRectangleIcon, il as SpeechBubbleIcon, im as SpeechBubblePlusIcon, io as SpeechBubbleQuestionMarkFillIcon, ip as SpeechBubbleQuestionMarkIcon, iq as SpeechBubbleStarIcon, ir as SpeedometerIcon, is as Spinner, it as SplitButton, iu as SqlIcon, iv as StarFillIcon, iw as StarIcon, ix as StepAfterLineIcon, iy as StepBeforeLineIcon, iz as Stepper, iA as StopCircleFillIcon, iB as StopCircleIcon, iC as StopIcon, iD as StoredProcedureIcon, iE as StorefrontIcon, iF as StreamIcon, iG as StrikeThroughIcon, iH as SunIcon, iI as SyncIcon, iJ as SyncSmallIcon, iK as SyncToFileIcon, iL as TableAsteriskIcon, iM as TableClockIcon, iN as TableCombineIcon, iO as TableGlassesIcon, iP as TableGlobeIcon, iQ as TableIcon, iR as TableLightningIcon, iS as TableMeasureIcon, iT as TableModelIcon, iU as TableReportIcon, iV as TableStreamIcon, iW as TableVectorIcon, iX as TableViewIcon, iY as Tabs, iZ as Tag, i_ as TagColumnIcon, i$ as TagIcon, j0 as TagTableIcon, j1 as TargetIcon, j2 as TerminalIcon, j3 as TextBoxIcon, j4 as TextColorIcon, j5 as TextIcon, j6 as TextJustifyIcon, j7 as TextUnderlineIcon, j8 as ThreeDotsIcon, j9 as ThumbsDownFilledIcon, ja as ThumbsDownIcon, jb as ThumbsUpFilledIcon, jc as ThumbsUpIcon, jd as ToggleButton, je as TokenIcon, jf as Toolbar, jg as TrashIcon, jh as Tree, ji as TreeIcon, jj as TrendingFillIcon, jk as TrendingIcon, jl as TriangleIcon, jm as TypeaheadComboboxCheckboxItem, jn as TypeaheadComboboxFooter, jo as TypeaheadComboboxMenuItem, jp as TypeaheadComboboxMultiSelectStateChangeTypes, jq as TypeaheadComboboxStateChangeTypes, jr as UnderlineIcon, js as UndoIcon, jt as UploadIcon, ju as UppercaseIcon, jv as UsageOverageGraphic, jw as UsageSpikeGraphic, jx as UsbIcon, jy as UserBadgeIcon, jz as UserCircleIcon, jA as UserGroupFillIcon, jB as UserGroupIcon, jC as UserIcon, jD as UserKeyIconIcon, jE as UserShieldIcon, jF as UserSparkleIcon, jG as UserTeamIcon, jH as VisibleFillIcon, jI as VisibleIcon, jJ as VisibleOffIcon, jK as WithDesignSystemThemeHoc, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, jL as WorkflowCodeIcon, jM as WorkflowCubeIcon, jN as WorkflowsIcon, jO as WorkspacesIcon, jP as WrenchIcon, jQ as WrenchSparkleIcon, jR as XCircleFillIcon, jS as XCircleIcon, jT as YearPickerGrid, jU as ZaHorizontalIcon, jV as ZaVerticalIcon, jW as ZeroOpsIcon, jX as ZeroOpsOutlineIcon, jY as ZoomInIcon, jZ as ZoomMarqueeSelection, j_ as ZoomOutIcon, j$ as ZoomToFitIcon, k0 as __INTERNAL_DO_NOT_USE__FormItem, k1 as __INTERNAL_DO_NOT_USE__Group, k2 as __INTERNAL_DO_NOT_USE__HorizontalGroup, k3 as __INTERNAL_DO_NOT_USE__VerticalGroup, k4 as __INTERNAL_DO_NOT_USE__wrapLegacyFormRules, k5 as augmentWithDataComponentProps, k6 as dialogComboboxLookAheadKeyDown, k7 as getBottomOnlyShadowScrollStyles, k8 as getButtonEmotionStyles, k9 as getComboboxOptionLabelStyles, ka as getDatePickerQuickActionBasic, kb as getDialogComboboxOptionLabelWidth, kc as getHorizontalTabShadowStyles, kd as getInputStyles, ke as getKeyboardNavigationFunctions, kf as getMemoizedButtonEmotionStyles, kg as getPaginationEmotionStyles, kh as getPanelContainmentStyle, ki as getRadioStyles, kj as getRangeQuickActionsBasic, kk as getShadowScrollStyles, kl as getTypographyColor, km as getVirtualListScrollbarStyles, kn as getVirtualListScrollbarThumbColor, ko as getVirtualizedComboboxMenuItemStyles, kp as getWrapperStyle, kq as highlightFirstNonDisabledOption, kr as isOptionDisabled, ks as resetTabIndexToFocusedElement, kt as setImplicitContextGetter, ku as skipHideIconButtonActionClassName, kv as themeMemoKey, kw as useAntDConfigProviderContext, kx as useCallbackOnEnter, ky as useComponentFinderContext, kz as useDesignSystemEventSuppressInteractionContext, kA as useFormContext, kB as useRadioGroupContext, u as useWizardCurrentStep } from './WizardStepContentWrapper-DsAS2ZAT.js';
|
|
3
3
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
4
4
|
import { css, Global, createElement, ClassNames, keyframes } from '@emotion/react';
|
|
5
5
|
import { Alert as Alert$1, AutoComplete as AutoComplete$1, Breadcrumb as Breadcrumb$1, DatePicker, Dropdown as Dropdown$1, Switch as Switch$1, Col as Col$1, Row as Row$1, Space as Space$1, notification, Popover, Skeleton, Menu as Menu$1, Steps as Steps$1 } from 'antd';
|
|
6
6
|
import classnames from 'classnames';
|
|
7
|
-
import React__default, { useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, createContext, useContext, Children, Fragment as Fragment$1, useLayoutEffect, useReducer } from 'react';
|
|
8
|
-
import '@ant-design/icons';
|
|
7
|
+
import React__default, { useState, useRef, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, createContext, useContext, Children, Fragment as Fragment$1, useLayoutEffect, useReducer, isValidElement } from 'react';
|
|
9
8
|
import { useMergeRefs, useFloating, autoUpdate, offset, flip, shift } from '@floating-ui/react';
|
|
10
9
|
import isUndefined from 'lodash/isUndefined';
|
|
11
10
|
import 'lodash/uniqueId';
|
|
@@ -17,6 +16,15 @@ import { computePosition, flip as flip$1, size } from '@floating-ui/dom';
|
|
|
17
16
|
import { createPortal } from 'react-dom';
|
|
18
17
|
import * as RadixHoverCard from '@radix-ui/react-hover-card';
|
|
19
18
|
import * as Toast from '@radix-ui/react-toast';
|
|
19
|
+
import { useComboBox } from '@react-aria/combobox';
|
|
20
|
+
import { useListBox, useOption } from '@react-aria/listbox';
|
|
21
|
+
import { useOverlay, useOverlayPosition, Overlay, DismissButton } from '@react-aria/overlays';
|
|
22
|
+
import { mergeRefs, mergeProps } from '@react-aria/utils';
|
|
23
|
+
import { createFocusManager } from '@react-aria/focus';
|
|
24
|
+
import { useButton } from '@react-aria/button';
|
|
25
|
+
import { useComboBoxState } from '@react-stately/combobox';
|
|
26
|
+
import { useFilter } from '@react-aria/i18n';
|
|
27
|
+
import { Item } from '@react-stately/collections';
|
|
20
28
|
import 'date-fns';
|
|
21
29
|
import '@radix-ui/react-popover';
|
|
22
30
|
import '@radix-ui/react-dropdown-menu';
|
|
@@ -34,6 +42,8 @@ import 'lodash/isString';
|
|
|
34
42
|
import 'lodash/mapValues';
|
|
35
43
|
import '@radix-ui/react-accordion';
|
|
36
44
|
import '@radix-ui/react-tooltip-patch';
|
|
45
|
+
import 'lodash/kebabCase';
|
|
46
|
+
import '@ant-design/icons';
|
|
37
47
|
import 'lodash/random';
|
|
38
48
|
import 'lodash/times';
|
|
39
49
|
import '@radix-ui/react-context-menu';
|
|
@@ -133,7 +143,8 @@ const consumerDarkColorList = {
|
|
|
133
143
|
textValidationDanger: primitiveColors.red500,
|
|
134
144
|
textValidationSuccess: primitiveColors.green500,
|
|
135
145
|
textValidationWarning: primitiveColors.yellow500,
|
|
136
|
-
tooltipBackgroundTooltip: primitiveColors.grey100
|
|
146
|
+
tooltipBackgroundTooltip: primitiveColors.grey100,
|
|
147
|
+
tooltipTextTooltip: primitiveColors.grey800
|
|
137
148
|
};
|
|
138
149
|
|
|
139
150
|
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
|
@@ -218,7 +229,8 @@ const consumerLightColorList = {
|
|
|
218
229
|
textValidationDanger: primitiveColors.red600,
|
|
219
230
|
textValidationSuccess: primitiveColors.green600,
|
|
220
231
|
textValidationWarning: primitiveColors.yellow600,
|
|
221
|
-
tooltipBackgroundTooltip: primitiveColors.neutral800
|
|
232
|
+
tooltipBackgroundTooltip: primitiveColors.neutral800,
|
|
233
|
+
tooltipTextTooltip: primitiveColors.white
|
|
222
234
|
};
|
|
223
235
|
|
|
224
236
|
/**
|
|
@@ -581,7 +593,7 @@ const Alert = ({ componentId, analyticsEvents = [
|
|
|
581
593
|
}),
|
|
582
594
|
children: [
|
|
583
595
|
props.description,
|
|
584
|
-
' ',
|
|
596
|
+
props.description != null && showMoreContent ? ' ' : null,
|
|
585
597
|
showMoreContent && /*#__PURE__*/ jsx(Typography.Link, {
|
|
586
598
|
href: "#",
|
|
587
599
|
componentId: componentId ? `${componentId}.show_more` : 'alert.show_more',
|
|
@@ -892,35 +904,6 @@ function SvgUserIcon(props) {
|
|
|
892
904
|
});
|
|
893
905
|
}
|
|
894
906
|
|
|
895
|
-
/**
|
|
896
|
-
* `LegacyInfoTooltip` is deprecated in favor of the new `InfoTooltip` component
|
|
897
|
-
* @deprecated
|
|
898
|
-
*/ const LegacyInfoTooltip = ({ title, tooltipProps, iconTitle, isKeyboardFocusable = true, ...iconProps })=>{
|
|
899
|
-
const { theme } = useDesignSystemTheme();
|
|
900
|
-
return /*#__PURE__*/ jsx(LegacyTooltip, {
|
|
901
|
-
useAsLabel: true,
|
|
902
|
-
title: title,
|
|
903
|
-
...tooltipProps,
|
|
904
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
905
|
-
...addDebugOutlineIfEnabled(),
|
|
906
|
-
style: {
|
|
907
|
-
display: 'inline-flex'
|
|
908
|
-
},
|
|
909
|
-
children: /*#__PURE__*/ jsx(LegacyInfoCircleOutlined, {
|
|
910
|
-
tabIndex: isKeyboardFocusable ? 0 : -1,
|
|
911
|
-
"aria-hidden": "false",
|
|
912
|
-
"aria-label": iconTitle,
|
|
913
|
-
alt: iconTitle,
|
|
914
|
-
css: {
|
|
915
|
-
fontSize: theme.typography.fontSizeSm,
|
|
916
|
-
color: theme.colors.textSecondary
|
|
917
|
-
},
|
|
918
|
-
...iconProps
|
|
919
|
-
})
|
|
920
|
-
})
|
|
921
|
-
});
|
|
922
|
-
};
|
|
923
|
-
|
|
924
907
|
const InfoPopover = ({ children, popoverProps, iconTitle, iconProps, isKeyboardFocusable = true, ariaLabel = 'More details' })=>{
|
|
925
908
|
const { theme } = useDesignSystemTheme();
|
|
926
909
|
const { isInsideModal } = useModalContext();
|
|
@@ -989,6 +972,73 @@ const InfoPopover = ({ children, popoverProps, iconTitle, iconProps, isKeyboardF
|
|
|
989
972
|
});
|
|
990
973
|
};
|
|
991
974
|
|
|
975
|
+
/**
|
|
976
|
+
* A variant of Tooltip that only shows when the child's text content is truncated.
|
|
977
|
+
* The tooltip content is automatically derived from the child element's textContent,
|
|
978
|
+
* so consumers don't need to pass the text.
|
|
979
|
+
*
|
|
980
|
+
* Truncation is checked lazily only on mouse enter, not during render.
|
|
981
|
+
* This ensures negligible performance impact even with many TruncationTooltips on the page.
|
|
982
|
+
*
|
|
983
|
+
* Detects both:
|
|
984
|
+
* - Horizontal ellipsis (text-overflow: ellipsis or overflow: hidden)
|
|
985
|
+
* - Vertical line-clamp (line-clamp or -webkit-line-clamp)
|
|
986
|
+
*
|
|
987
|
+
* See go/dubois.
|
|
988
|
+
*/ const TruncationTooltip = ({ children, ...tooltipProps })=>{
|
|
989
|
+
const [open, setOpen] = useState(false);
|
|
990
|
+
const [tooltipContent, setTooltipContent] = useState('');
|
|
991
|
+
const childRef = useRef(null);
|
|
992
|
+
const handleOpenChange = useCallback((shouldOpen)=>{
|
|
993
|
+
if (shouldOpen && childRef.current) {
|
|
994
|
+
const isHorizontallyTruncated = childRef.current.scrollWidth > childRef.current.clientWidth;
|
|
995
|
+
const isVerticallyTruncated = childRef.current.scrollHeight > childRef.current.clientHeight;
|
|
996
|
+
if (isHorizontallyTruncated || isVerticallyTruncated) {
|
|
997
|
+
setTooltipContent(childRef.current.textContent ?? '');
|
|
998
|
+
setOpen(true);
|
|
999
|
+
}
|
|
1000
|
+
} else {
|
|
1001
|
+
setOpen(false);
|
|
1002
|
+
}
|
|
1003
|
+
}, []);
|
|
1004
|
+
const wrappedChildren = useMemo(()=>{
|
|
1005
|
+
if (/*#__PURE__*/ React__default.isValidElement(children)) {
|
|
1006
|
+
const childElement = children;
|
|
1007
|
+
// TypeScript doesn't expose ref directly on ReactElement, so we need to cast
|
|
1008
|
+
const originalRef = childElement.ref;
|
|
1009
|
+
return /*#__PURE__*/ React__default.cloneElement(childElement, {
|
|
1010
|
+
ref: (node)=>{
|
|
1011
|
+
childRef.current = node;
|
|
1012
|
+
if (typeof originalRef === 'function') {
|
|
1013
|
+
originalRef(node);
|
|
1014
|
+
} else if (originalRef) {
|
|
1015
|
+
originalRef.current = node;
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
// Radix Tooltip sets aria-describedby on the trigger pointing to the tooltip content.
|
|
1019
|
+
// For truncation tooltips this causes screen readers to double-read: the full text is
|
|
1020
|
+
// already in the DOM (CSS truncation is visual-only), so the aria-describedby is
|
|
1021
|
+
// redundant. Setting undefined here overrides Radix's value via Slot prop merging.
|
|
1022
|
+
'aria-describedby': undefined
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
return /*#__PURE__*/ jsx("span", {
|
|
1026
|
+
ref: childRef,
|
|
1027
|
+
"aria-describedby": undefined,
|
|
1028
|
+
children: children
|
|
1029
|
+
});
|
|
1030
|
+
}, [
|
|
1031
|
+
children
|
|
1032
|
+
]);
|
|
1033
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
1034
|
+
...tooltipProps,
|
|
1035
|
+
content: tooltipContent,
|
|
1036
|
+
open: open,
|
|
1037
|
+
onOpenChange: handleOpenChange,
|
|
1038
|
+
children: wrappedChildren
|
|
1039
|
+
});
|
|
1040
|
+
};
|
|
1041
|
+
|
|
992
1042
|
const SIZE = new Map([
|
|
993
1043
|
[
|
|
994
1044
|
'xl',
|
|
@@ -1433,52 +1483,6 @@ const ParagraphSkeleton = ({ label, seed = '', frameRate = 60, style, loading =
|
|
|
1433
1483
|
});
|
|
1434
1484
|
};
|
|
1435
1485
|
|
|
1436
|
-
const titleContainerStyles = /*#__PURE__*/ css({
|
|
1437
|
-
cursor: 'progress',
|
|
1438
|
-
width: '100%',
|
|
1439
|
-
height: 28,
|
|
1440
|
-
display: 'flex',
|
|
1441
|
-
justifyContent: 'flex-start',
|
|
1442
|
-
alignItems: 'center'
|
|
1443
|
-
});
|
|
1444
|
-
const titleFillStyles = /*#__PURE__*/ css({
|
|
1445
|
-
borderRadius: 'var(--border-radius)',
|
|
1446
|
-
height: 12,
|
|
1447
|
-
width: '100%'
|
|
1448
|
-
});
|
|
1449
|
-
const TitleSkeleton = ({ label, seed = '', frameRate = 60, style, loading = true, loadingDescription = 'TitleSkeleton', ...restProps })=>{
|
|
1450
|
-
const { theme } = useDesignSystemTheme();
|
|
1451
|
-
const offsetWidth = getOffsets(seed)[0];
|
|
1452
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
1453
|
-
...addDebugOutlineIfEnabled(),
|
|
1454
|
-
css: titleContainerStyles,
|
|
1455
|
-
style: {
|
|
1456
|
-
...style,
|
|
1457
|
-
['--border-radius']: `${theme.general.borderRadiusBase}px`
|
|
1458
|
-
},
|
|
1459
|
-
...restProps,
|
|
1460
|
-
children: [
|
|
1461
|
-
loading && /*#__PURE__*/ jsx(LoadingState, {
|
|
1462
|
-
description: loadingDescription
|
|
1463
|
-
}),
|
|
1464
|
-
/*#__PURE__*/ jsx("span", {
|
|
1465
|
-
css: visuallyHidden,
|
|
1466
|
-
children: label
|
|
1467
|
-
}),
|
|
1468
|
-
/*#__PURE__*/ jsx("div", {
|
|
1469
|
-
"aria-hidden": true,
|
|
1470
|
-
css: [
|
|
1471
|
-
titleFillStyles,
|
|
1472
|
-
genSkeletonAnimatedColor(theme, frameRate),
|
|
1473
|
-
{
|
|
1474
|
-
width: `calc(100% - ${offsetWidth}px)`
|
|
1475
|
-
}
|
|
1476
|
-
]
|
|
1477
|
-
})
|
|
1478
|
-
]
|
|
1479
|
-
});
|
|
1480
|
-
};
|
|
1481
|
-
|
|
1482
1486
|
const TableContext = /*#__PURE__*/ createContext({
|
|
1483
1487
|
size: 'default',
|
|
1484
1488
|
grid: false
|
|
@@ -2249,7 +2253,7 @@ const DialogComboboxAddButton = ({ children, ...restProps })=>{
|
|
|
2249
2253
|
throw new Error('`DialogComboboxAddButton` must be used within `DialogCombobox`');
|
|
2250
2254
|
}
|
|
2251
2255
|
return /*#__PURE__*/ jsx(Button, {
|
|
2252
|
-
//
|
|
2256
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Contextual component ID validated through DialogCombobox component exempt:fc0846cb-b73b-401b-834e-75bb8b6d4c20
|
|
2253
2257
|
componentId: `${componentId ? componentId : 'design_system.dialogcombobox'}.add_option`,
|
|
2254
2258
|
...restProps,
|
|
2255
2259
|
type: "tertiary",
|
|
@@ -2301,73 +2305,6 @@ const DialogComboboxHintRow = ({ children })=>{
|
|
|
2301
2305
|
});
|
|
2302
2306
|
};
|
|
2303
2307
|
|
|
2304
|
-
/**
|
|
2305
|
-
* A variant of Tooltip that only shows when the child's text content is truncated.
|
|
2306
|
-
* The tooltip content is automatically derived from the child element's textContent,
|
|
2307
|
-
* so consumers don't need to pass the text.
|
|
2308
|
-
*
|
|
2309
|
-
* Truncation is checked lazily only on mouse enter, not during render.
|
|
2310
|
-
* This ensures negligible performance impact even with many TruncationTooltips on the page.
|
|
2311
|
-
*
|
|
2312
|
-
* Detects both:
|
|
2313
|
-
* - Horizontal ellipsis (text-overflow: ellipsis or overflow: hidden)
|
|
2314
|
-
* - Vertical line-clamp (line-clamp or -webkit-line-clamp)
|
|
2315
|
-
*
|
|
2316
|
-
* See go/dubois.
|
|
2317
|
-
*/ const TruncationTooltip = ({ children, ...tooltipProps })=>{
|
|
2318
|
-
const [open, setOpen] = useState(false);
|
|
2319
|
-
const [tooltipContent, setTooltipContent] = useState('');
|
|
2320
|
-
const childRef = useRef(null);
|
|
2321
|
-
const handleOpenChange = useCallback((shouldOpen)=>{
|
|
2322
|
-
if (shouldOpen && childRef.current) {
|
|
2323
|
-
const isHorizontallyTruncated = childRef.current.scrollWidth > childRef.current.clientWidth;
|
|
2324
|
-
const isVerticallyTruncated = childRef.current.scrollHeight > childRef.current.clientHeight;
|
|
2325
|
-
if (isHorizontallyTruncated || isVerticallyTruncated) {
|
|
2326
|
-
setTooltipContent(childRef.current.textContent ?? '');
|
|
2327
|
-
setOpen(true);
|
|
2328
|
-
}
|
|
2329
|
-
} else {
|
|
2330
|
-
setOpen(false);
|
|
2331
|
-
}
|
|
2332
|
-
}, []);
|
|
2333
|
-
const wrappedChildren = useMemo(()=>{
|
|
2334
|
-
if (/*#__PURE__*/ React__default.isValidElement(children)) {
|
|
2335
|
-
const childElement = children;
|
|
2336
|
-
// TypeScript doesn't expose ref directly on ReactElement, so we need to cast
|
|
2337
|
-
const originalRef = childElement.ref;
|
|
2338
|
-
return /*#__PURE__*/ React__default.cloneElement(childElement, {
|
|
2339
|
-
ref: (node)=>{
|
|
2340
|
-
childRef.current = node;
|
|
2341
|
-
if (typeof originalRef === 'function') {
|
|
2342
|
-
originalRef(node);
|
|
2343
|
-
} else if (originalRef) {
|
|
2344
|
-
originalRef.current = node;
|
|
2345
|
-
}
|
|
2346
|
-
},
|
|
2347
|
-
// Radix Tooltip sets aria-describedby on the trigger pointing to the tooltip content.
|
|
2348
|
-
// For truncation tooltips this causes screen readers to double-read: the full text is
|
|
2349
|
-
// already in the DOM (CSS truncation is visual-only), so the aria-describedby is
|
|
2350
|
-
// redundant. Setting undefined here overrides Radix's value via Slot prop merging.
|
|
2351
|
-
'aria-describedby': undefined
|
|
2352
|
-
});
|
|
2353
|
-
}
|
|
2354
|
-
return /*#__PURE__*/ jsx("span", {
|
|
2355
|
-
ref: childRef,
|
|
2356
|
-
"aria-describedby": undefined,
|
|
2357
|
-
children: children
|
|
2358
|
-
});
|
|
2359
|
-
}, [
|
|
2360
|
-
children
|
|
2361
|
-
]);
|
|
2362
|
-
return /*#__PURE__*/ jsx(Tooltip, {
|
|
2363
|
-
...tooltipProps,
|
|
2364
|
-
content: tooltipContent,
|
|
2365
|
-
open: open,
|
|
2366
|
-
onOpenChange: handleOpenChange,
|
|
2367
|
-
children: wrappedChildren
|
|
2368
|
-
});
|
|
2369
|
-
};
|
|
2370
|
-
|
|
2371
2308
|
const extractTextContent = (node)=>{
|
|
2372
2309
|
if (typeof node === 'string' || typeof node === 'number') {
|
|
2373
2310
|
return node.toString();
|
|
@@ -2509,7 +2446,7 @@ const DialogComboboxOptionListSearch = /*#__PURE__*/ forwardRef(// eslint-disabl
|
|
|
2509
2446
|
},
|
|
2510
2447
|
children: [
|
|
2511
2448
|
/*#__PURE__*/ jsx(Input, {
|
|
2512
|
-
//
|
|
2449
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Contextual component ID validated through DialogCombobox component exempt:a992c761-9f18-43b0-af9d-dc9ee629260a
|
|
2513
2450
|
componentId: componentId ? `${componentId}.search` : 'codegen_design_system_src_design_system_dialogcombobox_dialogcomboboxoptionlistsearch.tsx_173',
|
|
2514
2451
|
type: "search",
|
|
2515
2452
|
name: "search",
|
|
@@ -3126,41 +3063,29 @@ children, dangerouslySetAntdProps, onClick, ...restProps }, ref) {
|
|
|
3126
3063
|
onClick,
|
|
3127
3064
|
onValueChange
|
|
3128
3065
|
]);
|
|
3129
|
-
//
|
|
3130
|
-
//
|
|
3131
|
-
|
|
3132
|
-
// themed tokens too.
|
|
3133
|
-
const themeClass = useDuboisThemeClass();
|
|
3134
|
-
const rootClassName = classnames('ds-switch', themeClass, className);
|
|
3066
|
+
// Inherits the `--db-color-*` scope (theme-class + consumer override) from the DesignSystemProvider
|
|
3067
|
+
// wrapper; no self-scoped theme class, so a consumer override set on that wrapper reaches here.
|
|
3068
|
+
const rootClassName = classnames('ds-switch', className);
|
|
3135
3069
|
// Set only one of checked/defaultChecked — React warns if an input has both.
|
|
3136
3070
|
const checkedStateProps = checked !== undefined ? {
|
|
3137
3071
|
checked
|
|
3138
3072
|
} : {
|
|
3139
3073
|
defaultChecked
|
|
3140
3074
|
};
|
|
3141
|
-
const switchControl = /*#__PURE__*/
|
|
3075
|
+
const switchControl = /*#__PURE__*/ jsx("label", {
|
|
3142
3076
|
...addDebugOutlineIfEnabled(),
|
|
3143
3077
|
className: rootClassName,
|
|
3144
|
-
children:
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
}),
|
|
3156
|
-
/*#__PURE__*/ jsx("span", {
|
|
3157
|
-
className: "ds-switch-track",
|
|
3158
|
-
"aria-hidden": "true",
|
|
3159
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
3160
|
-
className: "ds-switch-thumb"
|
|
3161
|
-
})
|
|
3162
|
-
})
|
|
3163
|
-
]
|
|
3078
|
+
children: /*#__PURE__*/ jsx("input", {
|
|
3079
|
+
ref: mergedRef,
|
|
3080
|
+
type: "checkbox",
|
|
3081
|
+
role: "switch",
|
|
3082
|
+
id: uniqueId,
|
|
3083
|
+
...checkedStateProps,
|
|
3084
|
+
onChange: handleChange,
|
|
3085
|
+
disabled: disabled,
|
|
3086
|
+
...restProps,
|
|
3087
|
+
...eventContext.dataComponentProps
|
|
3088
|
+
})
|
|
3164
3089
|
});
|
|
3165
3090
|
if (!label) {
|
|
3166
3091
|
return switchControl;
|
|
@@ -3177,7 +3102,7 @@ children, dangerouslySetAntdProps, onClick, ...restProps }, ref) {
|
|
|
3177
3102
|
});
|
|
3178
3103
|
return /*#__PURE__*/ jsx("div", {
|
|
3179
3104
|
...addDebugOutlineIfEnabled(),
|
|
3180
|
-
className:
|
|
3105
|
+
className: "ds-switch-wrapper",
|
|
3181
3106
|
children: hasNewLabels ? /*#__PURE__*/ jsxs(Fragment, {
|
|
3182
3107
|
children: [
|
|
3183
3108
|
labelComponent,
|
|
@@ -3212,11 +3137,14 @@ const Switch = /*#__PURE__*/ forwardRef(function Switch(props, ref) {
|
|
|
3212
3137
|
});
|
|
3213
3138
|
});
|
|
3214
3139
|
|
|
3215
|
-
const ROOT_CSS = {
|
|
3140
|
+
const ROOT_CSS$1 = {
|
|
3216
3141
|
display: 'inline-block',
|
|
3217
3142
|
width: '100%'
|
|
3218
3143
|
};
|
|
3219
|
-
|
|
3144
|
+
/**
|
|
3145
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3146
|
+
* @deprecated
|
|
3147
|
+
*/ const TypeaheadComboboxRoot$1 = /*#__PURE__*/ forwardRef(({ comboboxState, multiSelect = false, floatingStrategy = 'absolute', children, ...props }, ref)=>{
|
|
3220
3148
|
const { classNamePrefix } = useDesignSystemTheme();
|
|
3221
3149
|
const { refs, floatingStyles } = useFloating({
|
|
3222
3150
|
whileElementsMounted: autoUpdate,
|
|
@@ -3255,11 +3183,11 @@ const TypeaheadComboboxRoot = /*#__PURE__*/ forwardRef(({ comboboxState, multiSe
|
|
|
3255
3183
|
suppressRefError: true
|
|
3256
3184
|
}),
|
|
3257
3185
|
className: `${classNamePrefix}-typeahead-combobox`,
|
|
3258
|
-
css: ROOT_CSS,
|
|
3186
|
+
css: ROOT_CSS$1,
|
|
3259
3187
|
...props,
|
|
3260
3188
|
ref: mergedRef,
|
|
3261
3189
|
"data-component-type": DesignSystemEventProviderComponentTypes.TypeaheadCombobox,
|
|
3262
|
-
//
|
|
3190
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Valid case, as combostate componentId is checked in the hook exempt:a7de1e72-e1ae-4747-9806-90853bef6a06
|
|
3263
3191
|
"data-component-id": comboboxState.componentId,
|
|
3264
3192
|
children: children
|
|
3265
3193
|
})
|
|
@@ -3274,8 +3202,11 @@ const TYPEAHEAD_COMBOBOX_MENU_STYLES = /*#__PURE__*/ css({
|
|
|
3274
3202
|
alignItems: 'flex-start',
|
|
3275
3203
|
position: 'absolute'
|
|
3276
3204
|
});
|
|
3277
|
-
|
|
3278
|
-
|
|
3205
|
+
/**
|
|
3206
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3207
|
+
* @deprecated
|
|
3208
|
+
*/ const TypeaheadComboboxMenu$1 = /*#__PURE__*/ forwardRef(// eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
3209
|
+
({ comboboxState, loading, emptyText, width, minWidth = 240, maxWidth, minHeight, maxHeight, listWrapperHeight, virtualizerRef, children, matchTriggerWidth, className, style, ...restProps }, ref)=>{
|
|
3279
3210
|
const { getMenuProps, isOpen } = comboboxState;
|
|
3280
3211
|
const { ref: downshiftRef, ...downshiftProps } = getMenuProps({}, {
|
|
3281
3212
|
suppressRefError: true
|
|
@@ -3293,6 +3224,8 @@ const TypeaheadComboboxMenu = /*#__PURE__*/ forwardRef(// eslint-disable-next-li
|
|
|
3293
3224
|
]);
|
|
3294
3225
|
const { theme } = useDesignSystemTheme();
|
|
3295
3226
|
const { getPopupContainer } = useDesignSystemContext();
|
|
3227
|
+
const themeClass = useDuboisThemeClass();
|
|
3228
|
+
const themeOverrideStyle = useDesignTokenOverrideStyles();
|
|
3296
3229
|
const recalculateMaxHeight = useCallback(()=>{
|
|
3297
3230
|
if (isOpen && floatingUiRefs?.floating && floatingUiRefs.reference.current && floatingUiRefs?.reference && floatingUiRefs.floating.current) {
|
|
3298
3231
|
computePosition(floatingUiRefs.reference.current, floatingUiRefs.floating.current, {
|
|
@@ -3369,10 +3302,13 @@ const TypeaheadComboboxMenu = /*#__PURE__*/ forwardRef(// eslint-disable-next-li
|
|
|
3369
3302
|
width: inputWidth
|
|
3370
3303
|
}
|
|
3371
3304
|
],
|
|
3305
|
+
...restProps,
|
|
3306
|
+
className: classnames(className, themeClass),
|
|
3372
3307
|
style: {
|
|
3373
|
-
...floatingStyles
|
|
3308
|
+
...floatingStyles,
|
|
3309
|
+
...style,
|
|
3310
|
+
...themeOverrideStyle
|
|
3374
3311
|
},
|
|
3375
|
-
...restProps,
|
|
3376
3312
|
children: loading ? /*#__PURE__*/ jsx(LoadingSpinner, {
|
|
3377
3313
|
"aria-label": "Loading",
|
|
3378
3314
|
alt: "Loading spinner"
|
|
@@ -3402,7 +3338,7 @@ const TypeaheadComboboxMenu = /*#__PURE__*/ forwardRef(// eslint-disable-next-li
|
|
|
3402
3338
|
}), getPopupContainer ? getPopupContainer() : document.body);
|
|
3403
3339
|
});
|
|
3404
3340
|
|
|
3405
|
-
const getToggleButtonStyles = (theme, disabled)=>{
|
|
3341
|
+
const getToggleButtonStyles$1 = (theme, disabled)=>{
|
|
3406
3342
|
return /*#__PURE__*/ css({
|
|
3407
3343
|
cursor: 'pointer',
|
|
3408
3344
|
userSelect: 'none',
|
|
@@ -3419,7 +3355,10 @@ const getToggleButtonStyles = (theme, disabled)=>{
|
|
|
3419
3355
|
}
|
|
3420
3356
|
});
|
|
3421
3357
|
};
|
|
3422
|
-
|
|
3358
|
+
/**
|
|
3359
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3360
|
+
* @deprecated
|
|
3361
|
+
*/ const TypeaheadComboboxToggleButton$1 = /*#__PURE__*/ React__default.forwardRef(// eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
3423
3362
|
({ disabled, ...restProps }, ref)=>{
|
|
3424
3363
|
const { theme } = useDesignSystemTheme();
|
|
3425
3364
|
const { onClick } = restProps;
|
|
@@ -3431,34 +3370,35 @@ const TypeaheadComboboxToggleButton = /*#__PURE__*/ React__default.forwardRef(//
|
|
|
3431
3370
|
type: "button",
|
|
3432
3371
|
"aria-label": "toggle menu",
|
|
3433
3372
|
ref: ref,
|
|
3434
|
-
css: getToggleButtonStyles(theme, disabled),
|
|
3373
|
+
css: getToggleButtonStyles$1(theme, disabled),
|
|
3435
3374
|
...restProps,
|
|
3436
3375
|
onClick: handleClick,
|
|
3437
3376
|
children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
3438
3377
|
});
|
|
3439
3378
|
});
|
|
3440
3379
|
|
|
3441
|
-
|
|
3380
|
+
/** Height of the non-inline controls block, for callers that position it themselves. */ const TYPEAHEAD_COMBOBOX_CONTROLS_HEIGHT = 16;
|
|
3381
|
+
const TypeaheadComboboxControls$1 = ({ getDownshiftToggleButtonProps, showClearSelectionButton, showComboboxToggleButton = true, handleClear, disabled, loading = false, inline = false, className })=>{
|
|
3442
3382
|
return /*#__PURE__*/ jsxs("div", {
|
|
3443
3383
|
className: className,
|
|
3444
|
-
css:
|
|
3384
|
+
css: {
|
|
3385
|
+
// Centers the 12px clear icon against the 16px toggle button.
|
|
3445
3386
|
display: 'flex',
|
|
3446
3387
|
alignItems: 'center',
|
|
3447
|
-
cursor: disabled ? 'not-allowed' : undefined
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3388
|
+
cursor: disabled ? 'not-allowed' : undefined,
|
|
3389
|
+
...inline ? {} : {
|
|
3390
|
+
height: TYPEAHEAD_COMBOBOX_CONTROLS_HEIGHT,
|
|
3391
|
+
zIndex: 1
|
|
3392
|
+
}
|
|
3452
3393
|
},
|
|
3453
3394
|
children: [
|
|
3454
3395
|
showClearSelectionButton && /*#__PURE__*/ jsx(ClearSelectionButton, {
|
|
3455
3396
|
onClick: handleClear,
|
|
3456
3397
|
css: {
|
|
3457
|
-
pointerEvents: 'all'
|
|
3458
|
-
verticalAlign: 'text-top'
|
|
3398
|
+
pointerEvents: 'all'
|
|
3459
3399
|
}
|
|
3460
3400
|
}),
|
|
3461
|
-
loading ? /*#__PURE__*/ jsx(LoadingSpinner, {}) : showComboboxToggleButton && /*#__PURE__*/ jsx(TypeaheadComboboxToggleButton, {
|
|
3401
|
+
loading ? /*#__PURE__*/ jsx(LoadingSpinner, {}) : showComboboxToggleButton && /*#__PURE__*/ jsx(TypeaheadComboboxToggleButton$1, {
|
|
3462
3402
|
...getDownshiftToggleButtonProps(),
|
|
3463
3403
|
disabled: disabled
|
|
3464
3404
|
})
|
|
@@ -3466,7 +3406,7 @@ const TypeaheadComboboxControls = ({ getDownshiftToggleButtonProps, showClearSel
|
|
|
3466
3406
|
});
|
|
3467
3407
|
};
|
|
3468
3408
|
|
|
3469
|
-
const getInputStyles$
|
|
3409
|
+
const getInputStyles$3 = (theme)=>/*#__PURE__*/ css({
|
|
3470
3410
|
width: '100%',
|
|
3471
3411
|
minWidth: 72,
|
|
3472
3412
|
textOverflow: 'ellipsis',
|
|
@@ -3481,7 +3421,10 @@ const getInputStyles$1 = (theme)=>/*#__PURE__*/ css({
|
|
|
3481
3421
|
backgroundColor: 'transparent'
|
|
3482
3422
|
}
|
|
3483
3423
|
});
|
|
3484
|
-
|
|
3424
|
+
/**
|
|
3425
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3426
|
+
* @deprecated
|
|
3427
|
+
*/ const TypeaheadComboboxInput$1 = /*#__PURE__*/ forwardRef(// eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
3485
3428
|
({ comboboxState, allowClear = true, showComboboxToggleButton = true, formOnChange, onClick, clearInputValueOnFocus = false, size, loading = false, suffix, ...restProps }, ref)=>{
|
|
3486
3429
|
const { isInsideTypeaheadCombobox, floatingUiRefs, setInputWidth, inputWidth } = useTypeaheadComboboxContext();
|
|
3487
3430
|
if (!isInsideTypeaheadCombobox) {
|
|
@@ -3554,14 +3497,14 @@ const TypeaheadComboboxInput = /*#__PURE__*/ forwardRef(// eslint-disable-next-l
|
|
|
3554
3497
|
className: restProps.className,
|
|
3555
3498
|
...addDebugOutlineIfEnabled(),
|
|
3556
3499
|
children: /*#__PURE__*/ jsx(Input, {
|
|
3557
|
-
//
|
|
3500
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Valid case, as combostate componentId is checked in the hook exempt:ef606c74-b984-4035-bbdb-9a6ae8e4e88e
|
|
3558
3501
|
componentId: componentId ? `${componentId}.input` : 'design_system.typeahead_combobox.input',
|
|
3559
3502
|
ref: mergedRef,
|
|
3560
3503
|
...downshiftProps,
|
|
3561
3504
|
"aria-controls": comboboxState.isOpen ? downshiftProps['aria-controls'] : undefined,
|
|
3562
3505
|
onClick: handleClick,
|
|
3563
3506
|
size: size,
|
|
3564
|
-
css: getInputStyles$
|
|
3507
|
+
css: getInputStyles$3(theme),
|
|
3565
3508
|
...restProps,
|
|
3566
3509
|
suffix: /*#__PURE__*/ jsxs("div", {
|
|
3567
3510
|
css: /*#__PURE__*/ css({
|
|
@@ -3571,7 +3514,7 @@ const TypeaheadComboboxInput = /*#__PURE__*/ forwardRef(// eslint-disable-next-l
|
|
|
3571
3514
|
}),
|
|
3572
3515
|
children: [
|
|
3573
3516
|
suffix,
|
|
3574
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxControls, {
|
|
3517
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxControls$1, {
|
|
3575
3518
|
getDownshiftToggleButtonProps: getToggleButtonProps,
|
|
3576
3519
|
showClearSelectionButton: allowClear && Boolean(inputValue) && !restProps.disabled,
|
|
3577
3520
|
showComboboxToggleButton: showComboboxToggleButton,
|
|
@@ -3586,7 +3529,7 @@ const TypeaheadComboboxInput = /*#__PURE__*/ forwardRef(// eslint-disable-next-l
|
|
|
3586
3529
|
});
|
|
3587
3530
|
});
|
|
3588
3531
|
|
|
3589
|
-
const getContainerStyles = (theme, validationState, width, disabled)=>{
|
|
3532
|
+
const getContainerStyles$1 = (theme, validationState, width, disabled)=>{
|
|
3590
3533
|
const validationColor = getValidationStateColor(theme, validationState);
|
|
3591
3534
|
return /*#__PURE__*/ css({
|
|
3592
3535
|
cursor: 'text',
|
|
@@ -3643,12 +3586,21 @@ const getContainerStyles = (theme, validationState, width, disabled)=>{
|
|
|
3643
3586
|
}
|
|
3644
3587
|
});
|
|
3645
3588
|
};
|
|
3589
|
+
// One tag row (20px line height + 2px margins) plus vertical padding on both sides and the
|
|
3590
|
+
// container's 1px borders: 36px by default, 32px at `size="middle"`.
|
|
3591
|
+
const TAG_ROW_HEIGHT = 24;
|
|
3592
|
+
const DEFAULT_VERTICAL_PADDING = 5;
|
|
3593
|
+
const MIDDLE_VERTICAL_PADDING = 3;
|
|
3594
|
+
const getVerticalPadding = (size)=>size === 'middle' ? MIDDLE_VERTICAL_PADDING : DEFAULT_VERTICAL_PADDING;
|
|
3595
|
+
// Centers the shorter controls block on the tag row it floats beside.
|
|
3596
|
+
const CONTROLS_ROW_OFFSET = (TAG_ROW_HEIGHT - TYPEAHEAD_COMBOBOX_CONTROLS_HEIGHT) / 2;
|
|
3646
3597
|
// Overflow lives on this inner wrapper so the floated, sticky controls
|
|
3647
3598
|
// (rendered as the first child) stay pinned to the top-right of the visible
|
|
3648
3599
|
// scroll viewport while the tag list scrolls.
|
|
3649
|
-
const getScrollContainerStyles = (maxHeight)=>{
|
|
3600
|
+
const getScrollContainerStyles$1 = (maxHeight, size)=>{
|
|
3601
|
+
const verticalPadding = getVerticalPadding(size);
|
|
3650
3602
|
return /*#__PURE__*/ css({
|
|
3651
|
-
padding:
|
|
3603
|
+
padding: `${verticalPadding}px 7px ${verticalPadding}px 12px`,
|
|
3652
3604
|
overflowY: 'auto',
|
|
3653
3605
|
overflowX: 'hidden',
|
|
3654
3606
|
...maxHeight ? {
|
|
@@ -3656,7 +3608,7 @@ const getScrollContainerStyles = (maxHeight)=>{
|
|
|
3656
3608
|
} : {}
|
|
3657
3609
|
});
|
|
3658
3610
|
};
|
|
3659
|
-
const getContentWrapperStyles = ()=>{
|
|
3611
|
+
const getContentWrapperStyles$1 = ()=>{
|
|
3660
3612
|
return /*#__PURE__*/ css({
|
|
3661
3613
|
display: 'flex',
|
|
3662
3614
|
flex: 'auto',
|
|
@@ -3665,7 +3617,7 @@ const getContentWrapperStyles = ()=>{
|
|
|
3665
3617
|
position: 'relative'
|
|
3666
3618
|
});
|
|
3667
3619
|
};
|
|
3668
|
-
const getInputWrapperStyles = ()=>{
|
|
3620
|
+
const getInputWrapperStyles$1 = ()=>{
|
|
3669
3621
|
return /*#__PURE__*/ css({
|
|
3670
3622
|
display: 'inline-flex',
|
|
3671
3623
|
position: 'relative',
|
|
@@ -3679,7 +3631,7 @@ const getInputWrapperStyles = ()=>{
|
|
|
3679
3631
|
minWidth: 40
|
|
3680
3632
|
});
|
|
3681
3633
|
};
|
|
3682
|
-
const getInputStyles = (theme)=>{
|
|
3634
|
+
const getInputStyles$2 = (theme)=>{
|
|
3683
3635
|
return /*#__PURE__*/ css({
|
|
3684
3636
|
lineHeight: 20,
|
|
3685
3637
|
height: 24,
|
|
@@ -3699,8 +3651,12 @@ const getInputStyles = (theme)=>{
|
|
|
3699
3651
|
}
|
|
3700
3652
|
});
|
|
3701
3653
|
};
|
|
3702
|
-
|
|
3703
|
-
|
|
3654
|
+
/**
|
|
3655
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3656
|
+
* @deprecated
|
|
3657
|
+
*/ const TypeaheadComboboxMultiSelectInput$1 = /*#__PURE__*/ forwardRef(// eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
3658
|
+
({ comboboxState, multipleSelectionState, selectedItems, setSelectedItems, getSelectedItemLabel, allowClear = true, showTagAfterValueCount = 20, width, maxHeight, placeholder, validationState, showComboboxToggleButton, disableTooltip = false, // Kept out of `restProps`: on an `input`, `size` is a character count.
|
|
3659
|
+
size, ...restProps }, ref)=>{
|
|
3704
3660
|
const { isInsideTypeaheadCombobox } = useTypeaheadComboboxContext();
|
|
3705
3661
|
if (!isInsideTypeaheadCombobox) {
|
|
3706
3662
|
throw new Error('`TypeaheadComboboxMultiSelectInput` must be used within `TypeaheadCombobox`');
|
|
@@ -3872,29 +3828,30 @@ const TypeaheadComboboxMultiSelectInput = /*#__PURE__*/ forwardRef(// eslint-dis
|
|
|
3872
3828
|
...addDebugOutlineIfEnabled(),
|
|
3873
3829
|
onClick: handleClick,
|
|
3874
3830
|
ref: mergedContainerRef,
|
|
3875
|
-
css: getContainerStyles(theme, validationState, width, restProps.disabled),
|
|
3831
|
+
css: getContainerStyles$1(theme, validationState, width, restProps.disabled),
|
|
3876
3832
|
tabIndex: restProps.disabled ? -1 : 0,
|
|
3877
3833
|
children: /*#__PURE__*/ jsxs("div", {
|
|
3878
3834
|
ref: scrollContainerRef,
|
|
3879
|
-
css: getScrollContainerStyles(maxHeight),
|
|
3835
|
+
css: getScrollContainerStyles$1(maxHeight, size),
|
|
3880
3836
|
children: [
|
|
3881
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxControls, {
|
|
3837
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxControls$1, {
|
|
3882
3838
|
getDownshiftToggleButtonProps: getToggleButtonProps,
|
|
3883
3839
|
showComboboxToggleButton: showComboboxToggleButton,
|
|
3884
3840
|
showClearSelectionButton: allowClear && (Boolean(inputValue) || selectedItems && selectedItems.length > 0) && !restProps.disabled,
|
|
3885
3841
|
handleClear: handleClear,
|
|
3886
3842
|
disabled: restProps.disabled,
|
|
3887
|
-
// top
|
|
3888
|
-
//
|
|
3843
|
+
// `top` equals the flow position, so scrolling the tag list leaves the controls in
|
|
3844
|
+
// place on the first row.
|
|
3889
3845
|
css: /*#__PURE__*/ css({
|
|
3890
3846
|
position: 'sticky',
|
|
3891
|
-
top:
|
|
3847
|
+
top: getVerticalPadding(size) + CONTROLS_ROW_OFFSET,
|
|
3848
|
+
marginTop: CONTROLS_ROW_OFFSET,
|
|
3892
3849
|
float: 'right'
|
|
3893
3850
|
})
|
|
3894
3851
|
}),
|
|
3895
3852
|
/*#__PURE__*/ jsxs("div", {
|
|
3896
3853
|
ref: itemsRef,
|
|
3897
|
-
css: getContentWrapperStyles(),
|
|
3854
|
+
css: getContentWrapperStyles$1(),
|
|
3898
3855
|
children: [
|
|
3899
3856
|
selectedItemsToRender?.map((selectedItemForRender, index)=>/*#__PURE__*/ jsx(TypeaheadComboboxSelectedItem, {
|
|
3900
3857
|
label: getSelectedItemLabel(selectedItemForRender),
|
|
@@ -3912,14 +3869,14 @@ const TypeaheadComboboxMultiSelectInput = /*#__PURE__*/ forwardRef(// eslint-dis
|
|
|
3912
3869
|
disabled: restProps.disabled
|
|
3913
3870
|
}),
|
|
3914
3871
|
/*#__PURE__*/ jsxs("div", {
|
|
3915
|
-
css: getInputWrapperStyles(),
|
|
3872
|
+
css: getInputWrapperStyles$1(),
|
|
3916
3873
|
"data-slot": "input",
|
|
3917
3874
|
children: [
|
|
3918
3875
|
/*#__PURE__*/ jsx("input", {
|
|
3919
3876
|
...downshiftProps,
|
|
3920
3877
|
ref: mergedInputRef,
|
|
3921
3878
|
css: [
|
|
3922
|
-
getInputStyles(theme),
|
|
3879
|
+
getInputStyles$2(theme),
|
|
3923
3880
|
{
|
|
3924
3881
|
width: inputWidth
|
|
3925
3882
|
}
|
|
@@ -3959,7 +3916,10 @@ const TypeaheadComboboxMultiSelectInput = /*#__PURE__*/ forwardRef(// eslint-dis
|
|
|
3959
3916
|
return content;
|
|
3960
3917
|
});
|
|
3961
3918
|
|
|
3962
|
-
|
|
3919
|
+
/**
|
|
3920
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3921
|
+
* @deprecated
|
|
3922
|
+
*/ const TypeaheadComboboxSectionHeader$1 = ({ children, ...props })=>{
|
|
3963
3923
|
const { isInsideTypeaheadCombobox } = useTypeaheadComboboxContext();
|
|
3964
3924
|
if (!isInsideTypeaheadCombobox) {
|
|
3965
3925
|
throw new Error('`TypeaheadComboboxSectionHeader` must be used within `TypeaheadComboboxMenu`');
|
|
@@ -3970,7 +3930,10 @@ const TypeaheadComboboxSectionHeader = ({ children, ...props })=>{
|
|
|
3970
3930
|
});
|
|
3971
3931
|
};
|
|
3972
3932
|
|
|
3973
|
-
|
|
3933
|
+
/**
|
|
3934
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3935
|
+
* @deprecated
|
|
3936
|
+
*/ const TypeaheadComboboxSeparator$1 = (props)=>{
|
|
3974
3937
|
const { isInsideTypeaheadCombobox } = useTypeaheadComboboxContext();
|
|
3975
3938
|
if (!isInsideTypeaheadCombobox) {
|
|
3976
3939
|
throw new Error('`TypeaheadComboboxSeparator` must be used within `TypeaheadComboboxMenu`');
|
|
@@ -3980,7 +3943,10 @@ const TypeaheadComboboxSeparator = (props)=>{
|
|
|
3980
3943
|
});
|
|
3981
3944
|
};
|
|
3982
3945
|
|
|
3983
|
-
|
|
3946
|
+
/**
|
|
3947
|
+
* Deprecated in favor of `TypeaheadComboboxV2`.
|
|
3948
|
+
* @deprecated
|
|
3949
|
+
*/ const TypeaheadComboboxAddButton$1 = /*#__PURE__*/ forwardRef(// eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
3984
3950
|
({ children, ...restProps }, forwardedRef)=>{
|
|
3985
3951
|
const { theme } = useDesignSystemTheme();
|
|
3986
3952
|
const { isInsideTypeaheadCombobox, componentId } = useTypeaheadComboboxContext();
|
|
@@ -3989,7 +3955,7 @@ const TypeaheadComboboxAddButton = /*#__PURE__*/ forwardRef(// eslint-disable-ne
|
|
|
3989
3955
|
}
|
|
3990
3956
|
return /*#__PURE__*/ jsx(Button, {
|
|
3991
3957
|
...restProps,
|
|
3992
|
-
//
|
|
3958
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Validated in the Root for the context exempt:844c1e83-84b8-41ba-95af-bae4799834aa
|
|
3993
3959
|
componentId: `${componentId}.add_option`,
|
|
3994
3960
|
type: "tertiary",
|
|
3995
3961
|
onClick: (event)=>{
|
|
@@ -4256,7 +4222,7 @@ function RHFControlledTypeaheadCombobox({ name, control, rules, allItems, itemTo
|
|
|
4256
4222
|
rules
|
|
4257
4223
|
});
|
|
4258
4224
|
const [items, setItems] = useState(allItems);
|
|
4259
|
-
const comboboxState = useComboboxState({
|
|
4225
|
+
const comboboxState = useComboboxState$1({
|
|
4260
4226
|
allItems,
|
|
4261
4227
|
items,
|
|
4262
4228
|
setItems,
|
|
@@ -4286,18 +4252,18 @@ function RHFControlledTypeaheadCombobox({ name, control, rules, allItems, itemTo
|
|
|
4286
4252
|
comboboxState.inputValue,
|
|
4287
4253
|
onInputChange
|
|
4288
4254
|
]);
|
|
4289
|
-
return /*#__PURE__*/ jsxs(TypeaheadComboboxRoot, {
|
|
4255
|
+
return /*#__PURE__*/ jsxs(TypeaheadComboboxRoot$1, {
|
|
4290
4256
|
...props,
|
|
4291
4257
|
comboboxState: comboboxState,
|
|
4292
4258
|
children: [
|
|
4293
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxInput, {
|
|
4259
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxInput$1, {
|
|
4294
4260
|
...inputProps,
|
|
4295
4261
|
validationState: validationState,
|
|
4296
4262
|
formOnChange: field.onChange,
|
|
4297
4263
|
comboboxState: comboboxState,
|
|
4298
4264
|
ref: field.ref
|
|
4299
4265
|
}),
|
|
4300
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxMenu, {
|
|
4266
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxMenu$1, {
|
|
4301
4267
|
...menuProps,
|
|
4302
4268
|
comboboxState: comboboxState,
|
|
4303
4269
|
children: children({
|
|
@@ -4330,7 +4296,7 @@ function RHFControlledMultiSelectTypeaheadCombobox({ name, control, rules, allIt
|
|
|
4330
4296
|
field.onChange(item);
|
|
4331
4297
|
setSelectedItems(item);
|
|
4332
4298
|
};
|
|
4333
|
-
const comboboxState = useComboboxState({
|
|
4299
|
+
const comboboxState = useComboboxState$1({
|
|
4334
4300
|
allItems,
|
|
4335
4301
|
items,
|
|
4336
4302
|
setInputValue,
|
|
@@ -4346,7 +4312,7 @@ function RHFControlledMultiSelectTypeaheadCombobox({ name, control, rules, allIt
|
|
|
4346
4312
|
analyticsEvents,
|
|
4347
4313
|
valueHasNoPii
|
|
4348
4314
|
});
|
|
4349
|
-
const multipleSelectionState = useMultipleSelectionState(selectedItems, handleItemUpdate, comboboxState);
|
|
4315
|
+
const multipleSelectionState = useMultipleSelectionState$1(selectedItems, handleItemUpdate, comboboxState);
|
|
4350
4316
|
const lastEmmitedInputValue = useRef(inputProps?.value);
|
|
4351
4317
|
useEffect(()=>{
|
|
4352
4318
|
if (onInputChange && lastEmmitedInputValue.current !== comboboxState.inputValue) {
|
|
@@ -4357,11 +4323,11 @@ function RHFControlledMultiSelectTypeaheadCombobox({ name, control, rules, allIt
|
|
|
4357
4323
|
comboboxState.inputValue,
|
|
4358
4324
|
onInputChange
|
|
4359
4325
|
]);
|
|
4360
|
-
return /*#__PURE__*/ jsxs(TypeaheadComboboxRoot, {
|
|
4326
|
+
return /*#__PURE__*/ jsxs(TypeaheadComboboxRoot$1, {
|
|
4361
4327
|
...props,
|
|
4362
4328
|
comboboxState: comboboxState,
|
|
4363
4329
|
children: [
|
|
4364
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxMultiSelectInput, {
|
|
4330
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxMultiSelectInput$1, {
|
|
4365
4331
|
...inputProps,
|
|
4366
4332
|
multipleSelectionState: multipleSelectionState,
|
|
4367
4333
|
selectedItems: selectedItems,
|
|
@@ -4371,7 +4337,7 @@ function RHFControlledMultiSelectTypeaheadCombobox({ name, control, rules, allIt
|
|
|
4371
4337
|
validationState: validationState,
|
|
4372
4338
|
ref: field.ref
|
|
4373
4339
|
}),
|
|
4374
|
-
/*#__PURE__*/ jsx(TypeaheadComboboxMenu, {
|
|
4340
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxMenu$1, {
|
|
4375
4341
|
...menuProps,
|
|
4376
4342
|
comboboxState: comboboxState,
|
|
4377
4343
|
children: children({
|
|
@@ -4544,14 +4510,19 @@ const FormUI = {
|
|
|
4544
4510
|
HorizontalFormRow
|
|
4545
4511
|
};
|
|
4546
4512
|
|
|
4547
|
-
const Col = (
|
|
4513
|
+
const Col = (props)=>/*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
4548
4514
|
children: /*#__PURE__*/ jsx(Col$1, {
|
|
4549
|
-
...props
|
|
4550
|
-
...dangerouslySetAntdProps
|
|
4515
|
+
...props
|
|
4551
4516
|
})
|
|
4552
4517
|
});
|
|
4553
4518
|
|
|
4554
|
-
|
|
4519
|
+
/**
|
|
4520
|
+
* Default horizontal gutter (px) for `Row`. NOTE this diverges from AntD's own default of `0`:
|
|
4521
|
+
* DuBois has always defaulted `Row` to `8`, and ~75% of `<Row>` usages rely on it, so both the
|
|
4522
|
+
* AntD-backed `Row` and the native `NativeRow` must apply it. Kept in its own module so both
|
|
4523
|
+
* variants (and the flag-gated `Row`) share one source without an import cycle.
|
|
4524
|
+
*/ const ROW_GUTTER_SIZE = 8;
|
|
4525
|
+
|
|
4555
4526
|
const Row = ({ gutter = ROW_GUTTER_SIZE, ...props })=>{
|
|
4556
4527
|
return /*#__PURE__*/ jsx(DesignSystemAntDConfigProvider, {
|
|
4557
4528
|
children: /*#__PURE__*/ jsx(Row$1, {
|
|
@@ -4693,6 +4664,8 @@ const Header = ({ breadcrumbs, title, titleAddOns, dangerouslyAppendEmotionCSS,
|
|
|
4693
4664
|
maxWidth,
|
|
4694
4665
|
backgroundColor
|
|
4695
4666
|
});
|
|
4667
|
+
const themeClass = useDuboisThemeClass();
|
|
4668
|
+
const themeOverrideStyle = useDesignTokenOverrideStyles();
|
|
4696
4669
|
return /*#__PURE__*/ jsxs(RadixHoverCard.Root, {
|
|
4697
4670
|
...props,
|
|
4698
4671
|
children: [
|
|
@@ -4707,6 +4680,8 @@ const Header = ({ breadcrumbs, title, titleAddOns, dangerouslyAppendEmotionCSS,
|
|
|
4707
4680
|
sideOffset: sideOffset,
|
|
4708
4681
|
align: align,
|
|
4709
4682
|
css: hoverCardStyles['content'],
|
|
4683
|
+
className: themeClass,
|
|
4684
|
+
style: themeOverrideStyle,
|
|
4710
4685
|
children: [
|
|
4711
4686
|
content,
|
|
4712
4687
|
withArrow && /*#__PURE__*/ jsx(RadixHoverCard.Arrow, {
|
|
@@ -5079,7 +5054,7 @@ const getToastRootStyle = (theme, classNamePrefix)=>{
|
|
|
5079
5054
|
const Root = // eslint-disable-next-line react-component-name/react-component-name -- TODO(FEINF-4716)
|
|
5080
5055
|
/*#__PURE__*/ forwardRef(function({ children, severity = 'info', severityLabel, componentId, analyticsEvents = [
|
|
5081
5056
|
DesignSystemEventProviderAnalyticsEventTypes.OnView
|
|
5082
|
-
], ...props }, ref) {
|
|
5057
|
+
], className, style, ...props }, ref) {
|
|
5083
5058
|
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
5084
5059
|
const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents, [
|
|
5085
5060
|
analyticsEvents
|
|
@@ -5095,6 +5070,8 @@ const Root = // eslint-disable-next-line react-component-name/react-component-na
|
|
|
5095
5070
|
const { elementRef } = useNotifyOnFirstView({
|
|
5096
5071
|
onView: eventContext.onView
|
|
5097
5072
|
});
|
|
5073
|
+
const themeClass = useDuboisThemeClass();
|
|
5074
|
+
const themeOverrideStyle = useDesignTokenOverrideStyles();
|
|
5098
5075
|
// Radix Toast already has a hidden announcer — the legacy `<span role="status" aria-live>`
|
|
5099
5076
|
// wrapper double-announced. We rely on Radix's defaults (`role="status"` on the <li>) and
|
|
5100
5077
|
// pass `type="foreground"` for errors so the hidden announcer goes assertive. The
|
|
@@ -5106,6 +5083,11 @@ const Root = // eslint-disable-next-line react-component-name/react-component-na
|
|
|
5106
5083
|
...props,
|
|
5107
5084
|
...addDebugOutlineIfEnabled(),
|
|
5108
5085
|
...preventSwipeToClose(),
|
|
5086
|
+
className: classnames(className, themeClass),
|
|
5087
|
+
style: {
|
|
5088
|
+
...style,
|
|
5089
|
+
...themeOverrideStyle
|
|
5090
|
+
},
|
|
5109
5091
|
children: [
|
|
5110
5092
|
/*#__PURE__*/ jsx(SeverityIcon, {
|
|
5111
5093
|
className: `${classNamePrefix}-notification-severity-icon ${classNamePrefix}-notification-${severity}-icon`,
|
|
@@ -5449,6 +5431,8 @@ const getViewportStyle = (theme, vertical, horizontal)=>{
|
|
|
5449
5431
|
};
|
|
5450
5432
|
const SnackBarRoot = /*#__PURE__*/ forwardRef(function SnackBarRoot({ snack }, ref) {
|
|
5451
5433
|
const { theme } = useDesignSystemTheme();
|
|
5434
|
+
const themeClass = useDuboisThemeClass();
|
|
5435
|
+
const themeOverrideStyle = useDesignTokenOverrideStyles();
|
|
5452
5436
|
const memoizedAnalyticsEvents = useMemo(()=>[
|
|
5453
5437
|
DesignSystemEventProviderAnalyticsEventTypes.OnView
|
|
5454
5438
|
], []);
|
|
@@ -5489,9 +5473,13 @@ const SnackBarRoot = /*#__PURE__*/ forwardRef(function SnackBarRoot({ snack }, r
|
|
|
5489
5473
|
return /*#__PURE__*/ jsxs(Toast.Root, {
|
|
5490
5474
|
ref: ref,
|
|
5491
5475
|
css: getSnackBarRootStyle(theme, snack.backgroundColor, snack.textColor),
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5476
|
+
className: themeClass,
|
|
5477
|
+
style: {
|
|
5478
|
+
...snack.closeButton === false ? {
|
|
5479
|
+
cursor: 'pointer'
|
|
5480
|
+
} : undefined,
|
|
5481
|
+
...themeOverrideStyle
|
|
5482
|
+
},
|
|
5495
5483
|
open: snack.open,
|
|
5496
5484
|
onOpenChange: handleOpenChange,
|
|
5497
5485
|
duration: snack.autoDismiss,
|
|
@@ -6420,11 +6408,1750 @@ const TreeGrid = ({ data, columns, renderCell, renderRow, renderTable, renderHea
|
|
|
6420
6408
|
});
|
|
6421
6409
|
};
|
|
6422
6410
|
|
|
6411
|
+
const ROOT_CSS = {
|
|
6412
|
+
display: 'inline-block',
|
|
6413
|
+
width: '100%',
|
|
6414
|
+
position: 'relative'
|
|
6415
|
+
};
|
|
6416
|
+
// `any` matches the original Root's pattern: ComboBoxState is invariant in T, so we can't widen
|
|
6417
|
+
// ComboboxStateValue<T> at this generic boundary. Typed consumer code still routes through
|
|
6418
|
+
// useComboboxState.
|
|
6419
|
+
const TypeaheadComboboxRoot = /*#__PURE__*/ forwardRef(function TypeaheadComboboxRoot({ comboboxState, children, footerFocusable = true, ...props }, ref) {
|
|
6420
|
+
const { classNamePrefix } = useDesignSystemTheme();
|
|
6421
|
+
const inputRef = useRef(null);
|
|
6422
|
+
const listBoxRef = useRef(null);
|
|
6423
|
+
const popoverRef = useRef(null);
|
|
6424
|
+
const buttonRef = useRef(null);
|
|
6425
|
+
const triggerRef = useRef(null);
|
|
6426
|
+
const footerRef = useRef(null);
|
|
6427
|
+
const { state, itemsByKey, getKeyForItem, itemToString, removeByKey, clearSelection, onInputBlur } = comboboxState;
|
|
6428
|
+
const { inputProps: ariaInputProps, listBoxProps, buttonProps } = useComboBox({
|
|
6429
|
+
inputRef,
|
|
6430
|
+
listBoxRef,
|
|
6431
|
+
popoverRef,
|
|
6432
|
+
buttonRef,
|
|
6433
|
+
// Arrowing past the last option wraps to the first (and vice versa), matching the original
|
|
6434
|
+
// downshift TypeaheadCombobox, whose `useCombobox` defaults to `circularNavigation: true`.
|
|
6435
|
+
// react-aria's `useSelectableCollection` defaults `shouldFocusWrap` to false, so without this
|
|
6436
|
+
// keyboard focus stops dead at the list boundary.
|
|
6437
|
+
shouldFocusWrap: true,
|
|
6438
|
+
'aria-label': props['aria-label']
|
|
6439
|
+
}, state);
|
|
6440
|
+
// Compose the consumer's formOnBlur onto react-aria's own input onBlur (which drives the
|
|
6441
|
+
// commit-on-blur), rather than clobbering it. useComboBox owns the value re-sync; we only add
|
|
6442
|
+
// the form notification on a genuine blur.
|
|
6443
|
+
const inputProps = useMemo(()=>({
|
|
6444
|
+
...ariaInputProps,
|
|
6445
|
+
onBlur: (e)=>{
|
|
6446
|
+
ariaInputProps.onBlur?.(e);
|
|
6447
|
+
// Only notify the form on a *real* blur — focus leaving the whole widget. Committing a
|
|
6448
|
+
// selection (and Tab-to-footer when footerFocusable) transiently blurs the input to a node
|
|
6449
|
+
// still inside the trigger/popover and refocuses; treating that as a blur would fire
|
|
6450
|
+
// formOnBlur mid-interaction, diverging from RHF touched/validation semantics. Skip when
|
|
6451
|
+
// focus lands on a node still inside the combobox.
|
|
6452
|
+
const next = e.relatedTarget;
|
|
6453
|
+
if (next instanceof Node && (triggerRef.current?.contains(next) || popoverRef.current?.contains(next))) {
|
|
6454
|
+
return;
|
|
6455
|
+
}
|
|
6456
|
+
onInputBlur();
|
|
6457
|
+
}
|
|
6458
|
+
}), [
|
|
6459
|
+
ariaInputProps,
|
|
6460
|
+
onInputBlur,
|
|
6461
|
+
triggerRef,
|
|
6462
|
+
popoverRef
|
|
6463
|
+
]);
|
|
6464
|
+
const { elementRef: viewRef } = useNotifyOnFirstView({
|
|
6465
|
+
onView: comboboxState.onView,
|
|
6466
|
+
value: comboboxState.firstOnViewValue
|
|
6467
|
+
});
|
|
6468
|
+
const mergedRef = useCallback((node)=>{
|
|
6469
|
+
if (typeof ref === 'function') ref(node);
|
|
6470
|
+
else if (ref) ref.current = node;
|
|
6471
|
+
viewRef.current = node;
|
|
6472
|
+
triggerRef.current = node;
|
|
6473
|
+
}, [
|
|
6474
|
+
ref,
|
|
6475
|
+
viewRef
|
|
6476
|
+
]);
|
|
6477
|
+
const contextValue = useMemo(()=>({
|
|
6478
|
+
componentId: comboboxState.componentId,
|
|
6479
|
+
multiSelect: comboboxState.multiSelect,
|
|
6480
|
+
showAllOptionsOnOpen: comboboxState.showAllOptionsOnOpen,
|
|
6481
|
+
isInsideTypeaheadCombobox: true,
|
|
6482
|
+
comboBoxState: state,
|
|
6483
|
+
inputProps,
|
|
6484
|
+
listBoxProps,
|
|
6485
|
+
buttonProps,
|
|
6486
|
+
inputRef,
|
|
6487
|
+
listBoxRef,
|
|
6488
|
+
popoverRef,
|
|
6489
|
+
buttonRef,
|
|
6490
|
+
triggerRef,
|
|
6491
|
+
footerFocusable,
|
|
6492
|
+
footerRef,
|
|
6493
|
+
itemsByKey,
|
|
6494
|
+
getKeyForItem,
|
|
6495
|
+
itemToString,
|
|
6496
|
+
removeByKey,
|
|
6497
|
+
clearSelection
|
|
6498
|
+
}), [
|
|
6499
|
+
comboboxState.componentId,
|
|
6500
|
+
comboboxState.multiSelect,
|
|
6501
|
+
comboboxState.showAllOptionsOnOpen,
|
|
6502
|
+
state,
|
|
6503
|
+
inputProps,
|
|
6504
|
+
listBoxProps,
|
|
6505
|
+
buttonProps,
|
|
6506
|
+
footerFocusable,
|
|
6507
|
+
itemsByKey,
|
|
6508
|
+
getKeyForItem,
|
|
6509
|
+
itemToString,
|
|
6510
|
+
removeByKey,
|
|
6511
|
+
clearSelection
|
|
6512
|
+
]);
|
|
6513
|
+
return /*#__PURE__*/ jsx(TypeaheadComboboxV2ContextProvider, {
|
|
6514
|
+
value: contextValue,
|
|
6515
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
6516
|
+
className: `${classNamePrefix}-typeahead-combobox-react-aria`,
|
|
6517
|
+
css: ROOT_CSS,
|
|
6518
|
+
...props,
|
|
6519
|
+
ref: mergedRef,
|
|
6520
|
+
"data-component-type": DesignSystemEventProviderComponentTypes.TypeaheadCombobox,
|
|
6521
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Valid case, as combostate componentId is checked in the hook exempt:b9d30633-6d2c-4215-8451-f32826273087
|
|
6522
|
+
"data-component-id": comboboxState.componentId,
|
|
6523
|
+
children: children
|
|
6524
|
+
})
|
|
6525
|
+
});
|
|
6526
|
+
});
|
|
6527
|
+
|
|
6528
|
+
// PROTOTYPE helper (DUBOIS-455, "Option A"): move DOM focus between the combobox input and the
|
|
6529
|
+
// footer's focusable controls. Only used when `footerFocusable` is set on the Root.
|
|
6530
|
+
//
|
|
6531
|
+
// Backed by react-aria's `createFocusManager` rather than a hand-rolled `querySelector`. The manager
|
|
6532
|
+
// walks the footer with `getFocusableTreeWalker`, whose node filter runs through `isFocusable` — so
|
|
6533
|
+
// it skips `display:none` / `visibility:hidden` / ancestor-hidden / `inert` / closed-`<details>`
|
|
6534
|
+
// controls that a raw CSS selector would wrongly match (and then `.focus()` as a no-op, stranding
|
|
6535
|
+
// focus). It also gives ordered `focusNext` / `focusPrevious`, so a footer with more than one control
|
|
6536
|
+
// navigates correctly instead of always landing on the first one.
|
|
6537
|
+
/**
|
|
6538
|
+
* Focus the first tabbable control in `container`. Returns true only if focus actually moved onto a
|
|
6539
|
+
* control inside `container` — react-aria skips non-visible/inert nodes and `.focus()` on them is a
|
|
6540
|
+
* no-op, so we confirm against the resulting element rather than assuming a query match succeeded.
|
|
6541
|
+
*/ function focusFirstFocusable(container) {
|
|
6542
|
+
if (!container) {
|
|
6543
|
+
return false;
|
|
6544
|
+
}
|
|
6545
|
+
const focused = createFocusManager({
|
|
6546
|
+
current: container
|
|
6547
|
+
}).focusFirst({
|
|
6548
|
+
tabbable: true
|
|
6549
|
+
});
|
|
6550
|
+
return focused != null && container.contains(focused);
|
|
6551
|
+
}
|
|
6552
|
+
/**
|
|
6553
|
+
* Step focus to the adjacent tabbable control within `container`, starting from the currently focused
|
|
6554
|
+
* element. Returns true if focus moved to another control in `container`; false when there is none in
|
|
6555
|
+
* that direction (Shift+Tab from the first control, or forward Tab from the last) — the caller's cue
|
|
6556
|
+
* to return focus to the input instead of letting it escape the popover.
|
|
6557
|
+
*/ function focusAdjacentFocusable(container, direction) {
|
|
6558
|
+
if (!container) {
|
|
6559
|
+
return false;
|
|
6560
|
+
}
|
|
6561
|
+
const active = document.activeElement;
|
|
6562
|
+
if (!(active instanceof HTMLElement) || !container.contains(active)) {
|
|
6563
|
+
return false;
|
|
6564
|
+
}
|
|
6565
|
+
const manager = createFocusManager({
|
|
6566
|
+
current: container
|
|
6567
|
+
});
|
|
6568
|
+
const focused = direction === 'next' ? manager.focusNext({
|
|
6569
|
+
from: active,
|
|
6570
|
+
tabbable: true
|
|
6571
|
+
}) : manager.focusPrevious({
|
|
6572
|
+
from: active,
|
|
6573
|
+
tabbable: true
|
|
6574
|
+
});
|
|
6575
|
+
return focused != null && container.contains(focused);
|
|
6576
|
+
}
|
|
6577
|
+
|
|
6578
|
+
// Menu identifies the footer by component type (`child.type === TypeaheadComboboxFooter`), so no
|
|
6579
|
+
// marker prop is needed — `defaultProps` on a function component is removed in React 19.
|
|
6580
|
+
const TypeaheadComboboxFooter = ({ children, onKeyDown, ...restProps })=>{
|
|
6581
|
+
const { theme } = useDesignSystemTheme();
|
|
6582
|
+
const { isInsideTypeaheadCombobox, footerFocusable, footerRef, inputRef, comboBoxState } = useTypeaheadComboboxV2Context();
|
|
6583
|
+
if (!isInsideTypeaheadCombobox) {
|
|
6584
|
+
throw new Error('`TypeaheadComboboxFooter` must be used within `TypeaheadComboboxMenu`');
|
|
6585
|
+
}
|
|
6586
|
+
// PROTOTYPE (DUBOIS-455, "Option A"): the return leg. When footerFocusable and focus is inside the
|
|
6587
|
+
// footer, Tab / Shift+Tab step between the footer's controls, and Escape (or stepping off either
|
|
6588
|
+
// end) sends DOM focus back to the input so the user can resume typing. The menu stays open on the
|
|
6589
|
+
// return leg — the Menu gates useOverlay's close-on-blur for focus moving to the input.
|
|
6590
|
+
const setFooterRef = useCallback((node)=>{
|
|
6591
|
+
if (footerFocusable) {
|
|
6592
|
+
footerRef.current = node;
|
|
6593
|
+
}
|
|
6594
|
+
}, [
|
|
6595
|
+
footerFocusable,
|
|
6596
|
+
footerRef
|
|
6597
|
+
]);
|
|
6598
|
+
const returnFocusToInput = (e, close)=>{
|
|
6599
|
+
e.preventDefault();
|
|
6600
|
+
e.stopPropagation();
|
|
6601
|
+
inputRef.current?.focus();
|
|
6602
|
+
if (close) {
|
|
6603
|
+
comboBoxState?.close();
|
|
6604
|
+
}
|
|
6605
|
+
};
|
|
6606
|
+
const handleKeyDown = (e)=>{
|
|
6607
|
+
onKeyDown?.(e);
|
|
6608
|
+
if (!footerFocusable) {
|
|
6609
|
+
return;
|
|
6610
|
+
}
|
|
6611
|
+
if (e.key === 'Escape') {
|
|
6612
|
+
returnFocusToInput(e, true);
|
|
6613
|
+
return;
|
|
6614
|
+
}
|
|
6615
|
+
if (e.key === 'Tab') {
|
|
6616
|
+
// Step to the adjacent footer control; if there is none in that direction (Shift+Tab from the
|
|
6617
|
+
// first control, forward Tab from the last), return to the input instead of letting focus
|
|
6618
|
+
// escape the popover. A single-control footer returns on the first Tab either way.
|
|
6619
|
+
const moved = focusAdjacentFocusable(footerRef.current, e.shiftKey ? 'previous' : 'next');
|
|
6620
|
+
if (moved) {
|
|
6621
|
+
e.preventDefault();
|
|
6622
|
+
e.stopPropagation();
|
|
6623
|
+
} else {
|
|
6624
|
+
returnFocusToInput(e, false);
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
};
|
|
6628
|
+
return /*#__PURE__*/ jsx("div", {
|
|
6629
|
+
...restProps,
|
|
6630
|
+
ref: setFooterRef,
|
|
6631
|
+
onKeyDown: handleKeyDown,
|
|
6632
|
+
css: getFooterStyles(theme),
|
|
6633
|
+
children: children
|
|
6634
|
+
});
|
|
6635
|
+
};
|
|
6636
|
+
|
|
6637
|
+
const MENU_STYLES = /*#__PURE__*/ css({
|
|
6638
|
+
padding: 0,
|
|
6639
|
+
margin: 0,
|
|
6640
|
+
display: 'flex',
|
|
6641
|
+
flexDirection: 'column',
|
|
6642
|
+
alignItems: 'flex-start',
|
|
6643
|
+
listStyle: 'none',
|
|
6644
|
+
outline: 'none'
|
|
6645
|
+
});
|
|
6646
|
+
const TypeaheadComboboxMenu = /*#__PURE__*/ forwardRef(function TypeaheadComboboxMenu(props, _ref) {
|
|
6647
|
+
const ctx = useTypeaheadComboboxV2Context();
|
|
6648
|
+
if (!ctx.isInsideTypeaheadCombobox) {
|
|
6649
|
+
throw new Error('`TypeaheadComboboxMenu` must be used within `TypeaheadComboboxRoot`');
|
|
6650
|
+
}
|
|
6651
|
+
if (!ctx.comboBoxState || !ctx.comboBoxState.isOpen) return null;
|
|
6652
|
+
return /*#__PURE__*/ jsx(TypeaheadComboboxMenuContents, {
|
|
6653
|
+
...props,
|
|
6654
|
+
state: ctx.comboBoxState,
|
|
6655
|
+
rawListBoxProps: ctx.listBoxProps,
|
|
6656
|
+
listBoxRef: ctx.listBoxRef,
|
|
6657
|
+
popoverRef: ctx.popoverRef,
|
|
6658
|
+
triggerRef: ctx.triggerRef,
|
|
6659
|
+
triggerWidth: ctx.triggerWidth,
|
|
6660
|
+
inputRef: ctx.inputRef,
|
|
6661
|
+
footerFocusable: ctx.footerFocusable
|
|
6662
|
+
});
|
|
6663
|
+
});
|
|
6664
|
+
const TypeaheadComboboxMenuContents = ({ loading, emptyText, width, minWidth = 240, maxWidth, minHeight, maxHeight, listWrapperHeight, virtualizerRef, children, matchTriggerWidth, state, rawListBoxProps, listBoxRef, popoverRef, triggerRef, triggerWidth, inputRef, footerFocusable, ...restProps })=>{
|
|
6665
|
+
const { theme } = useDesignSystemTheme();
|
|
6666
|
+
const { getPopupContainer } = useDesignSystemContext();
|
|
6667
|
+
const { isInsideRadixModal } = useRadixModalContext();
|
|
6668
|
+
// useOverlayPosition already caps to the viewport; only forward numeric maxHeight to tighten further.
|
|
6669
|
+
const popoverMaxHeight = typeof maxHeight === 'number' ? maxHeight : undefined;
|
|
6670
|
+
// We compose useOverlay + useOverlayPosition directly instead of usePopover because usePopover
|
|
6671
|
+
// hard-wires `onClose` into the position hook (usePopover.ts), which makes react-aria close the
|
|
6672
|
+
// menu on *any* scroll whose target contains the trigger (useCloseOnScroll) — including page
|
|
6673
|
+
// scroll. The original floating-ui combobox repositioned on scroll instead of closing. Passing
|
|
6674
|
+
// `onClose: null` to useOverlayPosition preserves that reposition-don't-close behavior. Dismissal
|
|
6675
|
+
// still happens via blur/outside-click (useComboBox + shouldCloseOnBlur) and Escape (useOverlay).
|
|
6676
|
+
const { overlayProps: dismissProps } = useOverlay({
|
|
6677
|
+
isOpen: state.isOpen,
|
|
6678
|
+
onClose: state.close,
|
|
6679
|
+
shouldCloseOnBlur: true,
|
|
6680
|
+
// Dismiss on outside press. With isDismissable:false, useOverlay wires NO interact-outside
|
|
6681
|
+
// handler and dismissal rides entirely on onBlurWithin — which deliberately does NOT close
|
|
6682
|
+
// when the blur's relatedTarget is null (focus falling to <body>). Clicking empty page area,
|
|
6683
|
+
// or clicking through the count-badge Tooltip that wraps the trigger, produces exactly that
|
|
6684
|
+
// null-relatedTarget blur, so the menu got stuck open (only the chevron, which toggles
|
|
6685
|
+
// directly, could close it). isDismissable:true activates useInteractOutside, which closes on
|
|
6686
|
+
// any outside pointer-down regardless of focus. This is independent of the scroll behavior:
|
|
6687
|
+
// useOverlayPosition still gets onClose:null below, so scrolling repositions, never closes.
|
|
6688
|
+
isDismissable: true,
|
|
6689
|
+
// PROTOTYPE (DUBOIS-455, "Option A"): when the footer is focusable, moving focus from the
|
|
6690
|
+
// footer BACK to the input leaves the popover and would trip useOverlay's close-on-blur —
|
|
6691
|
+
// closing the menu and wiping the typed filter. Gate that: don't treat the input as "outside".
|
|
6692
|
+
// (No-op when footerFocusable is false, so default behavior is unchanged.)
|
|
6693
|
+
...footerFocusable ? {
|
|
6694
|
+
shouldCloseOnInteractOutside: (element)=>!inputRef.current?.contains(element)
|
|
6695
|
+
} : {}
|
|
6696
|
+
}, popoverRef);
|
|
6697
|
+
const { overlayProps: positionProps } = useOverlayPosition({
|
|
6698
|
+
targetRef: triggerRef,
|
|
6699
|
+
overlayRef: popoverRef,
|
|
6700
|
+
isOpen: state.isOpen,
|
|
6701
|
+
placement: 'bottom start',
|
|
6702
|
+
offset: 4,
|
|
6703
|
+
maxHeight: popoverMaxHeight,
|
|
6704
|
+
onClose: null
|
|
6705
|
+
});
|
|
6706
|
+
const popoverProps = {
|
|
6707
|
+
...dismissProps,
|
|
6708
|
+
...positionProps
|
|
6709
|
+
};
|
|
6710
|
+
// PROTOTYPE (DUBOIS-455, "Option A"): because the Menu runs with <Overlay disableFocusManagement>
|
|
6711
|
+
// (no FocusScope), react-aria does NOT restore focus on close. If the menu closes (Escape, select,
|
|
6712
|
+
// outside-click) while focus is on the footer, focus would strand on <body> — a WCAG 2.4.3 gap. On
|
|
6713
|
+
// unmount (menu close), if focus is still inside the popover, hand it back to the input.
|
|
6714
|
+
//
|
|
6715
|
+
// MUST be a layout effect, not a passive useEffect: a passive cleanup runs AFTER the commit that
|
|
6716
|
+
// detaches the popover, and removing the focused footer button drops focus to <body> first — so the
|
|
6717
|
+
// `popover.contains(document.activeElement)` guard would already be false and the handoff would never
|
|
6718
|
+
// fire. A layout-effect cleanup runs before detachment, while focus is still on the footer.
|
|
6719
|
+
useIsomorphicLayoutEffect(()=>{
|
|
6720
|
+
if (!footerFocusable) {
|
|
6721
|
+
return;
|
|
6722
|
+
}
|
|
6723
|
+
// Capture both nodes here rather than reading .current in the cleanup: by teardown the refs may
|
|
6724
|
+
// already have been detached, so the cleanup would see null and skip the focus handoff.
|
|
6725
|
+
const popover = popoverRef.current;
|
|
6726
|
+
const input = inputRef.current;
|
|
6727
|
+
return ()=>{
|
|
6728
|
+
if (popover && popover.contains(document.activeElement)) {
|
|
6729
|
+
input?.focus();
|
|
6730
|
+
}
|
|
6731
|
+
};
|
|
6732
|
+
}, [
|
|
6733
|
+
footerFocusable,
|
|
6734
|
+
popoverRef,
|
|
6735
|
+
inputRef
|
|
6736
|
+
]);
|
|
6737
|
+
const isVirtualized = virtualizerRef !== undefined;
|
|
6738
|
+
const { listBoxProps } = useListBox({
|
|
6739
|
+
...rawListBoxProps,
|
|
6740
|
+
isVirtualized
|
|
6741
|
+
}, state, listBoxRef);
|
|
6742
|
+
// mergeRefs fans the listbox node out to both refs; memoized so it isn't detached/reattached
|
|
6743
|
+
// on every render.
|
|
6744
|
+
const setListBoxRef = useMemo(()=>mergeRefs(listBoxRef, virtualizerRef), [
|
|
6745
|
+
listBoxRef,
|
|
6746
|
+
virtualizerRef
|
|
6747
|
+
]);
|
|
6748
|
+
const hasFragmentWrapper = children && !Array.isArray(children) && /*#__PURE__*/ isValidElement(children) && children.type === Fragment$1;
|
|
6749
|
+
const filterableChildren = hasFragmentWrapper ? children.props.children : children;
|
|
6750
|
+
const [menuItemChildren, footer] = Children.toArray(filterableChildren).reduce((acc, child)=>{
|
|
6751
|
+
const isFooter = /*#__PURE__*/ isValidElement(child) && child.type === TypeaheadComboboxFooter;
|
|
6752
|
+
if (isFooter) acc[1].push(child);
|
|
6753
|
+
else acc[0].push(child);
|
|
6754
|
+
return acc;
|
|
6755
|
+
}, [
|
|
6756
|
+
[],
|
|
6757
|
+
[]
|
|
6758
|
+
]);
|
|
6759
|
+
const hasResults = menuItemChildren.length > 0;
|
|
6760
|
+
const close = ()=>state.close();
|
|
6761
|
+
// Inside a focus-trapped Radix modal, portal the menu into the modal's Dialog.Content
|
|
6762
|
+
// (role="document" — the FocusScope boundary) instead of document.body. Otherwise focusing a
|
|
6763
|
+
// footer control (footerFocusable) lands focus outside the trap and Radix immediately refocuses
|
|
6764
|
+
// the input. We target the role="document" node specifically, NOT the inner .modal-content div
|
|
6765
|
+
// (which is centered with a `transform`, and a transformed ancestor would become the containing
|
|
6766
|
+
// block for the menu's position: fixed and clip it). triggerRef sits inside the modal body, so
|
|
6767
|
+
// closest() resolves the content node once the trigger is mounted (always true when the menu is open).
|
|
6768
|
+
const modalContentNode = isInsideRadixModal && triggerRef.current ? triggerRef.current.closest('[role="document"]') : null;
|
|
6769
|
+
const portalContainer = modalContentNode ?? (getPopupContainer ? getPopupContainer() : undefined);
|
|
6770
|
+
return(// disableFocusManagement: the combobox input owns focus throughout (options are virtually
|
|
6771
|
+
// focused via aria-activedescendant), so the Overlay's default FocusScope must not move or
|
|
6772
|
+
// restore focus into the popover.
|
|
6773
|
+
/*#__PURE__*/ jsx(Overlay, {
|
|
6774
|
+
portalContainer: portalContainer,
|
|
6775
|
+
disableFocusManagement: true,
|
|
6776
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
6777
|
+
ref: popoverRef,
|
|
6778
|
+
...popoverProps,
|
|
6779
|
+
// Chrome (border, background, radius, shadow) + sizing live on the popover container so they
|
|
6780
|
+
// wrap the option list AND the footer/spinner. `overflow: hidden` + a flex column make the
|
|
6781
|
+
// <ul> the only scroll area, so the footer stays pinned below it inside the same container.
|
|
6782
|
+
css: [
|
|
6783
|
+
getComboboxContentWrapperStyles(theme, {
|
|
6784
|
+
maxHeight,
|
|
6785
|
+
maxWidth,
|
|
6786
|
+
minHeight,
|
|
6787
|
+
minWidth,
|
|
6788
|
+
width
|
|
6789
|
+
}),
|
|
6790
|
+
{
|
|
6791
|
+
display: 'flex',
|
|
6792
|
+
flexDirection: 'column',
|
|
6793
|
+
overflow: 'hidden'
|
|
6794
|
+
}
|
|
6795
|
+
],
|
|
6796
|
+
style: {
|
|
6797
|
+
...popoverProps.style,
|
|
6798
|
+
// react-aria hard-codes zIndex: 100000 on the overlay, which sits *above* Du Bois
|
|
6799
|
+
// tooltips (zIndexBase + 70) — burying both the multi-select tooltip and in-menu
|
|
6800
|
+
// InfoTooltips. Bring the menu into the Du Bois band (matching Popover, zIndexBase + 30):
|
|
6801
|
+
// still above modals (zIndexBase) and page content, but below tooltips as designed.
|
|
6802
|
+
zIndex: theme.options.zIndexBase + 30,
|
|
6803
|
+
...matchTriggerWidth && triggerWidth ? {
|
|
6804
|
+
width: triggerWidth
|
|
6805
|
+
} : {}
|
|
6806
|
+
},
|
|
6807
|
+
children: [
|
|
6808
|
+
/*#__PURE__*/ jsx(DismissButton, {
|
|
6809
|
+
onDismiss: close
|
|
6810
|
+
}),
|
|
6811
|
+
loading && /*#__PURE__*/ jsx(LoadingSpinner, {
|
|
6812
|
+
"aria-label": "Loading",
|
|
6813
|
+
alt: "Loading spinner"
|
|
6814
|
+
}),
|
|
6815
|
+
/*#__PURE__*/ jsx("ul", {
|
|
6816
|
+
...addDebugOutlineIfEnabled(),
|
|
6817
|
+
"aria-busy": loading,
|
|
6818
|
+
...listBoxProps,
|
|
6819
|
+
ref: setListBoxRef,
|
|
6820
|
+
// Inner scroll area only — chrome/sizing moved to the container above. `position: relative`
|
|
6821
|
+
// makes the <ul> the containing block for the absolutely-positioned virtualized rows AND
|
|
6822
|
+
// the offsetParent that useScrollOptionIntoView's offsetTop/scrollTop math depends on —
|
|
6823
|
+
// both break together if it is removed. MENU_STYLES keeps `padding: 0`: the virtual rows'
|
|
6824
|
+
// translateY offsets are measured from the <ul>'s padding-box origin, so adding padding
|
|
6825
|
+
// here would shift every row.
|
|
6826
|
+
css: [
|
|
6827
|
+
MENU_STYLES,
|
|
6828
|
+
{
|
|
6829
|
+
position: 'relative',
|
|
6830
|
+
flex: '1 1 auto',
|
|
6831
|
+
minHeight: 0,
|
|
6832
|
+
overflowY: 'auto',
|
|
6833
|
+
width: '100%'
|
|
6834
|
+
}
|
|
6835
|
+
],
|
|
6836
|
+
...restProps,
|
|
6837
|
+
children: !loading && (hasResults ? /*#__PURE__*/ jsxs(Fragment, {
|
|
6838
|
+
children: [
|
|
6839
|
+
menuItemChildren,
|
|
6840
|
+
listWrapperHeight ? // role="none" removes this spacer from the accessibility tree so the listbox still
|
|
6841
|
+
// owns only options. Keep it attribute-free: do NOT add any aria-* attribute, no id
|
|
6842
|
+
// (especially one targeted by aria-activedescendant), no tabindex, and keep it
|
|
6843
|
+
// non-focusable — per WAI-ARIA 1.2 §5.4, any of those makes the browser ignore
|
|
6844
|
+
// role="none" and expose this node as a spurious owned child of the listbox.
|
|
6845
|
+
// flexShrink: 0 stops the flex column from compressing the scroll-height carrier.
|
|
6846
|
+
/*#__PURE__*/ jsx("li", {
|
|
6847
|
+
role: "none",
|
|
6848
|
+
style: {
|
|
6849
|
+
height: listWrapperHeight,
|
|
6850
|
+
flexShrink: 0
|
|
6851
|
+
}
|
|
6852
|
+
}) : null
|
|
6853
|
+
]
|
|
6854
|
+
}) : /*#__PURE__*/ jsx(EmptyResults, {
|
|
6855
|
+
emptyText: emptyText
|
|
6856
|
+
}))
|
|
6857
|
+
}),
|
|
6858
|
+
!loading && footer,
|
|
6859
|
+
/*#__PURE__*/ jsx(DismissButton, {
|
|
6860
|
+
onDismiss: close
|
|
6861
|
+
})
|
|
6862
|
+
]
|
|
6863
|
+
})
|
|
6864
|
+
}));
|
|
6865
|
+
};
|
|
6866
|
+
|
|
6867
|
+
const TypeaheadComboboxCheckboxItemInner = ({ item, selectedItems, selectedMatcher, textOverflowMode = 'multiline', isDisabled, disabledReason, hintContent, children, ...restProps }, forwardedRef)=>{
|
|
6868
|
+
const ctx = useTypeaheadComboboxV2Context();
|
|
6869
|
+
if (!ctx.isInsideTypeaheadCombobox || !ctx.comboBoxState) {
|
|
6870
|
+
throw new Error('`TypeaheadComboboxCheckboxItem` must be used within an open `TypeaheadComboboxRoot`');
|
|
6871
|
+
}
|
|
6872
|
+
const { comboBoxState: state, getKeyForItem } = ctx;
|
|
6873
|
+
const { theme } = useDesignSystemTheme();
|
|
6874
|
+
const itemRef = useRef(null);
|
|
6875
|
+
const setRef = useCallback((node)=>{
|
|
6876
|
+
itemRef.current = node;
|
|
6877
|
+
if (typeof forwardedRef === 'function') forwardedRef(node);
|
|
6878
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
6879
|
+
}, [
|
|
6880
|
+
forwardedRef
|
|
6881
|
+
]);
|
|
6882
|
+
const key = getKeyForItem(item);
|
|
6883
|
+
const { optionProps, isFocused } = useOption({
|
|
6884
|
+
key,
|
|
6885
|
+
'aria-label': typeof children === 'string' ? children : undefined
|
|
6886
|
+
}, state, itemRef);
|
|
6887
|
+
const isSelected = selectedMatcher && selectedItems ? selectedItems.some((selectedItem)=>selectedMatcher(selectedItem, item)) : state.selectionManager.isSelected(key);
|
|
6888
|
+
useScrollOptionIntoView(itemRef, isFocused, state.isOpen);
|
|
6889
|
+
return /*#__PURE__*/ jsx("li", {
|
|
6890
|
+
...optionProps,
|
|
6891
|
+
ref: setRef,
|
|
6892
|
+
css: [
|
|
6893
|
+
getComboboxOptionItemWrapperStyles(theme),
|
|
6894
|
+
getMenuItemStyles(theme, isFocused, isDisabled)
|
|
6895
|
+
],
|
|
6896
|
+
...restProps,
|
|
6897
|
+
children: /*#__PURE__*/ jsx(Checkbox, {
|
|
6898
|
+
componentId: "design_system.typeahead_combobox_v2.checkbox_item",
|
|
6899
|
+
disabled: isDisabled,
|
|
6900
|
+
isChecked: isSelected,
|
|
6901
|
+
css: getCheckboxStyles(theme, textOverflowMode),
|
|
6902
|
+
tabIndex: -1,
|
|
6903
|
+
onClick: (e)=>e.stopPropagation(),
|
|
6904
|
+
children: /*#__PURE__*/ jsxs("label", {
|
|
6905
|
+
children: [
|
|
6906
|
+
isDisabled && disabledReason ? /*#__PURE__*/ jsxs("div", {
|
|
6907
|
+
css: {
|
|
6908
|
+
display: 'flex'
|
|
6909
|
+
},
|
|
6910
|
+
children: [
|
|
6911
|
+
/*#__PURE__*/ jsx("div", {
|
|
6912
|
+
children: children
|
|
6913
|
+
}),
|
|
6914
|
+
/*#__PURE__*/ jsx("div", {
|
|
6915
|
+
css: getInfoIconStyles(theme),
|
|
6916
|
+
children: /*#__PURE__*/ jsx(InfoTooltip, {
|
|
6917
|
+
componentId: "typeahead-combobox-react-aria-checkbox-item-disabled-reason-info-tooltip",
|
|
6918
|
+
content: disabledReason
|
|
6919
|
+
})
|
|
6920
|
+
})
|
|
6921
|
+
]
|
|
6922
|
+
}) : children,
|
|
6923
|
+
/*#__PURE__*/ jsx(HintRow, {
|
|
6924
|
+
disabled: isDisabled,
|
|
6925
|
+
children: hintContent
|
|
6926
|
+
})
|
|
6927
|
+
]
|
|
6928
|
+
})
|
|
6929
|
+
})
|
|
6930
|
+
});
|
|
6931
|
+
};
|
|
6932
|
+
const TypeaheadComboboxCheckboxItem = /*#__PURE__*/ forwardRef(TypeaheadComboboxCheckboxItemInner);
|
|
6933
|
+
|
|
6934
|
+
const getToggleButtonStyles = (theme, disabled)=>/*#__PURE__*/ css({
|
|
6935
|
+
cursor: 'pointer',
|
|
6936
|
+
userSelect: 'none',
|
|
6937
|
+
color: theme.colors.textSecondary,
|
|
6938
|
+
backgroundColor: 'transparent',
|
|
6939
|
+
border: 'none',
|
|
6940
|
+
padding: 0,
|
|
6941
|
+
marginLeft: theme.spacing.xs,
|
|
6942
|
+
height: 16,
|
|
6943
|
+
width: 16,
|
|
6944
|
+
...disabled && {
|
|
6945
|
+
pointerEvents: 'none',
|
|
6946
|
+
color: theme.colors.actionDisabledText
|
|
6947
|
+
}
|
|
6948
|
+
});
|
|
6949
|
+
const TypeaheadComboboxToggleButton = ({ disabled })=>{
|
|
6950
|
+
const { theme } = useDesignSystemTheme();
|
|
6951
|
+
const { buttonProps: ariaButtonProps, buttonRef } = useTypeaheadComboboxV2Context();
|
|
6952
|
+
const { buttonProps } = useButton({
|
|
6953
|
+
...ariaButtonProps,
|
|
6954
|
+
isDisabled: disabled
|
|
6955
|
+
}, buttonRef);
|
|
6956
|
+
return /*#__PURE__*/ jsx("button", {
|
|
6957
|
+
type: "button",
|
|
6958
|
+
"aria-label": "toggle menu",
|
|
6959
|
+
ref: (el)=>{
|
|
6960
|
+
buttonRef.current = el;
|
|
6961
|
+
},
|
|
6962
|
+
css: getToggleButtonStyles(theme, disabled),
|
|
6963
|
+
...buttonProps,
|
|
6964
|
+
children: /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
6965
|
+
});
|
|
6966
|
+
};
|
|
6967
|
+
|
|
6968
|
+
const TypeaheadComboboxControls = ({ showClearSelectionButton, showComboboxToggleButton = true, handleClear, disabled, loading = false, inline = false, className })=>{
|
|
6969
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
6970
|
+
className: className,
|
|
6971
|
+
css: inline ? {
|
|
6972
|
+
display: 'flex',
|
|
6973
|
+
alignItems: 'center',
|
|
6974
|
+
cursor: disabled ? 'not-allowed' : undefined
|
|
6975
|
+
} : {
|
|
6976
|
+
height: 16,
|
|
6977
|
+
zIndex: 1,
|
|
6978
|
+
cursor: disabled ? 'not-allowed' : undefined
|
|
6979
|
+
},
|
|
6980
|
+
children: [
|
|
6981
|
+
showClearSelectionButton && /*#__PURE__*/ jsx(ClearSelectionButton, {
|
|
6982
|
+
onClick: handleClear,
|
|
6983
|
+
css: {
|
|
6984
|
+
pointerEvents: 'all',
|
|
6985
|
+
verticalAlign: 'text-top'
|
|
6986
|
+
}
|
|
6987
|
+
}),
|
|
6988
|
+
loading ? /*#__PURE__*/ jsx(LoadingSpinner, {}) : showComboboxToggleButton && /*#__PURE__*/ jsx(TypeaheadComboboxToggleButton, {
|
|
6989
|
+
disabled: disabled
|
|
6990
|
+
})
|
|
6991
|
+
]
|
|
6992
|
+
});
|
|
6993
|
+
};
|
|
6994
|
+
|
|
6995
|
+
const getInputStyles$1 = (theme)=>/*#__PURE__*/ css({
|
|
6996
|
+
width: '100%',
|
|
6997
|
+
minWidth: 72,
|
|
6998
|
+
textOverflow: 'ellipsis',
|
|
6999
|
+
borderRadius: theme.borders.borderRadiusSm,
|
|
7000
|
+
borderColor: theme.colors.actionDefaultBorderDefault,
|
|
7001
|
+
'&:disabled': {
|
|
7002
|
+
borderColor: theme.colors.actionDisabledBorder,
|
|
7003
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
7004
|
+
color: theme.colors.actionDisabledText
|
|
7005
|
+
},
|
|
7006
|
+
'&:not(:disabled)': {
|
|
7007
|
+
backgroundColor: 'transparent'
|
|
7008
|
+
}
|
|
7009
|
+
});
|
|
7010
|
+
const TypeaheadComboboxInput = /*#__PURE__*/ forwardRef(function TypeaheadComboboxInput({ allowClear = true, showComboboxToggleButton = true, onClick, size, loading = false, suffix, ...restProps }, ref) {
|
|
7011
|
+
const ctx = useTypeaheadComboboxV2Context();
|
|
7012
|
+
if (!ctx.isInsideTypeaheadCombobox) {
|
|
7013
|
+
throw new Error('`TypeaheadComboboxInput` must be used within `TypeaheadComboboxRoot`');
|
|
7014
|
+
}
|
|
7015
|
+
const { inputProps, inputRef, comboBoxState: state, setTriggerWidth, triggerRef, componentId, clearSelection, footerFocusable, footerRef, showAllOptionsOnOpen } = ctx;
|
|
7016
|
+
const { theme } = useDesignSystemTheme();
|
|
7017
|
+
// Measure trigger so `matchTriggerWidth` on Menu can size to it. Must be a passive effect, not
|
|
7018
|
+
// useLayoutEffect: triggerRef points at the Root <div> (an ancestor), whose ref is attached
|
|
7019
|
+
// only after this child's layout effects run — reading it in useLayoutEffect sees null and
|
|
7020
|
+
// never sets triggerWidth (the menu then falls back to its min width).
|
|
7021
|
+
useEffect(()=>{
|
|
7022
|
+
const node = triggerRef.current;
|
|
7023
|
+
if (!node) return;
|
|
7024
|
+
const width = node.getBoundingClientRect().width;
|
|
7025
|
+
setTriggerWidth(width);
|
|
7026
|
+
}, [
|
|
7027
|
+
triggerRef,
|
|
7028
|
+
setTriggerWidth
|
|
7029
|
+
]);
|
|
7030
|
+
const handleClear = ()=>{
|
|
7031
|
+
// clearSelection() already notifies the form via the hook-level formOnChange(null).
|
|
7032
|
+
clearSelection();
|
|
7033
|
+
};
|
|
7034
|
+
const handleClick = (e)=>{
|
|
7035
|
+
onClick?.(e);
|
|
7036
|
+
// Open-only: toggling on every click would flicker on repeat clicks. Toggle button + outside-click close.
|
|
7037
|
+
// showAllOptionsOnOpen: open via the 'manual' trigger so react-aria shows all options; typing re-filters.
|
|
7038
|
+
if (state && !state.isOpen) state.open(null, showAllOptionsOnOpen ? 'manual' : undefined);
|
|
7039
|
+
};
|
|
7040
|
+
// PROTOTYPE (DUBOIS-455, "Option A"): when footerFocusable, forward-Tab moves DOM focus into the
|
|
7041
|
+
// footer instead of committing. Must run in the CAPTURE phase — useComboBox binds Tab to
|
|
7042
|
+
// commit()->closeMenu() in the bubble phase, and that would close the menu (unmounting the footer)
|
|
7043
|
+
// before our handler ran. stopPropagation prevents react-aria's bubble handler from also firing;
|
|
7044
|
+
// preventDefault stops the browser's native tab. Shift+Tab is left alone (handled in the footer).
|
|
7045
|
+
//
|
|
7046
|
+
// react-aria coupling (RE-VERIFY ON UPGRADE): this works only because react-aria exposes its Tab
|
|
7047
|
+
// handler as a React `onKeyDown` prop on this same input (useComboBox inputProps, bubble phase),
|
|
7048
|
+
// which a capture-phase handler preempts and stopPropagation() can suppress. If a future react-aria
|
|
7049
|
+
// version moved that handling to a native/document listener, stopPropagation() would no longer stop
|
|
7050
|
+
// it and Tab would close the menu again. react-aria is version-pinned in this repo, so an upgrade
|
|
7051
|
+
// must re-verify this — the "Tab moves focus to the footer, menu stays open" regression test in
|
|
7052
|
+
// tests/TypeaheadComboboxV2FooterFocus.test.tsx guards it.
|
|
7053
|
+
const handleKeyDownCapture = (e)=>{
|
|
7054
|
+
if (!footerFocusable || e.key !== 'Tab' || e.shiftKey || !state?.isOpen) {
|
|
7055
|
+
return;
|
|
7056
|
+
}
|
|
7057
|
+
const moved = focusFirstFocusable(footerRef.current);
|
|
7058
|
+
if (moved) {
|
|
7059
|
+
e.preventDefault();
|
|
7060
|
+
e.stopPropagation();
|
|
7061
|
+
// Clear virtual focus so the (now-unfocused) input doesn't keep a stale aria-activedescendant
|
|
7062
|
+
// pointing at an option while real focus sits on the footer button.
|
|
7063
|
+
state.selectionManager.setFocusedKey(null);
|
|
7064
|
+
}
|
|
7065
|
+
};
|
|
7066
|
+
return /*#__PURE__*/ jsx("div", {
|
|
7067
|
+
className: restProps.className,
|
|
7068
|
+
...addDebugOutlineIfEnabled(),
|
|
7069
|
+
children: /*#__PURE__*/ jsx(Input, {
|
|
7070
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Valid case, as combostate componentId is checked in the hook exempt:97883162-7cd4-4bdc-a433-170eb108a4e3
|
|
7071
|
+
componentId: componentId ? `${componentId}.input` : 'design_system.typeahead_combobox_v2.input',
|
|
7072
|
+
ref: (antdInput)=>{
|
|
7073
|
+
// useComboBox needs the underlying HTMLInputElement, exposed by AntD v4 as `.input`.
|
|
7074
|
+
const node = antdInput?.input ?? null;
|
|
7075
|
+
inputRef.current = node;
|
|
7076
|
+
// Also forward to the consumer's ref (e.g. RHF `field.ref` for focus-on-validation-error).
|
|
7077
|
+
// Parity with TypeaheadComboboxMultiSelectInput, whose input already forwards; this ref was
|
|
7078
|
+
// previously dropped.
|
|
7079
|
+
if (typeof ref === 'function') ref(node);
|
|
7080
|
+
else if (ref) ref.current = node;
|
|
7081
|
+
},
|
|
7082
|
+
...mergeProps(inputProps, restProps),
|
|
7083
|
+
onClick: handleClick,
|
|
7084
|
+
onKeyDownCapture: handleKeyDownCapture,
|
|
7085
|
+
size: size,
|
|
7086
|
+
css: getInputStyles$1(theme),
|
|
7087
|
+
suffix: /*#__PURE__*/ jsxs("div", {
|
|
7088
|
+
css: /*#__PURE__*/ css({
|
|
7089
|
+
display: 'flex',
|
|
7090
|
+
alignItems: 'center',
|
|
7091
|
+
gap: theme.spacing.xs
|
|
7092
|
+
}),
|
|
7093
|
+
children: [
|
|
7094
|
+
suffix,
|
|
7095
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxControls, {
|
|
7096
|
+
showClearSelectionButton: allowClear && Boolean(state?.inputValue) && !restProps.disabled,
|
|
7097
|
+
showComboboxToggleButton: showComboboxToggleButton,
|
|
7098
|
+
handleClear: handleClear,
|
|
7099
|
+
disabled: restProps.disabled,
|
|
7100
|
+
loading: loading,
|
|
7101
|
+
inline: true
|
|
7102
|
+
})
|
|
7103
|
+
]
|
|
7104
|
+
})
|
|
7105
|
+
})
|
|
7106
|
+
});
|
|
7107
|
+
});
|
|
7108
|
+
|
|
7109
|
+
const getContainerStyles = (theme, validationState, width, disabled)=>{
|
|
7110
|
+
const validationColor = getValidationStateColor(theme, validationState);
|
|
7111
|
+
return /*#__PURE__*/ css({
|
|
7112
|
+
cursor: 'text',
|
|
7113
|
+
display: 'inline-block',
|
|
7114
|
+
verticalAlign: 'top',
|
|
7115
|
+
border: `1px solid ${theme.colors.actionDefaultBorderDefault}`,
|
|
7116
|
+
borderRadius: theme.general.borderRadiusBase,
|
|
7117
|
+
minHeight: 32,
|
|
7118
|
+
height: 'auto',
|
|
7119
|
+
minWidth: 0,
|
|
7120
|
+
...width ? {
|
|
7121
|
+
width
|
|
7122
|
+
} : {},
|
|
7123
|
+
position: 'relative',
|
|
7124
|
+
'&:hover': {
|
|
7125
|
+
border: `1px solid ${theme.colors.actionPrimaryBackgroundHover}`
|
|
7126
|
+
},
|
|
7127
|
+
'&:focus-within': {
|
|
7128
|
+
outlineColor: theme.colors.actionDefaultBorderFocus,
|
|
7129
|
+
outlineWidth: 2,
|
|
7130
|
+
outlineOffset: -2,
|
|
7131
|
+
outlineStyle: 'solid',
|
|
7132
|
+
boxShadow: 'none',
|
|
7133
|
+
borderColor: 'transparent'
|
|
7134
|
+
},
|
|
7135
|
+
'&&': {
|
|
7136
|
+
...validationState && {
|
|
7137
|
+
borderColor: validationColor
|
|
7138
|
+
},
|
|
7139
|
+
'&:hover': {
|
|
7140
|
+
borderColor: validationState ? validationColor : theme.colors.actionPrimaryBackgroundHover
|
|
7141
|
+
},
|
|
7142
|
+
...disabled && {
|
|
7143
|
+
borderColor: theme.colors.actionDisabledBorder,
|
|
7144
|
+
backgroundColor: theme.colors.actionDisabledBackground,
|
|
7145
|
+
cursor: 'not-allowed',
|
|
7146
|
+
outline: 'none',
|
|
7147
|
+
'&:hover': {
|
|
7148
|
+
border: `1px solid ${theme.colors.actionDisabledBorder}`
|
|
7149
|
+
},
|
|
7150
|
+
'&:focus-within': {
|
|
7151
|
+
outline: 'none',
|
|
7152
|
+
borderColor: theme.colors.actionDisabledBorder
|
|
7153
|
+
}
|
|
7154
|
+
}
|
|
7155
|
+
}
|
|
7156
|
+
});
|
|
7157
|
+
};
|
|
7158
|
+
const getScrollContainerStyles = (maxHeight)=>/*#__PURE__*/ css({
|
|
7159
|
+
padding: '5px 7px 5px 12px',
|
|
7160
|
+
overflowY: 'auto',
|
|
7161
|
+
overflowX: 'hidden',
|
|
7162
|
+
...maxHeight ? {
|
|
7163
|
+
maxHeight
|
|
7164
|
+
} : {}
|
|
7165
|
+
});
|
|
7166
|
+
const getContentWrapperStyles = ()=>/*#__PURE__*/ css({
|
|
7167
|
+
display: 'flex',
|
|
7168
|
+
flex: 'auto',
|
|
7169
|
+
flexWrap: 'wrap',
|
|
7170
|
+
maxWidth: '100%',
|
|
7171
|
+
position: 'relative'
|
|
7172
|
+
});
|
|
7173
|
+
const getInputWrapperStyles = ()=>/*#__PURE__*/ css({
|
|
7174
|
+
display: 'inline-flex',
|
|
7175
|
+
position: 'relative',
|
|
7176
|
+
maxWidth: '100%',
|
|
7177
|
+
alignSelf: 'auto',
|
|
7178
|
+
flex: '1 1 auto',
|
|
7179
|
+
minWidth: 40
|
|
7180
|
+
});
|
|
7181
|
+
const getInputStyles = (theme)=>/*#__PURE__*/ css({
|
|
7182
|
+
lineHeight: 20,
|
|
7183
|
+
height: 24,
|
|
7184
|
+
margin: 0,
|
|
7185
|
+
padding: 0,
|
|
7186
|
+
appearance: 'none',
|
|
7187
|
+
cursor: 'auto',
|
|
7188
|
+
width: '100%',
|
|
7189
|
+
backgroundColor: 'transparent',
|
|
7190
|
+
color: theme.colors.textPrimary,
|
|
7191
|
+
'&, &:hover, &:focus-visible': {
|
|
7192
|
+
border: 'none',
|
|
7193
|
+
outline: 'none'
|
|
7194
|
+
},
|
|
7195
|
+
'&::placeholder': {
|
|
7196
|
+
color: theme.colors.textPlaceholder
|
|
7197
|
+
}
|
|
7198
|
+
});
|
|
7199
|
+
const TypeaheadComboboxMultiSelectInputInner = ({ selectedItems, // Destructured to keep it out of `restProps` (which is spread onto the <input>); the selection
|
|
7200
|
+
// reset is routed through the context's clearSelection, so this setter isn't used directly here.
|
|
7201
|
+
setSelectedItems: _setSelectedItems, getSelectedItemLabel, allowClear = true, showTagAfterValueCount = 20, width, maxHeight, placeholder, validationState, showComboboxToggleButton, disableTooltip = false, loading, ...restProps }, ref)=>{
|
|
7202
|
+
const ctx = useTypeaheadComboboxV2Context();
|
|
7203
|
+
if (!ctx.isInsideTypeaheadCombobox) {
|
|
7204
|
+
throw new Error('`TypeaheadComboboxMultiSelectInput` must be used within `TypeaheadComboboxRoot`');
|
|
7205
|
+
}
|
|
7206
|
+
const { inputProps, inputRef, comboBoxState: state, setTriggerWidth, triggerRef, clearSelection, removeByKey, getKeyForItem, footerFocusable, footerRef } = ctx;
|
|
7207
|
+
const { theme } = useDesignSystemTheme();
|
|
7208
|
+
const containerRef = useRef(null);
|
|
7209
|
+
const scrollContainerRef = useRef(null);
|
|
7210
|
+
const itemsRef = useRef(null);
|
|
7211
|
+
const measureRef = useRef(null);
|
|
7212
|
+
const [inputWidth, setInputWidth] = useState(0);
|
|
7213
|
+
const setContainerRef = useCallback((node)=>{
|
|
7214
|
+
containerRef.current = node;
|
|
7215
|
+
triggerRef.current = node;
|
|
7216
|
+
}, [
|
|
7217
|
+
triggerRef
|
|
7218
|
+
]);
|
|
7219
|
+
const setInputElRef = useCallback((node)=>{
|
|
7220
|
+
inputRef.current = node;
|
|
7221
|
+
if (typeof ref === 'function') ref(node);
|
|
7222
|
+
else if (ref) ref.current = node;
|
|
7223
|
+
}, [
|
|
7224
|
+
inputRef,
|
|
7225
|
+
ref
|
|
7226
|
+
]);
|
|
7227
|
+
const isResponsive = showTagAfterValueCount === 'responsive';
|
|
7228
|
+
const fixedTagCount = typeof showTagAfterValueCount === 'number' ? showTagAfterValueCount : 20;
|
|
7229
|
+
const [responsiveVisibleCount, setResponsiveVisibleCount] = useState(null);
|
|
7230
|
+
const selectedItemsToRender = isResponsive ? responsiveVisibleCount === null ? selectedItems : selectedItems.slice(0, responsiveVisibleCount) : selectedItems.slice(0, fixedTagCount);
|
|
7231
|
+
const shouldShowCountBadge = selectedItems.length > selectedItemsToRender.length;
|
|
7232
|
+
const countBadgeStartAt = selectedItemsToRender.length;
|
|
7233
|
+
const [showTooltip, setShowTooltip] = useState(shouldShowCountBadge);
|
|
7234
|
+
const handleClick = ()=>{
|
|
7235
|
+
if (restProps.disabled) return;
|
|
7236
|
+
inputRef.current?.focus();
|
|
7237
|
+
// Open-only on click (see TypeaheadComboboxInput for rationale).
|
|
7238
|
+
if (state && !state.isOpen) state.open();
|
|
7239
|
+
};
|
|
7240
|
+
const handleClear = ()=>{
|
|
7241
|
+
if (!state) return;
|
|
7242
|
+
// Clear the typed search text, then route the selection reset through the hook's clearSelection
|
|
7243
|
+
// so the onValueChange('[]') analytics event fires — the single-select input clears the same way.
|
|
7244
|
+
// (clearSelection resets selectedItems in multi-select mode but does not touch the input value.)
|
|
7245
|
+
state.setInputValue('');
|
|
7246
|
+
clearSelection();
|
|
7247
|
+
};
|
|
7248
|
+
// Backspace on an empty input removes the last selected item, matching the original downshift
|
|
7249
|
+
// TypeaheadCombobox (whose `useMultipleSelection` handled DropdownKeyDownBackspace). react-aria's
|
|
7250
|
+
// multi-select is managed by us, so it does not wire this. Routed through `removeByKey` so the
|
|
7251
|
+
// same `onValueChange` analytics event fires as tag-click / clear-button removal. Guarded on an
|
|
7252
|
+
// empty input so it never interferes with normal text editing (the caret has nothing to delete).
|
|
7253
|
+
const handleKeyDown = (e)=>{
|
|
7254
|
+
// Read the input value from state, not the DOM node: react-aria controls the input via
|
|
7255
|
+
// `state.inputValue`, so that is the authoritative "is the field empty" source at event time.
|
|
7256
|
+
if (e.key !== 'Backspace' || (state?.inputValue ?? '') !== '' || selectedItems.length === 0 || restProps.disabled) {
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7259
|
+
removeByKey(getKeyForItem(selectedItems[selectedItems.length - 1]));
|
|
7260
|
+
};
|
|
7261
|
+
// PROTOTYPE (DUBOIS-455, "Option A"): mirror TypeaheadComboboxInput's capture-phase Tab handler for
|
|
7262
|
+
// multi-select. Without it, react-aria's bubble-phase Tab->commit fires and toggles (selects/
|
|
7263
|
+
// deselects) the highlighted option instead of moving focus to the footer — and with the
|
|
7264
|
+
// first-option highlight always on, an option is always highlighted, so Tab always toggled it.
|
|
7265
|
+
// Capture phase + stopPropagation suppresses that commit; preventDefault stops the native tab; and
|
|
7266
|
+
// clearing the focused key drops the stale aria-activedescendant while focus sits on the footer.
|
|
7267
|
+
const handleKeyDownCapture = (e)=>{
|
|
7268
|
+
if (!footerFocusable || e.key !== 'Tab' || e.shiftKey || !state?.isOpen) {
|
|
7269
|
+
return;
|
|
7270
|
+
}
|
|
7271
|
+
const moved = focusFirstFocusable(footerRef.current);
|
|
7272
|
+
if (moved) {
|
|
7273
|
+
e.preventDefault();
|
|
7274
|
+
e.stopPropagation();
|
|
7275
|
+
state.selectionManager.setFocusedKey(null);
|
|
7276
|
+
}
|
|
7277
|
+
};
|
|
7278
|
+
const currentInputValue = state?.inputValue ?? '';
|
|
7279
|
+
useLayoutEffect(()=>{
|
|
7280
|
+
if (measureRef.current) setInputWidth(measureRef.current.scrollWidth);
|
|
7281
|
+
}, [
|
|
7282
|
+
currentInputValue,
|
|
7283
|
+
placeholder
|
|
7284
|
+
]);
|
|
7285
|
+
useLayoutEffect(()=>{
|
|
7286
|
+
if (!isResponsive) return;
|
|
7287
|
+
setResponsiveVisibleCount(null);
|
|
7288
|
+
}, [
|
|
7289
|
+
isResponsive,
|
|
7290
|
+
selectedItems,
|
|
7291
|
+
inputWidth
|
|
7292
|
+
]);
|
|
7293
|
+
useLayoutEffect(()=>{
|
|
7294
|
+
if (!isResponsive) return;
|
|
7295
|
+
const container = containerRef.current;
|
|
7296
|
+
if (!container || typeof ResizeObserver === 'undefined') return;
|
|
7297
|
+
const observer = new ResizeObserver(()=>setResponsiveVisibleCount(null));
|
|
7298
|
+
observer.observe(container);
|
|
7299
|
+
return ()=>observer.disconnect();
|
|
7300
|
+
}, [
|
|
7301
|
+
isResponsive
|
|
7302
|
+
]);
|
|
7303
|
+
useLayoutEffect(()=>{
|
|
7304
|
+
if (!isResponsive) return;
|
|
7305
|
+
const itemsEl = itemsRef.current;
|
|
7306
|
+
if (!itemsEl) return;
|
|
7307
|
+
const tagEls = itemsEl.querySelectorAll('[data-slot="tag"]');
|
|
7308
|
+
if (tagEls.length === 0) {
|
|
7309
|
+
setResponsiveVisibleCount(0);
|
|
7310
|
+
return;
|
|
7311
|
+
}
|
|
7312
|
+
const firstTop = tagEls[0].offsetTop;
|
|
7313
|
+
const onFirstLine = (el)=>el != null && Math.abs(el.offsetTop - firstTop) <= 2;
|
|
7314
|
+
let firstLineTagCount = 0;
|
|
7315
|
+
for(let i = 0; i < tagEls.length; i++){
|
|
7316
|
+
if (onFirstLine(tagEls[i])) firstLineTagCount++;
|
|
7317
|
+
else break;
|
|
7318
|
+
}
|
|
7319
|
+
const inputWrapperEl = itemsEl.querySelector('[data-slot="input"]');
|
|
7320
|
+
const inputWrapped = inputWrapperEl != null && !onFirstLine(inputWrapperEl);
|
|
7321
|
+
let nextCount;
|
|
7322
|
+
if (firstLineTagCount < tagEls.length) {
|
|
7323
|
+
nextCount = firstLineTagCount;
|
|
7324
|
+
} else if (tagEls.length === selectedItems.length) {
|
|
7325
|
+
nextCount = inputWrapped ? Math.max(0, tagEls.length - 1) : selectedItems.length;
|
|
7326
|
+
} else if (inputWrapped) {
|
|
7327
|
+
nextCount = Math.max(0, tagEls.length - 1);
|
|
7328
|
+
} else {
|
|
7329
|
+
nextCount = tagEls.length;
|
|
7330
|
+
}
|
|
7331
|
+
setResponsiveVisibleCount(nextCount);
|
|
7332
|
+
}, [
|
|
7333
|
+
isResponsive,
|
|
7334
|
+
selectedItems,
|
|
7335
|
+
responsiveVisibleCount
|
|
7336
|
+
]);
|
|
7337
|
+
// Measure trigger so the menu can match its width. useLayoutEffect so it is set before paint.
|
|
7338
|
+
useLayoutEffect(()=>{
|
|
7339
|
+
const node = containerRef.current;
|
|
7340
|
+
if (!node) return;
|
|
7341
|
+
setTriggerWidth(node.getBoundingClientRect().width);
|
|
7342
|
+
}, [
|
|
7343
|
+
setTriggerWidth
|
|
7344
|
+
]);
|
|
7345
|
+
// When adding tags overflows the (maxHeight-capped) scroll container, the input — which sits at
|
|
7346
|
+
// the end of the flow — scrolls below the fold and takes the cursor with it. Scroll the container
|
|
7347
|
+
// to the bottom so the input stays visible. Scoped to the container's own scrollTop (not
|
|
7348
|
+
// scrollIntoView, which would also scroll the page/menu). Only on growth, so removing a tag
|
|
7349
|
+
// doesn't yank the view.
|
|
7350
|
+
const prevSelectedCount = useRef(selectedItems.length);
|
|
7351
|
+
useLayoutEffect(()=>{
|
|
7352
|
+
const grew = selectedItems.length > prevSelectedCount.current;
|
|
7353
|
+
prevSelectedCount.current = selectedItems.length;
|
|
7354
|
+
const container = scrollContainerRef.current;
|
|
7355
|
+
if (!grew || !container) return;
|
|
7356
|
+
container.scrollTop = container.scrollHeight;
|
|
7357
|
+
}, [
|
|
7358
|
+
selectedItems
|
|
7359
|
+
]);
|
|
7360
|
+
useEffect(()=>{
|
|
7361
|
+
let isPartiallyHidden = false;
|
|
7362
|
+
if (itemsRef.current && scrollContainerRef.current) {
|
|
7363
|
+
isPartiallyHidden = itemsRef.current.clientHeight > scrollContainerRef.current.clientHeight;
|
|
7364
|
+
}
|
|
7365
|
+
setShowTooltip(!disableTooltip && (shouldShowCountBadge || isPartiallyHidden));
|
|
7366
|
+
}, [
|
|
7367
|
+
shouldShowCountBadge,
|
|
7368
|
+
disableTooltip
|
|
7369
|
+
]);
|
|
7370
|
+
const content = /*#__PURE__*/ jsx("div", {
|
|
7371
|
+
...addDebugOutlineIfEnabled(),
|
|
7372
|
+
onClick: handleClick,
|
|
7373
|
+
ref: setContainerRef,
|
|
7374
|
+
css: getContainerStyles(theme, validationState, width, restProps.disabled),
|
|
7375
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
7376
|
+
ref: scrollContainerRef,
|
|
7377
|
+
css: getScrollContainerStyles(maxHeight),
|
|
7378
|
+
children: [
|
|
7379
|
+
/*#__PURE__*/ jsx(TypeaheadComboboxControls, {
|
|
7380
|
+
showComboboxToggleButton: showComboboxToggleButton,
|
|
7381
|
+
showClearSelectionButton: allowClear && (Boolean(currentInputValue) || selectedItems.length > 0) && !restProps.disabled,
|
|
7382
|
+
handleClear: handleClear,
|
|
7383
|
+
disabled: restProps.disabled,
|
|
7384
|
+
loading: loading,
|
|
7385
|
+
css: /*#__PURE__*/ css({
|
|
7386
|
+
position: 'sticky',
|
|
7387
|
+
top: 3,
|
|
7388
|
+
float: 'right'
|
|
7389
|
+
})
|
|
7390
|
+
}),
|
|
7391
|
+
/*#__PURE__*/ jsxs("div", {
|
|
7392
|
+
ref: itemsRef,
|
|
7393
|
+
css: getContentWrapperStyles(),
|
|
7394
|
+
children: [
|
|
7395
|
+
selectedItemsToRender.map((selectedItem, index)=>/*#__PURE__*/ jsx(TypeaheadComboboxSelectedItem$1, {
|
|
7396
|
+
label: getSelectedItemLabel(selectedItem),
|
|
7397
|
+
item: selectedItem,
|
|
7398
|
+
disabled: restProps.disabled,
|
|
7399
|
+
"data-slot": "tag"
|
|
7400
|
+
}, `selected-item-${index}`)),
|
|
7401
|
+
shouldShowCountBadge && /*#__PURE__*/ jsx(CountBadge$1, {
|
|
7402
|
+
countStartAt: countBadgeStartAt,
|
|
7403
|
+
totalCount: selectedItems.length,
|
|
7404
|
+
disabled: restProps.disabled
|
|
7405
|
+
}),
|
|
7406
|
+
/*#__PURE__*/ jsxs("div", {
|
|
7407
|
+
css: getInputWrapperStyles(),
|
|
7408
|
+
"data-slot": "input",
|
|
7409
|
+
children: [
|
|
7410
|
+
/*#__PURE__*/ jsx("input", {
|
|
7411
|
+
...mergeProps(inputProps, restProps, {
|
|
7412
|
+
onKeyDown: handleKeyDown
|
|
7413
|
+
}),
|
|
7414
|
+
onKeyDownCapture: handleKeyDownCapture,
|
|
7415
|
+
ref: setInputElRef,
|
|
7416
|
+
css: [
|
|
7417
|
+
getInputStyles(theme),
|
|
7418
|
+
{
|
|
7419
|
+
width: inputWidth
|
|
7420
|
+
}
|
|
7421
|
+
],
|
|
7422
|
+
placeholder: selectedItems.length ? undefined : placeholder
|
|
7423
|
+
}),
|
|
7424
|
+
/*#__PURE__*/ jsxs("span", {
|
|
7425
|
+
ref: measureRef,
|
|
7426
|
+
"aria-hidden": true,
|
|
7427
|
+
css: /*#__PURE__*/ css({
|
|
7428
|
+
visibility: 'hidden',
|
|
7429
|
+
whiteSpace: 'pre',
|
|
7430
|
+
position: 'absolute'
|
|
7431
|
+
}),
|
|
7432
|
+
children: [
|
|
7433
|
+
currentInputValue || placeholder,
|
|
7434
|
+
"\xa0"
|
|
7435
|
+
]
|
|
7436
|
+
})
|
|
7437
|
+
]
|
|
7438
|
+
})
|
|
7439
|
+
]
|
|
7440
|
+
})
|
|
7441
|
+
]
|
|
7442
|
+
})
|
|
7443
|
+
});
|
|
7444
|
+
if (showTooltip && selectedItems.length > 0) {
|
|
7445
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
7446
|
+
componentId: "typeahead-combobox-react-aria-multi-select-input-tooltip",
|
|
7447
|
+
side: "right",
|
|
7448
|
+
content: selectedItems.map((item)=>getSelectedItemLabel(item)).join(', '),
|
|
7449
|
+
children: content
|
|
7450
|
+
});
|
|
7451
|
+
}
|
|
7452
|
+
return content;
|
|
7453
|
+
};
|
|
7454
|
+
const TypeaheadComboboxMultiSelectInput = /*#__PURE__*/ forwardRef(TypeaheadComboboxMultiSelectInputInner);
|
|
7455
|
+
|
|
7456
|
+
const TypeaheadComboboxSectionHeader = ({ children, ...props })=>{
|
|
7457
|
+
const { isInsideTypeaheadCombobox } = useTypeaheadComboboxV2Context();
|
|
7458
|
+
if (!isInsideTypeaheadCombobox) {
|
|
7459
|
+
throw new Error('`TypeaheadComboboxSectionHeader` must be used within `TypeaheadComboboxMenu`');
|
|
7460
|
+
}
|
|
7461
|
+
// role="presentation" keeps the header out of the listbox's owned children (which must be only
|
|
7462
|
+
// options) now that menu children render as direct children of the <ul role="listbox">. The
|
|
7463
|
+
// header text stays exposed as static content. A consumer-supplied role still wins via {...props}.
|
|
7464
|
+
return /*#__PURE__*/ jsx(SectionHeader, {
|
|
7465
|
+
role: "presentation",
|
|
7466
|
+
...props,
|
|
7467
|
+
children: children
|
|
7468
|
+
});
|
|
7469
|
+
};
|
|
7470
|
+
|
|
7471
|
+
const TypeaheadComboboxSeparator = (props)=>{
|
|
7472
|
+
const { isInsideTypeaheadCombobox } = useTypeaheadComboboxV2Context();
|
|
7473
|
+
if (!isInsideTypeaheadCombobox) {
|
|
7474
|
+
throw new Error('`TypeaheadComboboxSeparator` must be used within `TypeaheadComboboxMenu`');
|
|
7475
|
+
}
|
|
7476
|
+
// role="presentation" keeps the decorative separator out of the listbox's owned children (which
|
|
7477
|
+
// must be only options) now that menu children render as direct children of the <ul role="listbox">.
|
|
7478
|
+
return /*#__PURE__*/ jsx(Separator, {
|
|
7479
|
+
role: "presentation",
|
|
7480
|
+
...props
|
|
7481
|
+
});
|
|
7482
|
+
};
|
|
7483
|
+
|
|
7484
|
+
const TypeaheadComboboxAddButton = /*#__PURE__*/ forwardRef(function TypeaheadComboboxAddButton({ children, componentId: componentIdProp, ...restProps }, forwardedRef) {
|
|
7485
|
+
const { theme } = useDesignSystemTheme();
|
|
7486
|
+
const { isInsideTypeaheadCombobox, componentId } = useTypeaheadComboboxV2Context();
|
|
7487
|
+
if (!isInsideTypeaheadCombobox) {
|
|
7488
|
+
throw new Error('`TypeaheadComboboxAddButton` must be used within `TypeaheadComboboxRoot`');
|
|
7489
|
+
}
|
|
7490
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
7491
|
+
...restProps,
|
|
7492
|
+
// oxlint-disable-next-line @databricks/no-dynamic-property-value -- Validated in the Root for the context exempt:ae0b57c6-871d-4375-a3ea-2574d7a3899e
|
|
7493
|
+
componentId: componentIdProp ?? `${componentId}.add_option`,
|
|
7494
|
+
type: "tertiary",
|
|
7495
|
+
onClick: (event)=>{
|
|
7496
|
+
event.stopPropagation();
|
|
7497
|
+
restProps.onClick?.(event);
|
|
7498
|
+
},
|
|
7499
|
+
onMouseUp: (event)=>{
|
|
7500
|
+
event.stopPropagation();
|
|
7501
|
+
restProps.onMouseUp?.(event);
|
|
7502
|
+
},
|
|
7503
|
+
className: "combobox-footer-add-button",
|
|
7504
|
+
css: /*#__PURE__*/ css({
|
|
7505
|
+
...getComboboxOptionItemWrapperStyles(theme),
|
|
7506
|
+
.../*#__PURE__*/ css(importantify({
|
|
7507
|
+
width: '100%',
|
|
7508
|
+
padding: 0,
|
|
7509
|
+
display: 'flex',
|
|
7510
|
+
alignItems: 'center',
|
|
7511
|
+
borderRadius: 0,
|
|
7512
|
+
// Keep the row-highlight background on focus, but do NOT suppress the outline: the DS
|
|
7513
|
+
// Button renders its `:focus-visible` ring (2px actionDefaultBorderFocus, offset -2px),
|
|
7514
|
+
// which is the keyboard focus indicator. The old `outline: 'none'` here dated from when
|
|
7515
|
+
// the footer button was mouse-only (never keyboard-focusable); now that focus can land
|
|
7516
|
+
// on it (footerFocusable), suppressing the ring is a WCAG 2.4.7 failure.
|
|
7517
|
+
'&:focus': {
|
|
7518
|
+
background: theme.colors.actionTertiaryBackgroundHover
|
|
7519
|
+
}
|
|
7520
|
+
}))
|
|
7521
|
+
}),
|
|
7522
|
+
icon: /*#__PURE__*/ jsx(PlusIcon, {}),
|
|
7523
|
+
ref: forwardedRef,
|
|
7524
|
+
children: children
|
|
7525
|
+
});
|
|
7526
|
+
});
|
|
7527
|
+
|
|
7528
|
+
/** JSON-encode a list of items by their display strings (the multi-select analytics value shape). */ const mapItemsToString$1 = (items, itemToString)=>{
|
|
7529
|
+
return JSON.stringify(items.map(itemToString));
|
|
7530
|
+
};
|
|
7531
|
+
/**
|
|
7532
|
+
* Item ↔ key/string mapping for the TypeaheadCombobox: resolves each item's display string and
|
|
7533
|
+
* key, wraps items for react-aria's collection, and builds the key/text lookup maps. Warns in dev
|
|
7534
|
+
* when two items collapse to the same key.
|
|
7535
|
+
*/ function useComboboxItems({ allItems, itemToString: itemToStringProp, getKey: getKeyProp }) {
|
|
7536
|
+
const itemToString = useCallback((item)=>{
|
|
7537
|
+
if (item === null || item === undefined) return '';
|
|
7538
|
+
return itemToStringProp ? itemToStringProp(item) : String(item);
|
|
7539
|
+
}, [
|
|
7540
|
+
itemToStringProp
|
|
7541
|
+
]);
|
|
7542
|
+
// Normalize keys to strings. react-aria's collection key comes from the `<Item key>` we render,
|
|
7543
|
+
// which React coerces to a string, so `state.selectedKey` (and the keys `useOption` looks up) are
|
|
7544
|
+
// always strings. A numeric `getKey` would otherwise leave `itemsByKey` / `disabledKeys` /
|
|
7545
|
+
// controlled `value` keyed by the raw number, so every string-vs-number comparison against the
|
|
7546
|
+
// collection would miss — breaking selection, option focus, and removal for numeric-id consumers.
|
|
7547
|
+
const getKey = useCallback((item)=>{
|
|
7548
|
+
if (getKeyProp) return String(getKeyProp(item));
|
|
7549
|
+
return itemToString(item);
|
|
7550
|
+
}, [
|
|
7551
|
+
getKeyProp,
|
|
7552
|
+
itemToString
|
|
7553
|
+
]);
|
|
7554
|
+
const wrappedItems = useMemo(()=>allItems.map((value)=>({
|
|
7555
|
+
id: getKey(value),
|
|
7556
|
+
value
|
|
7557
|
+
})), [
|
|
7558
|
+
allItems,
|
|
7559
|
+
getKey
|
|
7560
|
+
]);
|
|
7561
|
+
const itemsByKey = useMemo(()=>{
|
|
7562
|
+
const map = new Map();
|
|
7563
|
+
for (const w of wrappedItems){
|
|
7564
|
+
if (process.env.NODE_ENV !== 'production' && map.has(w.id)) {
|
|
7565
|
+
// eslint-disable-next-line no-console
|
|
7566
|
+
console.error(`[TypeaheadCombobox] Duplicate item key "${String(w.id)}". Items must map to unique keys; ` + 'pass a `getKey` that returns a unique value (the default falls back to `itemToString`, which ' + 'is colliding here). Items that share a key are dropped from selection and removal.');
|
|
7567
|
+
}
|
|
7568
|
+
map.set(w.id, w.value);
|
|
7569
|
+
}
|
|
7570
|
+
return map;
|
|
7571
|
+
}, [
|
|
7572
|
+
wrappedItems
|
|
7573
|
+
]);
|
|
7574
|
+
// textValue → all items with that display string, for the custom-matcher path (runs per item per
|
|
7575
|
+
// keystroke). Grouping (rather than first-wins) keeps distinct items that share a label matchable
|
|
7576
|
+
// on their own non-label fields — otherwise every duplicate after the first is filtered against
|
|
7577
|
+
// the first item's data.
|
|
7578
|
+
const itemsByTextValue = useMemo(()=>{
|
|
7579
|
+
const map = new Map();
|
|
7580
|
+
for (const w of wrappedItems){
|
|
7581
|
+
const key = itemToString(w.value);
|
|
7582
|
+
const group = map.get(key);
|
|
7583
|
+
if (group) group.push(w.value);
|
|
7584
|
+
else map.set(key, [
|
|
7585
|
+
w.value
|
|
7586
|
+
]);
|
|
7587
|
+
}
|
|
7588
|
+
return map;
|
|
7589
|
+
}, [
|
|
7590
|
+
wrappedItems,
|
|
7591
|
+
itemToString
|
|
7592
|
+
]);
|
|
7593
|
+
return {
|
|
7594
|
+
itemToString,
|
|
7595
|
+
getKey,
|
|
7596
|
+
wrappedItems,
|
|
7597
|
+
itemsByKey,
|
|
7598
|
+
itemsByTextValue
|
|
7599
|
+
};
|
|
7600
|
+
}
|
|
7601
|
+
|
|
7602
|
+
/**
|
|
7603
|
+
* Assembles the `ComboBoxStateOptions` passed to react-aria's `useComboBoxState`: the filter, the
|
|
7604
|
+
* disabled-keys set, the controlled/uncontrolled selection value, the initial (uncontrolled) input
|
|
7605
|
+
* text, and the selection/input/open change handlers (including analytics + multi-select
|
|
7606
|
+
* input-reset). Kept separate from `useComboboxState` so the wiring into react-aria is isolated
|
|
7607
|
+
* from the selection helpers the hook derives afterward.
|
|
7608
|
+
*/ function useComboboxStateProps({ items, multiSelect, matcher, isItemDisabled, allowNewValue, initialInputValue, initialSelectedItem, formValue, formOnChange, onStateChange, onIsOpenChange, externalSelectedItems, externalSetSelectedItems, stateRef, onValueChange }) {
|
|
7609
|
+
const { itemToString, getKey, wrappedItems, itemsByKey, itemsByTextValue } = items;
|
|
7610
|
+
// react-aria blocks selection of keys listed here (keyboard + pointer); the per-item `isDisabled`
|
|
7611
|
+
// prop only styles the row.
|
|
7612
|
+
const disabledKeys = useMemo(()=>isItemDisabled ? wrappedItems.filter((w)=>isItemDisabled(w.value)).map((w)=>w.id) : [], [
|
|
7613
|
+
isItemDisabled,
|
|
7614
|
+
wrappedItems
|
|
7615
|
+
]);
|
|
7616
|
+
const { contains } = useFilter({
|
|
7617
|
+
sensitivity: 'base'
|
|
7618
|
+
});
|
|
7619
|
+
const defaultFilter = useCallback((textValue, inputValue)=>{
|
|
7620
|
+
if (matcher) {
|
|
7621
|
+
const group = itemsByTextValue.get(textValue);
|
|
7622
|
+
// A label is shown if any item carrying it matches — items that share a display string are
|
|
7623
|
+
// indistinguishable to react-aria's filter (it only gets the string), so we can't route a
|
|
7624
|
+
// single row to a single item here.
|
|
7625
|
+
if (group !== undefined) {
|
|
7626
|
+
const lowerCasedInputValue = inputValue.toLocaleLowerCase();
|
|
7627
|
+
return group.some((item)=>matcher(item, lowerCasedInputValue));
|
|
7628
|
+
}
|
|
7629
|
+
return contains(textValue, inputValue);
|
|
7630
|
+
}
|
|
7631
|
+
return contains(textValue, inputValue);
|
|
7632
|
+
}, [
|
|
7633
|
+
matcher,
|
|
7634
|
+
itemsByTextValue,
|
|
7635
|
+
contains
|
|
7636
|
+
]);
|
|
7637
|
+
// A single-select consumer opts into controlling the selection by passing `formValue` +
|
|
7638
|
+
// `formOnChange`. Once controlled, "nothing selected" must stay controlled as `null` (not
|
|
7639
|
+
// `undefined`) — otherwise clearing the input, which react-aria turns into setValue(null), would
|
|
7640
|
+
// flip the selection value from controlled to uncontrolled (React warns, and clicks revert).
|
|
7641
|
+
const isControlledSingleSelect = !multiSelect && formOnChange !== undefined;
|
|
7642
|
+
const controlledValue = useMemo(()=>{
|
|
7643
|
+
if (externalSelectedItems !== null) return externalSelectedItems.map(getKey);
|
|
7644
|
+
if (formValue !== undefined) return getKey(formValue);
|
|
7645
|
+
return isControlledSingleSelect ? null : undefined;
|
|
7646
|
+
}, [
|
|
7647
|
+
externalSelectedItems,
|
|
7648
|
+
formValue,
|
|
7649
|
+
getKey,
|
|
7650
|
+
isControlledSingleSelect
|
|
7651
|
+
]);
|
|
7652
|
+
const handleSelectionChange = useCallback((newValue)=>{
|
|
7653
|
+
if (externalSetSelectedItems !== null) {
|
|
7654
|
+
const keys = newValue ?? [];
|
|
7655
|
+
const selected = keys.map((k)=>itemsByKey.get(k)).filter((x)=>x !== undefined);
|
|
7656
|
+
externalSetSelectedItems(selected);
|
|
7657
|
+
// Multi-select stays open after a pick; clear the search text so the menu resets to all items.
|
|
7658
|
+
stateRef.current?.setInputValue('');
|
|
7659
|
+
onValueChange?.(mapItemsToString$1(selected, itemToString));
|
|
7660
|
+
onStateChange?.({
|
|
7661
|
+
type: 'select',
|
|
7662
|
+
selectedItem: selected[selected.length - 1] ?? null,
|
|
7663
|
+
inputValue: ''
|
|
7664
|
+
});
|
|
7665
|
+
return;
|
|
7666
|
+
}
|
|
7667
|
+
const key = newValue;
|
|
7668
|
+
const item = key === null ? null : itemsByKey.get(key) ?? null;
|
|
7669
|
+
formOnChange?.(item);
|
|
7670
|
+
onValueChange?.(itemToString(item));
|
|
7671
|
+
onStateChange?.({
|
|
7672
|
+
type: 'select',
|
|
7673
|
+
selectedItem: item,
|
|
7674
|
+
inputValue: ''
|
|
7675
|
+
});
|
|
7676
|
+
}, [
|
|
7677
|
+
externalSetSelectedItems,
|
|
7678
|
+
itemsByKey,
|
|
7679
|
+
onValueChange,
|
|
7680
|
+
itemToString,
|
|
7681
|
+
formOnChange,
|
|
7682
|
+
onStateChange,
|
|
7683
|
+
stateRef
|
|
7684
|
+
]);
|
|
7685
|
+
// Seed the initial input text, then let react-aria manage it (show the selected item's text,
|
|
7686
|
+
// revert on blur, etc.). `defaultInputValue` is uncontrolled — we no longer mirror it in state.
|
|
7687
|
+
const defaultInputValue = useMemo(()=>{
|
|
7688
|
+
if (initialInputValue !== undefined) return initialInputValue;
|
|
7689
|
+
if (initialSelectedItem !== undefined) return itemToString(initialSelectedItem);
|
|
7690
|
+
if (formValue !== undefined) return itemToString(formValue);
|
|
7691
|
+
return undefined;
|
|
7692
|
+
}, [
|
|
7693
|
+
initialInputValue,
|
|
7694
|
+
initialSelectedItem,
|
|
7695
|
+
formValue,
|
|
7696
|
+
itemToString
|
|
7697
|
+
]);
|
|
7698
|
+
// `defaultItems` rather than `items`: react-aria skips `defaultFilter` when `items` is set
|
|
7699
|
+
// ("No default filter if items are controlled" — useComboBoxState.js:110).
|
|
7700
|
+
return {
|
|
7701
|
+
defaultItems: wrappedItems,
|
|
7702
|
+
defaultFilter,
|
|
7703
|
+
disabledKeys,
|
|
7704
|
+
allowsCustomValue: allowNewValue,
|
|
7705
|
+
defaultInputValue,
|
|
7706
|
+
defaultSelectedKey: initialSelectedItem !== undefined ? getKey(initialSelectedItem) : undefined,
|
|
7707
|
+
selectionMode: multiSelect ? 'multiple' : 'single',
|
|
7708
|
+
value: controlledValue,
|
|
7709
|
+
onChange: handleSelectionChange,
|
|
7710
|
+
children: (wrapped)=>/*#__PURE__*/ jsx(Item, {
|
|
7711
|
+
textValue: itemToString(wrapped.value),
|
|
7712
|
+
children: itemToString(wrapped.value)
|
|
7713
|
+
}, wrapped.id),
|
|
7714
|
+
onInputChange: (inputValue)=>{
|
|
7715
|
+
onStateChange?.({
|
|
7716
|
+
type: 'input',
|
|
7717
|
+
selectedItem: null,
|
|
7718
|
+
inputValue
|
|
7719
|
+
});
|
|
7720
|
+
},
|
|
7721
|
+
onOpenChange: (isOpen)=>{
|
|
7722
|
+
onIsOpenChange?.(isOpen);
|
|
7723
|
+
onStateChange?.({
|
|
7724
|
+
type: isOpen ? 'open' : 'close',
|
|
7725
|
+
selectedItem: null,
|
|
7726
|
+
inputValue: ''
|
|
7727
|
+
});
|
|
7728
|
+
},
|
|
7729
|
+
// Non-modal popovers rely on blur as their dismiss path (usePopover hard-codes
|
|
7730
|
+
// isDismissable=false when isNonModal=true), so we can't ever leave this off.
|
|
7731
|
+
shouldCloseOnBlur: true
|
|
7732
|
+
};
|
|
7733
|
+
}
|
|
7734
|
+
|
|
7735
|
+
/**
|
|
7736
|
+
* Keeps an option highlighted while the menu is open so Enter commits it, matching the original
|
|
7737
|
+
* downshift variant's `defaultHighlightedIndex: 0`. react-aria clears the focused key on every input
|
|
7738
|
+
* change (useComboBoxState: "Clear focused key when input value changes"), and its `commit()` only
|
|
7739
|
+
* selects when `focusedKey != null` — so without this, typing leaves nothing highlighted and Enter
|
|
7740
|
+
* falls through to commitValue(), selecting nothing.
|
|
7741
|
+
*
|
|
7742
|
+
* Only re-focuses when nothing is focused, so arrowing or hovering to another option sticks and we
|
|
7743
|
+
* merely restore the default after react-aria drops it. Keyed on the collection so it re-runs as
|
|
7744
|
+
* filtering narrows the list. Skipped when `allowNewValue`: there Enter commits the typed text, so
|
|
7745
|
+
* pre-highlighting an option would hijack it and select the option instead.
|
|
7746
|
+
*/ function useRestoreHighlightedOption(state, { allowNewValue, showAllOptionsOnOpen }) {
|
|
7747
|
+
const { collection, isOpen, selectionManager, disabledKeys } = state;
|
|
7748
|
+
const focusedKey = selectionManager.focusedKey;
|
|
7749
|
+
useEffect(()=>{
|
|
7750
|
+
if (allowNewValue || !isOpen || focusedKey != null) return;
|
|
7751
|
+
// Only restore the highlight while the combobox input itself holds DOM focus. With footerFocusable,
|
|
7752
|
+
// Tab moves focus onto a footer control and deliberately clears focusedKey so no stale
|
|
7753
|
+
// aria-activedescendant points at an option while focus sits on the footer button (WCAG 4.1.3).
|
|
7754
|
+
// Re-focusing the first option here would undo that. The input carries role="combobox", so this
|
|
7755
|
+
// cleanly excludes footer buttons, tag remove-buttons, etc.
|
|
7756
|
+
if (document.activeElement?.getAttribute('role') !== 'combobox') return;
|
|
7757
|
+
// On a show-all reopen the selected option is not necessarily first, so highlight it (not option 0)
|
|
7758
|
+
// — aria-activedescendant should land on the current selection. Only while the list is still
|
|
7759
|
+
// unfiltered though: the input then still shows the selection's label, so once the user types a query
|
|
7760
|
+
// (input diverges) react-stately filters and we highlight the first match for Enter, as usual.
|
|
7761
|
+
const selectedKey = state.selectedKey;
|
|
7762
|
+
const selectedNode = selectedKey != null ? collection.getItem(selectedKey) : null;
|
|
7763
|
+
const showingSelection = selectedNode != null && state.inputValue === selectedNode.textValue;
|
|
7764
|
+
let candidate = showAllOptionsOnOpen && showingSelection ? selectedKey : collection.getFirstKey();
|
|
7765
|
+
while(candidate != null && disabledKeys.has(candidate)){
|
|
7766
|
+
candidate = collection.getKeyAfter(candidate);
|
|
7767
|
+
}
|
|
7768
|
+
if (candidate == null) return;
|
|
7769
|
+
selectionManager.setFocusedKey(candidate);
|
|
7770
|
+
}, [
|
|
7771
|
+
allowNewValue,
|
|
7772
|
+
isOpen,
|
|
7773
|
+
focusedKey,
|
|
7774
|
+
collection,
|
|
7775
|
+
selectionManager,
|
|
7776
|
+
disabledKeys,
|
|
7777
|
+
showAllOptionsOnOpen,
|
|
7778
|
+
state.selectedKey,
|
|
7779
|
+
state.inputValue
|
|
7780
|
+
]);
|
|
7781
|
+
}
|
|
7782
|
+
|
|
7783
|
+
/**
|
|
7784
|
+
* Backs the Du Bois TypeaheadCombobox (react-aria variant) by wrapping react-aria's
|
|
7785
|
+
* `useComboBoxState`. Handles single- and multi-select modes, item↔key mapping, filtering
|
|
7786
|
+
* (default substring match or a custom `matcher`), selection helpers (`removeItem`,
|
|
7787
|
+
* `clearSelection`, `isSelected`), form `onChange`/`onBlur` bridging, and analytics wiring.
|
|
7788
|
+
* The returned object is what the `Root`/`Input`/`Menu` subtree consumes via context.
|
|
7789
|
+
*/ function useComboboxState(props) {
|
|
7790
|
+
const multiSelect = props.multiSelect === true;
|
|
7791
|
+
// Narrow the discriminated union once for stable typed refs in deps/callbacks.
|
|
7792
|
+
const externalSelectedItems = multiSelect && props.multiSelect ? props.selectedItems : null;
|
|
7793
|
+
const externalSetSelectedItems = multiSelect && props.multiSelect ? props.setSelectedItems : null;
|
|
7794
|
+
const { allItems, itemToString: itemToStringProp, getKey: getKeyProp, matcher, isItemDisabled, componentId, analyticsEvents, valueHasNoPii, initialInputValue, initialSelectedItem, formValue, formOnChange, formOnBlur, onStateChange, onIsOpenChange, allowNewValue = false, showAllOptionsOnOpen = false } = props;
|
|
7795
|
+
// `preventUnsetOnBlur` is accepted for source compatibility with the original API but is a
|
|
7796
|
+
// no-op: in react-aria, blur never clears the selection (only re-syncs input text), and
|
|
7797
|
+
// closing on blur is required for non-modal popover dismissal.
|
|
7798
|
+
const emitOnView = safex('databricks.fe.observability.defaultComponentView.typeaheadCombobox', false);
|
|
7799
|
+
const items = useComboboxItems({
|
|
7800
|
+
allItems,
|
|
7801
|
+
itemToString: itemToStringProp,
|
|
7802
|
+
getKey: getKeyProp
|
|
7803
|
+
});
|
|
7804
|
+
const { itemToString, getKey, itemsByKey } = items;
|
|
7805
|
+
const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents ? [
|
|
7806
|
+
...analyticsEvents
|
|
7807
|
+
] : emitOnView ? [
|
|
7808
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange,
|
|
7809
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnView
|
|
7810
|
+
] : [
|
|
7811
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange
|
|
7812
|
+
], [
|
|
7813
|
+
analyticsEvents,
|
|
7814
|
+
emitOnView
|
|
7815
|
+
]);
|
|
7816
|
+
const eventContext = useDesignSystemEventComponentCallbacks({
|
|
7817
|
+
componentType: DesignSystemEventProviderComponentTypes.TypeaheadCombobox,
|
|
7818
|
+
componentId,
|
|
7819
|
+
analyticsEvents: memoizedAnalyticsEvents,
|
|
7820
|
+
valueHasNoPii
|
|
7821
|
+
});
|
|
7822
|
+
// react-aria owns the input value. `stateRef` lets the selection handler clear the input in
|
|
7823
|
+
// multi-select mode without making inputValue a controlled prop.
|
|
7824
|
+
const stateRef = useRef(null);
|
|
7825
|
+
const stateOptions = useComboboxStateProps({
|
|
7826
|
+
items,
|
|
7827
|
+
multiSelect,
|
|
7828
|
+
matcher,
|
|
7829
|
+
isItemDisabled,
|
|
7830
|
+
allowNewValue,
|
|
7831
|
+
initialInputValue,
|
|
7832
|
+
initialSelectedItem,
|
|
7833
|
+
formValue,
|
|
7834
|
+
formOnChange,
|
|
7835
|
+
onStateChange,
|
|
7836
|
+
onIsOpenChange,
|
|
7837
|
+
externalSelectedItems,
|
|
7838
|
+
externalSetSelectedItems,
|
|
7839
|
+
stateRef,
|
|
7840
|
+
onValueChange: eventContext.onValueChange
|
|
7841
|
+
});
|
|
7842
|
+
const state = useComboBoxState(stateOptions);
|
|
7843
|
+
stateRef.current = state;
|
|
7844
|
+
useRestoreHighlightedOption(state, {
|
|
7845
|
+
allowNewValue,
|
|
7846
|
+
showAllOptionsOnOpen
|
|
7847
|
+
});
|
|
7848
|
+
const selectedKeys = useMemo(()=>{
|
|
7849
|
+
if (externalSelectedItems !== null) {
|
|
7850
|
+
const set = new Set();
|
|
7851
|
+
for (const it of externalSelectedItems)set.add(getKey(it));
|
|
7852
|
+
return set;
|
|
7853
|
+
}
|
|
7854
|
+
return state.selectedKey === null ? new Set() : new Set([
|
|
7855
|
+
state.selectedKey
|
|
7856
|
+
]);
|
|
7857
|
+
}, [
|
|
7858
|
+
externalSelectedItems,
|
|
7859
|
+
getKey,
|
|
7860
|
+
state.selectedKey
|
|
7861
|
+
]);
|
|
7862
|
+
const selectedItems = useMemo(()=>{
|
|
7863
|
+
if (externalSelectedItems !== null) return externalSelectedItems;
|
|
7864
|
+
if (state.selectedKey === null) return [];
|
|
7865
|
+
const item = itemsByKey.get(state.selectedKey);
|
|
7866
|
+
return item === undefined ? [] : [
|
|
7867
|
+
item
|
|
7868
|
+
];
|
|
7869
|
+
}, [
|
|
7870
|
+
externalSelectedItems,
|
|
7871
|
+
state.selectedKey,
|
|
7872
|
+
itemsByKey
|
|
7873
|
+
]);
|
|
7874
|
+
// Fire the consumer's formOnBlur on a *real* input blur, reading the committed selection at blur
|
|
7875
|
+
// time. react-aria has no blur-with-value callback, so Root wires this onto the input's onBlur
|
|
7876
|
+
// (guarded so focus moving within the widget — toggle/clear buttons — doesn't count as a blur).
|
|
7877
|
+
// Keying an effect on selectedKey instead — the previous approach — fired formOnBlur on every
|
|
7878
|
+
// selection commit/clear while the field still had focus, diverging from RHF touched/validation
|
|
7879
|
+
// semantics (DUBOIS-455). Multi-select never routed formOnBlur through the single-value path in
|
|
7880
|
+
// the original downshift variant, so it stays single-select-scoped here.
|
|
7881
|
+
const selectedItemsRef = useRef(selectedItems);
|
|
7882
|
+
selectedItemsRef.current = selectedItems;
|
|
7883
|
+
const onInputBlur = useCallback(()=>{
|
|
7884
|
+
if (multiSelect) return;
|
|
7885
|
+
if (allowNewValue) {
|
|
7886
|
+
// Free-text parity with the downshift variant: react-aria's selection handler only reports
|
|
7887
|
+
// matched options, so a typed custom value would otherwise never reach the form. On blur,
|
|
7888
|
+
// register the current input string as the form value (empty input → null). allowNewValue
|
|
7889
|
+
// implies T is a string, so the raw inputValue is a valid T.
|
|
7890
|
+
const custom = stateRef.current?.inputValue ? stateRef.current.inputValue : null;
|
|
7891
|
+
formOnChange?.(custom);
|
|
7892
|
+
formOnBlur?.(custom);
|
|
7893
|
+
return;
|
|
7894
|
+
}
|
|
7895
|
+
formOnBlur?.(selectedItemsRef.current[0] ?? null);
|
|
7896
|
+
}, [
|
|
7897
|
+
multiSelect,
|
|
7898
|
+
allowNewValue,
|
|
7899
|
+
formOnChange,
|
|
7900
|
+
formOnBlur
|
|
7901
|
+
]);
|
|
7902
|
+
// Unwrap state.collection (post-filter) back to T[] for consumers.
|
|
7903
|
+
const filteredItems = useMemo(()=>{
|
|
7904
|
+
const out = [];
|
|
7905
|
+
for (const node of state.collection){
|
|
7906
|
+
if (node.type === 'item' && node.value) out.push(node.value.value);
|
|
7907
|
+
}
|
|
7908
|
+
return out;
|
|
7909
|
+
}, [
|
|
7910
|
+
state.collection
|
|
7911
|
+
]);
|
|
7912
|
+
const removeByKey = useCallback((key)=>{
|
|
7913
|
+
// Normalize to a string so a consumer passing a raw numeric key still matches our string
|
|
7914
|
+
// keys (getKey stringifies; react-aria's collection keys are strings — see useComboboxItems).
|
|
7915
|
+
const normalizedKey = String(key);
|
|
7916
|
+
if (externalSelectedItems !== null && externalSetSelectedItems !== null) {
|
|
7917
|
+
const next = externalSelectedItems.filter((it)=>getKey(it) !== normalizedKey);
|
|
7918
|
+
if (next.length === externalSelectedItems.length) return;
|
|
7919
|
+
externalSetSelectedItems(next);
|
|
7920
|
+
eventContext.onValueChange?.(mapItemsToString$1(next, itemToString));
|
|
7921
|
+
return;
|
|
7922
|
+
}
|
|
7923
|
+
// Single-select: removing the active selection clears it.
|
|
7924
|
+
if (state.selectedKey === normalizedKey) {
|
|
7925
|
+
formOnChange?.(null);
|
|
7926
|
+
state.setSelectedKey(null);
|
|
7927
|
+
eventContext.onValueChange?.(itemToString(null));
|
|
7928
|
+
}
|
|
7929
|
+
}, [
|
|
7930
|
+
externalSelectedItems,
|
|
7931
|
+
externalSetSelectedItems,
|
|
7932
|
+
getKey,
|
|
7933
|
+
eventContext,
|
|
7934
|
+
itemToString,
|
|
7935
|
+
state,
|
|
7936
|
+
formOnChange
|
|
7937
|
+
]);
|
|
7938
|
+
const removeItem = useCallback((item)=>removeByKey(getKey(item)), [
|
|
7939
|
+
removeByKey,
|
|
7940
|
+
getKey
|
|
7941
|
+
]);
|
|
7942
|
+
const clearSelection = useCallback(()=>{
|
|
7943
|
+
if (externalSetSelectedItems !== null) {
|
|
7944
|
+
externalSetSelectedItems([]);
|
|
7945
|
+
eventContext.onValueChange?.('[]');
|
|
7946
|
+
return;
|
|
7947
|
+
}
|
|
7948
|
+
formOnChange?.(null);
|
|
7949
|
+
state.setInputValue('');
|
|
7950
|
+
state.setSelectedKey(null);
|
|
7951
|
+
}, [
|
|
7952
|
+
externalSetSelectedItems,
|
|
7953
|
+
eventContext,
|
|
7954
|
+
formOnChange,
|
|
7955
|
+
state
|
|
7956
|
+
]);
|
|
7957
|
+
const isSelected = useCallback((item)=>selectedKeys.has(getKey(item)), [
|
|
7958
|
+
selectedKeys,
|
|
7959
|
+
getKey
|
|
7960
|
+
]);
|
|
7961
|
+
const firstOnViewValue = useMemo(()=>{
|
|
7962
|
+
if (externalSelectedItems !== null) return mapItemsToString$1(externalSelectedItems, itemToString);
|
|
7963
|
+
return itemToString(initialSelectedItem ?? null);
|
|
7964
|
+
}, [
|
|
7965
|
+
externalSelectedItems,
|
|
7966
|
+
initialSelectedItem,
|
|
7967
|
+
itemToString
|
|
7968
|
+
]);
|
|
7969
|
+
return {
|
|
7970
|
+
state,
|
|
7971
|
+
itemsByKey,
|
|
7972
|
+
getKeyForItem: getKey,
|
|
7973
|
+
itemToString,
|
|
7974
|
+
selectedItems,
|
|
7975
|
+
selectedKeys,
|
|
7976
|
+
filteredItems,
|
|
7977
|
+
removeItem,
|
|
7978
|
+
removeByKey,
|
|
7979
|
+
clearSelection,
|
|
7980
|
+
isSelected,
|
|
7981
|
+
onInputBlur,
|
|
7982
|
+
componentId,
|
|
7983
|
+
analyticsEvents: memoizedAnalyticsEvents,
|
|
7984
|
+
valueHasNoPii,
|
|
7985
|
+
onView: eventContext.onView,
|
|
7986
|
+
firstOnViewValue,
|
|
7987
|
+
multiSelect,
|
|
7988
|
+
showAllOptionsOnOpen
|
|
7989
|
+
};
|
|
7990
|
+
}
|
|
7991
|
+
|
|
7992
|
+
const mapItemsToString = (items, itemToString)=>{
|
|
7993
|
+
return JSON.stringify(items.map(itemToString));
|
|
7994
|
+
};
|
|
7995
|
+
/**
|
|
7996
|
+
* Companion hook to `useComboboxState` in multi-select mode. Returns chip-management helpers
|
|
7997
|
+
* keyed off the consumer-owned `selectedItems` array, plus analytics wiring. Mostly redundant —
|
|
7998
|
+
* the state hook already exposes `removeItem`/`removeByKey`/`clearSelection` — but kept for API
|
|
7999
|
+
* parity with the original.
|
|
8000
|
+
*/ function useMultipleSelectionState(selectedItems, setSelectedItems, { componentId, analyticsEvents, valueHasNoPii, itemToString, getKey }) {
|
|
8001
|
+
const toString = useCallback((item)=>item === null || item === undefined ? '' : itemToString ? itemToString(item) : String(item), [
|
|
8002
|
+
itemToString
|
|
8003
|
+
]);
|
|
8004
|
+
const keyFor = useCallback((item)=>getKey ? getKey(item) : toString(item), [
|
|
8005
|
+
getKey,
|
|
8006
|
+
toString
|
|
8007
|
+
]);
|
|
8008
|
+
const memoizedAnalyticsEvents = useMemo(()=>analyticsEvents ?? [
|
|
8009
|
+
DesignSystemEventProviderAnalyticsEventTypes.OnValueChange
|
|
8010
|
+
], [
|
|
8011
|
+
analyticsEvents
|
|
8012
|
+
]);
|
|
8013
|
+
const eventContext = useDesignSystemEventComponentCallbacks({
|
|
8014
|
+
componentType: DesignSystemEventProviderComponentTypes.TypeaheadCombobox,
|
|
8015
|
+
componentId,
|
|
8016
|
+
analyticsEvents: memoizedAnalyticsEvents,
|
|
8017
|
+
valueHasNoPii
|
|
8018
|
+
});
|
|
8019
|
+
const selectedKeys = useMemo(()=>{
|
|
8020
|
+
const set = new Set();
|
|
8021
|
+
for (const item of selectedItems)set.add(keyFor(item));
|
|
8022
|
+
return set;
|
|
8023
|
+
}, [
|
|
8024
|
+
selectedItems,
|
|
8025
|
+
keyFor
|
|
8026
|
+
]);
|
|
8027
|
+
const addItem = useCallback((item)=>{
|
|
8028
|
+
const k = keyFor(item);
|
|
8029
|
+
if (selectedKeys.has(k)) return;
|
|
8030
|
+
const next = [
|
|
8031
|
+
...selectedItems,
|
|
8032
|
+
item
|
|
8033
|
+
];
|
|
8034
|
+
setSelectedItems(next);
|
|
8035
|
+
eventContext.onValueChange?.(mapItemsToString(next, toString));
|
|
8036
|
+
}, [
|
|
8037
|
+
keyFor,
|
|
8038
|
+
selectedKeys,
|
|
8039
|
+
selectedItems,
|
|
8040
|
+
setSelectedItems,
|
|
8041
|
+
eventContext,
|
|
8042
|
+
toString
|
|
8043
|
+
]);
|
|
8044
|
+
const removeByKey = useCallback((key)=>{
|
|
8045
|
+
const next = selectedItems.filter((item)=>keyFor(item) !== key);
|
|
8046
|
+
if (next.length === selectedItems.length) return;
|
|
8047
|
+
setSelectedItems(next);
|
|
8048
|
+
eventContext.onValueChange?.(mapItemsToString(next, toString));
|
|
8049
|
+
}, [
|
|
8050
|
+
selectedItems,
|
|
8051
|
+
setSelectedItems,
|
|
8052
|
+
keyFor,
|
|
8053
|
+
eventContext,
|
|
8054
|
+
toString
|
|
8055
|
+
]);
|
|
8056
|
+
const removeItem = useCallback((item)=>removeByKey(keyFor(item)), [
|
|
8057
|
+
removeByKey,
|
|
8058
|
+
keyFor
|
|
8059
|
+
]);
|
|
8060
|
+
const clear = useCallback(()=>{
|
|
8061
|
+
setSelectedItems([]);
|
|
8062
|
+
eventContext.onValueChange?.('[]');
|
|
8063
|
+
}, [
|
|
8064
|
+
setSelectedItems,
|
|
8065
|
+
eventContext
|
|
8066
|
+
]);
|
|
8067
|
+
const isSelected = useCallback((item)=>selectedKeys.has(keyFor(item)), [
|
|
8068
|
+
selectedKeys,
|
|
8069
|
+
keyFor
|
|
8070
|
+
]);
|
|
8071
|
+
return {
|
|
8072
|
+
selectedItems,
|
|
8073
|
+
selectedKeys,
|
|
8074
|
+
addItem,
|
|
8075
|
+
removeItem,
|
|
8076
|
+
removeByKey,
|
|
8077
|
+
clear,
|
|
8078
|
+
isSelected
|
|
8079
|
+
};
|
|
8080
|
+
}
|
|
8081
|
+
|
|
8082
|
+
/**
|
|
8083
|
+
* Scrolls the virtually-focused option into view when it is NOT currently rendered. Under
|
|
8084
|
+
* virtualization only a window of options is in the DOM, so react-aria's own scroll-into-view (and
|
|
8085
|
+
* our per-item `useScrollOptionIntoView`) can't reach an option that hasn't mounted — arrowing past
|
|
8086
|
+
* the rendered window would otherwise appear to do nothing. This bridges react-aria's
|
|
8087
|
+
* `selectionManager.focusedKey` to the consumer's virtualizer so the row mounts and scrolls in.
|
|
8088
|
+
*
|
|
8089
|
+
* Consumer-invoked (the consumer owns the virtualizer instance).
|
|
8090
|
+
*
|
|
8091
|
+
* The effect keys ONLY on `focusedKey`/`isOpen` — i.e. it runs when the *active option* changes,
|
|
8092
|
+
* not on every render. This is essential: `useVirtual` returns a new `virtualizer` object on every
|
|
8093
|
+
* render and re-renders on every scroll frame, so depending on it would re-fire `scrollToIndex` on
|
|
8094
|
+
* each scroll tick and fight the user's scrollbar drag. The mutable inputs are read through a ref
|
|
8095
|
+
* instead. Hovering an option also moves `focusedKey`, but a hovered option is by definition already
|
|
8096
|
+
* rendered/visible, so `scrollToIndex` (align "auto") is a no-op for it.
|
|
8097
|
+
*/ function useVirtualizedComboboxScroll({ state, filteredItems, getKey, virtualizer }) {
|
|
8098
|
+
const focusedKey = state.selectionManager.focusedKey;
|
|
8099
|
+
const isOpen = state.isOpen;
|
|
8100
|
+
// Latest mutable inputs, read inside the effect without adding them as deps (they change identity
|
|
8101
|
+
// every render / scroll frame).
|
|
8102
|
+
const latest = useRef({
|
|
8103
|
+
filteredItems,
|
|
8104
|
+
getKey,
|
|
8105
|
+
virtualizer
|
|
8106
|
+
});
|
|
8107
|
+
latest.current = {
|
|
8108
|
+
filteredItems,
|
|
8109
|
+
getKey,
|
|
8110
|
+
virtualizer
|
|
8111
|
+
};
|
|
8112
|
+
useEffect(()=>{
|
|
8113
|
+
if (!isOpen || focusedKey == null) return;
|
|
8114
|
+
const { filteredItems: items, getKey: key, virtualizer: v } = latest.current;
|
|
8115
|
+
const index = items.findIndex((item)=>key(item) === focusedKey);
|
|
8116
|
+
if (index < 0) return;
|
|
8117
|
+
// Defer one frame so the collection re-render + virtualizer measurement settle before we scroll.
|
|
8118
|
+
const raf = requestAnimationFrame(()=>v.scrollToIndex(index));
|
|
8119
|
+
return ()=>cancelAnimationFrame(raf);
|
|
8120
|
+
}, [
|
|
8121
|
+
focusedKey,
|
|
8122
|
+
isOpen
|
|
8123
|
+
]);
|
|
8124
|
+
}
|
|
8125
|
+
|
|
8126
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
8127
|
+
__proto__: null,
|
|
8128
|
+
TypeaheadComboboxAddButton: TypeaheadComboboxAddButton,
|
|
8129
|
+
TypeaheadComboboxCheckboxItem: TypeaheadComboboxCheckboxItem,
|
|
8130
|
+
TypeaheadComboboxFooter: TypeaheadComboboxFooter,
|
|
8131
|
+
TypeaheadComboboxInput: TypeaheadComboboxInput,
|
|
8132
|
+
TypeaheadComboboxMenu: TypeaheadComboboxMenu,
|
|
8133
|
+
TypeaheadComboboxMenuItem: TypeaheadComboboxMenuItem,
|
|
8134
|
+
TypeaheadComboboxMultiSelectInput: TypeaheadComboboxMultiSelectInput,
|
|
8135
|
+
TypeaheadComboboxRoot: TypeaheadComboboxRoot,
|
|
8136
|
+
TypeaheadComboboxSectionHeader: TypeaheadComboboxSectionHeader,
|
|
8137
|
+
TypeaheadComboboxSelectedItem: TypeaheadComboboxSelectedItem$1,
|
|
8138
|
+
TypeaheadComboboxSeparator: TypeaheadComboboxSeparator,
|
|
8139
|
+
TypeaheadComboboxToggleButton: TypeaheadComboboxToggleButton,
|
|
8140
|
+
useComboboxState: useComboboxState,
|
|
8141
|
+
useMultipleSelectionState: useMultipleSelectionState,
|
|
8142
|
+
useTypeaheadComboboxV2Context: useTypeaheadComboboxV2Context,
|
|
8143
|
+
useVirtualizedComboboxScroll: useVirtualizedComboboxScroll
|
|
8144
|
+
});
|
|
8145
|
+
|
|
6423
8146
|
// Single source of truth for the DM Sans font-family stack used by Databricks One surfaces
|
|
6424
8147
|
// (webapp DatabricksOneRouter, accounts-ui DatabricksOneWrapper). Co-located with the vendored
|
|
6425
8148
|
// font CSS under `@databricks/design-system/fonts/dm-sans.css` so consumers can import both
|
|
6426
8149
|
// from the design-system without duplicating the fallback chain.
|
|
6427
8150
|
const DM_SANS_FONT_FAMILY = "'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif";
|
|
8151
|
+
// Monospace counterpart to DM_SANS_FONT_FAMILY, vendored under
|
|
8152
|
+
// `@databricks/design-system/fonts/dm-mono.css`. Falls back to the platform monospace stack so
|
|
8153
|
+
// code and other tabular text keep a fixed-width face if the web font fails to load.
|
|
8154
|
+
const DM_MONO_FONT_FAMILY = "'DM Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace";
|
|
6428
8155
|
|
|
6429
|
-
export { AccessibleContainer, Alert, ApplyGlobalStyles, AssistantAvatar, AutoComplete, Avatar, AvatarGroup, Breadcrumb, Button, Card, CheckCircleFillIcon, CheckCircleIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, CircleIcon, CircleOffIcon, CircleOutlineIcon, CloseIcon, CloseSmallIcon, Col, DBAssistantAvatar, DM_SANS_FONT_FAMILY, DU_BOIS_ENABLE_ANIMATION_CLASSNAME, DangerFillIcon, DangerIcon, DesignSystemAntDConfigProvider, DesignSystemEventProvider, DesignSystemEventProviderAnalyticsEventTypes, DesignSystemEventProviderComponentSubTypeMap, DesignSystemEventProviderComponentTypes, DesignSystemEventSuppressInteractionProviderContext, DesignSystemEventSuppressInteractionTrueContextValue, DialogCombobox, DialogComboboxAddButton, DialogComboboxContent, EmptyResults as DialogComboboxEmpty, DialogComboboxFooter, DialogComboboxHintRow, DialogComboboxOptionControlledList, DialogComboboxOptionList, DialogComboboxOptionListCheckboxItem, DialogComboboxOptionListSearch, DialogComboboxOptionListSelectItem, DialogComboboxSeparator, DialogComboboxTrigger, Dropdown, DuboisDatePicker, FormUI, GenericSkeleton, Header, HoverCard, InfoFillIcon, InfoPopover, InfoSmallIcon, Input, LegacyDatePicker,
|
|
8156
|
+
export { AccessibleContainer, Alert, ApplyGlobalStyles, AssistantAvatar, AutoComplete, Avatar, AvatarGroup, Breadcrumb, Button, Card, CheckCircleFillIcon, CheckCircleIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, CircleIcon, CircleOffIcon, CircleOutlineIcon, CloseIcon, CloseSmallIcon, Col, DBAssistantAvatar, DM_MONO_FONT_FAMILY, DM_SANS_FONT_FAMILY, DU_BOIS_ENABLE_ANIMATION_CLASSNAME, DangerFillIcon, DangerIcon, DesignSystemAntDConfigProvider, DesignSystemEventProvider, DesignSystemEventProviderAnalyticsEventTypes, DesignSystemEventProviderComponentSubTypeMap, DesignSystemEventProviderComponentTypes, DesignSystemEventSuppressInteractionProviderContext, DesignSystemEventSuppressInteractionTrueContextValue, DialogCombobox, DialogComboboxAddButton, DialogComboboxContent, EmptyResults as DialogComboboxEmpty, DialogComboboxFooter, DialogComboboxHintRow, DialogComboboxOptionControlledList, DialogComboboxOptionList, DialogComboboxOptionListCheckboxItem, DialogComboboxOptionListSearch, DialogComboboxOptionListSelectItem, DialogComboboxSeparator, DialogComboboxTrigger, Dropdown, DuboisDatePicker, FormUI, GenericSkeleton, Header, HoverCard, InfoFillIcon, InfoPopover, InfoSmallIcon, InfoTooltip, Input, LegacyDatePicker, LegacyPopover, LegacySelect, LegacySkeleton, LoadingState, Menu, MinusSquareIcon, Modal, Notification, OverflowPopover, PageWrapper, ParagraphSkeleton, PlusIcon, PlusSquareIcon, RHFControlledComponents, ROW_GUTTER_SIZE, Radio, ResourceStatusIndicator, RestoreAntDDefaultClsPrefix, Row, SearchIcon, Select, SelectContent, SelectOption, SelectTrigger, ShapeTokens, SnackBar, SortAscendingIcon, SortDescendingIcon, SortUnsortedIcon, Space, SparkleDoubleIcon, Steps, Switch, Table, TableCell, TableContext, TableFilterInput, TableFilterLayout, TableHeader, TableRow, TableRowAction, TableRowActionHeader, TableRowContext, TableRowMenuContainer, TableRowMultiAction, TableRowSelectCell, TableSkeleton, TableSkeletonRows, TitleSkeleton, Tooltip, TreeGrid, TruncationTooltip, TypeaheadComboboxAddButton$1 as TypeaheadComboboxAddButton, TypeaheadComboboxInput$1 as TypeaheadComboboxInput, TypeaheadComboboxMenu$1 as TypeaheadComboboxMenu, TypeaheadComboboxMultiSelectInput$1 as TypeaheadComboboxMultiSelectInput, TypeaheadComboboxRoot$1 as TypeaheadComboboxRoot, TypeaheadComboboxSectionHeader$1 as TypeaheadComboboxSectionHeader, TypeaheadComboboxSelectedItem, TypeaheadComboboxSeparator$1 as TypeaheadComboboxSeparator, TypeaheadComboboxToggleButton$1 as TypeaheadComboboxToggleButton, index as TypeaheadComboboxV2, Typography, WarningFillIcon, WarningIcon, consumerDarkColorList, consumerLightColorList, findClosestOptionSibling, findHighlightedOption, flushFastdomForTesting, getAnimationCss, getComboboxOptionItemWrapperStyles, getContentOptions, getDarkModePortalStyles, getGlobalResetStyles, getGlobalStyles, getSwitchWithLabelStyles, getValidationStateColor, hideIconButtonRowStyles, highlightOption, importantify, isSafeRelativeUrl, isSafeUrl, measure, sanitizeNextUrl, setupDesignSystemEventProviderForTesting, snackBarManager, update, useComboboxState$1 as useComboboxState, useDefaultTreeGridState, useDesignSystemEventComponentCallbacks, useDesignSystemFlags, useDesignSystemTheme, useDesignTokenOverrideStyles, useDuboisThemeClass, useFastDom, useLegacyNotification, useModalContext, useMultipleSelectionState$1 as useMultipleSelectionState, useNotifyOnFirstView, useRadixModalContext, useSnackBar, useThemedStyles, useTypeaheadComboboxContext, visuallyHidden, withNotifications };
|
|
6430
8157
|
//# sourceMappingURL=index.js.map
|