twenty-ui 2.50.0 → 2.51.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.
Files changed (215) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +36 -32
  3. package/dist/{AllIcons-Cyd7721G.cjs → AllIcons-1tBWXXrE.cjs} +1 -1
  4. package/dist/{AllIcons-D132B8_i.js → AllIcons-ayl8BCtV.js} +1 -1
  5. package/dist/Dropdown-D_hFndP5.cjs +1 -0
  6. package/dist/Dropdown-xXsGBv57.js +1056 -0
  7. package/dist/Input-D1sIHUZ5.js +25 -0
  8. package/dist/Input-D69M4UwD.cjs +1 -0
  9. package/dist/ListItem-B-SFWJZb.cjs +1 -0
  10. package/dist/ListItem-WLONJMo5.js +91 -0
  11. package/dist/ListItem.module-B31VK9XZ.js +34 -0
  12. package/dist/ListItem.module-DiUK6-0Z.cjs +1 -0
  13. package/dist/OverflowingTextWithTooltip-ClpPsdpP.cjs +1 -0
  14. package/dist/OverflowingTextWithTooltip-D4eZc-7P.js +96 -0
  15. package/dist/ProgressBar-8pjpGrmZ.js +99 -0
  16. package/dist/ProgressBar-goqxS9NE.cjs +1 -0
  17. package/dist/Radio-CpQPRHXa.cjs +1 -0
  18. package/dist/Radio-VTjpEz8M.js +175 -0
  19. package/dist/Skeleton-BbIF780H.js +31 -0
  20. package/dist/Skeleton-tXeIy4qq.cjs +1 -0
  21. package/dist/TablerIcons-B-5Ua_Ne.js +460 -0
  22. package/dist/{Tooltip-DL3sfbuw.cjs → Tooltip-08dDawT_.cjs} +1 -1
  23. package/dist/components/data-display/DetailsRow/DetailsRow.d.ts +2 -0
  24. package/dist/components/data-display/DetailsRow/types/DetailsRowProps.d.ts +9 -0
  25. package/dist/components/data-display/index.d.ts +2 -0
  26. package/dist/components/data-display.cjs +1 -1
  27. package/dist/components/data-display.mjs +9 -8
  28. package/dist/components/feedback/InlineBanner/types/InlineBannerProps.d.ts +1 -1
  29. package/dist/components/feedback.cjs +1 -1
  30. package/dist/components/feedback.mjs +1 -1
  31. package/dist/components/input/DatePicker/DatePicker.d.ts +2 -0
  32. package/dist/components/input/DatePicker/__stories__/DatePickerCssVariableThemeExample.d.ts +1 -0
  33. package/dist/components/input/DatePicker/__stories__/DatePickerExample.d.ts +5 -0
  34. package/dist/components/input/DatePicker/__stories__/DatePickerExternalMonthExample.d.ts +4 -0
  35. package/dist/components/input/DatePicker/__stories__/DatePickerNavigationUnmountExample.d.ts +2 -0
  36. package/dist/components/input/DatePicker/__stories__/datePickerWeekdayLabels.d.ts +1 -0
  37. package/dist/components/input/DatePicker/internal/DatePickerException.d.ts +5 -0
  38. package/dist/components/input/DatePicker/internal/DatePickerHeader.d.ts +3 -0
  39. package/dist/components/input/DatePicker/internal/DatePickerSelect.d.ts +15 -0
  40. package/dist/components/input/DatePicker/internal/DatePickerSelectLifecycleEffect.d.ts +7 -0
  41. package/dist/components/input/DatePicker/internal/DatePickerViewedMonthEffect.d.ts +9 -0
  42. package/dist/components/input/DatePicker/internal/ReactDatePickerLibrary.d.ts +2 -0
  43. package/dist/components/input/DatePicker/internal/datePickerConstants.d.ts +6 -0
  44. package/dist/components/input/DatePicker/internal/formatDatePickerLocalDate.d.ts +1 -0
  45. package/dist/components/input/DatePicker/internal/parseDatePickerDateOrThrow.d.ts +1 -0
  46. package/dist/components/input/DatePicker/internal/parseDatePickerLocalDateOrThrow.d.ts +1 -0
  47. package/dist/components/input/DatePicker/internal/validateDatePickerHighlightedRangeOrThrow.d.ts +4 -0
  48. package/dist/components/input/DatePicker/types/DatePickerHeaderProps.d.ts +9 -0
  49. package/dist/components/input/DatePicker/types/DatePickerProps.d.ts +42 -0
  50. package/dist/components/input/EmojiPicker/EmojiPicker.d.ts +2 -0
  51. package/dist/components/input/EmojiPicker/__stories__/EmojiPickerExample.d.ts +4 -0
  52. package/dist/components/input/EmojiPicker/__stories__/emojiPickerStoryData.d.ts +30 -0
  53. package/dist/components/input/EmojiPicker/__stories__/emojiPickerStoryEmojibaseUrl.d.ts +1 -0
  54. package/dist/components/input/EmojiPicker/__stories__/mockEmojiPickerStoryData.d.ts +5 -0
  55. package/dist/components/input/EmojiPicker/internal/EmojiPickerEmoji.d.ts +2 -0
  56. package/dist/components/input/EmojiPicker/internal/EmojiPickerRow.d.ts +2 -0
  57. package/dist/components/input/EmojiPicker/internal/EmojiPickerScrollEffect.d.ts +6 -0
  58. package/dist/components/input/EmojiPicker/internal/scrollActiveEmojiIntoView.d.ts +1 -0
  59. package/dist/components/input/EmojiPicker/types/EmojiPickerProps.d.ts +11 -0
  60. package/dist/components/input/FormFieldRow/FormFieldRow.d.ts +2 -0
  61. package/dist/components/input/FormFieldRow/types/FormFieldRowProps.d.ts +12 -0
  62. package/dist/components/input/ReactionButton/ReactionButton.d.ts +2 -0
  63. package/dist/components/input/ReactionButton/__stories__/ReactionButtonExample.d.ts +2 -0
  64. package/dist/components/input/ReactionButton/types/ReactionButtonProps.d.ts +14 -0
  65. package/dist/components/input/SearchInput/SearchInput.d.ts +1 -1
  66. package/dist/components/input/SearchInput/types/SearchInputProps.d.ts +1 -1
  67. package/dist/components/input/SegmentedControl/SegmentedControl.d.ts +1 -1
  68. package/dist/components/input/SegmentedControl/types/SegmentedControlProps.d.ts +2 -0
  69. package/dist/components/input/SegmentedControl/types/SegmentedControlVariant.d.ts +1 -0
  70. package/dist/components/input/index.d.ts +10 -0
  71. package/dist/components/input.cjs +1 -1
  72. package/dist/components/input.mjs +17 -13
  73. package/dist/components/layout/LabeledSeparator/LabeledSeparator.d.ts +2 -0
  74. package/dist/components/layout/LabeledSeparator/types/LabeledSeparatorProps.d.ts +7 -0
  75. package/dist/components/layout/index.d.ts +2 -0
  76. package/dist/components/layout.cjs +1 -1
  77. package/dist/components/layout.mjs +5 -4
  78. package/dist/components/navigation/CountPager/CountPager.d.ts +2 -0
  79. package/dist/components/navigation/CountPager/__stories__/CountPagerCollectionExample.d.ts +3 -0
  80. package/dist/components/navigation/CountPager/__stories__/CountPagerExample.d.ts +2 -0
  81. package/dist/components/navigation/CountPager/types/CountPagerProps.d.ts +11 -0
  82. package/dist/components/navigation/Dropdown/Dropdown.d.ts +4 -4
  83. package/dist/components/navigation/Dropdown/__stories__/DropdownControlledPageSessionExample.d.ts +1 -0
  84. package/dist/components/navigation/Dropdown/__stories__/DropdownNestedPageSessionExample.d.ts +6 -0
  85. package/dist/components/navigation/Dropdown/__stories__/DropdownPageActivityExample.d.ts +1 -0
  86. package/dist/components/navigation/Dropdown/__stories__/DropdownPageSessionExample.d.ts +5 -0
  87. package/dist/components/navigation/Dropdown/__stories__/DropdownPickerPageSessionExample.d.ts +1 -0
  88. package/dist/components/navigation/Dropdown/hooks/useDropdownPage.d.ts +1 -0
  89. package/dist/components/navigation/Dropdown/internal/DropdownContent.d.ts +1 -1
  90. package/dist/components/navigation/Dropdown/internal/DropdownContextValue.d.ts +3 -0
  91. package/dist/components/navigation/Dropdown/internal/DropdownEmpty.d.ts +1 -1
  92. package/dist/components/navigation/Dropdown/internal/DropdownLoading.d.ts +1 -1
  93. package/dist/components/navigation/Dropdown/internal/DropdownPageEffect.d.ts +8 -0
  94. package/dist/components/navigation/Dropdown/internal/DropdownSearch.d.ts +1 -1
  95. package/dist/components/navigation/Dropdown/internal/isActiveDropdownElement.d.ts +1 -0
  96. package/dist/components/navigation/Dropdown/types/DropdownSearchProps.d.ts +1 -1
  97. package/dist/components/navigation/ListItemButton/ListItemButton.d.ts +1 -1
  98. package/dist/components/navigation/ListItemButton/types/ListItemButtonProps.d.ts +1 -1
  99. package/dist/components/navigation/index.d.ts +2 -0
  100. package/dist/components/navigation.cjs +1 -1
  101. package/dist/components/navigation.mjs +7 -6
  102. package/dist/components/settings.cjs +1 -1
  103. package/dist/components/settings.mjs +1 -1
  104. package/dist/components.cjs +1 -1
  105. package/dist/components.mjs +44 -37
  106. package/dist/{data-display-CXw-mxeS.js → data-display-DUMj_z1t.js} +25 -25
  107. package/dist/data-display-D_kbXJJd.cjs +2 -0
  108. package/dist/{data-display-DdES9XqZ.cjs → data-display-DzHM5j7j.cjs} +1 -1
  109. package/dist/data-display-b-9s0RTe.js +422 -0
  110. package/dist/feedback-B50I0C35.cjs +1 -0
  111. package/dist/feedback-BQFSnMjh.js +10 -0
  112. package/dist/{feedback-DspXawf9.cjs → feedback-BzR4ggrP.cjs} +1 -1
  113. package/dist/{feedback-4HKPcMRs.js → feedback-EaZszoXf.js} +29 -29
  114. package/dist/icon/components/TablerIcons.d.ts +1 -1
  115. package/dist/icon/constants/TwentyIconDictionary.d.ts +9 -0
  116. package/dist/icon/index.d.ts +1 -1
  117. package/dist/{icon-CUE-QGQK.js → icon-ICz2_dVB.js} +550 -944
  118. package/dist/icon-TSBamkxk.cjs +1 -0
  119. package/dist/icon.cjs +1 -1
  120. package/dist/icon.mjs +510 -504
  121. package/dist/index.cjs +1 -1
  122. package/dist/index.mjs +666 -652
  123. package/dist/input-BQABEELu.cjs +1 -0
  124. package/dist/input-CuySKbhm.js +2356 -0
  125. package/dist/input-DxoXgI5-.js +373 -0
  126. package/dist/input-ExCbk62Y.cjs +1 -0
  127. package/dist/layout-B1Iwc9ku.cjs +1 -0
  128. package/dist/layout-B2KvJ900.js +479 -0
  129. package/dist/navigation-DP5Edsq_.cjs +1 -0
  130. package/dist/navigation-DXMjQMPm.js +134 -0
  131. package/dist/primitives/data-display.cjs +1 -1
  132. package/dist/primitives/data-display.mjs +1 -1
  133. package/dist/primitives/feedback/Banner/Banner.d.ts +1 -1
  134. package/dist/primitives/feedback/Banner/internal/BannerComponent.d.ts +1 -1
  135. package/dist/primitives/feedback/Banner/types/BannerProps.d.ts +2 -0
  136. package/dist/primitives/feedback.cjs +1 -1
  137. package/dist/primitives/feedback.mjs +9 -8
  138. package/dist/primitives/input/Autocomplete/types/AutocompleteItemProps.d.ts +3 -1
  139. package/dist/primitives/input/Input/Input.d.ts +1 -1
  140. package/dist/primitives/input/Input/types/InputProps.d.ts +3 -0
  141. package/dist/primitives/input/InputGroup/InputGroup.d.ts +1 -1
  142. package/dist/primitives/input/InputGroup/types/InputGroupProps.d.ts +1 -0
  143. package/dist/primitives/input/Textarea/Textarea.d.ts +1 -1
  144. package/dist/primitives/input/Textarea/internal/TextareaAutoResizeEffect.d.ts +8 -0
  145. package/dist/primitives/input/Textarea/types/TextareaProps.d.ts +2 -0
  146. package/dist/primitives/input/index.d.ts +1 -0
  147. package/dist/primitives/input/types/InputVariant.d.ts +1 -0
  148. package/dist/primitives/input.cjs +1 -1
  149. package/dist/primitives/input.mjs +14 -14
  150. package/dist/primitives/navigation/ListItem/ListItem.d.ts +1 -1
  151. package/dist/primitives/navigation/ListItem/__stories__/ListItemMultilineExample.d.ts +7 -0
  152. package/dist/primitives/navigation/ListItem/types/ListItemDescriptionPlacement.d.ts +1 -1
  153. package/dist/primitives/navigation/ListItem/types/ListItemProps.d.ts +3 -0
  154. package/dist/primitives/navigation/ListItem/types/ListItemState.d.ts +1 -0
  155. package/dist/primitives/navigation.cjs +1 -1
  156. package/dist/primitives/navigation.mjs +1 -1
  157. package/dist/primitives/surfaces/Card/Card.d.ts +2 -0
  158. package/dist/primitives/surfaces/Card/internal/CardAction.d.ts +2 -0
  159. package/dist/primitives/surfaces/Card/internal/CardControl.d.ts +2 -0
  160. package/dist/primitives/surfaces/Card/types/CardActionProps.d.ts +2 -0
  161. package/dist/primitives/surfaces/Card/types/CardControlProps.d.ts +2 -0
  162. package/dist/primitives/surfaces/index.d.ts +2 -0
  163. package/dist/primitives/surfaces.cjs +1 -1
  164. package/dist/primitives/surfaces.mjs +2 -2
  165. package/dist/primitives/typography/Heading/types/HeadingProps.d.ts +4 -2
  166. package/dist/primitives/typography/OverflowingTextWithTooltip/types/OverflowingTextWithTooltipProps.d.ts +2 -1
  167. package/dist/primitives/typography/Text/Text.d.ts +1 -1
  168. package/dist/primitives/typography/Text/internal/TextTypographyProps.d.ts +7 -0
  169. package/dist/primitives/typography/Text/types/TextProps.d.ts +2 -1
  170. package/dist/primitives/typography/internal/TypographyColor.d.ts +2 -0
  171. package/dist/primitives/typography/internal/TypographyFontSize.d.ts +2 -0
  172. package/dist/primitives/typography.cjs +1 -1
  173. package/dist/primitives/typography.mjs +2 -2
  174. package/dist/primitives.cjs +1 -1
  175. package/dist/primitives.mjs +52 -51
  176. package/dist/{settings-XGSJtobU.js → settings-BTFAqYrD.js} +1 -1
  177. package/dist/{settings-DT5bEO6A.cjs → settings-D_iT1ngl.cjs} +1 -1
  178. package/dist/style.css +1 -1
  179. package/dist/surfaces-DtZwsfms.cjs +1 -0
  180. package/dist/surfaces-v0kQLZYO.js +224 -0
  181. package/dist/{typography-CWtuNruY.cjs → typography-B05olPwL.cjs} +1 -1
  182. package/dist/{typography-BPdXzW2T.js → typography-BwyZEDDi.js} +1 -1
  183. package/dist/utilities/color/utils/themeColorSchema.d.ts +15 -15
  184. package/package.json +3 -1
  185. package/dist/Dropdown-ChTVyesF.js +0 -1018
  186. package/dist/Dropdown-DlItz8Gh.cjs +0 -1
  187. package/dist/Input-DZWl81G_.js +0 -23
  188. package/dist/Input-DvL77rvu.cjs +0 -1
  189. package/dist/ListItem-C6Xl00m1.cjs +0 -1
  190. package/dist/ListItem-C84ANa76.js +0 -86
  191. package/dist/ListItem.module-BJ9Ttjrc.js +0 -34
  192. package/dist/ListItem.module-CO4u2oeF.cjs +0 -1
  193. package/dist/OverflowingTextWithTooltip-BQmpPObX.cjs +0 -1
  194. package/dist/OverflowingTextWithTooltip-BtB9cGdJ.js +0 -89
  195. package/dist/ProgressBar-CzGs7cuE.cjs +0 -1
  196. package/dist/ProgressBar-D4tKQ7OA.js +0 -84
  197. package/dist/Radio-BwBZ4e8g.js +0 -103
  198. package/dist/Radio-sIYxZnR_.cjs +0 -1
  199. package/dist/data-display-C-eoJ5En.js +0 -378
  200. package/dist/data-display-CM1yXpnE.cjs +0 -2
  201. package/dist/feedback-BSOWDBI0.js +0 -38
  202. package/dist/feedback-DBRXDPSP.cjs +0 -1
  203. package/dist/icon-BNcdwwdl.cjs +0 -1
  204. package/dist/input-CWWp7cqL.cjs +0 -1
  205. package/dist/input-CvZ_uB_9.cjs +0 -1
  206. package/dist/input-Qn5_aFYU.js +0 -785
  207. package/dist/input-k5cMhFI_.js +0 -428
  208. package/dist/layout-DDqeMgFv.js +0 -439
  209. package/dist/layout-iSfGrMrH.cjs +0 -1
  210. package/dist/navigation-7Y6gHFlj.cjs +0 -1
  211. package/dist/navigation-BcXCiLE1.js +0 -86
  212. package/dist/primitives/typography/internal/Label/Label.d.ts +0 -8
  213. package/dist/surfaces-q8voTXEJ.cjs +0 -1
  214. package/dist/surfaces-vhSZBmbz.js +0 -201
  215. package/dist/{Tooltip-6uS8_wdA.js → Tooltip-C7zc16gI.js} +1 -1
