@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.
- package/dist/components/CodeEditor/CodeEditor.d.ts +1 -1
- package/dist/components/CodeEditor/CodeEditor.js +41 -11
- package/dist/components/ContentCard/Skeleton.d.ts +1 -1
- package/dist/components/ContentCard/Skeleton.js +13 -8
- package/dist/components/ContentCard/index.js +131 -51
- package/dist/components/ContentCardGroup/Card.js +63 -22
- package/dist/components/ContentCardGroup/SkeletonCard.d.ts +1 -1
- package/dist/components/ContentCardGroup/SkeletonCard.js +1 -1
- package/dist/components/ContentCardGroup/index.js +11 -6
- package/dist/components/ContentCardGroup/styles.css.js +1 -0
- package/dist/components/Conversation/index.d.ts +9 -9
- package/dist/components/Conversation/index.js +23 -6
- package/dist/components/CustomerSatisfaction/index.d.ts +1 -1
- package/dist/components/CustomerSatisfaction/index.js +68 -39
- package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts +1 -1
- package/dist/components/EstimateCost/Components/CustomUnitInput.js +47 -27
- package/dist/components/EstimateCost/Components/Item.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Item.js +303 -203
- package/dist/components/EstimateCost/Components/LineThrough.d.ts +1 -1
- package/dist/components/EstimateCost/Components/LineThrough.js +8 -2
- package/dist/components/EstimateCost/Components/NumberInput.d.ts +1 -1
- package/dist/components/EstimateCost/Components/NumberInput.js +17 -9
- package/dist/components/EstimateCost/Components/Region.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Region.js +43 -25
- package/dist/components/EstimateCost/Components/Regular.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Regular.js +20 -16
- package/dist/components/EstimateCost/Components/Strong.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Strong.js +11 -10
- package/dist/components/EstimateCost/Components/Unit.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Unit.js +20 -13
- package/dist/components/EstimateCost/Components/Zone.d.ts +1 -1
- package/dist/components/EstimateCost/Components/Zone.js +41 -24
- package/dist/components/EstimateCost/EstimateCost.d.ts +11 -11
- package/dist/components/EstimateCost/EstimateCost.js +61 -10
- package/dist/components/EstimateCost/EstimateCostContent.d.ts +1 -1
- package/dist/components/EstimateCost/EstimateCostContent.js +264 -120
- package/dist/components/EstimateCost/EstimateCostProvider.d.ts +1 -1
- package/dist/components/EstimateCost/EstimateCostProvider.js +24 -21
- package/dist/components/EstimateCost/OverlayComponent.d.ts +1 -1
- package/dist/components/EstimateCost/OverlayComponent.js +53 -41
- package/dist/components/EstimateCost/OverlayContext.d.ts +1 -1
- package/dist/components/EstimateCost/OverlayContext.js +2 -4
- package/dist/components/FAQ/index.d.ts +1 -1
- package/dist/components/FAQ/index.js +1 -1
- package/dist/components/InfoTable/InfoTable.d.ts +3 -3
- package/dist/components/InfoTable/InfoTable.js +10 -4
- package/dist/components/InfoTable/components/Cell.d.ts +1 -1
- package/dist/components/InfoTable/components/Cell.js +24 -4
- package/dist/components/InfoTable/components/Row.d.ts +1 -1
- package/dist/components/InfoTable/components/Row.js +16 -10
- package/dist/components/InfoTable/styles.css.d.ts +0 -1
- package/dist/components/InfoTable/styles.css.js +0 -2
- package/dist/components/Navigation/Footer.d.ts +1 -1
- package/dist/components/Navigation/Footer.js +34 -19
- package/dist/components/Navigation/Header.d.ts +1 -1
- package/dist/components/Navigation/Header.js +12 -9
- package/dist/components/Navigation/Navigation.d.ts +5 -5
- package/dist/components/Navigation/Navigation.js +2 -5
- package/dist/components/Navigation/NavigationContent.d.ts +1 -1
- package/dist/components/Navigation/NavigationContent.js +56 -18
- package/dist/components/Navigation/NavigationProvider.d.ts +1 -1
- package/dist/components/Navigation/NavigationProvider.js +108 -70
- package/dist/components/Navigation/components/Group.d.ts +1 -1
- package/dist/components/Navigation/components/Group.js +20 -19
- package/dist/components/Navigation/components/Item.d.ts +1 -1
- package/dist/components/Navigation/components/Item.js +551 -254
- package/dist/components/Navigation/components/ItemProvider.d.ts +1 -1
- package/dist/components/Navigation/components/ItemProvider.js +2 -4
- package/dist/components/Navigation/components/PinnedItems.d.ts +1 -1
- package/dist/components/Navigation/components/PinnedItems.js +91 -37
- package/dist/components/Navigation/components/Separator.d.ts +1 -1
- package/dist/components/Navigation/components/Separator.js +1 -1
- package/dist/components/Navigation/styles.css.js +0 -1
- package/dist/components/Navigation/variables.css.js +1 -0
- package/dist/components/OfferList/OfferList.d.ts +3 -3
- package/dist/components/OfferList/OfferList.js +41 -9
- package/dist/components/OfferList/OfferListProvider.d.ts +1 -1
- package/dist/components/OfferList/OfferListProvider.js +25 -15
- package/dist/components/OfferList/components/Banner.d.ts +1 -1
- package/dist/components/OfferList/components/Banner.js +30 -8
- package/dist/components/OfferList/components/Cell.d.ts +1 -1
- package/dist/components/OfferList/components/Cell.js +12 -5
- package/dist/components/OfferList/components/Row.d.ts +1 -1
- package/dist/components/OfferList/components/Row.js +135 -42
- package/dist/components/OrderSummary/NonScrollableContent.d.ts +1 -1
- package/dist/components/OrderSummary/NonScrollableContent.js +68 -22
- package/dist/components/OrderSummary/Provider.js +1 -4
- package/dist/components/OrderSummary/ScrollableContent.d.ts +1 -1
- package/dist/components/OrderSummary/ScrollableContent.js +174 -33
- package/dist/components/OrderSummary/constants.js +7 -1
- package/dist/components/OrderSummary/helpers.js +36 -18
- package/dist/components/OrderSummary/index.d.ts +1 -1
- package/dist/components/OrderSummary/index.js +135 -48
- package/dist/components/Plans/FeatureHint.d.ts +1 -1
- package/dist/components/Plans/FeatureHint.js +26 -8
- package/dist/components/Plans/PlanHeader.d.ts +1 -1
- package/dist/components/Plans/PlanHeader.js +79 -25
- package/dist/components/Plans/index.d.ts +1 -1
- package/dist/components/Plans/index.js +142 -53
- package/dist/components/Plans/styles.css.js +0 -1
- package/dist/components/SteppedListCard/Step.d.ts +1 -1
- package/dist/components/SteppedListCard/Step.js +42 -2
- package/dist/components/SteppedListCard/SteppedListCard.d.ts +2 -2
- package/dist/components/SteppedListCard/SteppedListCard.js +66 -19
- package/dist/components/SteppedListCard/SteppedListContent.d.ts +1 -1
- package/dist/components/SteppedListCard/SteppedListContent.js +13 -11
- package/dist/components/SteppedListCard/helper.js +3 -1
- package/dist/plus.css +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useState, useReducer, useRef, useCallback, useMemo, createContext } from "react";
|
|
4
4
|
import { NAVIGATION_WIDTH, ANIMATION_DURATION } from "./constants.js";
|
|
5
5
|
import NavigationLocales from "./locales/en.js";
|
|
@@ -10,9 +10,7 @@ const NavigationContext = createContext({
|
|
|
10
10
|
expanded: true,
|
|
11
11
|
items: {},
|
|
12
12
|
locales: NavigationLocales,
|
|
13
|
-
navigationRef: {
|
|
14
|
-
current: null
|
|
15
|
-
},
|
|
13
|
+
navigationRef: { current: null },
|
|
16
14
|
pinItem: () => [],
|
|
17
15
|
pinLimit: 7,
|
|
18
16
|
pinnedItems: [],
|
|
@@ -51,75 +49,115 @@ const NavigationProvider = ({
|
|
|
51
49
|
}) => {
|
|
52
50
|
const [expanded, setExpanded] = useState(initialExpanded);
|
|
53
51
|
const [pinnedItems, setPinnedItems] = useState(initialPinned ?? []);
|
|
54
|
-
const [animation, setAnimation] = useState(
|
|
52
|
+
const [animation, setAnimation] = useState(
|
|
53
|
+
false
|
|
54
|
+
);
|
|
55
55
|
const [width, setWidth] = useState(initialWidth);
|
|
56
|
-
const [allowNavigationResize, setAllowNavigationResize] = useState(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
const [allowNavigationResize, setAllowNavigationResize] = useState(
|
|
57
|
+
initialAllowNavigationResize
|
|
58
|
+
);
|
|
59
|
+
const [items, registerItem] = useReducer(
|
|
60
|
+
(oldState, newState) => ({
|
|
61
|
+
...oldState,
|
|
62
|
+
...newState
|
|
63
|
+
}),
|
|
64
|
+
{}
|
|
65
|
+
);
|
|
61
66
|
const navigationRef = useRef(null);
|
|
62
|
-
const toggleExpand = useCallback(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
const toggleExpand = useCallback(
|
|
68
|
+
(toggle) => {
|
|
69
|
+
if (typeof toggle !== "boolean" && toggle !== void 0) {
|
|
70
|
+
throw new Error(
|
|
71
|
+
"toggleExpand only accepts boolean or undefined as parameter. You most likely did <button onClick={toggleExpand}> instead of <button onClick={() => toggleExpand()}>"
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (toggle !== void 0 && toggle === expanded) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
onExpandChange?.(!expanded);
|
|
78
|
+
if (navigationRef.current) {
|
|
79
|
+
navigationRef.current.style.width = "";
|
|
80
|
+
}
|
|
81
|
+
if (shouldAnimate) {
|
|
82
|
+
setAnimation(expanded ? "collapse" : "expand");
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
setExpanded(toggle !== void 0 ? toggle : !expanded);
|
|
85
|
+
setAnimation(false);
|
|
86
|
+
}, ANIMATION_DURATION);
|
|
87
|
+
} else {
|
|
76
88
|
setExpanded(toggle !== void 0 ? toggle : !expanded);
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[expanded, onExpandChange, shouldAnimate]
|
|
92
|
+
);
|
|
93
|
+
const pinItem = useCallback(
|
|
94
|
+
(item) => {
|
|
95
|
+
const newValue = [...pinnedItems, item];
|
|
96
|
+
setPinnedItems(newValue);
|
|
97
|
+
return newValue;
|
|
98
|
+
},
|
|
99
|
+
[pinnedItems]
|
|
100
|
+
);
|
|
101
|
+
const unpinItem = useCallback(
|
|
102
|
+
(item) => {
|
|
103
|
+
const newValue = pinnedItems.filter((localItem) => localItem !== item);
|
|
104
|
+
setPinnedItems(newValue);
|
|
105
|
+
return newValue;
|
|
106
|
+
},
|
|
107
|
+
[pinnedItems]
|
|
108
|
+
);
|
|
109
|
+
const reorderItems = useCallback(
|
|
110
|
+
(initialIndex, endIndex) => {
|
|
111
|
+
const newPinnedItems = [...pinnedItems];
|
|
112
|
+
const [removed] = newPinnedItems.splice(initialIndex, 1);
|
|
113
|
+
newPinnedItems.splice(endIndex, 0, removed);
|
|
114
|
+
setPinnedItems(newPinnedItems);
|
|
115
|
+
return newPinnedItems;
|
|
116
|
+
},
|
|
117
|
+
[pinnedItems]
|
|
118
|
+
);
|
|
119
|
+
const value = useMemo(
|
|
120
|
+
() => ({
|
|
121
|
+
allowNavigationResize,
|
|
122
|
+
animation,
|
|
123
|
+
animationType,
|
|
124
|
+
expanded,
|
|
125
|
+
items,
|
|
126
|
+
locales,
|
|
127
|
+
navigationRef,
|
|
128
|
+
pinItem,
|
|
129
|
+
pinLimit,
|
|
130
|
+
pinnedFeature,
|
|
131
|
+
pinnedItems,
|
|
132
|
+
registerItem,
|
|
133
|
+
reorderItems,
|
|
134
|
+
setAllowNavigationResize,
|
|
135
|
+
setAnimation,
|
|
136
|
+
setPinnedItems,
|
|
137
|
+
setWidth,
|
|
138
|
+
shouldAnimate,
|
|
139
|
+
toggleExpand,
|
|
140
|
+
unpinItem,
|
|
141
|
+
width
|
|
142
|
+
}),
|
|
143
|
+
[
|
|
144
|
+
expanded,
|
|
145
|
+
toggleExpand,
|
|
146
|
+
pinnedItems,
|
|
147
|
+
pinItem,
|
|
148
|
+
unpinItem,
|
|
149
|
+
pinnedFeature,
|
|
150
|
+
locales,
|
|
151
|
+
pinLimit,
|
|
152
|
+
animation,
|
|
153
|
+
width,
|
|
154
|
+
reorderItems,
|
|
155
|
+
items,
|
|
156
|
+
allowNavigationResize,
|
|
157
|
+
shouldAnimate,
|
|
158
|
+
animationType
|
|
159
|
+
]
|
|
160
|
+
);
|
|
123
161
|
return /* @__PURE__ */ jsx(NavigationContext.Provider, { value, children });
|
|
124
162
|
};
|
|
125
163
|
export {
|
|
@@ -4,5 +4,5 @@ type GroupProps = {
|
|
|
4
4
|
label: string;
|
|
5
5
|
style?: CSSProperties;
|
|
6
6
|
};
|
|
7
|
-
export declare const Group: ({ children, label, style }: GroupProps) => import("
|
|
7
|
+
export declare const Group: ({ children, label, style }: GroupProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
8
|
export {};
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Stack, Text } from "@ultraviolet/ui";
|
|
4
4
|
import { Children } from "react";
|
|
5
5
|
import { useNavigation } from "../NavigationProvider.js";
|
|
6
6
|
import { navigationGroupStack, navigationGroupText } from "./styles.css.js";
|
|
7
|
-
const Group = ({
|
|
8
|
-
children,
|
|
9
|
-
label,
|
|
10
|
-
style
|
|
11
|
-
}) => {
|
|
7
|
+
const Group = ({ children, label, style }) => {
|
|
12
8
|
const context = useNavigation();
|
|
13
9
|
if (!context) {
|
|
14
|
-
throw new Error(
|
|
10
|
+
throw new Error(
|
|
11
|
+
"Navigation.Group can only be used inside a NavigationProvider."
|
|
12
|
+
);
|
|
15
13
|
}
|
|
16
|
-
const {
|
|
17
|
-
expanded,
|
|
18
|
-
animation,
|
|
19
|
-
animationType
|
|
20
|
-
} = context;
|
|
14
|
+
const { expanded, animation, animationType } = context;
|
|
21
15
|
const isDiplay = !animation && expanded;
|
|
22
16
|
if (Children.count(children) > 0) {
|
|
23
|
-
return /* @__PURE__ */ jsx("div", { style: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
17
|
+
return /* @__PURE__ */ jsx("div", { style: { width: animation ? "100%" : void 0, ...style }, children: /* @__PURE__ */ jsxs(Stack, { className: navigationGroupStack, direction: "column", children: [
|
|
18
|
+
isDiplay ? /* @__PURE__ */ jsx(
|
|
19
|
+
Text,
|
|
20
|
+
{
|
|
21
|
+
as: "span",
|
|
22
|
+
className: navigationGroupText({
|
|
23
|
+
animation: animationType === "complex" ? animation : false
|
|
24
|
+
}),
|
|
25
|
+
prominence: "weak",
|
|
26
|
+
sentiment: "neutral",
|
|
27
|
+
variant: "bodySmallStrong",
|
|
28
|
+
children: label
|
|
29
|
+
}
|
|
30
|
+
) : null,
|
|
30
31
|
children
|
|
31
32
|
] }) });
|
|
32
33
|
}
|
|
@@ -80,5 +80,5 @@ type ItemProps = {
|
|
|
80
80
|
'data-testid'?: string;
|
|
81
81
|
style?: CSSProperties;
|
|
82
82
|
};
|
|
83
|
-
export declare const Item: import("react").MemoExoticComponent<({ children, categoryIcon, label, labelDescription, subLabel, badgeText, badgeSentiment, href, target, rel, onToggle, onClickPinUnpin, toggle, active, noPinButton, type, as, disabled, noExpand, index, id, "data-testid": dataTestId, style, }: ItemProps) => import("
|
|
83
|
+
export declare const Item: import("react").MemoExoticComponent<({ children, categoryIcon, label, labelDescription, subLabel, badgeText, badgeSentiment, href, target, rel, onToggle, onClickPinUnpin, toggle, active, noPinButton, type, as, disabled, noExpand, index, id, "data-testid": dataTestId, style, }: ItemProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
84
84
|
export {};
|