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

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 (110) hide show
  1. package/dist/components/ContentCard/styles.css.js +0 -1
  2. package/dist/components/EstimateCost/Components/components.css.js +1 -0
  3. package/dist/components/InfoTable/components/Cell.js +2 -2
  4. package/dist/components/InfoTable/styles.css.d.ts +1 -0
  5. package/dist/components/InfoTable/styles.css.js +2 -0
  6. package/dist/components/OfferList/OfferList.d.ts +1 -0
  7. package/dist/components/OfferList/components/Row.d.ts +1 -0
  8. package/dist/components/OfferList/components/Row.js +1 -1
  9. package/dist/components/Plans/styles.css.js +1 -0
  10. package/dist/components/SteppedListCard/Step.d.ts +6 -1
  11. package/dist/components/SteppedListCard/Step.js +2 -1
  12. package/dist/components/SteppedListCard/SteppedListCard.d.ts +5 -2
  13. package/dist/components/SteppedListCard/SteppedListCard.js +10 -6
  14. package/dist/components/SteppedListCard/SteppedListContent.d.ts +1 -1
  15. package/dist/components/SteppedListCard/helper.d.ts +1 -1
  16. package/dist/components/SteppedListCard/helper.js +2 -1
  17. package/dist/components/SteppedListCard/styles.css.d.ts +1 -0
  18. package/dist/components/SteppedListCard/styles.css.js +2 -0
  19. package/dist/plus.css +1 -1
  20. package/package.json +8 -12
  21. package/dist/components/CodeEditor/CodeEditor.cjs +0 -50
  22. package/dist/components/CodeEditor/styles.css.cjs +0 -9
  23. package/dist/components/ContentCard/Skeleton.cjs +0 -23
  24. package/dist/components/ContentCard/index.cjs +0 -62
  25. package/dist/components/ContentCard/styles.css.cjs +0 -28
  26. package/dist/components/ContentCardGroup/Card.cjs +0 -30
  27. package/dist/components/ContentCardGroup/SkeletonCard.cjs +0 -15
  28. package/dist/components/ContentCardGroup/index.cjs +0 -18
  29. package/dist/components/ContentCardGroup/styles.css.cjs +0 -17
  30. package/dist/components/Conversation/index.cjs +0 -42
  31. package/dist/components/Conversation/styles.css.cjs +0 -17
  32. package/dist/components/CustomerSatisfaction/assets/1-5.svg.cjs +0 -3
  33. package/dist/components/CustomerSatisfaction/assets/1-5NB.svg.cjs +0 -3
  34. package/dist/components/CustomerSatisfaction/assets/2-5.svg.cjs +0 -3
  35. package/dist/components/CustomerSatisfaction/assets/2-5NB.svg.cjs +0 -3
  36. package/dist/components/CustomerSatisfaction/assets/3-5.svg.cjs +0 -3
  37. package/dist/components/CustomerSatisfaction/assets/3-5NB.svg.cjs +0 -3
  38. package/dist/components/CustomerSatisfaction/assets/4-5.svg.cjs +0 -3
  39. package/dist/components/CustomerSatisfaction/assets/4-5NB.svg.cjs +0 -3
  40. package/dist/components/CustomerSatisfaction/assets/5-5.svg.cjs +0 -3
  41. package/dist/components/CustomerSatisfaction/assets/5-5NB.svg.cjs +0 -3
  42. package/dist/components/CustomerSatisfaction/index.cjs +0 -66
  43. package/dist/components/CustomerSatisfaction/styles.css.cjs +0 -6
  44. package/dist/components/EstimateCost/Components/CustomUnitInput.cjs +0 -34
  45. package/dist/components/EstimateCost/Components/Item.cjs +0 -221
  46. package/dist/components/EstimateCost/Components/LineThrough.cjs +0 -11
  47. package/dist/components/EstimateCost/Components/NumberInput.cjs +0 -31
  48. package/dist/components/EstimateCost/Components/Region.cjs +0 -34
  49. package/dist/components/EstimateCost/Components/Regular.cjs +0 -23
  50. package/dist/components/EstimateCost/Components/Strong.cjs +0 -16
  51. package/dist/components/EstimateCost/Components/Unit.cjs +0 -36
  52. package/dist/components/EstimateCost/Components/Zone.cjs +0 -33
  53. package/dist/components/EstimateCost/Components/components.css.cjs +0 -123
  54. package/dist/components/EstimateCost/EstimateCost.cjs +0 -86
  55. package/dist/components/EstimateCost/EstimateCostContent.cjs +0 -206
  56. package/dist/components/EstimateCost/EstimateCostProvider.cjs +0 -37
  57. package/dist/components/EstimateCost/OverlayComponent.cjs +0 -85
  58. package/dist/components/EstimateCost/OverlayContext.cjs +0 -15
  59. package/dist/components/EstimateCost/constants.cjs +0 -28
  60. package/dist/components/EstimateCost/helper.cjs +0 -16
  61. package/dist/components/EstimateCost/locales/en.cjs +0 -23
  62. package/dist/components/EstimateCost/styles.css.cjs +0 -50
  63. package/dist/components/FAQ/index.cjs +0 -49
  64. package/dist/components/FAQ/styles.css.cjs +0 -5
  65. package/dist/components/InfoTable/InfoTable.cjs +0 -20
  66. package/dist/components/InfoTable/components/Cell.cjs +0 -16
  67. package/dist/components/InfoTable/components/Row.cjs +0 -25
  68. package/dist/components/InfoTable/context.cjs +0 -5
  69. package/dist/components/InfoTable/styles.css.cjs +0 -15
  70. package/dist/components/Navigation/Footer.cjs +0 -56
  71. package/dist/components/Navigation/Header.cjs +0 -18
  72. package/dist/components/Navigation/Navigation.cjs +0 -18
  73. package/dist/components/Navigation/NavigationContent.cjs +0 -112
  74. package/dist/components/Navigation/NavigationProvider.cjs +0 -129
  75. package/dist/components/Navigation/components/Group.cjs +0 -37
  76. package/dist/components/Navigation/components/Item.cjs +0 -277
  77. package/dist/components/Navigation/components/ItemProvider.cjs +0 -14
  78. package/dist/components/Navigation/components/PinnedItems.cjs +0 -80
  79. package/dist/components/Navigation/components/Separator.cjs +0 -8
  80. package/dist/components/Navigation/components/items.css.cjs +0 -47
  81. package/dist/components/Navigation/components/styles.css.cjs +0 -17
  82. package/dist/components/Navigation/constants.cjs +0 -10
  83. package/dist/components/Navigation/locales/en.cjs +0 -11
  84. package/dist/components/Navigation/styles.css.cjs +0 -23
  85. package/dist/components/Navigation/variables.css.cjs +0 -4
  86. package/dist/components/OfferList/OfferList.cjs +0 -45
  87. package/dist/components/OfferList/OfferListProvider.cjs +0 -38
  88. package/dist/components/OfferList/components/Banner.cjs +0 -21
  89. package/dist/components/OfferList/components/Cell.cjs +0 -20
  90. package/dist/components/OfferList/components/Row.cjs +0 -113
  91. package/dist/components/OfferList/styles.css.cjs +0 -38
  92. package/dist/components/OrderSummary/NonScrollableContent.cjs +0 -56
  93. package/dist/components/OrderSummary/Provider.cjs +0 -18
  94. package/dist/components/OrderSummary/ScrollableContent.cjs +0 -73
  95. package/dist/components/OrderSummary/constants.cjs +0 -12
  96. package/dist/components/OrderSummary/helpers.cjs +0 -91
  97. package/dist/components/OrderSummary/index.cjs +0 -102
  98. package/dist/components/OrderSummary/locales/en.cjs +0 -11
  99. package/dist/components/OrderSummary/styles.css.cjs +0 -19
  100. package/dist/components/Plans/FeatureHint.cjs +0 -24
  101. package/dist/components/Plans/PlanHeader.cjs +0 -42
  102. package/dist/components/Plans/index.cjs +0 -102
  103. package/dist/components/Plans/locales/en.cjs +0 -7
  104. package/dist/components/Plans/styles.css.cjs +0 -26
  105. package/dist/components/SteppedListCard/Step.cjs +0 -20
  106. package/dist/components/SteppedListCard/SteppedListCard.cjs +0 -54
  107. package/dist/components/SteppedListCard/SteppedListContent.cjs +0 -51
  108. package/dist/components/SteppedListCard/helper.cjs +0 -38
  109. package/dist/components/SteppedListCard/styles.css.cjs +0 -17
  110. package/dist/index.cjs +0 -33
