@ultraviolet/plus 3.4.5 → 3.5.0

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 (222) hide show
  1. package/dist/.vite/license.md +3 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/defineProperty.js +15 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js +28 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js +18 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutPropertiesLoose.js +15 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPrimitive.js +17 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPropertyKey.js +12 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/typeof.js +14 -0
  9. package/dist/_virtual/_rolldown/runtime.js +9 -0
  10. package/dist/components/CodeEditor/CodeEditor.d.ts +1 -1
  11. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  12. package/dist/components/CodeEditor/CodeEditor.js +111 -137
  13. package/dist/components/CodeEditor/styles.css.js +18 -15
  14. package/dist/components/ContentCard/Skeleton.d.ts.map +1 -1
  15. package/dist/components/ContentCard/Skeleton.js +31 -27
  16. package/dist/components/ContentCard/index.js +107 -140
  17. package/dist/components/ContentCard/styles.css.d.ts +1 -1
  18. package/dist/components/ContentCard/styles.css.js +24 -19
  19. package/dist/components/ContentCardGroup/Card.js +55 -69
  20. package/dist/components/ContentCardGroup/SkeletonCard.js +28 -14
  21. package/dist/components/ContentCardGroup/index.d.ts +7 -7
  22. package/dist/components/ContentCardGroup/index.js +20 -25
  23. package/dist/components/ContentCardGroup/styles.css.js +6 -11
  24. package/dist/components/Conversation/index.d.ts +29 -23
  25. package/dist/components/Conversation/index.d.ts.map +1 -1
  26. package/dist/components/Conversation/index.js +46 -48
  27. package/dist/components/Conversation/styles.css.js +18 -13
  28. package/dist/components/CustomerSatisfaction/assets/1-5.js +5 -0
  29. package/dist/components/CustomerSatisfaction/assets/1-5NB.js +5 -0
  30. package/dist/components/CustomerSatisfaction/assets/2-5.js +5 -0
  31. package/dist/components/CustomerSatisfaction/assets/2-5NB.js +5 -0
  32. package/dist/components/CustomerSatisfaction/assets/3-5.js +5 -0
  33. package/dist/components/CustomerSatisfaction/assets/3-5NB.js +5 -0
  34. package/dist/components/CustomerSatisfaction/assets/4-5.js +5 -0
  35. package/dist/components/CustomerSatisfaction/assets/4-5NB.js +5 -0
  36. package/dist/components/CustomerSatisfaction/assets/5-5.js +5 -0
  37. package/dist/components/CustomerSatisfaction/assets/5-5NB.js +5 -0
  38. package/dist/components/CustomerSatisfaction/index.d.ts +1 -1
  39. package/dist/components/CustomerSatisfaction/index.d.ts.map +1 -1
  40. package/dist/components/CustomerSatisfaction/index.js +85 -100
  41. package/dist/components/CustomerSatisfaction/styles.css.js +18 -6
  42. package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts.map +1 -1
  43. package/dist/components/EstimateCost/Components/CustomUnitInput.js +39 -52
  44. package/dist/components/EstimateCost/Components/Item.d.ts.map +1 -1
  45. package/dist/components/EstimateCost/Components/Item.js +223 -323
  46. package/dist/components/EstimateCost/Components/LineThrough.d.ts.map +1 -1
  47. package/dist/components/EstimateCost/Components/LineThrough.js +16 -16
  48. package/dist/components/EstimateCost/Components/NumberInput.d.ts.map +1 -1
  49. package/dist/components/EstimateCost/Components/NumberInput.js +33 -37
  50. package/dist/components/EstimateCost/Components/Region.d.ts.map +1 -1
  51. package/dist/components/EstimateCost/Components/Region.js +34 -57
  52. package/dist/components/EstimateCost/Components/Regular.d.ts.map +1 -1
  53. package/dist/components/EstimateCost/Components/Regular.js +21 -26
  54. package/dist/components/EstimateCost/Components/Strong.d.ts.map +1 -1
  55. package/dist/components/EstimateCost/Components/Strong.js +14 -19
  56. package/dist/components/EstimateCost/Components/Unit.d.ts.map +1 -1
  57. package/dist/components/EstimateCost/Components/Unit.js +47 -40
  58. package/dist/components/EstimateCost/Components/Zone.d.ts.map +1 -1
  59. package/dist/components/EstimateCost/Components/Zone.js +33 -55
  60. package/dist/components/EstimateCost/Components/components.css.js +122 -86
  61. package/dist/components/EstimateCost/EstimateCost.d.ts +138 -121
  62. package/dist/components/EstimateCost/EstimateCost.d.ts.map +1 -1
  63. package/dist/components/EstimateCost/EstimateCost.js +79 -124
  64. package/dist/components/EstimateCost/EstimateCostContent.d.ts.map +1 -1
  65. package/dist/components/EstimateCost/EstimateCostContent.js +284 -394
  66. package/dist/components/EstimateCost/EstimateCostProvider.d.ts +1 -1
  67. package/dist/components/EstimateCost/EstimateCostProvider.d.ts.map +1 -1
  68. package/dist/components/EstimateCost/EstimateCostProvider.js +30 -37
  69. package/dist/components/EstimateCost/OverlayComponent.d.ts.map +1 -1
  70. package/dist/components/EstimateCost/OverlayComponent.js +95 -93
  71. package/dist/components/EstimateCost/OverlayContext.d.ts.map +1 -1
  72. package/dist/components/EstimateCost/OverlayContext.js +12 -10
  73. package/dist/components/EstimateCost/constants.js +19 -21
  74. package/dist/components/EstimateCost/helper.d.ts +2 -2
  75. package/dist/components/EstimateCost/helper.d.ts.map +1 -1
  76. package/dist/components/EstimateCost/helper.js +9 -14
  77. package/dist/components/EstimateCost/locales/en.js +24 -23
  78. package/dist/components/EstimateCost/styles.css.d.ts +2 -2
  79. package/dist/components/EstimateCost/styles.css.js +50 -36
  80. package/dist/components/EstimateCost/types.d.ts +1 -1
  81. package/dist/components/EstimateCost/types.d.ts.map +1 -1
  82. package/dist/components/FAQ/index.d.ts.map +1 -1
  83. package/dist/components/FAQ/index.js +37 -31
  84. package/dist/components/FAQ/styles.css.js +6 -4
  85. package/dist/components/InfoTable/InfoTable.d.ts +10 -13
  86. package/dist/components/InfoTable/InfoTable.d.ts.map +1 -1
  87. package/dist/components/InfoTable/InfoTable.js +24 -15
  88. package/dist/components/InfoTable/components/Cell.d.ts.map +1 -1
  89. package/dist/components/InfoTable/components/Cell.js +37 -45
  90. package/dist/components/InfoTable/components/Row.d.ts.map +1 -1
  91. package/dist/components/InfoTable/components/Row.js +19 -27
  92. package/dist/components/InfoTable/context.d.ts +1 -1
  93. package/dist/components/InfoTable/context.d.ts.map +1 -1
  94. package/dist/components/InfoTable/context.js +5 -3
  95. package/dist/components/InfoTable/styles.css.js +6 -10
  96. package/dist/components/Navigation/Footer.d.ts.map +1 -1
  97. package/dist/components/Navigation/Footer.js +59 -75
  98. package/dist/components/Navigation/Header.d.ts.map +1 -1
  99. package/dist/components/Navigation/Header.js +20 -17
  100. package/dist/components/Navigation/Navigation.d.ts +46 -43
  101. package/dist/components/Navigation/Navigation.d.ts.map +1 -1
  102. package/dist/components/Navigation/Navigation.js +23 -27
  103. package/dist/components/Navigation/NavigationContent.d.ts +1 -1
  104. package/dist/components/Navigation/NavigationContent.d.ts.map +1 -1
  105. package/dist/components/Navigation/NavigationContent.js +100 -138
  106. package/dist/components/Navigation/NavigationProvider.d.ts.map +1 -1
  107. package/dist/components/Navigation/NavigationProvider.js +116 -165
  108. package/dist/components/Navigation/components/Group.d.ts.map +1 -1
  109. package/dist/components/Navigation/components/Group.js +36 -43
  110. package/dist/components/Navigation/components/Item.d.ts +1 -1
  111. package/dist/components/Navigation/components/Item.d.ts.map +1 -1
  112. package/dist/components/Navigation/components/Item.js +440 -607
  113. package/dist/components/Navigation/components/ItemProvider.d.ts.map +1 -1
  114. package/dist/components/Navigation/components/ItemProvider.js +13 -8
  115. package/dist/components/Navigation/components/PinnedItems.d.ts.map +1 -1
  116. package/dist/components/Navigation/components/PinnedItems.js +101 -132
  117. package/dist/components/Navigation/components/Separator.js +10 -7
  118. package/dist/components/Navigation/components/ShowHide.d.ts +1 -1
  119. package/dist/components/Navigation/components/ShowHide.d.ts.map +1 -1
  120. package/dist/components/Navigation/components/ShowHide.js +51 -75
  121. package/dist/components/Navigation/components/items.css.js +72 -30
  122. package/dist/components/Navigation/components/styles.css.js +23 -13
  123. package/dist/components/Navigation/locales/en.js +12 -11
  124. package/dist/components/Navigation/styles.css.js +29 -14
  125. package/dist/components/Navigation/variables.css.js +4 -4
  126. package/dist/components/OfferList/OfferList.d.ts +5 -51
  127. package/dist/components/OfferList/OfferList.d.ts.map +1 -1
  128. package/dist/components/OfferList/OfferList.js +11 -78
  129. package/dist/components/OrderSummary/index.d.ts +5 -2
  130. package/dist/components/OrderSummary/index.d.ts.map +1 -1
  131. package/dist/components/OrderSummary/index.js +11 -204
  132. package/dist/components/Plans/index.d.ts +5 -21
  133. package/dist/components/Plans/index.d.ts.map +1 -1
  134. package/dist/components/Plans/index.js +11 -214
  135. package/dist/components/SteppedListCard/index.d.ts +5 -1
  136. package/dist/components/SteppedListCard/index.d.ts.map +1 -1
  137. package/dist/components/SteppedListCard/index.js +11 -0
  138. package/dist/index.js +5 -21
  139. package/dist/plus.css +2 -1
  140. package/package.json +8 -7
  141. package/LICENSE +0 -189
  142. package/dist/components/CustomerSatisfaction/assets/1-5.svg.js +0 -4
  143. package/dist/components/CustomerSatisfaction/assets/1-5NB.svg.js +0 -4
  144. package/dist/components/CustomerSatisfaction/assets/2-5.svg.js +0 -4
  145. package/dist/components/CustomerSatisfaction/assets/2-5NB.svg.js +0 -4
  146. package/dist/components/CustomerSatisfaction/assets/3-5.svg.js +0 -4
  147. package/dist/components/CustomerSatisfaction/assets/3-5NB.svg.js +0 -4
  148. package/dist/components/CustomerSatisfaction/assets/4-5.svg.js +0 -4
  149. package/dist/components/CustomerSatisfaction/assets/4-5NB.svg.js +0 -4
  150. package/dist/components/CustomerSatisfaction/assets/5-5.svg.js +0 -4
  151. package/dist/components/CustomerSatisfaction/assets/5-5NB.svg.js +0 -4
  152. package/dist/components/Navigation/constants.js +0 -10
  153. package/dist/components/OfferList/OfferListProvider.d.ts +0 -30
  154. package/dist/components/OfferList/OfferListProvider.d.ts.map +0 -1
  155. package/dist/components/OfferList/OfferListProvider.js +0 -48
  156. package/dist/components/OfferList/components/Banner.d.ts +0 -13
  157. package/dist/components/OfferList/components/Banner.d.ts.map +0 -1
  158. package/dist/components/OfferList/components/Banner.js +0 -43
  159. package/dist/components/OfferList/components/Cell.d.ts +0 -4
  160. package/dist/components/OfferList/components/Cell.d.ts.map +0 -1
  161. package/dist/components/OfferList/components/Cell.js +0 -35
  162. package/dist/components/OfferList/components/OfferListRowProvider.d.ts +0 -9
  163. package/dist/components/OfferList/components/OfferListRowProvider.d.ts.map +0 -1
  164. package/dist/components/OfferList/components/OfferListRowProvider.js +0 -10
  165. package/dist/components/OfferList/components/Row.d.ts +0 -18
  166. package/dist/components/OfferList/components/Row.d.ts.map +0 -1
  167. package/dist/components/OfferList/components/Row.js +0 -258
  168. package/dist/components/OfferList/styles.css.d.ts +0 -44
  169. package/dist/components/OfferList/styles.css.d.ts.map +0 -1
  170. package/dist/components/OfferList/styles.css.js +0 -40
  171. package/dist/components/OrderSummary/NonScrollableContent.d.ts +0 -20
  172. package/dist/components/OrderSummary/NonScrollableContent.d.ts.map +0 -1
  173. package/dist/components/OrderSummary/NonScrollableContent.js +0 -136
  174. package/dist/components/OrderSummary/Provider.d.ts +0 -15
  175. package/dist/components/OrderSummary/Provider.d.ts.map +0 -1
  176. package/dist/components/OrderSummary/Provider.js +0 -15
  177. package/dist/components/OrderSummary/ScrollableContent.d.ts +0 -2
  178. package/dist/components/OrderSummary/ScrollableContent.d.ts.map +0 -1
  179. package/dist/components/OrderSummary/ScrollableContent.js +0 -314
  180. package/dist/components/OrderSummary/constants.d.ts +0 -3
  181. package/dist/components/OrderSummary/constants.d.ts.map +0 -1
  182. package/dist/components/OrderSummary/constants.js +0 -18
  183. package/dist/components/OrderSummary/helpers.d.ts +0 -28
  184. package/dist/components/OrderSummary/helpers.d.ts.map +0 -1
  185. package/dist/components/OrderSummary/helpers.js +0 -156
  186. package/dist/components/OrderSummary/locales/en.d.ts +0 -11
  187. package/dist/components/OrderSummary/locales/en.d.ts.map +0 -1
  188. package/dist/components/OrderSummary/locales/en.js +0 -12
  189. package/dist/components/OrderSummary/styles.css.d.ts +0 -21
  190. package/dist/components/OrderSummary/styles.css.d.ts.map +0 -1
  191. package/dist/components/OrderSummary/styles.css.js +0 -26
  192. package/dist/components/OrderSummary/types.d.ts +0 -125
  193. package/dist/components/OrderSummary/types.d.ts.map +0 -1
  194. package/dist/components/Plans/FeatureHint.d.ts +0 -7
  195. package/dist/components/Plans/FeatureHint.d.ts.map +0 -1
  196. package/dist/components/Plans/FeatureHint.js +0 -42
  197. package/dist/components/Plans/PlanHeader.d.ts +0 -14
  198. package/dist/components/Plans/PlanHeader.d.ts.map +0 -1
  199. package/dist/components/Plans/PlanHeader.js +0 -96
  200. package/dist/components/Plans/locales/en.d.ts +0 -7
  201. package/dist/components/Plans/locales/en.d.ts.map +0 -1
  202. package/dist/components/Plans/locales/en.js +0 -8
  203. package/dist/components/Plans/styles.css.d.ts +0 -67
  204. package/dist/components/Plans/styles.css.d.ts.map +0 -1
  205. package/dist/components/Plans/styles.css.js +0 -26
  206. package/dist/components/Plans/types.d.ts +0 -38
  207. package/dist/components/Plans/types.d.ts.map +0 -1
  208. package/dist/components/SteppedListCard/Step.d.ts +0 -23
  209. package/dist/components/SteppedListCard/Step.d.ts.map +0 -1
  210. package/dist/components/SteppedListCard/Step.js +0 -61
  211. package/dist/components/SteppedListCard/SteppedListCard.d.ts +0 -69
  212. package/dist/components/SteppedListCard/SteppedListCard.d.ts.map +0 -1
  213. package/dist/components/SteppedListCard/SteppedListCard.js +0 -105
  214. package/dist/components/SteppedListCard/SteppedListContent.d.ts +0 -12
  215. package/dist/components/SteppedListCard/SteppedListContent.d.ts.map +0 -1
  216. package/dist/components/SteppedListCard/SteppedListContent.js +0 -53
  217. package/dist/components/SteppedListCard/helper.d.ts +0 -27
  218. package/dist/components/SteppedListCard/helper.d.ts.map +0 -1
  219. package/dist/components/SteppedListCard/helper.js +0 -41
  220. package/dist/components/SteppedListCard/styles.css.d.ts +0 -9
  221. package/dist/components/SteppedListCard/styles.css.d.ts.map +0 -1
  222. package/dist/components/SteppedListCard/styles.css.js +0 -19
