@ultraviolet/plus 0.10.6 → 0.11.1

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 (45) hide show
  1. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/Icons.js +53 -0
  2. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/ai.svg.js +20 -0
  3. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/baremetal.svg.js +28 -0
  4. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/billing.svg.js +26 -0
  5. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/compute.svg.js +26 -0
  6. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/console.svg.js +26 -0
  7. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/containers.svg.js +24 -0
  8. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/database.svg.js +22 -0
  9. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/datacenter.svg.js +26 -0
  10. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/dedicated-server.svg.js +24 -0
  11. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/dev-tools.svg.js +32 -0
  12. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/documentation.svg.js +26 -0
  13. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/iot.svg.js +30 -0
  14. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/labs.svg.js +28 -0
  15. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/managed-services.svg.js +22 -0
  16. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/network.svg.js +31 -0
  17. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/observability.svg.js +22 -0
  18. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/pin.svg.js +29 -0
  19. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/security.svg.js +26 -0
  20. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/serverless.svg.js +22 -0
  21. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/storage.svg.js +22 -0
  22. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/tools-services.svg.js +24 -0
  23. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/use-case.svg.js +26 -0
  24. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/vpc.svg.js +60 -0
  25. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/assets/web-hosting.svg.js +24 -0
  26. package/dist/@ultraviolet/icons/dist/components/CategoryIcon/index.js +27 -0
  27. package/dist/@ultraviolet/icons/dist/components/ProductIcon/Icons.js +5 -1
  28. package/dist/@ultraviolet/icons/dist/components/ProductIcon/assets/cost-manager.svg.js +73 -0
  29. package/dist/@ultraviolet/icons/dist/components/ProductIcon/assets/managed-search-database.svg.js +59 -0
  30. package/dist/index.d.ts +98 -4
  31. package/dist/src/components/EstimateCost/Components/Item.js +1 -2
  32. package/dist/src/components/EstimateCost/EstimateCost.js +2 -0
  33. package/dist/src/components/EstimateCost/EstimateCostContent.js +5 -5
  34. package/dist/src/components/EstimateCost/OverlayComponent.js +10 -7
  35. package/dist/src/components/Navigation/Navigation.js +50 -0
  36. package/dist/src/components/Navigation/NavigationContent.js +230 -0
  37. package/dist/src/components/Navigation/NavigationProvider.js +55 -0
  38. package/dist/src/components/Navigation/components/Group.js +53 -0
  39. package/dist/src/components/Navigation/components/Item.js +445 -0
  40. package/dist/src/components/Navigation/components/PinnedItems.js +30 -0
  41. package/dist/src/components/Navigation/components/Separator.js +12 -0
  42. package/dist/src/components/Navigation/constants.js +37 -0
  43. package/dist/src/components/Navigation/locales/en.js +9 -0
  44. package/dist/src/index.js +1 -0
  45. package/package.json +12 -13
