@ultraviolet/plus 3.0.0-beta.16 → 3.0.0-beta.18

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