@@ -1,615 +1,448 @@
1
- "use client";
2
- import { jsxs, Fragment, jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
3
+ import { useNavigation } from "../NavigationProvider.js";
4
+ import { ItemContext, ItemProvider } from "./ItemProvider.js";
5
+ import { navigationItemAnimatedIcon, navigationItemBadge, navigationItemCategoryIcon, navigationItemContainer, navigationItemContainerAnimated, navigationItemDragIcon, navigationItemMenu, navigationItemMenuContainer, navigationItemMenuPinned, navigationItemMenuStack, navigationItemPadded, navigationItemPaddingStack, navigationItemPinIcon, navigationItemPinnedButton, navigationItemRelative, navigationItemShowDraggable, navigationItemShowPinButton, navigationItemStackIcon, navigationItemWeakText, navigationItemWrapText } from "./items.css.js";
3
6
  import { ArrowDownIcon } from "@ultraviolet/icons/ArrowDownIcon";
7
+ import { Badge, Button, Expandable, Menu, Stack, Text, Tooltip } from "@ultraviolet/ui";
8
+ import { cn } from "@ultraviolet/utils";
9
+ import { Children, isValidElement, memo, useCallback, useContext, useEffect, useMemo, useReducer, useRef } from "react";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { OpenInNewIcon } from "@ultraviolet/icons/OpenInNewIcon";
4
12
  import { ArrowRightIcon } from "@ultraviolet/icons/ArrowRightIcon";
5
13
  import { OrganizationDashboardCategoryIcon } from "@ultraviolet/icons/category";
6
14
  import { DragIcon } from "@ultraviolet/icons/DragIcon";
7
- import { OpenInNewIcon } from "@ultraviolet/icons/OpenInNewIcon";
8
15
  import { PinOutlineIcon } from "@ultraviolet/icons/PinOutlineIcon";
9
16
  import { UnpinIcon } from "@ultraviolet/icons/UnpinIcon";
10
- import { Stack, Text, Badge, Tooltip, Expandable, Menu, Button } from "@ultraviolet/ui";
11
- import { cn } from "@ultraviolet/utils";
12
- import { memo, useContext, useRef, useEffect, useReducer, useCallback, useMemo, Children, isValidElement } from "react";
13
- import { useNavigation } from "../NavigationProvider.js";
14
- import { ItemContext, ItemProvider } from "./ItemProvider.js";
15
- import { navigationItemCategoryIcon, navigationItemDragIcon, navigationItemWrapText, navigationItemPadded, navigationItemBadge, navigationItemRelative, navigationItemPinnedButton, navigationItemPinIcon, navigationItemStackIcon, navigationItemContainer, navigationItemContainerAnimated, navigationItemShowDraggable, navigationItemShowPinButton, navigationItemWeakText, navigationItemPaddingStack, navigationItemMenuStack, navigationItemMenuContainer, navigationItemAnimatedIcon, navigationItemMenu, navigationItemMenuPinned } from "./items.css.js";
17
+
18
+ //#region src/components/Navigation/components/Item.tsx
16
19
  const onDragStopTrigger = (event) => {
17
- const element = event.currentTarget;
18
- element.style.opacity = "1";
19
- };
20
- const Item = memo(
21
- ({
22
- children,
23
- categoryIcon,
24
- label,
25
- labelDescription,
26
- subLabel,
27
- badgeText,
28
- badgeSentiment,
29
- href,
30
- target,
31
- rel,
32
- onToggle,
33
- onClickPinUnpin,
34
- toggle,
35
- active,
36
- noPinButton,
37
- type = "default",
38
- as,
39
- disabled,
40
- noExpand = false,
41
- index,
42
- id,
43
- "data-testid": dataTestId,
44
- style,
45
- alwaysVisible
46
- }) => {
47
- const context = useNavigation();
48
- if (!context) {
49
- throw new Error(
50
- "Navigation.Item can only be used inside a NavigationProvider."
51
- );
52
- }
53
- const itemProvider = useContext(ItemContext);
54
- const hasParents = !!itemProvider;
55
- const {
56
- expanded,
57
- locales,
58
- pinnedFeature,
59
- pinItem,
60
- unpinItem,
61
- pinnedItems,
62
- pinLimit,
63
- animation,
64
- registerItem,
65
- shouldAnimate,
66
- animationType,
67
- showHide
68
- } = context;
69
- const makeRegisterRef = useRef(null);
70
- useEffect(() => {
71
- makeRegisterRef.current = () => registerItem({
72
- [id]: { active, label, onClickPinUnpin, onToggle }
73
- });
74
- }, [active, id, label, onClickPinUnpin, registerItem, onToggle]);
75
- useEffect(() => {
76
- if (type !== "pinnedGroup" && pinnedFeature) {
77
- makeRegisterRef.current?.();
78
- }
79
- }, [type, pinnedFeature, active, id, label, registerItem]);
80
- const [internalExpanded, onToggleExpand] = useReducer(
81
- (prevState) => !prevState,
82
- Boolean(toggle)
83
- );
84
- const triggerToggle = useCallback(() => {
85
- onToggleExpand();
86
- onToggle?.(internalExpanded);
87
- }, [internalExpanded, onToggle]);
88
- const hasHrefAndNoChildren = href && !children;
89
- const hasPinnedFeatureAndNoChildren = pinnedFeature && !children && !noPinButton;
90
- const isItemPinned = pinnedItems.includes(id);
91
- const shouldShowPinnedButton = useMemo(() => {
92
- if (href || disabled) {
93
- return false;
94
- }
95
- if (hasPinnedFeatureAndNoChildren && type !== "default") {
96
- return true;
97
- }
98
- if (hasPinnedFeatureAndNoChildren) {
99
- return true;
100
- }
101
- return false;
102
- }, [disabled, hasPinnedFeatureAndNoChildren, href, type]);
103
- const hasActiveChildren = useMemo(() => {
104
- if (!children) {
105
- return false;
106
- }
107
- return Children.map(children, (child) => {
108
- if (isValidElement(child)) {
109
- if ("to" in child.props) {
110
- return child.props.children?.props.active;
111
- }
112
- return child.props.active;
113
- }
114
- return null;
115
- }).includes(true);
116
- }, [children]);
117
- const containerTag = useMemo(() => {
118
- if (as) {
119
- return as;
120
- }
121
- if (hasHrefAndNoChildren) {
122
- return "a";
123
- }
124
- if (noExpand) {
125
- return "div";
126
- }
127
- return "button";
128
- }, [as, hasHrefAndNoChildren, noExpand]);
129
- const ArrowIcon = useMemo(
130
- () => internalExpanded ? ArrowDownIcon : ArrowRightIcon,
131
- [internalExpanded]
132
- );
133
- const PinUnpinIcon = useMemo(
134
- () => isItemPinned ? UnpinIcon : PinOutlineIcon,
135
- [isItemPinned]
136
- );
137
- const ariaExpanded = useMemo(() => {
138
- if (hasHrefAndNoChildren && internalExpanded) {
139
- return true;
140
- }
141
- if (hasHrefAndNoChildren && !internalExpanded) {
142
- return false;
143
- }
144
- return void 0;
145
- }, [hasHrefAndNoChildren, internalExpanded]);
146
- const isPinDisabled = pinnedItems.length >= pinLimit;
147
- const pinTooltipLocale = useMemo(() => {
148
- if (isPinDisabled) {
149
- return locales["navigation.pin.limit"];
150
- }
151
- if (isItemPinned) {
152
- return locales["navigation.unpin.tooltip"];
153
- }
154
- return locales["navigation.pin.tooltip"];
155
- }, [isItemPinned, isPinDisabled, locales]);
156
- const onDragStart = useCallback(
157
- (event) => {
158
- if (expanded) {
159
- event.dataTransfer.setData(
160
- "text/plain",
161
- JSON.stringify({ index, label })
162
- );
163
- const element = event.currentTarget;
164
- element.style.opacity = "0.5";
165
- }
166
- return void 0;
167
- },
168
- [expanded, index, label]
169
- );
170
- const onDragEnd = useCallback(
171
- (event) => expanded ? onDragStopTrigger(event) : void 0,
172
- [expanded]
173
- );
174
- const showDraggableIcon = !noExpand && pinnedFeature && shouldShowPinnedButton && !disabled;
175
- const showPinIcon = !(noExpand || disabled) && shouldShowPinnedButton && pinnedFeature;
176
- const shouldHaveWeakText = !!children && !active && shouldShowPinnedButton && !disabled;
177
- if (!alwaysVisible && showHide === "hide") {
178
- return null;
179
- }
180
- if (expanded || !expanded && animation === "expand") {
181
- return /* @__PURE__ */ jsxs(Fragment, { children: [
182
- /* @__PURE__ */ jsxs(
183
- Stack,
184
- {
185
- alignItems: categoryIcon ? "flex-start" : "center",
186
- "aria-expanded": ariaExpanded,
187
- as: containerTag,
188
- className: cn(
189
- navigationItemContainer({
190
- disabled,
191
- hasActive: hasActiveChildren,
192
- isActive: !!active,
193
- noExpand,
194
- subLabel: !!subLabel
195
- }),
196
- shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : "",
197
- showDraggableIcon ? navigationItemShowDraggable : "",
198
- showPinIcon ? navigationItemShowPinButton : "",
199
- shouldHaveWeakText ? navigationItemWeakText : ""
200
- ),
201
- "data-testid": dataTestId,
202
- direction: "row",
203
- disabled: containerTag === "button" ? disabled : void 0,
204
- draggable: type === "pinned" && expanded,
205
- gap: 1,
206
- href,
207
- id,
208
- justifyContent: "space-between",
209
- onClick: triggerToggle,
210
- onDragEnd,
211
- onDragStart,
212
- rel,
213
- style,
214
- target,
215
- children: [
216
- /* @__PURE__ */ jsxs(
217
- Stack,
218
- {
219
- alignItems: categoryIcon ? "flex-start" : "center",
220
- direction: "row",
221
- gap: 1,
222
- justifyContent: "center",
223
- children: [
224
- categoryIcon ? /* @__PURE__ */ jsx(
225
- Stack,
226
- {
227
- alignItems: "center",
228
- className: navigationItemCategoryIcon,
229
- justifyContent: "center",
230
- children: categoryIcon
231
- }
232
- ) : null,
233
- type === "pinned" && expanded ? /* @__PURE__ */ jsx(
234
- DragIcon,
235
- {
236
- className: navigationItemDragIcon,
237
- disabled,
238
- prominence: "weak",
239
- sentiment: "neutral",
240
- size: "small"
241
- }
242
- ) : null,
243
- /* @__PURE__ */ jsxs(Stack, { children: [
244
- animation ? null : /* @__PURE__ */ jsxs(
245
- Text,
246
- {
247
- as: "span",
248
- className: navigationItemWrapText({
249
- disabled,
250
- weak: hasActiveChildren && !noExpand && !disabled && !!active
251
- }),
252
- "data-animation": animation,
253
- disabled,
254
- prominence: (categoryIcon || !hasParents) && !active ? "strong" : "default",
255
- sentiment: active ? "primary" : "neutral",
256
- variant: "bodySmallStrong",
257
- whiteSpace: "pre-wrap",
258
- children: [
259
- label,
260
- labelDescription ? /* @__PURE__ */ jsx("span", { className: navigationItemPadded, children: labelDescription }) : null
261
- ]
262
- }
263
- ),
264
- subLabel && !animation ? /* @__PURE__ */ jsx(
265
- Text,
266
- {
267
- as: "span",
268
- className: navigationItemWrapText({
269
- disabled,
270
- weak: hasActiveChildren && !noExpand && !disabled && !!active
271
- }),
272
- "data-animation": animation,
273
- disabled,
274
- prominence: "weak",
275
- sentiment: "neutral",
276
- variant: "caption",
277
- whiteSpace: "pre-wrap",
278
- children: subLabel
279
- }
280
- ) : null
281
- ] })
282
- ]
283
- }
284
- ),
285
- /* @__PURE__ */ jsxs(
286
- Stack,
287
- {
288
- alignItems: "center",
289
- direction: "row",
290
- gap: href ? 1 : void 0,
291
- children: [
292
- badgeText || hasPinnedFeatureAndNoChildren ? /* @__PURE__ */ jsxs(Fragment, { children: [
293
- badgeText && !animation ? /* @__PURE__ */ jsx(
294
- Badge,
295
- {
296
- className: navigationItemBadge,
297
- disabled,
298
- prominence: "strong",
299
- sentiment: badgeSentiment,
300
- size: "small",
301
- children: badgeText
302
- }
303
- ) : null,
304
- shouldShowPinnedButton ? /* @__PURE__ */ jsx(
305
- Tooltip,
306
- {
307
- placement: "right",
308
- tabIndex: -1,
309
- text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
310
- children: /* @__PURE__ */ jsx("div", { className: navigationItemRelative, children: /* @__PURE__ */ jsx(
311
- "button",
312
- {
313
- "aria-disabled": isItemPinned ? false : isPinDisabled,
314
- "aria-label": isItemPinned ? "unpin" : "pin",
315
- className: navigationItemPinnedButton,
316
- onClick: (event) => {
317
- if (pinnedItems.length < pinLimit || isItemPinned) {
318
- event.preventDefault();
319
- event.stopPropagation();
320
- let newValue;
321
- if (isItemPinned) {
322
- newValue = unpinItem(id);
323
- } else {
324
- newValue = pinItem(id);
325
- }
326
- onClickPinUnpin?.({
327
- id,
328
- state: isItemPinned ? "unpin" : "pin",
329
- totalPinned: newValue
330
- });
331
- }
332
- },
333
- onKeyDown: () => {
334
- },
335
- type: "button",
336
- children: /* @__PURE__ */ jsx(
337
- PinUnpinIcon,
338
- {
339
- className: navigationItemPinIcon[active ? "active" : "inactive"],
340
- disabled: isItemPinned ? false : isPinDisabled,
341
- sentiment: active ? "primary" : "neutral",
342
- size: "medium"
343
- }
344
- )
345
- }
346
- ) })
347
- }
348
- ) : null
349
- ] }) : null,
350
- hasHrefAndNoChildren && target === "_blank" && !animation ? /* @__PURE__ */ jsx(
351
- OpenInNewIcon,
352
- {
353
- disabled,
354
- prominence: "default",
355
- sentiment: "neutral"
356
- }
357
- ) : null,
358
- children ? /* @__PURE__ */ jsx(
359
- Stack,
360
- {
361
- alignItems: "center",
362
- className: navigationItemStackIcon,
363
- direction: "row",
364
- gap: 1,
365
- children: animation || noExpand ? null : /* @__PURE__ */ jsx(ArrowIcon, { prominence: "weak", sentiment: "neutral" })
366
- }
367
- ) : null
368
- ]
369
- }
370
- )
371
- ]
372
- }
373
- ),
374
- children ? (
375
- // biome-ignore lint/complexity/noUselessFragments: allow multiple ternary
376
- /* @__PURE__ */ jsx(Fragment, { children: noExpand ? /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(
377
- Stack,
378
- {
379
- className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({
380
- hide: shouldAnimate && animationType === "complex" && animation === "expand"
381
- }),
382
- width: animation ? "100%" : void 0,
383
- children
384
- }
385
- ) }) : /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(Expandable, { animationDuration: 0, opened: internalExpanded, children: /* @__PURE__ */ jsx(
386
- Stack,
387
- {
388
- className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({
389
- hide: shouldAnimate && animationType === "complex" && animation === "expand"
390
- }),
391
- width: animation ? "100%" : void 0,
392
- children
393
- }
394
- ) }) }) })
395
- ) : null
396
- ] });
397
- }
398
- if (categoryIcon || Children.count(children) > 0 && !hasParents) {
399
- return /* @__PURE__ */ jsx(
400
- Stack,
401
- {
402
- alignItems: "flex-start",
403
- className: navigationItemMenuStack,
404
- gap: 1,
405
- justifyContent: "flex-start",
406
- style,
407
- children: Children.count(children) > 0 ? /* @__PURE__ */ jsx(
408
- Menu,
409
- {
410
- className: navigationItemMenuContainer,
411
- disclosure: /* @__PURE__ */ jsx(
412
- Button,
413
- {
414
- "aria-label": label,
415
- sentiment: "neutral",
416
- size: "small",
417
- variant: hasActiveChildren ? "filled" : "ghost",
418
- children: categoryIcon ? /* @__PURE__ */ jsx(
419
- Stack,
420
- {
421
- alignItems: "center",
422
- direction: "row",
423
- gap: 1,
424
- justifyContent: "center",
425
- children: categoryIcon
426
- }
427
- ) : null
428
- }
429
- ),
430
- dynamicDomRendering: false,
431
- placement: "right",
432
- triggerMethod: "hover",
433
- children: /* @__PURE__ */ jsx(ItemProvider, { children })
434
- }
435
- ) : /* @__PURE__ */ jsx(Tooltip, { placement: "right", tabIndex: -1, text: label, children: /* @__PURE__ */ jsx(
436
- Button,
437
- {
438
- "aria-label": label,
439
- sentiment: "neutral",
440
- size: "small",
441
- variant: active ? "filled" : "ghost",
442
- children: /* @__PURE__ */ jsx(
443
- Stack,
444
- {
445
- alignItems: "center",
446
- direction: "row",
447
- gap: 1,
448
- justifyContent: "center",
449
- children: categoryIcon ?? /* @__PURE__ */ jsx(
450
- OrganizationDashboardCategoryIcon,
451
- {
452
- variant: active ? "primary" : "neutral"
453
- }
454
- )
455
- }
456
- )
457
- }
458
- ) })
459
- }
460
- );
461
- }
462
- if (hasParents) {
463
- return /* @__PURE__ */ jsx(
464
- Menu.Item,
465
- {
466
- active,
467
- borderless: true,
468
- className: cn(
469
- navigationItemMenu,
470
- pinnedFeature && shouldShowPinnedButton ? navigationItemMenuPinned : ""
471
- ),
472
- disabled,
473
- href,
474
- onClick: () => onToggle?.(!!active),
475
- rel,
476
- sentiment: active ? "primary" : "neutral",
477
- style,
478
- target,
479
- children: /* @__PURE__ */ jsxs(
480
- Stack,
481
- {
482
- alignItems: "center",
483
- direction: "row",
484
- flex: 1,
485
- gap: 1,
486
- justifyContent: "space-between",
487
- width: "100%",
488
- children: [
489
- animation ? null : /* @__PURE__ */ jsx(
490
- Text,
491
- {
492
- as: "span",
493
- className: navigationItemWrapText({
494
- disabled,
495
- weak: hasActiveChildren && !noExpand && !disabled && !!active
496
- }),
497
- variant: "bodySmall",
498
- whiteSpace: "pre-wrap",
499
- children: label
500
- }
501
- ),
502
- labelDescription ? /* @__PURE__ */ jsx("span", { className: navigationItemPadded, children: labelDescription }) : null,
503
- /* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
504
- badgeText && !animation ? /* @__PURE__ */ jsx(
505
- Badge,
506
- {
507
- className: navigationItemBadge,
508
- disabled,
509
- prominence: "strong",
510
- sentiment: badgeSentiment,
511
- size: "small",
512
- children: badgeText
513
- }
514
- ) : null,
515
- hasHrefAndNoChildren && target === "_blank" ? /* @__PURE__ */ jsx(
516
- OpenInNewIcon,
517
- {
518
- className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
519
- disabled,
520
- prominence: "weak",
521
- sentiment: "neutral"
522
- }
523
- ) : null,
524
- shouldShowPinnedButton ? /* @__PURE__ */ jsx(
525
- Tooltip,
526
- {
527
- placement: "right",
528
- text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
529
- children: /* @__PURE__ */ jsx("div", { className: navigationItemRelative, children: /* @__PURE__ */ jsx(
530
- "button",
531
- {
532
- "aria-disabled": isItemPinned ? false : isPinDisabled,
533
- "aria-label": isItemPinned ? "unpin" : "pin",
534
- className: navigationItemPinnedButton,
535
- onClick: (event) => {
536
- if (pinnedItems.length < pinLimit || isItemPinned) {
537
- event.preventDefault();
538
- event.stopPropagation();
539
- let newValue;
540
- if (isItemPinned) {
541
- newValue = unpinItem(id);
542
- } else {
543
- newValue = pinItem(id);
544
- }
545
- onClickPinUnpin?.({
546
- id,
547
- state: isItemPinned ? "unpin" : "pin",
548
- totalPinned: newValue
549
- });
550
- }
551
- },
552
- onKeyDown: () => {
553
- },
554
- type: "button",
555
- children: /* @__PURE__ */ jsx(
556
- PinUnpinIcon,
557
- {
558
- className: navigationItemPinIcon[active ? "active" : "inactive"],
559
- disabled: isItemPinned ? false : isPinDisabled,
560
- sentiment: active ? "primary" : "neutral",
561
- size: "medium"
562
- }
563
- )
564
- }
565
- ) })
566
- }
567
- ) : null
568
- ] })
569
- ]
570
- }
571
- )
572
- }
573
- );
574
- }
575
- if (!hasParents && href) {
576
- return /* @__PURE__ */ jsx(Tooltip, { placement: "right", text: label, children: /* @__PURE__ */ jsx(
577
- Stack,
578
- {
579
- alignItems: "flex-start",
580
- className: navigationItemMenuStack,
581
- gap: 1,
582
- justifyContent: "flex-start",
583
- children: /* @__PURE__ */ jsx(
584
- Stack,
585
- {
586
- alignItems: "center",
587
- as: containerTag,
588
- className: cn(
589
- navigationItemContainer({ disabled }),
590
- shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : ""
591
- ),
592
- gap: 1,
593
- href,
594
- justifyContent: "center",
595
- rel,
596
- target,
597
- children: /* @__PURE__ */ jsx(
598
- OpenInNewIcon,
599
- {
600
- className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
601
- prominence: "weak",
602
- sentiment: "neutral"
603
- }
604
- )
605
- }
606
- )
607
- }
608
- ) });
609
- }
610
- return null;
611
- }
612
- );
613
- export {
614
- Item
20
+ const element = event.currentTarget;
21
+ element.style.opacity = "1";
615
22
  };