@@ -0,0 +1,445 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import '@emotion/react';
3
+ import { MenuV2, Stack, Tooltip, Expandable, Button, Badge, Text, fadeIn } from '@ultraviolet/ui';
4
+ import { useState, useCallback, useEffect, useMemo, Children, isValidElement, cloneElement } from 'react';
5
+ import { useNavigation } from '../NavigationProvider.js';
6
+ import { ANIMATION_DURATION, PIN_BUTTON_OPACITY_TRANSITION, shrinkHeight } from '../constants.js';
7
+ import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
8
+ import { CategoryIcon } from '../../../../@ultraviolet/icons/dist/components/CategoryIcon/index.js';
9
+ import { Icon } from '../../../../@ultraviolet/icons/dist/components/Icon/index.js';
10
+
11
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
12
+ const NeutralButtonLink = process.env.NODE_ENV === "production" ? {
13
+ name: "rhgg7c",
14
+ styles: "color:inherit;text-decoration:none;background-color:inherit;border:none;text-align:left"
15
+ } : {
16
+ name: "rhgg7c",
17
+ styles: "color:inherit;text-decoration:none;background-color:inherit;border:none;text-align:left",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ };
20
+ const ExpandedPinnedButton = /*#__PURE__*/_styled(Button, {
21
+ target: "e134hokc11"
22
+ })("opacity:0;right:0;position:absolute;left:-24px;top:0;bottom:0;margin:auto;&:hover,&:focus{opacity:1;}transition:", PIN_BUTTON_OPACITY_TRANSITION, ";transition-delay:0.3s;");
23
+ const CollapsedPinnedButton = /*#__PURE__*/_styled(Button, {
24
+ target: "e134hokc10"
25
+ })("opacity:0;&:hover,&:focus{opacity:1;}transition:", PIN_BUTTON_OPACITY_TRANSITION, ";transition-delay:0.3s;");
26
+ const StyledMenuItem = /*#__PURE__*/_styled(MenuV2.Item, {
27
+ target: "e134hokc9"
28
+ })("text-align:left;&:hover{", ExpandedPinnedButton, ",", CollapsedPinnedButton, "{opacity:1;}}");
29
+ const StyledMenu = /*#__PURE__*/_styled(MenuV2, {
30
+ target: "e134hokc8"
31
+ })(process.env.NODE_ENV === "production" ? {
32
+ name: "educr3",
33
+ styles: "width:180px"
34
+ } : {
35
+ name: "educr3",
36
+ styles: "width:180px",
37
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
+ });
39
+ const StyledBadge = /*#__PURE__*/_styled(Badge, {
40
+ target: "e134hokc7"
41
+ })("transition:", PIN_BUTTON_OPACITY_TRANSITION, ";transition-delay:0.3s;");
42
+ const PaddingStack = /*#__PURE__*/_styled(Stack, {
43
+ target: "e134hokc6"
44
+ })(process.env.NODE_ENV === "production" ? {
45
+ name: "13feash",
46
+ styles: "padding-left:28px"
47
+ } : {
48
+ name: "13feash",
49
+ styles: "padding-left:28px",
50
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
51
+ });
52
+ const AnimatedIcon = /*#__PURE__*/_styled(Icon, {
53
+ target: "e134hokc5"
54
+ })();
55
+ const WrapText = /*#__PURE__*/_styled(Text, {
56
+ shouldForwardProp: prop => !['animation', 'subLabel'].includes(prop),
57
+ target: "e134hokc4"
58
+ })("overflow-wrap:", ({
59
+ animation
60
+ }) => animation ? 'normal' : 'anywhere', ";white-space:", ({
61
+ animation
62
+ }) => animation ? 'nowrap' : 'normal', ";");
63
+ const StyledStack = /*#__PURE__*/_styled(Stack, {
64
+ target: "e134hokc3"
65
+ })(process.env.NODE_ENV === "production" ? {
66
+ name: "13feash",
67
+ styles: "padding-left:28px"
68
+ } : {
69
+ name: "13feash",
70
+ styles: "padding-left:28px",
71
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
72
+ });
73
+ const StyledContainer = /*#__PURE__*/_styled(Stack, {
74
+ target: "e134hokc2"
75
+ })(NeutralButtonLink, ";border-radius:", ({
76
+ theme
77
+ }) => theme.radii.default, ";&[data-has-no-expand='false']{cursor:pointer;}margin-top:", ({
78
+ theme
79
+ }) => theme.space['0.25'], ";padding:", ({
80
+ theme
81
+ }) => `calc(${theme.space['0.25']} + ${theme.space['0.5']}) ${theme.space['1']}`, ";&[data-has-sub-label='true']{padding:", ({
82
+ theme
83
+ }) => `${theme.space['0.5']} ${theme.space['1']}`, ";}width:100%;&:hover[data-has-no-expand='false']:not([disabled]):not(\n [data-is-active='true']\n ),&:focus[data-has-no-expand='false']:not([disabled]):not(\n [data-is-active='true']\n ),&[data-has-active-children='true'][data-has-no-expand='false']:not(\n [disabled][data-is-active='true']\n ){background-color:", ({
84
+ theme
85
+ }) => theme.colors.neutral.backgroundHover, ";", ExpandedPinnedButton, ",", CollapsedPinnedButton, "{opacity:1;}&[data-is-pinnable='true']{", StyledBadge, "{opacity:0;}}", WrapText, "{color:", ({
86
+ theme
87
+ }) => theme.colors.neutral.textWeakHover, ";}}&:active[data-has-no-expand='false']:not([disabled]):not(\n [data-is-active='true']\n ){background-color:", ({
88
+ theme
89
+ }) => theme.colors.neutral.backgroundHover, ";}&[data-is-active='true'],&:hover[data-has-active='true']{background-color:", ({
90
+ theme
91
+ }) => theme.colors.primary.background, ";&:hover{background-color:", ({
92
+ theme
93
+ }) => theme.colors.primary.backgroundHover, ";}}&[disabled]{cursor:not-allowed;background-color:unset;", WrapText, "{color:", ({
94
+ theme
95
+ }) => theme.colors.neutral.textWeakDisabled, ";}}&[data-animation='collapse']{animation:", shrinkHeight, " ", ANIMATION_DURATION, "ms ease-in-out;", WrapText, ",", AnimatedIcon, ",", StyledBadge, "{animation:", fadeIn, " ", ANIMATION_DURATION, "ms ease-in-out reverse;}}&[data-animation='expand']{animation:", shrinkHeight, " ", ANIMATION_DURATION, "ms ease-in-out reverse;", WrapText, ",", AnimatedIcon, ",", StyledBadge, "{animation:", fadeIn, " ", ANIMATION_DURATION, "ms ease-in-out;}", StyledStack, "{display:none;}}");
96
+ const MenuStack = /*#__PURE__*/_styled(Stack, {
97
+ target: "e134hokc1"
98
+ })("padding:", ({
99
+ theme
100
+ }) => `0 ${theme.space['2']}`, ";margin-top:", ({
101
+ theme
102
+ }) => theme.space['0.25'], ";");
103
+ const ContainerCategoryIcon = /*#__PURE__*/_styled(Stack, {
104
+ target: "e134hokc0"
105
+ })(process.env.NODE_ENV === "production" ? {
106
+ name: "d47oax",
107
+ styles: "min-width:20px"
108
+ } : {
109
+ name: "d47oax",
110
+ styles: "min-width:20px",
111
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
112
+ });
113
+ const Item = ({
114
+ children,
115
+ categoryIcon,
116
+ label,
117
+ subLabel,
118
+ badgeText,
119
+ badgeSentiment,
120
+ href,
121
+ onClick,
122
+ toggle,
123
+ active,
124
+ noPinButton,
125
+ type = 'default',
126
+ hasParents,
127
+ as,
128
+ disabled,
129
+ noExpand = false,
130
+ toggleMenu
131
+ }) => {
132
+ const context = useNavigation();
133
+ if (!context) {
134
+ throw new Error('Navigation.Item can only be used inside a Navigation');
135
+ }
136
+ const {
137
+ expanded,
138
+ locales,
139
+ pinnedFeature,
140
+ pinItem,
141
+ unpinItem,
142
+ pinnedItems,
143
+ pinLimit,
144
+ animation
145
+ } = context;
146
+ const [internalToggle, setToggle] = useState(toggle !== false);
147
+ const triggerToggle = useCallback(value => {
148
+ setToggle(value);
149
+ onClick?.(internalToggle);
150
+ }, [internalToggle, onClick]);
151
+ useEffect(() => {
152
+ if (animation === 'collapse') {
153
+ setToggle(false);
154
+ }
155
+ if (animation === 'expand') {
156
+ setTimeout(() => {
157
+ setToggle(toggle ?? true);
158
+ }, 1);
159
+ }
160
+ }, [animation, toggle]);
161
+ const PaddedStack = noExpand ? Stack : PaddingStack;
162
+ const hasHrefAndNoChildren = href && !children;
163
+ const hasPinnedFeatureAndNoChildren = pinnedFeature && !children && !noPinButton;
164
+ const isItemPinned = pinnedItems.includes(label);
165
+ const shouldShowPinnedButton = useMemo(() => {
166
+ if (href || disabled) return false;
167
+ if (pinnedItems.length >= pinLimit && type === 'default') return false;
168
+ if (hasPinnedFeatureAndNoChildren && type !== 'default') {
169
+ return true;
170
+ }
171
+ if (hasPinnedFeatureAndNoChildren && !isItemPinned) {
172
+ return true;
173
+ }
174
+ return false;
175
+ }, [disabled, hasPinnedFeatureAndNoChildren, href, isItemPinned, pinLimit, pinnedItems.length, type]);
176
+ const hasActiveChildren = useMemo(() => {
177
+ if (!children) return false;
178
+ return Children.map(children, child => /*#__PURE__*/isValidElement(child) ? child.props?.active : false).includes(true);
179
+ }, [children]);
180
+ const containerTag = useMemo(() => {
181
+ if (as) {
182
+ return as;
183
+ }
184
+ if (hasHrefAndNoChildren) {
185
+ return 'a';
186
+ }
187
+ if (noExpand) {
188
+ return 'div';
189
+ }
190
+ return 'button';
191
+ }, [as, hasHrefAndNoChildren, noExpand]);
192
+ const Container = StyledContainer.withComponent(containerTag, {
193
+ target: "e134hokc12"
194
+ });
195
+ const ariaExpanded = useMemo(() => {
196
+ if (hasHrefAndNoChildren && internalToggle) {
197
+ return true;
198
+ }
199
+ if (hasHrefAndNoChildren && !internalToggle) {
200
+ return false;
201
+ }
202
+ return undefined;
203
+ }, [hasHrefAndNoChildren, internalToggle]);
204
+
205
+ // This content is when the navigation is expanded
206
+ if (expanded || !expanded && animation === 'expand') {
207
+ const renderChildren = Children.map(children, child => /*#__PURE__*/isValidElement(child) ? /*#__PURE__*/cloneElement(child, {
208
+ hasParents: true
209
+ }) : child);
210
+ return jsxs(Fragment, {
211
+ children: [jsxs(Container, {
212
+ gap: 1,
213
+ direction: "row",
214
+ alignItems: "center",
215
+ justifyContent: "space-between",
216
+ "data-has-sub-label": !!subLabel,
217
+ onClick: () => {
218
+ if (children) {
219
+ return triggerToggle(!internalToggle);
220
+ }
221
+ return onClick?.();
222
+ },
223
+ "aria-expanded": ariaExpanded,
224
+ href: href,
225
+ target: href ? '_blank' : undefined,
226
+ "data-is-pinnable": shouldShowPinnedButton,
227
+ "data-is-active": active,
228
+ "data-animation": animation,
229
+ "data-has-children": !!children,
230
+ "data-has-active-children": hasActiveChildren,
231
+ "data-has-no-expand": noExpand,
232
+ disabled: disabled,
233
+ children: [jsxs(Stack, {
234
+ direction: "row",
235
+ gap: 1,
236
+ alignItems: "center",
237
+ justifyContent: "center",
238
+ children: [categoryIcon ? jsx(ContainerCategoryIcon, {
239
+ alignItems: "center",
240
+ justifyContent: "center",
241
+ children: jsx(CategoryIcon, {
242
+ name: categoryIcon
243
+ })
244
+ }) : null, jsxs(Stack, {
245
+ children: [jsx(WrapText, {
246
+ as: "span",
247
+ variant: "bodySmallStrong",
248
+ sentiment: active ? 'primary' : 'neutral',
249
+ prominence: categoryIcon || !hasParents ? undefined : 'weak',
250
+ animation: animation,
251
+ disabled: disabled,
252
+ children: label
253
+ }), subLabel ? jsx(WrapText, {
254
+ as: "span",
255
+ variant: "caption",
256
+ sentiment: "neutral",
257
+ prominence: "weak",
258
+ animation: animation,
259
+ disabled: disabled,
260
+ subLabel: true,
261
+ children: subLabel
262
+ }) : null]
263
+ })]
264
+ }), jsxs(Stack, {
265
+ direction: "row",
266
+ alignItems: "center",
267
+ gap: href ? 1 : undefined,
268
+ children: [badgeText || hasPinnedFeatureAndNoChildren ? jsxs(Fragment, {
269
+ children: [badgeText ? jsx(StyledBadge, {
270
+ sentiment: badgeSentiment,
271
+ size: "small",
272
+ prominence: "strong",
273
+ disabled: disabled,
274
+ children: badgeText
275
+ }) : null, shouldShowPinnedButton ? jsx(Tooltip, {
276
+ text: isItemPinned ? locales['navigation.unpin.tooltip'] : locales['navigation.pin.tooltip'],
277
+ placement: "right",
278
+ children: jsx("div", {
279
+ style: {
280
+ position: 'relative'
281
+ },
282
+ children: jsx(ExpandedPinnedButton, {
283
+ size: "xsmall",
284
+ variant: "ghost",
285
+ sentiment: active ? 'primary' : 'neutral',
286
+ onClick: () => isItemPinned ? unpinItem(label) : pinItem(label),
287
+ icon: "pin"
288
+ })
289
+ })
290
+ }) : null]
291
+ }) : null, hasHrefAndNoChildren ? jsx(AnimatedIcon, {
292
+ name: "open-in-new",
293
+ sentiment: "neutral",
294
+ prominence: "weak",
295
+ disabled: disabled
296
+ }) : null, children ? jsxs(Stack, {
297
+ gap: 1,
298
+ direction: "row",
299
+ alignItems: "center",
300
+ children: [type === 'pinnedGroup' && pinLimit !== Infinity ? jsxs(WrapText, {
301
+ as: "span",
302
+ variant: "caption",
303
+ sentiment: "neutral",
304
+ prominence: "weak",
305
+ children: [pinnedItems.length, "/", pinLimit]
306
+ }) : null, !animation && !noExpand ? jsx(AnimatedIcon, {
307
+ name: internalToggle ? 'arrow-down' : 'arrow-right',
308
+ sentiment: "neutral",
309
+ prominence: "weak"
310
+ }) : null]
311
+ }) : null]
312
+ })]
313
+ }), children ? jsx(Fragment, {
314
+ children: !noExpand ? jsx(Expandable, {
315
+ opened: internalToggle,
316
+ animationDuration: animation ? ANIMATION_DURATION / 2 : undefined,
317
+ children: jsx(PaddedStack, {
318
+ children: renderChildren
319
+ })
320
+ }) : jsx(PaddedStack, {
321
+ children: renderChildren
322
+ })
323
+ }) : null]
324
+ });
325
+ }
326
+
327
+ // This content is the menu of the navigation when collapsed
328
+ if (categoryIcon || Children.count(children) > 0 && !hasParents) {
329
+ return jsx(MenuStack, {
330
+ gap: 1,
331
+ alignItems: "start",
332
+ justifyContent: "start",
333
+ children: Children.count(children) > 0 ? jsx(StyledMenu, {
334
+ disclosure: jsx(Button, {
335
+ sentiment: "neutral",
336
+ variant: hasActiveChildren ? 'filled' : 'ghost',
337
+ size: "small",
338
+ icon: !categoryIcon ? 'dots-horizontal' : undefined,
339
+ children: categoryIcon ? jsx(Stack, {
340
+ direction: "row",
341
+ gap: 1,
342
+ alignItems: "center",
343
+ justifyContent: "center",
344
+ children: jsx(CategoryIcon, {
345
+ name: categoryIcon
346
+ })
347
+ }) : null
348
+ }),
349
+ placement: "right",
350
+ children: ({
351
+ toggle: toggleMenuLocal
352
+ }) => Children.map(children, child => /*#__PURE__*/isValidElement(child) ? /*#__PURE__*/cloneElement(child, {
353
+ hasParents: true,
354
+ toggleMenu: toggleMenuLocal
355
+ }) : child)
356
+ }) : jsx(Tooltip, {
357
+ text: label,
358
+ placement: "right",
359
+ tabIndex: -1,
360
+ children: jsx(Button, {
361
+ sentiment: "neutral",
362
+ variant: active ? 'filled' : 'ghost',
363
+ size: "small",
364
+ onClick: () => onClick?.(),
365
+ children: jsx(Stack, {
366
+ direction: "row",
367
+ gap: 1,
368
+ alignItems: "center",
369
+ justifyContent: "center",
370
+ children: jsx(CategoryIcon, {
371
+ name: categoryIcon ?? 'console'
372
+ })
373
+ })
374
+ })
375
+ })
376
+ });
377
+ }
378
+
379
+ // This content is what is inside a menu item the navigation is collapsed
380
+ if (hasParents) {
381
+ return jsx(StyledMenuItem, {
382
+ href: href,
383
+ onClick: () => {
384
+ onClick?.();
385
+ toggleMenu?.();
386
+ },
387
+ borderless: true,
388
+ children: jsxs(Stack, {
389
+ gap: 1,
390
+ direction: "row",
391
+ alignItems: "center",
392
+ justifyContent: "space-between",
393
+ children: [jsx(WrapText, {
394
+ as: "span",
395
+ variant: "bodySmall",
396
+ children: label
397
+ }), shouldShowPinnedButton ? jsx(Tooltip, {
398
+ text: isItemPinned ? locales['navigation.unpin.tooltip'] : locales['navigation.pin.tooltip'],
399
+ placement: "right",
400
+ children: jsx(CollapsedPinnedButton, {
401
+ size: "xsmall",
402
+ variant: "ghost",
403
+ sentiment: active ? 'primary' : 'neutral',
404
+ onClick: () => {
405
+ if (isItemPinned) {
406
+ unpinItem(label);
407
+ } else {
408
+ pinItem(label);
409
+ }
410
+ },
411
+ icon: "auto-fix"
412
+ })
413
+ }) : null]
414
+ })
415
+ });
416
+ }
417
+
418
+ // This content is for when navigation is collapsed and we show an icon of link
419
+ if (!hasParents && href) {
420
+ return jsx(Tooltip, {
421
+ text: label,
422
+ placement: "right",
423
+ children: jsx(MenuStack, {
424
+ gap: 1,
425
+ alignItems: "start",
426
+ justifyContent: "start",
427
+ children: jsx(Container, {
428
+ gap: 1,
429
+ alignItems: "center",
430
+ justifyContent: "center",
431
+ href: href,
432
+ target: "_blank",
433
+ children: jsx(AnimatedIcon, {
434
+ name: "open-in-new",
435
+ sentiment: "neutral",
436
+ prominence: "weak"
437
+ })
438
+ })
439
+ })
440
+ });
441
+ }
442
+ return null;
443
+ };
444
+
445
+ export { Item };
@@ -0,0 +1,30 @@
1
+ import { useNavigation } from '../NavigationProvider.js';
2
+ import { Item } from './Item.js';
3
+ import { jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ const PinnedItems = () => {
6
+ const context = useNavigation();
7
+ if (!context) {
8
+ throw new Error('Navigation.PinnedItems can only be used inside a Navigation');
9
+ }
10
+ const {
11
+ locales,
12
+ pinnedItems,
13
+ pinnedFeature
14
+ } = context;
15
+ if (pinnedItems.length > 0 && pinnedFeature) {
16
+ return jsx(Item, {
17
+ label: locales['navigation.pinned.item.group.label'],
18
+ categoryIcon: "pin",
19
+ toggle: false,
20
+ type: "pinnedGroup",
21
+ children: pinnedItems.map(item => jsx(Item, {
22
+ label: item,
23
+ type: "pinned"
24
+ }, item))
25
+ });
26
+ }
27
+ return null;
28
+ };
29
+
30
+ export { PinnedItems };
@@ -0,0 +1,12 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { Separator as Separator$1 } from '@ultraviolet/ui';
3
+ import { jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ const StyledSeparator = /*#__PURE__*/_styled(Separator$1, {
6
+ target: "e1tbaa9b0"
7
+ })("margin:", ({
8
+ theme
9
+ }) => `${theme.space['2']} -${theme.space['2']}`, ";");
10
+ const Separator = () => jsx(StyledSeparator, {});
11
+
12
+ export { Separator };
@@ -0,0 +1,37 @@
1
+ import { keyframes } from '@emotion/react';
2
+
3
+ const NAVIGATION_MIN_WIDTH = 220; // in px
4
+ const NAVIGATION_WIDTH = 280; // in px
5
+ const NAVIGATION_COLLASPED_WIDTH = 67; // in px
6
+ const NAVIGATION_MAX_WIDTH = 320; // in px
7
+
8
+ /**
9
+ * ANIMATIONS
10
+ */
11
+ const PIN_BUTTON_OPACITY_TRANSITION = 'opacity 250ms ease-in-out'; // this is the transition animation when hovering pin button
12
+ const ANIMATION_DURATION = 700; // collapse and expand animation duration of the whole nav in ms
13
+
14
+ const shrinkHeight = keyframes`
15
+ 0% {
16
+ max-height: 50px; // this is on purpose higher than the actual height of the item
17
+ }
18
+
19
+ 100% {
20
+ max-height: 32px;
21
+ }
22
+ `;
23
+ const groupAnimation = keyframes`
24
+ 0% {
25
+ opacity: 0;
26
+ max-height: 0;
27
+ margin-bottom: -8px;
28
+ }
29
+
30
+ 100% {
31
+ opacity: 1;
32
+ max-height: 40px;
33
+ margin-bottom: 0;
34
+ }
35
+ `;
36
+
37
+ export { ANIMATION_DURATION, NAVIGATION_COLLASPED_WIDTH, NAVIGATION_MAX_WIDTH, NAVIGATION_MIN_WIDTH, NAVIGATION_WIDTH, PIN_BUTTON_OPACITY_TRANSITION, groupAnimation, shrinkHeight };
@@ -0,0 +1,9 @@
1
+ var NavigationLocales = {
2
+ 'navigation.pin.tooltip': 'Pin product',
3
+ 'navigation.unpin.tooltip': 'Unpin product',
4
+ 'navigation.pinned.item.group.label': 'Pinned items',
5
+ 'navigation.expand.button': 'Expand sidebar',
6
+ 'navigation.collapse.button': 'Collapse sidebar'
7
+ };
8
+
9
+ export { NavigationLocales as default };
package/dist/src/index.js CHANGED
@@ -5,5 +5,6 @@ export { EstimateCost } from './components/EstimateCost/EstimateCost.js';
5
5
  export { default as estimateCostDefaultLocales } from './components/EstimateCost/locales/en.js';
6
6
  export { CustomerSatisfaction } from './components/CustomerSatisfaction/index.js';
7
7
  export { Conversation } from './components/Conversation/index.js';
8
+ export { Navigation } from './components/Navigation/Navigation.js';
8
9
  export { FAQ } from './components/FAQ/index.js';
9
10
  export { SteppedListContainer } from './components/SteppedListCard/SteppedListContainer.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/plus",
3
- "version": "0.10.6",
3
+ "version": "0.11.1",
4
4
  "description": "Ultraviolet Plus",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -34,30 +34,29 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@emotion/react": "11.11.4",
37
- "@emotion/styled": "11.11.0",
37
+ "@emotion/styled": "11.11.5",
38
38
  "react": "18.2.0",
39
39
  "react-dom": "18.2.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@babel/core": "7.24.1",
42
+ "@babel/core": "7.24.3",
43
43
  "@emotion/babel-plugin": "11.11.0",
44
44
  "@emotion/react": "11.11.4",
45
- "@emotion/styled": "11.11.0",
46
- "@types/react": "18.2.61",
47
- "@types/react-dom": "18.2.19",
45
+ "@emotion/styled": "11.11.5",
46
+ "@types/react": "18.2.64",
47
+ "@types/react-dom": "18.2.21",
48
48
  "react": "18.2.0",
49
49
  "react-dom": "18.2.0",
50
- "@ultraviolet/icons": "2.11.0",
51
- "@ultraviolet/illustrations": "1.6.4"
50
+ "@ultraviolet/icons": "2.11.2",
51
+ "@ultraviolet/illustrations": "1.7.0"
52
52
  },
53
53
  "dependencies": {
54
- "@uiw/codemirror-extensions-langs": "4.21.24",
55
- "@uiw/codemirror-theme-material": "4.21.24",
56
- "@uiw/react-codemirror": "4.21.24",
57
- "react-flatten-children": "1.1.2",
54
+ "@uiw/codemirror-extensions-langs": "4.21.25",
55
+ "@uiw/codemirror-theme-material": "4.21.25",
56
+ "@uiw/react-codemirror": "4.21.25",
58
57
  "react-intersection-observer": "9.8.1",
59
58
  "@ultraviolet/themes": "1.9.0",
60
- "@ultraviolet/ui": "1.44.0"
59
+ "@ultraviolet/ui": "1.45.1"
61
60
  },
62
61
  "scripts": {
63
62
  "build": "rollup -c ../../rollup.config.mjs",