@@ -1,129 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const react = require("react");
6
- const constants = require("./constants.cjs");
7
- const en = require("./locales/en.cjs");
8
- const NavigationContext = react.createContext({
9
- allowNavigationResize: true,
10
- animation: false,
11
- animationType: "simple",
12
- expanded: true,
13
- items: {},
14
- locales: en,
15
- navigationRef: {
16
- current: null
17
- },
18
- pinItem: () => [],
19
- pinLimit: 7,
20
- pinnedItems: [],
21
- registerItem: () => {
22
- },
23
- reorderItems: () => [],
24
- setAllowNavigationResize: () => {
25
- },
26
- setPinnedItems: () => {
27
- },
28
- setWidth: () => {
29
- },
30
- shouldAnimate: true,
31
- /**
32
- * This function will trigger the expand/collapse of the navigation and
33
- * will also trigger the animation
34
- */
35
- toggleExpand: () => {
36
- },
37
- unpinItem: () => [],
38
- width: constants.NAVIGATION_WIDTH
39
- });
40
- const useNavigation = () => react.useContext(NavigationContext);
41
- const NavigationProvider = ({
42
- children,
43
- pinnedFeature = false,
44
- initialPinned,
45
- initialExpanded = true,
46
- locales = en,
47
- pinLimit = 7,
48
- onExpandChange,
49
- initialWidth = constants.NAVIGATION_WIDTH,
50
- initialAllowNavigationResize = true,
51
- animation: shouldAnimate = true,
52
- animationType
53
- }) => {
54
- const [expanded, setExpanded] = react.useState(initialExpanded);
55
- const [pinnedItems, setPinnedItems] = react.useState(initialPinned ?? []);
56
- const [animation, setAnimation] = react.useState(false);
57
- const [width, setWidth] = react.useState(initialWidth);
58
- const [allowNavigationResize, setAllowNavigationResize] = react.useState(initialAllowNavigationResize);
59
- const [items, registerItem] = react.useReducer((oldState, newState) => ({
60
- ...oldState,
61
- ...newState
62
- }), {});
63
- const navigationRef = react.useRef(null);
64
- const toggleExpand = react.useCallback((toggle) => {
65
- if (typeof toggle !== "boolean" && toggle !== void 0) {
66
- throw new Error("toggleExpand only accepts boolean or undefined as parameter. You most likely did <button onClick={toggleExpand}> instead of <button onClick={() => toggleExpand()}>");
67
- }
68
- if (toggle !== void 0 && toggle === expanded) {
69
- return;
70
- }
71
- onExpandChange?.(!expanded);
72
- if (navigationRef.current) {
73
- navigationRef.current.style.width = "";
74
- }
75
- if (shouldAnimate) {
76
- setAnimation(expanded ? "collapse" : "expand");
77
- setTimeout(() => {
78
- setExpanded(toggle !== void 0 ? toggle : !expanded);
79
- setAnimation(false);
80
- }, constants.ANIMATION_DURATION);
81
- } else {
82
- setExpanded(toggle !== void 0 ? toggle : !expanded);
83
- }
84
- }, [expanded, onExpandChange, shouldAnimate]);
85
- const pinItem = react.useCallback((item) => {
86
- const newValue = [...pinnedItems, item];
87
- setPinnedItems(newValue);
88
- return newValue;
89
- }, [pinnedItems]);
90
- const unpinItem = react.useCallback((item) => {
91
- const newValue = pinnedItems.filter((localItem) => localItem !== item);
92
- setPinnedItems(newValue);
93
- return newValue;
94
- }, [pinnedItems]);
95
- const reorderItems = react.useCallback((initialIndex, endIndex) => {
96
- const newPinnedItems = [...pinnedItems];
97
- const [removed] = newPinnedItems.splice(initialIndex, 1);
98
- newPinnedItems.splice(endIndex, 0, removed);
99
- setPinnedItems(newPinnedItems);
100
- return newPinnedItems;
101
- }, [pinnedItems]);
102
- const value = react.useMemo(() => ({
103
- allowNavigationResize,
104
- animation,
105
- animationType,
106
- expanded,
107
- items,
108
- locales,
109
- navigationRef,
110
- pinItem,
111
- pinLimit,
112
- pinnedFeature,
113
- pinnedItems,
114
- registerItem,
115
- reorderItems,
116
- setAllowNavigationResize,
117
- setAnimation,
118
- setPinnedItems,
119
- setWidth,
120
- shouldAnimate,
121
- toggleExpand,
122
- unpinItem,
123
- width
124
- }), [expanded, toggleExpand, pinnedItems, pinItem, unpinItem, pinnedFeature, locales, pinLimit, animation, width, reorderItems, items, allowNavigationResize, shouldAnimate, animationType]);
125
- return /* @__PURE__ */ jsxRuntime.jsx(NavigationContext.Provider, { value, children });
126
- };
127
- exports.NavigationContext = NavigationContext;
128
- exports.NavigationProvider = NavigationProvider;
129
- exports.useNavigation = useNavigation;
@@ -1,37 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const ui = require("@ultraviolet/ui");
6
- const react = require("react");
7
- const NavigationProvider = require("../NavigationProvider.cjs");
8
- const styles_css = require("./styles.css.cjs");
9
- const Group = ({
10
- children,
11
- label,
12
- style
13
- }) => {
14
- const context = NavigationProvider.useNavigation();
15
- if (!context) {
16
- throw new Error("Navigation.Group can only be used inside a NavigationProvider.");
17
- }
18
- const {
19
- expanded,
20
- animation,
21
- animationType
22
- } = context;
23
- const isDiplay = !animation && expanded;
24
- if (react.Children.count(children) > 0) {
25
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
26
- width: animation ? "100%" : void 0,
27
- ...style
28
- }, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { className: styles_css.navigationGroupStack, direction: "column", children: [
29
- isDiplay ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", className: styles_css.navigationGroupText({
30
- animation: animationType === "complex" ? animation : false
31
- }), prominence: "weak", sentiment: "neutral", variant: "bodySmallStrong", children: label }) : null,
32
- children
33
- ] }) });
34
- }
35
- return null;
36
- };
37
- exports.Group = Group;
@@ -1,277 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const icons = require("@ultraviolet/icons");
6
- const category = require("@ultraviolet/icons/category");
7
- const ui = require("@ultraviolet/ui");
8
- const react = require("react");
9
- const NavigationProvider = require("../NavigationProvider.cjs");
10
- const ItemProvider = require("./ItemProvider.cjs");
11
- const items_css = require("./items.css.cjs");
12
- const onDragStopTrigger = (event) => {
13
- event.currentTarget.style.opacity = "1";
14
- };
15
- const Item = react.memo(({
16
- children,
17
- categoryIcon,
18
- label,
19
- labelDescription,
20
- subLabel,
21
- badgeText,
22
- badgeSentiment,
23
- href,
24
- target,
25
- rel,
26
- onToggle,
27
- onClickPinUnpin,
28
- toggle,
29
- active,
30
- noPinButton,
31
- type = "default",
32
- as,
33
- disabled,
34
- noExpand = false,
35
- index,
36
- id,
37
- "data-testid": dataTestId,
38
- style
39
- }) => {
40
- const context = NavigationProvider.useNavigation();
41
- if (!context) {
42
- throw new Error("Navigation.Item can only be used inside a NavigationProvider.");
43
- }
44
- const itemProvider = react.useContext(ItemProvider.ItemContext);
45
- const hasParents = !!itemProvider;
46
- const {
47
- expanded,
48
- locales,
49
- pinnedFeature,
50
- pinItem,
51
- unpinItem,
52
- pinnedItems,
53
- pinLimit,
54
- animation,
55
- registerItem,
56
- shouldAnimate,
57
- animationType
58
- } = context;
59
- react.useEffect(() => {
60
- if (type !== "pinnedGroup" && pinnedFeature) {
61
- registerItem({
62
- [id]: {
63
- active,
64
- label,
65
- onClickPinUnpin,
66
- onToggle
67
- }
68
- });
69
- }
70
- }, [active, id, label, registerItem]);
71
- const [internalExpanded, onToggleExpand] = react.useReducer((prevState) => !prevState, Boolean(toggle));
72
- const triggerToggle = react.useCallback(() => {
73
- onToggleExpand();
74
- onToggle?.(internalExpanded);
75
- }, [internalExpanded, onToggle]);
76
- const hasHrefAndNoChildren = href && !children;
77
- const hasPinnedFeatureAndNoChildren = pinnedFeature && !children && !noPinButton;
78
- const isItemPinned = pinnedItems.includes(id);
79
- const shouldShowPinnedButton = react.useMemo(() => {
80
- if (href || disabled) {
81
- return false;
82
- }
83
- if (hasPinnedFeatureAndNoChildren && type !== "default") {
84
- return true;
85
- }
86
- if (hasPinnedFeatureAndNoChildren) {
87
- return true;
88
- }
89
- return false;
90
- }, [disabled, hasPinnedFeatureAndNoChildren, href, type]);
91
- const hasActiveChildren = react.useMemo(() => {
92
- if (!children) {
93
- return false;
94
- }
95
- return react.Children.map(children, (child) => {
96
- if (react.isValidElement(child)) {
97
- if ("to" in child.props) {
98
- return child.props.children?.props.active;
99
- }
100
- return child.props.active;
101
- }
102
- return null;
103
- }).includes(true);
104
- }, [children]);
105
- const containerTag = react.useMemo(() => {
106
- if (as) {
107
- return as;
108
- }
109
- if (hasHrefAndNoChildren) {
110
- return "a";
111
- }
112
- if (noExpand) {
113
- return "div";
114
- }
115
- return "button";
116
- }, [as, hasHrefAndNoChildren, noExpand]);
117
- const ArrowIcon = react.useMemo(() => internalExpanded ? icons.ArrowDownIcon : icons.ArrowRightIcon, [internalExpanded]);
118
- const PinUnpinIcon = react.useMemo(() => isItemPinned ? icons.UnpinIcon : icons.PinOutlineIcon, [isItemPinned]);
119
- const ariaExpanded = react.useMemo(() => {
120
- if (hasHrefAndNoChildren && internalExpanded) {
121
- return true;
122
- }
123
- if (hasHrefAndNoChildren && !internalExpanded) {
124
- return false;
125
- }
126
- return void 0;
127
- }, [hasHrefAndNoChildren, internalExpanded]);
128
- const isPinDisabled = pinnedItems.length >= pinLimit;
129
- const pinTooltipLocale = react.useMemo(() => {
130
- if (isPinDisabled) {
131
- return locales["navigation.pin.limit"];
132
- }
133
- if (isItemPinned) {
134
- return locales["navigation.unpin.tooltip"];
135
- }
136
- return locales["navigation.pin.tooltip"];
137
- }, [isItemPinned, isPinDisabled, locales]);
138
- const onDragStart = react.useCallback((event) => {
139
- if (expanded) {
140
- event.dataTransfer.setData("text/plain", JSON.stringify({
141
- index,
142
- label
143
- }));
144
- event.currentTarget.style.opacity = "0.5";
145
- }
146
- return void 0;
147
- }, [expanded, index, label]);
148
- const onDragEnd = react.useCallback((event) => expanded ? onDragStopTrigger(event) : void 0, [expanded]);
149
- const showDraggableIcon = !noExpand && pinnedFeature && shouldShowPinnedButton && !disabled;
150
- const showPinIcon = !noExpand && !disabled && shouldShowPinnedButton && pinnedFeature;
151
- const shouldHaveWeakText = !!children && !active && shouldShowPinnedButton && !disabled;
152
- if (expanded || !expanded && animation === "expand") {
153
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
154
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { alignItems: categoryIcon ? "flex-start" : "center", "aria-expanded": ariaExpanded, as: containerTag, className: `${items_css.navigationItemContainer({
155
- disabled,
156
- hasActive: hasActiveChildren,
157
- isActive: !!active,
158
- noExpand,
159
- subLabel: !!subLabel
160
- })} ${shouldAnimate && animationType === "complex" ? items_css.navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : ""} ${showDraggableIcon ? items_css.navigationItemShowDraggable : ""} ${showPinIcon ? items_css.navigationItemShowPinButton : ""} ${shouldHaveWeakText ? items_css.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: [
161
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { alignItems: categoryIcon ? "flex-start" : "center", direction: "row", gap: 1, justifyContent: "center", children: [
162
- categoryIcon ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "center", className: items_css.navigationItemCategoryIcon, justifyContent: "center", children: categoryIcon }) : null,
163
- type === "pinned" && expanded ? /* @__PURE__ */ jsxRuntime.jsx(icons.DragIcon, { className: items_css.navigationItemDragIcon, disabled, prominence: "weak", sentiment: "neutral", size: "small" }) : null,
164
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { children: [
165
- !animation ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { as: "span", className: items_css.navigationItemWrapText({
166
- disabled,
167
- weak: hasActiveChildren && !noExpand && !disabled && !!active
168
- }), "data-animation": animation, disabled, prominence: (categoryIcon || !hasParents) && !active ? "strong" : "default", sentiment: active ? "primary" : "neutral", variant: "bodySmallStrong", whiteSpace: "pre-wrap", children: [
169
- label,
170
- labelDescription ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: items_css.navigationItemPadded, children: labelDescription }) : null
171
- ] }) : null,
172
- subLabel && !animation ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", className: items_css.navigationItemWrapText({
173
- disabled,
174
- weak: hasActiveChildren && !noExpand && !disabled && !!active
175
- }), "data-animation": animation, disabled, prominence: "weak", sentiment: "neutral", variant: "caption", whiteSpace: "pre-wrap", children: subLabel }) : null
176
- ] })
177
- ] }),
178
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { alignItems: "center", direction: "row", gap: href ? 1 : void 0, children: [
179
- badgeText || hasPinnedFeatureAndNoChildren ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
180
- badgeText && !animation ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: items_css.navigationItemBadge, disabled, prominence: "strong", sentiment: badgeSentiment, size: "small", children: badgeText }) : null,
181
- shouldShowPinnedButton ? /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "right", text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: items_css.navigationItemRelative, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-disabled": isItemPinned ? false : isPinDisabled, "aria-label": isItemPinned ? "unpin" : "pin", className: items_css.navigationItemPinnedButton, onClick: (event) => {
182
- if (pinnedItems.length < pinLimit || isItemPinned) {
183
- event.preventDefault();
184
- event.stopPropagation();
185
- let newValue;
186
- if (isItemPinned) {
187
- newValue = unpinItem(id);
188
- } else {
189
- newValue = pinItem(id);
190
- }
191
- onClickPinUnpin?.({
192
- id,
193
- state: isItemPinned ? "unpin" : "pin",
194
- totalPinned: newValue
195
- });
196
- }
197
- }, onKeyDown: () => {
198
- }, role: "button", children: /* @__PURE__ */ jsxRuntime.jsx(PinUnpinIcon, { className: items_css.navigationItemPinIcon[active ? "active" : "inactive"], disabled: isItemPinned ? false : isPinDisabled, sentiment: active ? "primary" : "neutral", size: "medium" }) }) }) }) : null
199
- ] }) : null,
200
- hasHrefAndNoChildren && target === "_blank" && !animation ? /* @__PURE__ */ jsxRuntime.jsx(icons.OpenInNewIcon, { disabled, prominence: "default", sentiment: "neutral" }) : null,
201
- children ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "center", className: items_css.navigationItemStackIcon, direction: "row", gap: 1, children: !animation && !noExpand ? /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { prominence: "weak", sentiment: "neutral" }) : null }) : null
202
- ] })
203
- ] }),
204
- children ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: !noExpand ? /* @__PURE__ */ jsxRuntime.jsx(ItemProvider.ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Expandable, { animationDuration: 0, opened: internalExpanded, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { className: noExpand || type === "pinnedGroup" ? "" : items_css.navigationItemPaddingStack({
205
- hide: shouldAnimate && animationType === "complex" && animation === "expand"
206
- }), width: animation ? "100%" : void 0, children }) }) }) : /* @__PURE__ */ jsxRuntime.jsx(ItemProvider.ItemProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { className: noExpand || type === "pinnedGroup" ? "" : items_css.navigationItemPaddingStack({
207
- hide: shouldAnimate && animationType === "complex" && animation === "expand"
208
- }), width: animation ? "100%" : void 0, children }) }) }) : null
209
- ] });
210
- }
211
- if (categoryIcon || react.Children.count(children) > 0 && !hasParents) {
212
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "start", className: items_css.navigationItemMenuStack, gap: 1, justifyContent: "start", style, children: react.Children.count(children) > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
213
- ui.Menu,
214
- {
215
- className: items_css.navigationItemMenuContainer,
216
- disclosure: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { "aria-label": label, sentiment: "neutral", size: "small", variant: hasActiveChildren ? "filled" : "ghost", children: categoryIcon ? /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "center", direction: "row", gap: 1, justifyContent: "center", children: categoryIcon }) : null }),
217
- dynamicDomRendering: false,
218
- placement: "right",
219
- triggerMethod: "hover",
220
- children: /* @__PURE__ */ jsxRuntime.jsx(ItemProvider.ItemProvider, { children })
221
- }
222
- ) : /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "right", tabIndex: -1, text: label, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { "aria-label": label, sentiment: "neutral", size: "small", variant: active ? "filled" : "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "center", direction: "row", gap: 1, justifyContent: "center", children: categoryIcon || /* @__PURE__ */ jsxRuntime.jsx(category.OrganizationDashboardCategoryIcon, { variant: active ? "primary" : "neutral" }) }) }) }) });
223
- }
224
- if (hasParents) {
225
- return /* @__PURE__ */ jsxRuntime.jsx(
226
- ui.Menu.Item,
227
- {
228
- active,
229
- borderless: true,
230
- className: `${items_css.navigationItemMenu}${pinnedFeature && shouldShowPinnedButton ? ` ${items_css.navigationItemMenuPinned}` : ""}`,
231
- disabled,
232
- href,
233
- onClick: () => onToggle?.(!!active),
234
- rel,
235
- sentiment: active ? "primary" : "neutral",
236
- style,
237
- target,
238
- children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { alignItems: "center", direction: "row", flex: 1, gap: 1, justifyContent: "space-between", width: "100%", children: [
239
- !animation ? /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "span", className: items_css.navigationItemWrapText({
240
- disabled,
241
- weak: hasActiveChildren && !noExpand && !disabled && !!active
242
- }), variant: "bodySmall", whiteSpace: "pre-wrap", children: label }) : null,
243
- labelDescription ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: items_css.navigationItemPadded, children: labelDescription }) : null,
244
- /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { direction: "row", children: [
245
- badgeText && !animation ? /* @__PURE__ */ jsxRuntime.jsx(ui.Badge, { className: items_css.navigationItemBadge, disabled, prominence: "strong", sentiment: badgeSentiment, size: "small", children: badgeText }) : null,
246
- hasHrefAndNoChildren && target === "_blank" ? /* @__PURE__ */ jsxRuntime.jsx(icons.OpenInNewIcon, { className: shouldAnimate && animationType === "complex" ? items_css.navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "", disabled, prominence: "weak", sentiment: "neutral" }) : null,
247
- shouldShowPinnedButton ? /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "right", text: isItemPinned ? locales["navigation.unpin.tooltip"] : pinTooltipLocale, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: items_css.navigationItemRelative, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-disabled": isItemPinned ? false : isPinDisabled, "aria-label": isItemPinned ? "unpin" : "pin", className: items_css.navigationItemPinnedButton, onClick: (event) => {
248
- if (pinnedItems.length < pinLimit || isItemPinned) {
249
- event.preventDefault();
250
- event.stopPropagation();
251
- let newValue;
252
- if (isItemPinned) {
253
- newValue = unpinItem(id);
254
- } else {
255
- newValue = pinItem(id);
256
- }
257
- onClickPinUnpin?.({
258
- id,
259
- state: isItemPinned ? "unpin" : "pin",
260
- totalPinned: newValue
261
- });
262
- }
263
- }, onKeyDown: () => {
264
- }, role: "button", children: /* @__PURE__ */ jsxRuntime.jsx(PinUnpinIcon, { className: items_css.navigationItemPinIcon[active ? "active" : "inactive"], disabled: isItemPinned ? false : isPinDisabled, sentiment: active ? "primary" : "neutral", size: "medium" }) }) }) }) : null
265
- ] })
266
- ] })
267
- }
268
- );
269
- }
270
- if (!hasParents && href) {
271
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { placement: "right", text: label, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "start", className: items_css.navigationItemMenuStack, gap: 1, justifyContent: "start", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { alignItems: "center", as: containerTag, className: `${items_css.navigationItemContainer({
272
- disabled
273
- })} ${shouldAnimate && animationType === "complex" ? items_css.navigationItemContainerAnimated[animation === "collapse" ? "collapse" : "expand"] : ""}`, gap: 1, href, justifyContent: "center", rel, target, children: /* @__PURE__ */ jsxRuntime.jsx(icons.OpenInNewIcon, { className: shouldAnimate && animationType === "complex" ? items_css.navigationItemAnimatedIcon[animation === "expand" ? "expand" : "collapse"] : "", prominence: "weak", sentiment: "neutral" }) }) }) });
274
- }
275
- return null;
276
- });
277
- exports.Item = Item;
@@ -1,14 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const react = require("react");
6
- const ItemContext = react.createContext(false);
7
- const ItemProvider = ({
8
- children
9
- }) => {
10
- const value = react.useMemo(() => true, []);
11
- return /* @__PURE__ */ jsxRuntime.jsx(ItemContext.Provider, { value, children });
12
- };
13
- exports.ItemContext = ItemContext;
14
- exports.ItemProvider = ItemProvider;
@@ -1,80 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const category = require("@ultraviolet/icons/category");
6
- const themes = require("@ultraviolet/themes");
7
- const ui = require("@ultraviolet/ui");
8
- const react = require("react");
9
- const NavigationProvider = require("../NavigationProvider.cjs");
10
- const Item = require("./Item.cjs");
11
- const styles_css = require("./styles.css.cjs");
12
- const PinnedItems = ({
13
- toggle = true,
14
- onReorder,
15
- onToggle,
16
- itemWrapper,
17
- style
18
- }) => {
19
- const context = NavigationProvider.useNavigation();
20
- if (!context) {
21
- throw new Error("Navigation.PinnedItems can only be used inside a NavigationProvider.");
22
- }
23
- const {
24
- locales,
25
- pinnedItems,
26
- pinnedFeature,
27
- reorderItems,
28
- expanded,
29
- items,
30
- animation
31
- } = context;
32
- const theme = themes.useTheme();
33
- const onDrop = react.useCallback((event, index) => {
34
- event.preventDefault();
35
- if (event?.dataTransfer) {
36
- event.currentTarget.style.borderColor = "transparent";
37
- const data = JSON.parse(event.dataTransfer.getData("text"));
38
- if (data.index === index - 1 || index > data.index) {
39
- const newItems2 = reorderItems(data.index, index - 1);
40
- onReorder?.(newItems2);
41
- return;
42
- }
43
- const newItems = reorderItems(data.index, index);
44
- onReorder?.(newItems);
45
- }
46
- }, [onReorder, reorderItems]);
47
- const onDragOver = react.useCallback((event) => {
48
- event.preventDefault();
49
- event.currentTarget.style.borderColor = theme.colors.primary.border;
50
- }, [theme.colors.primary.border]);
51
- const onDragLeave = react.useCallback((event) => {
52
- event.preventDefault();
53
- event.currentTarget.style.borderColor = "transparent";
54
- }, []);
55
- if (Object.keys(items).length === 0) {
56
- return null;
57
- }
58
- if (pinnedFeature) {
59
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: {
60
- width: animation ? "100%" : void 0,
61
- ...style
62
- }, children: /* @__PURE__ */ jsxRuntime.jsxs(Item.Item, { categoryIcon: /* @__PURE__ */ jsxRuntime.jsx(category.PinCategoryIcon, { variant: "neutral" }), "data-testid": "pinned-group", id: "pinned-group", label: locales["navigation.pinned.item.group.label"], onToggle, toggle, type: "pinnedGroup", children: [
63
- pinnedItems.length > 0 ? pinnedItems.map((itemId, index) => {
64
- if (items[itemId]?.label) {
65
- const itemElement = /* @__PURE__ */ jsxRuntime.jsx(Item.Item, { active: items[itemId]?.active ?? false, id: itemId, index, label: items[itemId].label, onClickPinUnpin: items[itemId]?.onClickPinUnpin ?? void 0, onToggle: items[itemId]?.onToggle, toggle, type: "pinned" });
66
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_css.navigationPinnedItemRelativeDiv, children: [
67
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.navigationPinnedItemDropableArea, onDragLeave, onDragOver, onDrop: (event) => onDrop(event, index) }),
68
- itemWrapper ? itemWrapper(itemElement, itemId) : itemElement
69
- ] }, itemId);
70
- }
71
- return null;
72
- }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.navigationPinnedItemContainer({
73
- expanded
74
- }), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "p", prominence: "weak", sentiment: "neutral", variant: "caption", children: locales["navigation.pinned.item.group.empty"] }) }),
75
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.navigationPinnedItemRelativeDiv, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_css.navigationPinnedItemDropableArea, onDragLeave, onDragOver, onDrop: (event) => onDrop(event, pinnedItems.length) }) })
76
- ] }) });
77
- }
78
- return null;
79
- };
80
- exports.PinnedItems = PinnedItems;
@@ -1,8 +0,0 @@
1
- "use client";
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const jsxRuntime = require("@emotion/react/jsx-runtime");
5
- const ui = require("@ultraviolet/ui");
6
- const styles_css = require("./styles.css.cjs");
7
- const Separator = () => /* @__PURE__ */ jsxRuntime.jsx(ui.Separator, { className: styles_css.navigationSeparator });
8
- exports.Separator = Separator;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- ;/* empty css */
4
- ;/* empty css */
5
- ;/* empty css */
6
- ;/* empty css */
7
- const createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
8
- var navigationItemMenuContainer = "uv_plus_x6an4g0";
9
- var navigationItemRelative = "uv_plus_x6an4g1";
10
- var navigationItemPadded = "uv_plus_x6an4g2";
11
- var navigationItemPinIcon = { active: "uv_plus_x6an4g4 uv_plus_x6an4g3", inactive: "uv_plus_x6an4g5 uv_plus_x6an4g3" };
12
- var navigationItemMenu = "uv_plus_x6an4g6";
13
- var navigationItemMenuPinned = "uv_plus_x6an4g7";
14
- var navigationItemContainer = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_x6an4g9 uv_plus_x6an4g8", variantClassNames: { noExpand: { false: "uv_plus_x6an4ga" }, disabled: { true: "uv_plus_x6an4gb" }, isActive: { true: "uv_plus_x6an4gc" }, hasActive: { true: "uv_plus_x6an4gd" }, subLabel: { true: "uv_plus_x6an4ge" } }, defaultVariants: { noExpand: false, disabled: false, isActive: false, hasActive: false, subLabel: false }, compoundVariants: [[{ noExpand: false, disabled: false, isActive: false }, "uv_plus_x6an4gf"], [{ hasActive: true, noExpand: false, disabled: false, isActive: false }, "uv_plus_x6an4gg"], [{ noExpand: false, disabled: false, isActive: false }, "uv_plus_x6an4gh"]] });
15
- var navigationItemContainerAnimated = { collapse: "uv_plus_x6an4gi", expand: "uv_plus_x6an4gj" };
16
- var navigationItemShowDraggable = "uv_plus_x6an4gk";
17
- var navigationItemShowPinButton = "uv_plus_x6an4gl";
18
- var navigationItemWeakText = "uv_plus_x6an4gm";
19
- var navigationItemDragIcon = "uv_plus_x6an4gn";
20
- var navigationItemWrapText = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_x6an4go", variantClassNames: { disabled: { true: "uv_plus_x6an4gp" }, weak: { true: "uv_plus_x6an4gq" } }, defaultVariants: { disabled: false, weak: false }, compoundVariants: [] });
21
- var navigationItemBadge = "uv_plus_x6an4gr";
22
- var navigationItemPinnedButton = "uv_plus_x6an4gs";
23
- var navigationItemAnimatedIcon = { expand: "uv_plus_x6an4gt", collapse: "uv_plus_x6an4gu" };
24
- var navigationItemMenuStack = "uv_plus_x6an4gv";
25
- var navigationItemStackIcon = "uv_plus_x6an4gw";
26
- var navigationItemCategoryIcon = "uv_plus_x6an4gx";
27
- var navigationItemPaddingStack = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_x6an4gy", variantClassNames: { hide: { true: "uv_plus_x6an4gz" } }, defaultVariants: {}, compoundVariants: [] });
28
- exports.navigationItemAnimatedIcon = navigationItemAnimatedIcon;
29
- exports.navigationItemBadge = navigationItemBadge;
30
- exports.navigationItemCategoryIcon = navigationItemCategoryIcon;
31
- exports.navigationItemContainer = navigationItemContainer;
32
- exports.navigationItemContainerAnimated = navigationItemContainerAnimated;
33
- exports.navigationItemDragIcon = navigationItemDragIcon;
34
- exports.navigationItemMenu = navigationItemMenu;
35
- exports.navigationItemMenuContainer = navigationItemMenuContainer;
36
- exports.navigationItemMenuPinned = navigationItemMenuPinned;
37
- exports.navigationItemMenuStack = navigationItemMenuStack;
38
- exports.navigationItemPadded = navigationItemPadded;
39
- exports.navigationItemPaddingStack = navigationItemPaddingStack;
40
- exports.navigationItemPinIcon = navigationItemPinIcon;
41
- exports.navigationItemPinnedButton = navigationItemPinnedButton;
42
- exports.navigationItemRelative = navigationItemRelative;
43
- exports.navigationItemShowDraggable = navigationItemShowDraggable;
44
- exports.navigationItemShowPinButton = navigationItemShowPinButton;
45
- exports.navigationItemStackIcon = navigationItemStackIcon;
46
- exports.navigationItemWeakText = navigationItemWeakText;
47
- exports.navigationItemWrapText = navigationItemWrapText;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- ;/* empty css */
4
- ;/* empty css */
5
- const createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
6
- var navigationGroupText = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_nytpcy0", variantClassNames: { animation: { expand: "uv_plus_nytpcy1", collapse: "uv_plus_nytpcy2", false: "uv_plus_nytpcy3" } }, defaultVariants: {}, compoundVariants: [] });
7
- var navigationGroupStack = "uv_plus_nytpcy4";
8
- var navigationPinnedItemDropableArea = "uv_plus_nytpcy5";
9
- var navigationPinnedItemRelativeDiv = "uv_plus_nytpcy6";
10
- var navigationPinnedItemContainer = createRuntimeFn.createRuntimeFn({ defaultClassName: "uv_plus_nytpcy7", variantClassNames: { expanded: { true: "uv_plus_nytpcy8" } }, defaultVariants: {}, compoundVariants: [] });
11
- var navigationSeparator = "uv_plus_nytpcy9";
12
- exports.navigationGroupStack = navigationGroupStack;
13
- exports.navigationGroupText = navigationGroupText;
14
- exports.navigationPinnedItemContainer = navigationPinnedItemContainer;
15
- exports.navigationPinnedItemDropableArea = navigationPinnedItemDropableArea;
16
- exports.navigationPinnedItemRelativeDiv = navigationPinnedItemRelativeDiv;
17
- exports.navigationSeparator = navigationSeparator;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const NAVIGATION_MIN_WIDTH = 220;
4
- const NAVIGATION_WIDTH = 280;
5
- const NAVIGATION_COLLASPED_WIDTH = 67;
6
- const ANIMATION_DURATION = 250;
7
- exports.ANIMATION_DURATION = ANIMATION_DURATION;
8
- exports.NAVIGATION_COLLASPED_WIDTH = NAVIGATION_COLLASPED_WIDTH;
9
- exports.NAVIGATION_MIN_WIDTH = NAVIGATION_MIN_WIDTH;
10
- exports.NAVIGATION_WIDTH = NAVIGATION_WIDTH;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- const NavigationLocales = {
3
- "navigation.collapse.button": "Collapse sidebar",
4
- "navigation.expand.button": "Expand sidebar",
5
- "navigation.pin.limit": "You cannot pin more products",
6
- "navigation.pin.tooltip": "Pin product",
7
- "navigation.pinned.item.group.empty": "You have no pinned items.",
8
- "navigation.pinned.item.group.label": "Pinned items",
9
- "navigation.unpin.tooltip": "Unpin product"
10
- };
11
- module.exports = NavigationLocales;