23
+ const Item = memo(({ children, categoryIcon, label, labelDescription, subLabel, badgeText, badgeSentiment, href, target, rel, onToggle, onClickPinUnpin, toggle, active, noPinButton, type = "default", as, disabled, noExpand = false, index, id, "data-testid": dataTestId, style, alwaysVisible }) => {
24
+ const context = useNavigation();
25
+ if (!context) throw new Error("Navigation.Item can only be used inside a NavigationProvider.");
26
+ const hasParents = !!useContext(ItemContext);
27
+ const { expanded, locales, pinnedFeature, pinItem, unpinItem, pinnedItems, pinLimit, animation, registerItem, shouldAnimate, animationType, showHide } = context;
28
+ const makeRegisterRef = useRef(null);
29
+ useEffect(() => {
30
+ makeRegisterRef.current = () => registerItem({ [id]: {
31
+ active,
32
+ label,
33
+ onClickPinUnpin,
34
+ onToggle
35
+ } });
36
+ }, [
37
+ active,
38
+ id,
39
+ label,
40
+ onClickPinUnpin,
41
+ registerItem,
42
+ onToggle
43
+ ]);
44
+ useEffect(() => {
45
+ if (type !== "pinnedGroup" && pinnedFeature) {
46
+ var _makeRegisterRef$curr;
47
+ (_makeRegisterRef$curr = makeRegisterRef.current) === null || _makeRegisterRef$curr === void 0 || _makeRegisterRef$curr.call(makeRegisterRef);
48
+ }
49
+ }, [
50
+ type,
51
+ pinnedFeature,
52
+ active,
53
+ id,
54
+ label,
55
+ registerItem
56
+ ]);
57
+ const [internalExpanded, onToggleExpand] = useReducer((prevState) => !prevState, Boolean(toggle));
58
+ const triggerToggle = useCallback(() => {
59
+ onToggleExpand();
60
+ onToggle === null || onToggle === void 0 || onToggle(internalExpanded);
61
+ }, [internalExpanded, onToggle]);
62
+ const hasHrefAndNoChildren = href && !children;
63
+ const hasPinnedFeatureAndNoChildren = pinnedFeature && !children && !noPinButton;
64
+ const isItemPinned = pinnedItems.includes(id);
65
+ const shouldShowPinnedButton = useMemo(() => {
66
+ if (href || disabled) return false;
67
+ if (hasPinnedFeatureAndNoChildren && type !== "default") return true;
68
+ if (hasPinnedFeatureAndNoChildren) return true;
69
+ return false;
70
+ }, [
71
+ disabled,
72
+ hasPinnedFeatureAndNoChildren,
73
+ href,
74
+ type
75
+ ]);
76
+ const hasActiveChildren = useMemo(() => {
77
+ if (!children) return false;
78
+ return Children.map(children, (child) => {
79
+ if (isValidElement(child)) {
80
+ if ("to" in child.props) {
81
+ var _child$props$children;
82
+ return (_child$props$children = child.props.children) === null || _child$props$children === void 0 ? void 0 : _child$props$children.props.active;
83
+ }
84
+ return child.props.active;
85
+ }
86
+ return null;
87
+ }).includes(true);
88
+ }, [children]);
89
+ const containerTag = useMemo(() => {
90
+ if (as) return as;
91
+ if (hasHrefAndNoChildren) return "a";
92
+ if (noExpand) return "div";
93
+ return "button";
94
+ }, [
95
+ as,
96
+ hasHrefAndNoChildren,
97
+ noExpand
98
+ ]);
99
+ const ArrowIcon = useMemo(() => internalExpanded ? ArrowDownIcon : ArrowRightIcon, [internalExpanded]);
100
+ const PinUnpinIcon = useMemo(() => isItemPinned ? UnpinIcon : PinOutlineIcon, [isItemPinned]);
101
+ const ariaExpanded = useMemo(() => {
102
+ if (hasHrefAndNoChildren && internalExpanded) return true;
103
+ if (hasHrefAndNoChildren && !internalExpanded) return false;
104
+ }, [hasHrefAndNoChildren, internalExpanded]);
105
+ const isPinDisabled = pinnedItems.length >= pinLimit;
106
+ const pinTooltipLocale = useMemo(() => {
107
+ if (isPinDisabled) return locales["navigation.pin.limit"];
108
+ if (isItemPinned) return locales["navigation.unpin.tooltip"];
109
+ return locales["navigation.pin.tooltip"];
110
+ }, [
111
+ isItemPinned,
112
+ isPinDisabled,
113
+ locales
114
+ ]);
115
+ const onDragStart = useCallback((event) => {
116
+ if (expanded) {
117
+ event.dataTransfer.setData("text/plain", JSON.stringify({
118
+ index,
119
+ label
120
+ }));
121
+ const element = event.currentTarget;
122
+ element.style.opacity = "0.5";
123
+ }
124
+ }, [
125
+ expanded,
126
+ index,
127
+ label
128
+ ]);
129
+ const onDragEnd = useCallback((event) => expanded ? onDragStopTrigger(event) : void 0, [expanded]);
130
+ const showDraggableIcon = !noExpand && pinnedFeature && shouldShowPinnedButton && !disabled;
131
+ const showPinIcon = !(noExpand || disabled) && shouldShowPinnedButton && pinnedFeature;
132
+ const shouldHaveWeakText = !!children && !active && shouldShowPinnedButton && !disabled;
133
+ if (!alwaysVisible && showHide === "hide") return null;
134
+ if (expanded || !expanded && animation === "expand") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Stack, {
135
+ alignItems: categoryIcon ? "flex-start" : "center",
136
+ "aria-expanded": ariaExpanded,
137
+ as: containerTag,
138
+ className: cn(navigationItemContainer({
139
+ disabled,
140
+ hasActive: hasActiveChildren,
141
+ isActive: !!active,
142
+ noExpand,
143
+ subLabel: !!subLabel
144
+ }), shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : "", showDraggableIcon ? navigationItemShowDraggable : "", showPinIcon ? navigationItemShowPinButton : "", shouldHaveWeakText ? navigationItemWeakText : ""),
145
+ "data-testid": dataTestId,
146
+ direction: "row",
147
+ disabled: containerTag === "button" ? disabled : void 0,
148
+ draggable: type === "pinned" && expanded,
149
+ gap: 1,
150
+ href,
151
+ id,
152
+ justifyContent: "space-between",
153
+ onClick: triggerToggle,
154
+ onDragEnd,
155
+ onDragStart,
156
+ rel,
157
+ style,
158
+ target,
159
+ children: [/* @__PURE__ */ jsxs(Stack, {
160
+ alignItems: categoryIcon ? "flex-start" : "center",
161
+ direction: "row",
162
+ gap: 1,
163
+ justifyContent: "center",
164
+ children: [
165
+ categoryIcon ? /* @__PURE__ */ jsx(Stack, {
166
+ alignItems: "center",
167
+ className: navigationItemCategoryIcon,
168
+ justifyContent: "center",
169
+ children: categoryIcon
170
+ }) : null,
171
+ type === "pinned" && expanded ? /* @__PURE__ */ jsx(DragIcon, {
172
+ className: navigationItemDragIcon,
173
+ disabled,
174
+ prominence: "weak",
175
+ sentiment: "neutral",
176
+ size: "small"
177
+ }) : null,
178
+ /* @__PURE__ */ jsxs(Stack, { children: [animation ? null : /* @__PURE__ */ jsxs(Text, {
179
+ as: "span",
180
+ className: navigationItemWrapText({
181
+ disabled,
182
+ weak: hasActiveChildren && !noExpand && !disabled && !!active
183
+ }),
184
+ "data-animation": animation,
185
+ disabled,
186
+ prominence: (categoryIcon || !hasParents) && !active ? "strong" : "default",
187
+ sentiment: active ? "primary" : "neutral",
188
+ variant: "bodySmallStrong",
189
+ whiteSpace: "pre-wrap",
190
+ children: [label, labelDescription ? /* @__PURE__ */ jsx("span", {
191
+ className: navigationItemPadded,
192
+ children: labelDescription
193
+ }) : null]
194
+ }), subLabel && !animation ? /* @__PURE__ */ jsx(Text, {
195
+ as: "span",
196
+ className: navigationItemWrapText({
197
+ disabled,
198
+ weak: hasActiveChildren && !noExpand && !disabled && !!active
199
+ }),
200
+ "data-animation": animation,
201
+ disabled,
202
+ prominence: "weak",
203
+ sentiment: "neutral",
204
+ variant: "caption",
205
+ whiteSpace: "pre-wrap",
206
+ children: subLabel
207
+ }) : null] })
208
+ ]
209
+ }), /* @__PURE__ */ jsxs(Stack, {
210
+ alignItems: "center",
211
+ direction: "row",
212
+ gap: href ? 1 : void 0,
213
+ children: [
214
+ badgeText || hasPinnedFeatureAndNoChildren ? /* @__PURE__ */ jsxs(Fragment, { children: [badgeText && !animation ? /* @__PURE__ */ jsx(Badge, {
215
+ className: navigationItemBadge,
216
+ disabled,
217
+ prominence: "strong",
218
+ sentiment: badgeSentiment,
219
+ size: "small",
220
+ children: badgeText
221
+ }) : null, shouldShowPinnedButton ? /* @__PURE__ */ jsx(Tooltip, {
222
+ placement: "right",
223
+ tabIndex: -1,
224
+ text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
225
+ children: /* @__PURE__ */ jsx("div", {
226
+ className: navigationItemRelative,
227
+ children: /* @__PURE__ */ jsx("button", {
228
+ "aria-disabled": isItemPinned ? false : isPinDisabled,
229
+ "aria-label": isItemPinned ? "unpin" : "pin",
230
+ className: navigationItemPinnedButton,
231
+ onClick: (event) => {
232
+ if (pinnedItems.length < pinLimit || isItemPinned) {
233
+ event.preventDefault();
234
+ event.stopPropagation();
235
+ let newValue;
236
+ if (isItemPinned) newValue = unpinItem(id);
237
+ else newValue = pinItem(id);
238
+ onClickPinUnpin === null || onClickPinUnpin === void 0 || onClickPinUnpin({
239
+ id,
240
+ state: isItemPinned ? "unpin" : "pin",
241
+ totalPinned: newValue
242
+ });
243
+ }
244
+ },
245
+ onKeyDown: () => {},
246
+ type: "button",
247
+ children: /* @__PURE__ */ jsx(PinUnpinIcon, {
248
+ className: navigationItemPinIcon[active ? "active" : "inactive"],
249
+ disabled: isItemPinned ? false : isPinDisabled,
250
+ sentiment: active ? "primary" : "neutral",
251
+ size: "medium"
252
+ })
253
+ })
254
+ })
255
+ }) : null] }) : null,
256
+ hasHrefAndNoChildren && target === "_blank" && !animation ? /* @__PURE__ */ jsx(OpenInNewIcon, {
257
+ disabled,
258
+ prominence: "default",
259
+ sentiment: "neutral"
260
+ }) : null,
261
+ children ? /* @__PURE__ */ jsx(Stack, {
262
+ alignItems: "center",
263
+ className: navigationItemStackIcon,
264
+ direction: "row",
265
+ gap: 1,
266
+ children: animation || noExpand ? null : /* @__PURE__ */ jsx(ArrowIcon, {
267
+ prominence: "weak",
268
+ sentiment: "neutral"
269
+ })
270
+ }) : null
271
+ ]
272
+ })]
273
+ }), children ? /* @__PURE__ */ jsx(Fragment, { children: noExpand ? /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(Stack, {
274
+ className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({ hide: shouldAnimate && animationType === "complex" && animation === "expand" }),
275
+ width: animation ? "100%" : void 0,
276
+ children
277
+ }) }) : /* @__PURE__ */ jsx(ItemProvider, { children: /* @__PURE__ */ jsx(Expandable, {
278
+ animationDuration: 0,
279
+ opened: internalExpanded,
280
+ children: /* @__PURE__ */ jsx(Stack, {
281
+ className: noExpand || type === "pinnedGroup" ? "" : navigationItemPaddingStack({ hide: shouldAnimate && animationType === "complex" && animation === "expand" }),
282
+ width: animation ? "100%" : void 0,
283
+ children
284
+ })
285
+ }) }) }) : null] });
286
+ if (categoryIcon || Children.count(children) > 0 && !hasParents) return /* @__PURE__ */ jsx(Stack, {
287
+ alignItems: "flex-start",
288
+ className: navigationItemMenuStack,
289
+ gap: 1,
290
+ justifyContent: "flex-start",
291
+ style,
292
+ children: Children.count(children) > 0 ? /* @__PURE__ */ jsx(Menu, {
293
+ className: navigationItemMenuContainer,
294
+ disclosure: /* @__PURE__ */ jsx(Button, {
295
+ "aria-label": label,
296
+ sentiment: "neutral",
297
+ size: "small",
298
+ variant: hasActiveChildren ? "filled" : "ghost",
299
+ children: categoryIcon ? /* @__PURE__ */ jsx(Stack, {
300
+ alignItems: "center",
301
+ direction: "row",
302
+ gap: 1,
303
+ justifyContent: "center",
304
+ children: categoryIcon
305
+ }) : null
306
+ }),
307
+ dynamicDomRendering: false,
308
+ placement: "right",
309
+ triggerMethod: "hover",
310
+ children: /* @__PURE__ */ jsx(ItemProvider, { children })
311
+ }) : /* @__PURE__ */ jsx(Tooltip, {
312
+ placement: "right",
313
+ tabIndex: -1,
314
+ text: label,
315
+ children: /* @__PURE__ */ jsx(Button, {
316
+ "aria-label": label,
317
+ sentiment: "neutral",
318
+ size: "small",
319
+ variant: active ? "filled" : "ghost",
320
+ children: /* @__PURE__ */ jsx(Stack, {
321
+ alignItems: "center",
322
+ direction: "row",
323
+ gap: 1,
324
+ justifyContent: "center",
325
+ children: categoryIcon !== null && categoryIcon !== void 0 ? categoryIcon : /* @__PURE__ */ jsx(OrganizationDashboardCategoryIcon, { variant: active ? "primary" : "neutral" })
326
+ })
327
+ })
328
+ })
329
+ });
330
+ if (hasParents) return /* @__PURE__ */ jsx(Menu.Item, {
331
+ active,
332
+ borderless: true,
333
+ className: cn(navigationItemMenu, pinnedFeature && shouldShowPinnedButton ? navigationItemMenuPinned : ""),
334
+ disabled,
335
+ href,
336
+ onClick: () => onToggle === null || onToggle === void 0 ? void 0 : onToggle(!!active),
337
+ rel,
338
+ sentiment: active ? "primary" : "neutral",
339
+ style,
340
+ target,
341
+ children: /* @__PURE__ */ jsxs(Stack, {
342
+ alignItems: "center",
343
+ direction: "row",
344
+ flex: 1,
345
+ gap: 1,
346
+ justifyContent: "space-between",
347
+ width: "100%",
348
+ children: [
349
+ animation ? null : /* @__PURE__ */ jsx(Text, {
350
+ as: "span",
351
+ className: navigationItemWrapText({
352
+ disabled,
353
+ weak: hasActiveChildren && !noExpand && !disabled && !!active
354
+ }),
355
+ variant: "bodySmall",
356
+ whiteSpace: "pre-wrap",
357
+ children: label
358
+ }),
359
+ labelDescription ? /* @__PURE__ */ jsx("span", {
360
+ className: navigationItemPadded,
361
+ children: labelDescription
362
+ }) : null,
363
+ /* @__PURE__ */ jsxs(Stack, {
364
+ direction: "row",
365
+ children: [
366
+ badgeText && !animation ? /* @__PURE__ */ jsx(Badge, {
367
+ className: navigationItemBadge,
368
+ disabled,
369
+ prominence: "strong",
370
+ sentiment: badgeSentiment,
371
+ size: "small",
372
+ children: badgeText
373
+ }) : null,
374
+ hasHrefAndNoChildren && target === "_blank" ? /* @__PURE__ */ jsx(OpenInNewIcon, {
375
+ className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
376
+ disabled,
377
+ prominence: "weak",
378
+ sentiment: "neutral"
379
+ }) : null,
380
+ shouldShowPinnedButton ? /* @__PURE__ */ jsx(Tooltip, {
381
+ placement: "right",
382
+ text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale,
383
+ children: /* @__PURE__ */ jsx("div", {
384
+ className: navigationItemRelative,
385
+ children: /* @__PURE__ */ jsx("button", {
386
+ "aria-disabled": isItemPinned ? false : isPinDisabled,
387
+ "aria-label": isItemPinned ? "unpin" : "pin",
388
+ className: navigationItemPinnedButton,
389
+ onClick: (event) => {
390
+ if (pinnedItems.length < pinLimit || isItemPinned) {
391
+ event.preventDefault();
392
+ event.stopPropagation();
393
+ let newValue;
394
+ if (isItemPinned) newValue = unpinItem(id);
395
+ else newValue = pinItem(id);
396
+ onClickPinUnpin === null || onClickPinUnpin === void 0 || onClickPinUnpin({
397
+ id,
398
+ state: isItemPinned ? "unpin" : "pin",
399
+ totalPinned: newValue
400
+ });
401
+ }
402
+ },
403
+ onKeyDown: () => {},
404
+ type: "button",
405
+ children: /* @__PURE__ */ jsx(PinUnpinIcon, {
406
+ className: navigationItemPinIcon[active ? "active" : "inactive"],
407
+ disabled: isItemPinned ? false : isPinDisabled,
408
+ sentiment: active ? "primary" : "neutral",
409
+ size: "medium"
410
+ })
411
+ })
412
+ })
413
+ }) : null
414
+ ]
415
+ })
416
+ ]
417
+ })
418
+ });
419
+ if (!hasParents && href) return /* @__PURE__ */ jsx(Tooltip, {
420
+ placement: "right",
421
+ text: label,
422
+ children: /* @__PURE__ */ jsx(Stack, {
423
+ alignItems: "flex-start",
424
+ className: navigationItemMenuStack,
425
+ gap: 1,
426
+ justifyContent: "flex-start",
427
+ children: /* @__PURE__ */ jsx(Stack, {
428
+ alignItems: "center",
429
+ as: containerTag,
430
+ className: cn(navigationItemContainer({ disabled }), shouldAnimate && animationType === "complex" ? navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : ""),
431
+ gap: 1,
432
+ href,
433
+ justifyContent: "center",
434
+ rel,
435
+ target,
436
+ children: /* @__PURE__ */ jsx(OpenInNewIcon, {
437
+ className: shouldAnimate && animationType === "complex" ? navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "",
438
+ prominence: "weak",
439
+ sentiment: "neutral"
440
+ })
441
+ })
442
+ })
443
+ });
444
+ return null;
445
+ });
446
+
447
+ //#endregion
448
+ export { Item };