@@ -1,1018 +0,0 @@
1
- import { t as i } from "./isDefined-fMi6eQ4r.js";
2
- import { Cn as rt, Dn as ot, En as nt, gl as at } from "./icon-CUE-QGQK.js";
3
- import { t as ee } from "./doNotTranslate-BSVT8Xyd.js";
4
- import { t as X } from "./mergeClassNames-ClFMR1v0.js";
5
- import { t as it } from "./preventDismissingClickActivation-BQFMKRey.js";
6
- import { r as Ne, t as st } from "./Button-CU8BS-Yd.js";
7
- import { t as Fe } from "./isRenderableSlot-DT_depzM.js";
8
- import { t as ct } from "./Tooltip-6uS8_wdA.js";
9
- import { r as Le } from "./OverflowingTextWithTooltip-BtB9cGdJ.js";
10
- import { t as ue } from "./ListItem.module-BJ9Ttjrc.js";
11
- import { t as Ie } from "./ListItem-C84ANa76.js";
12
- import { t as Z } from "./Popover-CWeCV7X9.js";
13
- import { t as lt } from "./Input-DZWl81G_.js";
14
- import { useRender as me } from "@base-ui/react/use-render";
15
- import { isBoolean as dt, isFunction as ut, isNonEmptyString as ge, isPositiveInteger as Ge, isUndefined as pe } from "@sniptt/guards";
16
- import { clsx as U } from "clsx";
17
- import { createContext as Me, isValidElement as pt, useCallback as j, useContext as se, useEffect as ft, useId as we, useLayoutEffect as ve, useRef as _e, useState as B } from "react";
18
- import { Fragment as mt, jsx as l, jsxs as te } from "react/jsx-runtime";
19
- import { Button as Be } from "@base-ui/react/button";
20
- import { useMergedRefs as ce } from "@base-ui/utils/useMergedRefs";
21
- import { Popover as qe } from "@base-ui/react/popover";
22
- import { areArraysEqual as gt } from "@base-ui/utils/areArraysEqual";
23
- import { useDirection as Ke } from "@base-ui/react/direction-provider";
24
- import { Menu as Ae } from "@base-ui/react/menu";
25
- var wt = "_content_obixo_1", vt = "_page_obixo_13", ht = "_selectionGroup_obixo_17", bt = "_group_obixo_21", Dt = "_groupLabel_obixo_27", yt = "_separator_obixo_36", Tt = "_section_obixo_43", It = "_back_obixo_77", _t = "_backIcon_obixo_89", At = "_searchContainer_obixo_93", Ct = "_search_obixo_93", Et = "_status_obixo_110", xt = "_header_obixo_116", St = "_title_obixo_129", kt = "_itemWithActions_obixo_138", Rt = "_itemWithActionsPrimary_obixo_144", Pt = "_itemActions_obixo_159", Ot = "_itemDecoration_obixo_163", S = {
26
- content: wt,
27
- page: vt,
28
- selectionGroup: ht,
29
- group: bt,
30
- groupLabel: Dt,
31
- separator: yt,
32
- section: Tt,
33
- back: It,
34
- backIcon: _t,
35
- searchContainer: At,
36
- search: Ct,
37
- status: Et,
38
- header: xt,
39
- title: St,
40
- itemWithActions: kt,
41
- itemWithActionsPrimary: Rt,
42
- itemActions: Pt,
43
- itemDecoration: Ot
44
- }, Ue = ({ render: e, ref: t, disabled: r, ...o }) => me({
45
- render: e,
46
- ref: t,
47
- defaultTagName: "button",
48
- props: {
49
- ...o,
50
- disabled: r
51
- }
52
- }), Ce = ({ nativeButton: e, renderProps: t }) => e && "disabled" in t && dt(t.disabled) ? t.disabled : void 0, Nt = "[data-dropdown-item]", He = ({ actions: e, actionsVisibility: t = "hover", color: r = "neutral", selected: o = !1, focused: a = !1, indicator: c = "none", disabled: s = !1, hasSubmenu: m = !1, children: n }) => /* @__PURE__ */ te("div", {
53
- className: U(ue.root, S.itemWithActions),
54
- role: "none",
55
- "data-actions-visibility": t,
56
- "data-color": r,
57
- "data-selected": o ? "" : void 0,
58
- "data-highlighted": a ? "" : void 0,
59
- "data-indicator": c,
60
- "data-disabled": s ? "" : void 0,
61
- onClick: (u) => {
62
- u.target === u.currentTarget && u.currentTarget.querySelector(Nt)?.click();
63
- },
64
- children: [
65
- n,
66
- /* @__PURE__ */ l("span", {
67
- className: U(ue.actions, S.itemActions),
68
- children: e
69
- }),
70
- c === "check" && o && /* @__PURE__ */ l(rt, {
71
- className: U(ue.checkIndicator, S.itemDecoration),
72
- "aria-hidden": !0
73
- }),
74
- m && /* @__PURE__ */ l(ot, {
75
- className: U(ue.submenuIcon, S.itemDecoration),
76
- "aria-hidden": !0
77
- })
78
- ]
79
- }), Ee = ({ id: e, render: t }) => pt(t) ? t.props.id ?? e : e, xe = (e) => e.getAttribute("aria-label") ?? e.textContent ?? "", Ve = ({ content: e, item: t }) => t.getAttribute("aria-disabled") !== "true" && !t.hasAttribute("disabled") && t.closest("[data-dropdown-content]") === e, he = (e) => Array.from(e.querySelectorAll("[data-dropdown-item]")).filter((t) => Ve({
80
- content: e,
81
- item: t
82
- })), fe = Me(void 0), G = () => {
83
- const e = se(fe);
84
- if (!i(e)) throw new Error(ee("Dropdown components must be inside Dropdown.Root"));
85
- return e;
86
- }, Se = ({ id: e, disabled: t, isSubmenuTrigger: r = !1 }) => {
87
- const o = G(), a = r ? o.parentType : o.type, c = r ? o.parentRowFocus : o.rowFocus, s = a !== "panel" && (c?.rowIds?.includes(e) ?? !0);
88
- return { tabIndex: t || s && c?.tabStopRowId !== e ? -1 : 0 };
89
- }, We = ({ color: e, startIcon: t, endIcon: r, description: o, descriptionPlacement: a, shortcut: c, shortcutJoinLabel: s, hasSubmenu: m, actions: n, actionsVisibility: u, children: d, render: v, disabled: h = !1, nativeButton: g = !i(v), closeOnClick: f = !0, onClick: C, page: E, id: D, ...p }) => {
90
- const { type: w, closeTree: T, goToPage: b } = G(), I = we(), k = Ee({
91
- id: D,
92
- render: v
93
- }), R = k ?? I, H = Se({
94
- id: R,
95
- disabled: h
96
- }), P = Fe(n), O = m ?? i(E), q = /* @__PURE__ */ l(Be, {
97
- ...p,
98
- id: R,
99
- disabled: h,
100
- nativeButton: g,
101
- role: p.role ?? (w === "menu" ? "menuitem" : void 0),
102
- tabIndex: H.tabIndex,
103
- "data-dropdown-item": "",
104
- "data-dropdown-page": E,
105
- onClick: (_) => {
106
- if (C?.(_), !_.defaultPrevented) {
107
- if (i(E)) {
108
- const A = _.currentTarget.closest("[data-dropdown-content]");
109
- if (!i(A)) return;
110
- b({
111
- id: E,
112
- trigger: {
113
- id: k,
114
- index: he(A).indexOf(_.currentTarget),
115
- page: E,
116
- label: xe(_.currentTarget)
117
- }
118
- });
119
- return;
120
- }
121
- f && T();
122
- }
123
- },
124
- render: (_) => {
125
- const A = Ce({
126
- nativeButton: g,
127
- renderProps: _
128
- });
129
- return /* @__PURE__ */ l(Ie, {
130
- ..._,
131
- render: /* @__PURE__ */ l(Ue, {
132
- render: v,
133
- disabled: A
134
- }),
135
- className: U(_.className, P && S.itemWithActionsPrimary),
136
- disabled: h,
137
- color: e,
138
- startIcon: t,
139
- endIcon: r,
140
- actionsVisibility: u,
141
- description: o,
142
- descriptionPlacement: a,
143
- shortcut: c,
144
- shortcutJoinLabel: s,
145
- hasSubmenu: !P && O,
146
- children: d
147
- });
148
- }
149
- });
150
- return P ? /* @__PURE__ */ l(He, {
151
- actions: n,
152
- actionsVisibility: u,
153
- color: e,
154
- disabled: h,
155
- hasSubmenu: O,
156
- children: q
157
- }) : q;
158
- }, Ft = ({ children: e = ee("Back"), className: t, onClick: r, ...o }) => {
159
- const { goBack: a, canGoBack: c } = G();
160
- return /* @__PURE__ */ l(We, {
161
- ...o,
162
- className: U(S.back, t),
163
- "data-dropdown-back": "",
164
- disabled: o.disabled || !c,
165
- startIcon: /* @__PURE__ */ l(nt, { className: S.backIcon }),
166
- closeOnClick: !1,
167
- onClick: (s) => {
168
- r?.(s), !s.defaultPrevented && a();
169
- },
170
- children: e
171
- });
172
- }, Lt = "_button_1qwl0_1", Gt = "_tooltipAnchor_1qwl0_29", Mt = "_icon_1qwl0_33", De = {
173
- button: Lt,
174
- tooltipAnchor: Gt,
175
- icon: Mt
176
- }, Bt = ({ children: e, size: t, shape: r = "square", className: o, tooltip: a, tooltipPlace: c = "bottom", tooltipDelay: s = 1e3, tooltipOffset: m = 5, disabled: n, loading: u, ...d }) => {
177
- const v = se(Ne), h = t ?? v?.size ?? "md", g = ge(a), f = n || u, C = /* @__PURE__ */ l(st, {
178
- ...d,
179
- size: h === "xs" ? "sm" : h,
180
- "data-icon-size": h,
181
- "data-shape": r,
182
- disabled: n,
183
- loading: u,
184
- startIcon: /* @__PURE__ */ l("span", {
185
- className: De.icon,
186
- children: e
187
- }),
188
- className: X(De.button, o)
189
- });
190
- return g ? /* @__PURE__ */ l(ct, {
191
- content: a,
192
- delay: s,
193
- side: c,
194
- sideOffset: m,
195
- children: f ? /* @__PURE__ */ l("span", {
196
- className: De.tooltipAnchor,
197
- children: C
198
- }) : C
199
- }) : C;
200
- }, qt = "_button_prhtf_1", Kt = { button: qt }, Ut = ({ className: e, emphasis: t = "standard", size: r, variant: o, ...a }) => {
201
- const c = se(Ne), s = r ?? c?.size ?? "sm", m = o ?? c?.variant ?? "ghost";
202
- return /* @__PURE__ */ l(Bt, {
203
- ...a,
204
- size: s,
205
- variant: m,
206
- "data-emphasis": t,
207
- className: X(Kt.button, e)
208
- });
209
- }, Ht = ({ render: e, children: t, "aria-label": r, ...o }) => /* @__PURE__ */ l(qe.Close, {
210
- ...o,
211
- "aria-label": r,
212
- render: e ?? /* @__PURE__ */ l(Ut, {
213
- size: "sm",
214
- "aria-label": r,
215
- children: t ?? /* @__PURE__ */ l(at, {})
216
- }),
217
- children: i(e) ? t : void 0
218
- }), be = (e) => e.querySelector("[data-dropdown-search]:not(:disabled)"), ke = ({ content: e, target: t, edge: r = "first", type: o }) => {
219
- const a = i(t?.id) ? e.ownerDocument.getElementById(t.id) : null;
220
- if (i(a) && e.contains(a)) return a;
221
- const c = he(e), s = i(t) ? c.filter((f) => f.dataset.dropdownPage === t.page) : [], [m] = s;
222
- if (s.length === 1 && i(m)) return m;
223
- const n = ge(t?.label) ? s.filter((f) => xe(f) === t?.label) : [], [u] = n;
224
- if (n.length === 1 && i(u)) return u;
225
- const d = i(t) ? c[t.index] : void 0;
226
- if (i(d)) return d;
227
- const v = e.querySelector('input:not(:disabled):not([type="hidden"]),button:not(:disabled),textarea:not(:disabled),select:not(:disabled),a[href],[tabindex="0"]'), h = Array.from(e.querySelectorAll("[data-dropdown-page-type]")).find((f) => f.closest("[data-dropdown-content]") === e)?.dataset.dropdownPageType ?? o ?? e.dataset.type;
228
- if (h === "panel") return v ?? e;
229
- const g = be(e);
230
- return i(g) ? g : r === "last" ? c[c.length - 1] ?? v ?? e : (h === "picker" ? c.find((f) => f.hasAttribute("data-dropdown-option-item") && (f.getAttribute("aria-selected") === "true" || f.getAttribute("aria-pressed") === "true" || f.getAttribute("aria-checked") === "true" || f.getAttribute("aria-current") === "true")) : void 0) ?? c.find((f) => !f.hasAttribute("data-dropdown-back")) ?? c[0] ?? v ?? e;
231
- }, Vt = ({ contentRef: e }) => {
232
- const { open: t, pageId: r, pageFocusRequest: o, setPageFocusRequest: a } = G();
233
- return ve(() => {
234
- i(o) && (a(void 0), !(!t || o.pageId !== r || !i(e.current)) && ke({
235
- content: e.current,
236
- target: o.target
237
- }).focus());
238
- }, [
239
- e,
240
- t,
241
- r,
242
- o,
243
- a
244
- ]), null;
245
- }, ze = ({ content: e, item: t }) => t.hasAttribute("data-dropdown-item") && Ve({
246
- content: e,
247
- item: t
248
- }) && (!t.hasAttribute("data-dropdown-back") || !i(be(e))), $e = (e) => Array.from(e.querySelectorAll("[data-dropdown-item]")).filter((t) => ze({
249
- content: e,
250
- item: t
251
- })), ie = (e) => {
252
- if (e.dataset.type === "panel") return;
253
- const t = be(e);
254
- if (!(!i(t) || t !== e.ownerDocument.activeElement || !ge(t.value.trim())))
255
- return he(e).find((r) => r.hasAttribute("data-dropdown-option-item"));
256
- }, Wt = ({ content: e }) => {
257
- const { setRowIds: t, setSearchTargetId: r } = G();
258
- return ve(() => {
259
- if (!i(e)) return;
260
- const o = () => {
261
- const c = $e(e).map((s) => s.id);
262
- t((s) => i(s) && gt(s, c) ? s : c), r(ie(e)?.id);
263
- };
264
- o();
265
- const a = new MutationObserver(o);
266
- return a.observe(e, {
267
- childList: !0,
268
- subtree: !0,
269
- attributes: !0,
270
- attributeFilter: [
271
- "disabled",
272
- "aria-disabled",
273
- "id"
274
- ]
275
- }), () => {
276
- a.disconnect(), t(void 0), r(void 0);
277
- };
278
- }, [
279
- e,
280
- t,
281
- r
282
- ]), null;
283
- }, zt = (e) => (e.ctrlKey || e.metaKey) && !e.defaultPrevented, ye = /* @__PURE__ */ new WeakMap(), Ye = {
284
- activate: ({ item: e, event: t }) => {
285
- ye.set(e, t);
286
- try {
287
- e.click();
288
- } finally {
289
- ye.delete(e);
290
- }
291
- },
292
- getEvent: ({ item: e, event: t }) => ye.get(e) ?? t
293
- }, $t = (e) => Array.from(e.ownerDocument.querySelectorAll("[data-dropdown-item][aria-controls]")).find((t) => t.getAttribute("aria-controls") === e.id), Yt = ({ rowCells: e, column: t, isEnabledCell: r }) => {
294
- const o = Math.min(t, e.length - 1);
295
- for (let a = 0; a < e.length; a++) {
296
- const c = [e[o - a], e[o + a]].find(r);
297
- if (i(c)) return c;
298
- }
299
- }, je = ({ key: e, items: t, currentItem: r, search: o, isRightToLeft: a }) => {
300
- const c = r?.closest("[data-dropdown-columns]"), s = Number(c?.dataset.dropdownColumns), m = ee([
301
- "ArrowUp",
302
- "ArrowDown",
303
- "ArrowLeft",
304
- "ArrowRight"
305
- ]).includes(e);
306
- if (!i(c) || !i(r) || !m || !Ge(s)) return;
307
- const n = Array.from(c.children).filter((p) => p instanceof HTMLElement && !p.hasAttribute("data-dropdown-section-label")), u = n.indexOf(r);
308
- if (u < 0) return;
309
- const d = Math.floor(u / s), v = u % s, h = e === "ArrowUp" || e === "ArrowDown", g = ee(a ? "ArrowLeft" : "ArrowRight"), f = e === "ArrowDown" || e === g ? 1 : -1, C = Math.ceil(n.length / s), E = new Set(t), D = (p) => i(p) && E.has(p);
310
- if (h) {
311
- for (let T = d + f; T >= 0 && T < C; T += f) {
312
- const b = n[Math.min(T * s + v, n.length - 1)];
313
- if (D(b)) return b;
314
- }
315
- for (let T = d + f; T >= 0 && T < C; T += f) {
316
- const b = Yt({
317
- rowCells: n.slice(T * s, (T + 1) * s),
318
- column: v,
319
- isEnabledCell: D
320
- });
321
- if (i(b)) return b;
322
- }
323
- const p = n.filter(D), w = f < 0 ? p[0] : p[p.length - 1];
324
- return (i(w) ? t[t.indexOf(w) + f] : void 0) ?? (f < 0 ? o : void 0) ?? r;
325
- }
326
- for (let p = v + f; p >= 0 && p < s; p += f) {
327
- const w = n[d * s + p];
328
- if (D(w)) return w;
329
- }
330
- return r;
331
- }, jt = ({ key: e, items: t, currentIndex: r, search: o, isSearch: a, isRightToLeft: c = !1 }) => {
332
- const s = je({
333
- key: e,
334
- items: t,
335
- currentItem: t[r],
336
- search: o,
337
- isRightToLeft: c
338
- });
339
- if (i(s)) return s;
340
- const m = t.length - 1;
341
- if (e === "ArrowDown") return t[r === m ? 0 : r + 1];
342
- if (e === "ArrowUp" && r === 0 && i(o)) return o;
343
- if (e === "ArrowUp") return t[r <= 0 ? m : r - 1];
344
- if (!a && e === "Home") return t[0];
345
- if (!a && e === "End") return t[m];
346
- }, Xt = 500, Jt = 229, Qt = () => {
347
- const { type: e, isSubmenu: t, setOpen: r, closeTree: o, tabForwardOutOfTree: a } = G(), c = Ke(), [s, m] = B({
348
- text: "",
349
- timestamp: 0
350
- });
351
- return (n) => {
352
- if (n.defaultPrevented || n.nativeEvent.isComposing || n.nativeEvent.keyCode === Jt) return;
353
- const u = n.currentTarget, d = n.target;
354
- if (!(d instanceof HTMLElement) || d.closest("[data-dropdown-content]") !== u) return;
355
- const v = d.matches('input,textarea,select,[contenteditable="true"]'), h = c === "rtl", g = ee(h ? "ArrowRight" : "ArrowLeft"), f = t && !v && n.key === g, C = f && e !== "panel" ? je({
356
- key: n.key,
357
- items: he(u),
358
- currentItem: d,
359
- search: null,
360
- isRightToLeft: h
361
- }) : void 0, E = i(C) && C !== d;
362
- if (t && (n.key === "Escape" || f && !E)) {
363
- n.preventDefault(), n.stopPropagation(), $t(u)?.focus(), r(!1);
364
- return;
365
- }
366
- if (e === "panel") return;
367
- if (e === "menu" && n.key === "Tab" && n.shiftKey) {
368
- n.preventDefault(), o(n.nativeEvent);
369
- return;
370
- }
371
- if (e === "menu" && n.key === "Tab" && t) {
372
- n.preventDefault(), a({
373
- ownerDocument: u.ownerDocument,
374
- tabOutEvent: n.nativeEvent
375
- });
376
- return;
377
- }
378
- const D = be(u), p = d === D;
379
- if (v && !p) return;
380
- const w = $e(u), T = p && n.key === "Enter" ? ie(u) : void 0;
381
- if (i(T)) {
382
- n.preventDefault(), Ye.activate({
383
- item: T,
384
- event: n.nativeEvent
385
- });
386
- return;
387
- }
388
- const b = w.indexOf(d), I = jt({
389
- key: n.key,
390
- items: w,
391
- currentIndex: b,
392
- search: D,
393
- isSearch: p,
394
- isRightToLeft: h
395
- });
396
- if (i(I)) {
397
- n.preventDefault(), I.focus();
398
- return;
399
- }
400
- if (v || n.key.length !== 1 || n.key === " " || n.altKey || n.ctrlKey || n.metaKey) return;
401
- const k = Date.now(), R = k - s.timestamp > Xt ? n.key : s.text + n.key;
402
- m({
403
- text: R,
404
- timestamp: k
405
- });
406
- const H = ([...R].every((O) => O === R[0]) ? n.key : R).toLocaleLowerCase(), P = [...w.slice(b + 1), ...w.slice(0, b + 1)].find((O) => xe(O).trim().toLocaleLowerCase().startsWith(H));
407
- i(P) && (n.preventDefault(), P.focus());
408
- };
409
- }, Zt = ({ side: e, align: t = "start", sideOffset: r = 0, alignOffset: o, anchor: a, collisionPadding: c, container: s, keepMounted: m, width: n = 200, className: u, style: d, children: v, initialFocus: h, onKeyDown: g, onFocus: f, onInput: C, onClick: E, onMouseDown: D, onPointerDown: p, "aria-label": w, "aria-labelledby": T, ref: b, ...I }) => {
410
- const { type: k, isSubmenu: R, rowFocus: H, initialFocusEdge: P, focusOnOpen: O, triggerId: q, titleId: _, setSearchTargetId: A } = G(), M = _e(null), [L, W] = B(null), J = ce(M, b, W), re = Qt(), Y = i(w) ? void 0 : _ ?? q;
411
- return /* @__PURE__ */ te(mt, { children: [
412
- /* @__PURE__ */ l(Z.Portal, {
413
- container: s,
414
- keepMounted: m,
415
- children: /* @__PURE__ */ l(Z.Positioner, {
416
- side: e ?? (R ? "inline-end" : "bottom"),
417
- align: t,
418
- sideOffset: r,
419
- alignOffset: o,
420
- anchor: a,
421
- collisionPadding: c,
422
- children: /* @__PURE__ */ l(Z.Popup, {
423
- ...I,
424
- ref: J,
425
- role: k === "menu" ? "menu" : "dialog",
426
- "aria-label": w,
427
- "aria-labelledby": T ?? Y,
428
- "data-dropdown-content": "",
429
- "data-type": k,
430
- className: X(S.content, u),
431
- style: (y) => ({
432
- width: n,
433
- ...ut(d) ? d(y) : d
434
- }),
435
- initialFocus: h ?? (() => O ? i(M.current) ? ke({
436
- content: M.current,
437
- edge: P,
438
- type: k
439
- }) : !0 : !1),
440
- onKeyDown: (y) => {
441
- g?.(y), re(y), zt(y) || y.stopPropagation();
442
- },
443
- onFocus: (y) => {
444
- f?.(y), A(ie(y.currentTarget)?.id);
445
- const { target: V } = y;
446
- V instanceof HTMLElement && ze({
447
- content: y.currentTarget,
448
- item: V
449
- }) && H.focusRow(V.id);
450
- },
451
- onInput: (y) => {
452
- C?.(y), A(ie(y.currentTarget)?.id);
453
- },
454
- onClick: (y) => {
455
- y.stopPropagation(), E?.(y);
456
- },
457
- onMouseDown: (y) => {
458
- y.stopPropagation(), D?.(y);
459
- },
460
- onPointerDown: (y) => {
461
- y.stopPropagation(), p?.(y);
462
- },
463
- children: v
464
- })
465
- })
466
- }),
467
- /* @__PURE__ */ l(Vt, { contentRef: M }),
468
- /* @__PURE__ */ l(Wt, { content: L })
469
- ] });
470
- }, er = ({ className: e, ...t }) => /* @__PURE__ */ l(Le, {
471
- ...t,
472
- role: "status",
473
- "aria-live": "polite",
474
- className: U(S.status, e)
475
- }), tr = ({ render: e, ref: t, className: r, ...o }) => me({
476
- render: e,
477
- ref: t,
478
- props: {
479
- ...o,
480
- className: U(S.header, r)
481
- }
482
- }), rr = ({ className: e, ...t }) => /* @__PURE__ */ l(Le, {
483
- ...t,
484
- role: "status",
485
- "aria-live": "polite",
486
- "aria-busy": "true",
487
- className: U(S.status, e)
488
- }), or = ({ render: e, ref: t, state: r, ...o }) => me({
489
- render: e,
490
- ref: t,
491
- state: r,
492
- defaultTagName: "button",
493
- props: o
494
- }), Re = Me(void 0), nr = ({ event: e, trigger: t }) => {
495
- let r = !1;
496
- return {
497
- reason: "item-press",
498
- event: e,
499
- trigger: t,
500
- cancel: () => {
501
- r = !0;
502
- },
503
- get isCanceled() {
504
- return r;
505
- }
506
- };
507
- }, ar = ({ type: e, hasSelectionState: t, hasSelectionOwner: r, multiple: o, role: a }) => e === "menu" && t ? o ? "menuitemcheckbox" : "menuitemradio" : e === "menu" ? "menuitem" : e === "picker" && r ? "option" : a, ir = ({ selection: e, value: t, standaloneSelected: r }) => !i(e) || !i(t) ? r : e.multiple ? e.value.includes(t) : e.value === t, sr = ({ value: e, selected: t, indicator: r, onSelect: o, closeOnSelect: a, color: c, startIcon: s, endIcon: m, description: n, descriptionPlacement: u, shortcut: d, shortcutJoinLabel: v, hasSubmenu: h, actions: g, actionsVisibility: f, children: C, render: E, disabled: D = !1, nativeButton: p = !i(E), onClick: w, id: T, ...b }) => {
508
- const { type: I, multiple: k, closeTree: R, searchTargetId: H } = G(), P = se(Re), O = i(P) && i(e), q = O ? P.multiple : k, _ = ir({
509
- selection: P,
510
- value: e,
511
- standaloneSelected: t
512
- }), A = I === "menu", M = I === "picker" && O, L = i(_), W = !A && !M && (p || b.role === "button"), J = !A && !M && !W && L && _, re = ar({
513
- type: I,
514
- hasSelectionState: L,
515
- hasSelectionOwner: O,
516
- multiple: q,
517
- role: b.role
518
- }), Y = q ? "checkbox" : "check", y = we(), V = Ee({
519
- id: T,
520
- render: E
521
- }) ?? y, oe = Se({
522
- id: V,
523
- disabled: D
524
- }), Q = Fe(g), le = H === V, ne = r ?? (L ? Y : "none"), de = Q && ne === "check", ae = /* @__PURE__ */ l(Be, {
525
- ...b,
526
- id: V,
527
- disabled: D,
528
- nativeButton: p,
529
- role: re,
530
- "aria-checked": A && L ? _ : void 0,
531
- "aria-selected": M ? _ : void 0,
532
- "aria-pressed": W && L ? _ : void 0,
533
- "aria-current": J ? "true" : void 0,
534
- tabIndex: oe.tabIndex,
535
- "data-dropdown-item": "",
536
- "data-dropdown-option-item": "",
537
- onClick: (F) => {
538
- if (w?.(F), F.defaultPrevented) return;
539
- const z = nr({
540
- event: Ye.getEvent({
541
- item: F.currentTarget,
542
- event: F.nativeEvent
543
- }),
544
- trigger: F.currentTarget
545
- });
546
- o?.(z), !(z.isCanceled || F.defaultPrevented) && (O && P.select({
547
- value: e,
548
- eventDetails: z
549
- }), !(z.isCanceled || F.defaultPrevented) && (a ?? (O ? P.closeOnSelect : !q)) && R());
550
- },
551
- render: (F) => {
552
- const z = Ce({
553
- nativeButton: p,
554
- renderProps: F
555
- });
556
- return /* @__PURE__ */ l(Ie, {
557
- ...F,
558
- render: /* @__PURE__ */ l(or, {
559
- render: E,
560
- disabled: z,
561
- state: {
562
- selected: _ ?? !1,
563
- multiple: q,
564
- disabled: D
565
- }
566
- }),
567
- className: U(F.className, Q && S.itemWithActionsPrimary),
568
- disabled: D,
569
- selected: _,
570
- focused: le,
571
- indicator: de ? "none" : ne,
572
- color: c,
573
- startIcon: s,
574
- endIcon: m,
575
- actionsVisibility: f,
576
- description: n,
577
- descriptionPlacement: u,
578
- shortcut: d,
579
- shortcutJoinLabel: v,
580
- hasSubmenu: !Q && h,
581
- children: C
582
- });
583
- }
584
- });
585
- return Q ? /* @__PURE__ */ l(He, {
586
- actions: g,
587
- actionsVisibility: f,
588
- color: c,
589
- selected: _,
590
- focused: le,
591
- indicator: ne,
592
- disabled: D,
593
- hasSubmenu: h,
594
- children: ae
595
- }) : ae;
596
- }, cr = ({ id: e, type: t, children: r }) => {
597
- const o = G(), { registerPage: a } = o, c = j((s) => {
598
- i(s) && a({
599
- id: e,
600
- type: t
601
- });
602
- }, [
603
- e,
604
- t,
605
- a
606
- ]);
607
- return o.pageId !== e ? null : /* @__PURE__ */ l(fe.Provider, {
608
- value: {
609
- ...o,
610
- type: t ?? o.rootType
611
- },
612
- children: /* @__PURE__ */ l("div", {
613
- ref: c,
614
- className: S.page,
615
- "data-dropdown-page-type": t ?? o.rootType,
616
- children: r
617
- })
618
- });
619
- }, lr = ({ open: e, registerOpenNestedRoot: t }) => (ft(() => {
620
- if (e)
621
- return t?.();
622
- }, [e, t]), null), dr = ({ rowIds: e = [], focusedRowId: t }) => i(t) && e.includes(t) ? t : e[0], ur = "data-base-ui-focus-guard", pr = (e) => {
623
- const t = e?.nextElementSibling;
624
- if (!(!(t instanceof HTMLElement) || !t.hasAttribute(ur)))
625
- return t;
626
- }, fr = (e) => e instanceof FocusEvent ? e.type === "focusout" && e.relatedTarget instanceof Element ? e.relatedTarget : null : e.target instanceof Element ? e.target : null, Te = ({ onDismiss: e, event: t, target: r = fr(t) }) => {
627
- if (!i(e)) return !1;
628
- let o = !1;
629
- return e({
630
- target: r,
631
- type: t.type,
632
- preventDefault: () => {
633
- o = !0;
634
- }
635
- }), o;
636
- }, Oe = () => {
637
- const [e, t] = B();
638
- return [e, j((r) => (t(r), () => t((o) => o === r ? void 0 : o)), [])];
639
- }, mr = () => {
640
- const [e, t] = B(() => /* @__PURE__ */ new Map());
641
- return {
642
- selections: e,
643
- initializeSelection: j(({ id: r, state: o }) => {
644
- t((a) => a.get(r)?.multiple === o.multiple ? a : new Map(a).set(r, o));
645
- }, []),
646
- updateSelection: j(({ id: r, state: o }) => {
647
- t((a) => new Map(a).set(r, o));
648
- }, [])
649
- };
650
- }, Xe = ({ children: e, type: t, open: r, defaultOpen: o = !1, onOpenChange: a, onEscapeKeyDown: c, onInteractOutside: s, multiple: m = !1, defaultPage: n = "root", isSubmenu: u = !1 }) => {
651
- const d = se(fe), v = mr(), { selections: h, initializeSelection: g, updateSelection: f } = u && i(d) ? d : v, C = _e(0), E = j(() => (C.current += 1, () => {
652
- C.current -= 1;
653
- }), []), [D, p] = B(o), w = r ?? D, [T, b] = B(w), [I, k] = B([{ id: n }]), [R, H] = B(), [P, O] = B(), [q, _] = B(), A = I[I.length - 1]?.id, [M, L] = B(), [W, J] = B("first"), [re, Y] = B(!0), [y, V] = B(), [oe, Q] = Oe(), [le, ne] = Oe(), de = w && !T, ae = !w && T;
654
- (de || ae) && b(w), de && (k([{ id: n }]), H(void 0), L(void 0), _(void 0)), ae && (J("first"), Y(!0), V(void 0));
655
- const F = (x) => {
656
- i(r) || p(x), a?.(x);
657
- }, z = (x) => {
658
- i(x) && Te({
659
- onDismiss: s,
660
- event: x,
661
- target: null
662
- }) || (F(!1), u && d?.closeTree(x));
663
- }, Je = ({ ownerDocument: x, tabOutEvent: N }) => {
664
- const K = i(oe) ? x.getElementById(oe) : null;
665
- if (u && i(d)) {
666
- F(!1), K?.focus(), d.tabForwardOutOfTree({
667
- ownerDocument: x,
668
- tabOutEvent: N
669
- });
670
- return;
671
- }
672
- const $ = pr(K);
673
- if (!i($)) {
674
- z(N);
675
- return;
676
- }
677
- $.focus();
678
- }, Qe = ({ id: x, trigger: N }) => {
679
- L({ pageId: x }), k((K) => [...K, {
680
- id: x,
681
- trigger: N
682
- }]);
683
- }, Ze = () => {
684
- const x = I[I.length - 2];
685
- if (!i(x)) return;
686
- const N = I[I.length - 1]?.trigger;
687
- L({
688
- pageId: x.id,
689
- target: N
690
- }), k((K) => K.slice(0, -1));
691
- }, et = j(({ id: x, type: N }) => {
692
- if (!w) return;
693
- const K = N ?? t;
694
- H(($) => $?.id === x && $.type === K ? $ : {
695
- id: x,
696
- type: K
697
- });
698
- }, [w, t]);
699
- return /* @__PURE__ */ l(Z.Root, {
700
- open: w,
701
- onOpenChange: (x, N) => {
702
- if (!x && !w) {
703
- N.cancel();
704
- return;
705
- }
706
- const K = N.reason === "outside-press" || N.reason === "focus-out";
707
- if (K && C.current > 0) {
708
- N.cancel();
709
- return;
710
- }
711
- const $ = N.reason === "escape-key" && Te({
712
- onDismiss: c,
713
- event: N.event
714
- }), tt = K && Te({
715
- onDismiss: s,
716
- event: N.event
717
- });
718
- if ($ || tt) {
719
- N.cancel();
720
- return;
721
- }
722
- K && it(N.event), Y(N.reason !== "trigger-hover"), F(x);
723
- },
724
- children: /* @__PURE__ */ te(fe.Provider, {
725
- value: {
726
- type: i(R) && R.id === A ? R.type : t,
727
- rootType: t,
728
- open: w,
729
- multiple: m,
730
- selections: h,
731
- initializeSelection: g,
732
- updateSelection: f,
733
- isSubmenu: u,
734
- parentType: d?.type,
735
- rowFocus: {
736
- rowIds: P,
737
- tabStopRowId: dr({
738
- rowIds: P,
739
- focusedRowId: q
740
- }),
741
- focusRow: _
742
- },
743
- parentRowFocus: d?.rowFocus,
744
- setRowIds: O,
745
- pageId: A,
746
- pageFocusRequest: M,
747
- setPageFocusRequest: L,
748
- canGoBack: I.length > 1,
749
- initialFocusEdge: W,
750
- setInitialFocusEdge: J,
751
- focusOnOpen: re,
752
- setFocusOnOpen: Y,
753
- setOpen: F,
754
- closeTree: z,
755
- tabForwardOutOfTree: Je,
756
- goToPage: Qe,
757
- goBack: Ze,
758
- registerPage: et,
759
- registerOpenNestedRoot: E,
760
- searchTargetId: y,
761
- setSearchTargetId: V,
762
- triggerId: oe,
763
- registerTrigger: Q,
764
- titleId: le,
765
- registerTitle: ne
766
- },
767
- children: [/* @__PURE__ */ l(lr, {
768
- open: w,
769
- registerOpenNestedRoot: u ? void 0 : d?.registerOpenNestedRoot
770
- }), /* @__PURE__ */ l(Re.Provider, {
771
- value: void 0,
772
- children: e
773
- })]
774
- })
775
- });
776
- }, gr = ({ searchRef: e, value: t }) => {
777
- const { setSearchTargetId: r } = G();
778
- return ve(() => {
779
- const o = e.current?.closest("[data-dropdown-content]");
780
- i(o) && r(ie(o)?.id);
781
- }, [
782
- e,
783
- t,
784
- r
785
- ]), null;
786
- }, wr = ({ onValueChange: e, onBlur: t, className: r, value: o, ref: a, ...c }) => {
787
- const { searchTargetId: s, setSearchTargetId: m } = G(), n = _e(null), u = ce(n, a);
788
- return /* @__PURE__ */ te("div", {
789
- className: S.searchContainer,
790
- children: [/* @__PURE__ */ l(lt, {
791
- type: "search",
792
- autoComplete: "off",
793
- "aria-activedescendant": s,
794
- ...c,
795
- ref: u,
796
- value: o,
797
- "data-dropdown-search": "",
798
- className: X(S.search, r),
799
- onValueChange: (d) => e?.(d),
800
- onBlur: (d) => {
801
- m(void 0), t?.(d);
802
- }
803
- }), /* @__PURE__ */ l(gr, {
804
- searchRef: n,
805
- value: o
806
- })]
807
- });
808
- }, vr = ({ className: e, ...t }) => /* @__PURE__ */ l(Ae.Group, {
809
- ...t,
810
- className: X(S.group, e)
811
- }), hr = ({ className: e, ...t }) => /* @__PURE__ */ l(Ae.GroupLabel, {
812
- ...t,
813
- className: X(S.groupLabel, e)
814
- }), br = ({ label: e, scrollable: t, columns: r, style: o, className: a, children: c, ...s }) => {
815
- const m = Ge(r) ? r : void 0;
816
- return /* @__PURE__ */ te(vr, {
817
- ...s,
818
- "data-scrollable": t || void 0,
819
- "data-dropdown-columns": m,
820
- style: {
821
- ...o,
822
- ...i(m) && { gridTemplateColumns: `repeat(${m}, minmax(0, 1fr))` }
823
- },
824
- className: U(S.section, a),
825
- children: [i(e) && /* @__PURE__ */ l(hr, {
826
- "data-dropdown-section-label": "",
827
- children: e
828
- }), c]
829
- });
830
- }, Dr = ({ id: e, initialState: t, initializeSelection: r }) => (ve(() => {
831
- r({
832
- id: e,
833
- state: t
834
- });
835
- }, [
836
- e,
837
- t,
838
- r
839
- ]), null), yr = ({ props: e, storedState: t }) => e.multiple ? {
840
- multiple: !0,
841
- value: e.value ?? (t?.multiple ? t.value : e.defaultValue ?? [])
842
- } : pe(e.value) ? {
843
- multiple: !1,
844
- value: t?.multiple === !1 ? t.value : e.defaultValue ?? null
845
- } : {
846
- multiple: !1,
847
- value: e.value
848
- }, Tr = (e) => {
849
- const { id: t, multiple: r = !1, value: o, defaultValue: a, onValueChange: c, closeOnSelect: s = !r, render: m, ref: n, className: u, children: d, ...v } = e, { type: h, selections: g, initializeSelection: f, updateSelection: C } = G(), E = we(), D = t ?? E, p = yr({
850
- props: e,
851
- storedState: g.get(D)
852
- }), w = ({ value: b, eventDetails: I }) => {
853
- if (!(!p.multiple && p.value === b)) {
854
- if (p.multiple && e.multiple) {
855
- const k = p.value.includes(b) ? p.value.filter((R) => R !== b) : [...p.value, b];
856
- e.onValueChange?.(k, I), !I.isCanceled && pe(o) && C({
857
- id: D,
858
- state: {
859
- multiple: !0,
860
- value: k
861
- }
862
- });
863
- return;
864
- }
865
- e.multiple || (e.onValueChange?.(b, I), !I.isCanceled && pe(o) && C({
866
- id: D,
867
- state: {
868
- multiple: !1,
869
- value: b
870
- }
871
- }));
872
- }
873
- }, T = me({
874
- render: m,
875
- ref: n,
876
- state: p,
877
- props: {
878
- ...v,
879
- id: D,
880
- className: U(S.selectionGroup, u),
881
- role: h === "picker" ? "listbox" : "group",
882
- "aria-multiselectable": h === "picker" ? r : void 0,
883
- children: d
884
- }
885
- });
886
- return /* @__PURE__ */ te(Re.Provider, {
887
- value: {
888
- ...p,
889
- closeOnSelect: s,
890
- select: w
891
- },
892
- children: [pe(o) && /* @__PURE__ */ l(Dr, {
893
- id: D,
894
- initialState: p,
895
- initializeSelection: f
896
- }), T]
897
- });
898
- }, Ir = ({ className: e, ...t }) => /* @__PURE__ */ l(Ae.Separator, {
899
- ...t,
900
- role: "separator",
901
- "data-dropdown-separator": "",
902
- className: U(S.separator, e)
903
- }), _r = ({ type: e = "menu", ...t }) => /* @__PURE__ */ l(Xe, {
904
- ...t,
905
- type: e,
906
- isSubmenu: !0
907
- }), Pe = (e) => j((t) => {
908
- if (!(!i(t) || !ge(t.id)))
909
- return e(t.id);
910
- }, [e]), Ar = ({ color: e, startIcon: t, endIcon: r, description: o, descriptionPlacement: a, shortcut: c, shortcutJoinLabel: s, hasSubmenu: m = !0, children: n, render: u, disabled: d = !1, nativeButton: v = !i(u), openOnHover: h = !0, onKeyDown: g, id: f, ref: C, ...E }) => {
911
- const D = Ke(), { type: p, rootType: w, parentType: T, open: b, setOpen: I, setFocusOnOpen: k, registerTrigger: R } = G(), H = b ? p : w, P = we(), O = Ee({
912
- id: f,
913
- render: u
914
- }) ?? P, q = Se({
915
- id: O,
916
- disabled: d,
917
- isSubmenuTrigger: !0
918
- }), _ = ce(C, Pe(R));
919
- return /* @__PURE__ */ l(Z.Trigger, {
920
- ...E,
921
- ref: _,
922
- id: O,
923
- disabled: d,
924
- nativeButton: v,
925
- openOnHover: h,
926
- role: T === "menu" ? "menuitem" : void 0,
927
- "aria-haspopup": H === "menu" ? "menu" : "dialog",
928
- tabIndex: q.tabIndex,
929
- "data-dropdown-item": "",
930
- onKeyDown: (A) => {
931
- if (g?.(A), A.defaultPrevented || d) return;
932
- const M = ee(D === "rtl" ? "ArrowLeft" : "ArrowRight");
933
- if (A.key === M) {
934
- A.preventDefault(), A.stopPropagation(), k(!0);
935
- const L = A.currentTarget.getAttribute("aria-controls"), W = i(L) ? A.currentTarget.ownerDocument.getElementById(L) : null;
936
- if (b && i(W)) {
937
- ke({
938
- content: W,
939
- type: p
940
- }).focus();
941
- return;
942
- }
943
- I(!0);
944
- }
945
- },
946
- render: (A) => {
947
- const M = Ce({
948
- nativeButton: v,
949
- renderProps: A
950
- });
951
- return /* @__PURE__ */ l(Ie, {
952
- ...A,
953
- render: /* @__PURE__ */ l(Ue, {
954
- render: u,
955
- disabled: M
956
- }),
957
- disabled: d,
958
- color: e,
959
- startIcon: t,
960
- endIcon: r,
961
- description: o,
962
- descriptionPlacement: a,
963
- shortcut: c,
964
- shortcutJoinLabel: s,
965
- hasSubmenu: m,
966
- children: n
967
- });
968
- }
969
- });
970
- }, Cr = ({ className: e, render: t, ref: r, ...o }) => {
971
- const { registerTitle: a } = G(), c = ce(r, Pe(a));
972
- return /* @__PURE__ */ l(qe.Title, {
973
- ...o,
974
- ref: c,
975
- render: t ?? /* @__PURE__ */ l("div", {}),
976
- className: X(S.title, e)
977
- });
978
- }, Er = ({ onKeyDown: e, onClick: t, ref: r, ...o }) => {
979
- const { type: a, rootType: c, open: s, setOpen: m, setInitialFocusEdge: n, setFocusOnOpen: u, registerTrigger: d } = G(), v = s ? a : c, h = ce(r, Pe(d));
980
- return /* @__PURE__ */ l(Z.Trigger, {
981
- ...o,
982
- ref: h,
983
- "aria-haspopup": v === "menu" ? "menu" : "dialog",
984
- onClick: (g) => {
985
- g.stopPropagation(), g.preventDefault(), t?.(g);
986
- },
987
- onKeyDown: (g) => {
988
- e?.(g), !(g.defaultPrevented || g.baseUIHandlerPrevented || o.disabled || v === "panel") && (g.key !== "ArrowDown" && g.key !== "ArrowUp" || (g.preventDefault(), u(!0), n(g.key === "ArrowUp" ? "last" : "first"), m(!0)));
989
- }
990
- });
991
- }, xr = Xe, Zr = {
992
- Root: xr,
993
- Trigger: Er,
994
- Content: Zt,
995
- ActionItem: We,
996
- OptionItem: sr,
997
- SelectionGroup: Tr,
998
- Search: wr,
999
- Header: tr,
1000
- Title: Cr,
1001
- Close: Ht,
1002
- Page: cr,
1003
- Back: Ft,
1004
- Submenu: _r,
1005
- SubmenuTrigger: Ar,
1006
- Section: br,
1007
- Separator: Ir,
1008
- Loading: rr,
1009
- Empty: er
1010
- };
1011
- export {
1012
- Bt as a,
1013
- Ut as i,
1014
- yr as n,
1015
- G as o,
1016
- Dr as r,
1017
- Zr as t
1018
- };