@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 { jsxs, Fragment, jsx } from "
|
|
2
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowUpIcon, ArrowDownIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { theme } from "@ultraviolet/themes";
|
|
5
5
|
import { List, Badge, Tooltip, Radio, Checkbox, Button } from "@ultraviolet/ui";
|
|
@@ -36,11 +36,7 @@ const Row = ({
|
|
|
36
36
|
onChangeSelect,
|
|
37
37
|
autoCollapse
|
|
38
38
|
} = useOfferListContext();
|
|
39
|
-
const {
|
|
40
|
-
expandedRowIds,
|
|
41
|
-
collapseRow,
|
|
42
|
-
expandRow
|
|
43
|
-
} = List.useListContext();
|
|
39
|
+
const { expandedRowIds, collapseRow, expandRow } = List.useListContext();
|
|
44
40
|
const [isHovered, setHovered] = useState(false);
|
|
45
41
|
const childrenNumber = Children.count(children) + (selectable ? 1 : 0) + (expandable ? 1 : 0);
|
|
46
42
|
const toggleRowExpand = useCallback(() => {
|
|
@@ -55,9 +51,16 @@ const Row = ({
|
|
|
55
51
|
const computedExpandableContent = useMemo(() => {
|
|
56
52
|
if (expandable && !loading && expandedRowIds[id] && banner) {
|
|
57
53
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: offerListRowExpandable,
|
|
58
|
+
style: assignInlineVars({
|
|
59
|
+
[expandablePadding]: theme.space[expandablePadding$1 ?? 2]
|
|
60
|
+
}),
|
|
61
|
+
children: expandableContent
|
|
62
|
+
}
|
|
63
|
+
),
|
|
61
64
|
/* @__PURE__ */ jsx(Banner, { disabled, sentiment: banner.sentiment, children: banner.text })
|
|
62
65
|
] });
|
|
63
66
|
}
|
|
@@ -65,7 +68,16 @@ const Row = ({
|
|
|
65
68
|
return expandableContent;
|
|
66
69
|
}
|
|
67
70
|
return void 0;
|
|
68
|
-
}, [
|
|
71
|
+
}, [
|
|
72
|
+
expandable,
|
|
73
|
+
loading,
|
|
74
|
+
expandedRowIds,
|
|
75
|
+
banner,
|
|
76
|
+
expandablePadding$1,
|
|
77
|
+
id,
|
|
78
|
+
expandableContent,
|
|
79
|
+
disabled
|
|
80
|
+
]);
|
|
69
81
|
const isRowSelected = useMemo(() => {
|
|
70
82
|
if (selectable === "radio") {
|
|
71
83
|
return radioSelectedRow === offerName;
|
|
@@ -74,38 +86,119 @@ const Row = ({
|
|
|
74
86
|
}, [offerName, checkboxSelectedRows, radioSelectedRow, selectable]);
|
|
75
87
|
const isSelected = selectable === "radio" ? radioSelectedRow === offerName : checkboxSelectedRows.includes(offerName);
|
|
76
88
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
77
|
-
/* @__PURE__ */ jsxs(
|
|
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
|
-
|
|
89
|
+
/* @__PURE__ */ jsxs(
|
|
90
|
+
List.Row,
|
|
91
|
+
{
|
|
92
|
+
className: `${className ? `${className} ` : ""}${banner ? offerListRowBanner : ""}${isSelected ? `${" "}${offerListRowSelected}` : ""} ${expandable ? offerListRowSelectedExpandable : offerListRowSelectedNotExpandable}`,
|
|
93
|
+
"data-dragging": dataDragging,
|
|
94
|
+
"data-testid": dataTestId,
|
|
95
|
+
disabled,
|
|
96
|
+
expandable: computedExpandableContent,
|
|
97
|
+
expandablePadding: banner ? "0" : void 0,
|
|
98
|
+
expanded: expanded ?? expandedRowIds[id],
|
|
99
|
+
highlightAnimation,
|
|
100
|
+
id,
|
|
101
|
+
onMouseEnter: () => setHovered(true),
|
|
102
|
+
onMouseLeave: () => setHovered(false),
|
|
103
|
+
style,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs(List.Cell, { className: offerListNoPaddingCell, children: [
|
|
106
|
+
badge ? /* @__PURE__ */ jsx("div", { className: offerListBadgeContainer, children: /* @__PURE__ */ jsx(
|
|
107
|
+
Badge,
|
|
108
|
+
{
|
|
109
|
+
className: offerListBadge,
|
|
110
|
+
disabled,
|
|
111
|
+
prominence: badge.prominence,
|
|
112
|
+
sentiment: badge.sentiment,
|
|
113
|
+
size: "small",
|
|
114
|
+
children: badge.text
|
|
115
|
+
}
|
|
116
|
+
) }) : null,
|
|
117
|
+
/* @__PURE__ */ jsx("div", { className: offerListRowSelectableContainer, children: /* @__PURE__ */ jsx(
|
|
118
|
+
Tooltip,
|
|
119
|
+
{
|
|
120
|
+
text: typeof selectDisabled === "string" ? selectDisabled : void 0,
|
|
121
|
+
children: selectable === "radio" ? /* @__PURE__ */ jsx(
|
|
122
|
+
Radio,
|
|
123
|
+
{
|
|
124
|
+
checked: isRowSelected,
|
|
125
|
+
disabled: disabled || loading || !!selectDisabled,
|
|
126
|
+
id,
|
|
127
|
+
name: `radio-offer-list-${id}`,
|
|
128
|
+
onChange: () => {
|
|
129
|
+
setRadioSelectedRow(offerName);
|
|
130
|
+
onChangeSelect?.(offerName);
|
|
131
|
+
if (expandedRowIds[id]) {
|
|
132
|
+
expandRow(id);
|
|
133
|
+
} else if (!autoCollapse) {
|
|
134
|
+
collapseRow(id);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
value: id
|
|
138
|
+
}
|
|
139
|
+
) : /* @__PURE__ */ jsx(
|
|
140
|
+
Checkbox,
|
|
141
|
+
{
|
|
142
|
+
"aria-label": "select",
|
|
143
|
+
checked: isRowSelected,
|
|
144
|
+
disabled: disabled || loading || !!selectDisabled,
|
|
145
|
+
id,
|
|
146
|
+
name: `checkbox-offer-list-${id}`,
|
|
147
|
+
onChange: () => {
|
|
148
|
+
if (isRowSelected) {
|
|
149
|
+
const newSelectedList = checkboxSelectedRows.filter(
|
|
150
|
+
(element) => element !== offerName
|
|
151
|
+
);
|
|
152
|
+
setCheckboxSelectedRows(newSelectedList);
|
|
153
|
+
onChangeSelect?.(newSelectedList);
|
|
154
|
+
} else {
|
|
155
|
+
const newSelectedList = [
|
|
156
|
+
...checkboxSelectedRows,
|
|
157
|
+
offerName
|
|
158
|
+
];
|
|
159
|
+
setCheckboxSelectedRows(newSelectedList);
|
|
160
|
+
onChangeSelect?.(newSelectedList);
|
|
161
|
+
}
|
|
162
|
+
if (expandedRowIds[id]) {
|
|
163
|
+
expandRow(id);
|
|
164
|
+
} else if (!autoCollapse) {
|
|
165
|
+
collapseRow(id);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
value: id
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
) })
|
|
173
|
+
] }),
|
|
174
|
+
expandable ? /* @__PURE__ */ jsx(List.Cell, { className: offerListNoPaddingCell, children: /* @__PURE__ */ jsx(
|
|
175
|
+
Button,
|
|
176
|
+
{
|
|
177
|
+
"aria-label": "expand",
|
|
178
|
+
"data-testid": "list-expand-button",
|
|
179
|
+
disabled: disabled || !expandable || loading,
|
|
180
|
+
onClick: toggleRowExpand,
|
|
181
|
+
sentiment: "neutral",
|
|
182
|
+
size: "small",
|
|
183
|
+
variant: "ghost",
|
|
184
|
+
children: expandedRowIds[id] ? /* @__PURE__ */ jsx(ArrowUpIcon, {}) : /* @__PURE__ */ jsx(ArrowDownIcon, {})
|
|
185
|
+
}
|
|
186
|
+
) }) : null,
|
|
187
|
+
children
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
banner && !expandedRowIds[id] ? /* @__PURE__ */ jsx(
|
|
192
|
+
Banner,
|
|
193
|
+
{
|
|
194
|
+
colSpan: childrenNumber,
|
|
195
|
+
disabled,
|
|
196
|
+
sentiment: banner.sentiment,
|
|
197
|
+
shouldHavePrimaryBorder: isHovered || isRowSelected,
|
|
198
|
+
type: "cell",
|
|
199
|
+
children: banner.text
|
|
200
|
+
}
|
|
201
|
+
) : null
|
|
109
202
|
] });
|
|
110
203
|
};
|
|
111
204
|
export {
|
|
@@ -11,5 +11,5 @@ type NonScrollableContentProps = {
|
|
|
11
11
|
hideDetails: boolean;
|
|
12
12
|
unit: TimeUnit;
|
|
13
13
|
};
|
|
14
|
-
export declare const NonScrollableContent: ({ totalPrice, footer, children, totalPriceInfo, hideDetails, unit, totalPriceDescription, additionalInfo, }: NonScrollableContentProps) => import("
|
|
14
|
+
export declare const NonScrollableContent: ({ totalPrice, footer, children, totalPriceInfo, hideDetails, unit, totalPriceDescription, additionalInfo, }: NonScrollableContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, jsx } from "
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Text } from "@ultraviolet/ui";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { DisplayPrice } from "./helpers.js";
|
|
@@ -14,38 +14,84 @@ const NonScrollableContent = ({
|
|
|
14
14
|
totalPriceDescription,
|
|
15
15
|
additionalInfo
|
|
16
16
|
}) => {
|
|
17
|
-
const {
|
|
18
|
-
locales
|
|
19
|
-
} = useContext(OrderSummaryContext);
|
|
17
|
+
const { locales } = useContext(OrderSummaryContext);
|
|
20
18
|
return /* @__PURE__ */ jsxs(Stack, { className: orderSummaryNonScrollableContainer, gap: 3, children: [
|
|
21
19
|
children,
|
|
22
20
|
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
23
21
|
totalPriceInfo ? /* @__PURE__ */ jsxs(Stack, { children: [
|
|
24
22
|
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
25
|
-
/* @__PURE__ */ jsxs(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
/* @__PURE__ */ jsxs(
|
|
24
|
+
Text,
|
|
25
|
+
{
|
|
26
|
+
as: "span",
|
|
27
|
+
prominence: "strong",
|
|
28
|
+
sentiment: "neutral",
|
|
29
|
+
variant: "bodyStrong",
|
|
30
|
+
children: [
|
|
31
|
+
locales["order.summary.total"],
|
|
32
|
+
":"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
29
36
|
totalPriceDescription
|
|
30
37
|
] }),
|
|
31
38
|
totalPriceInfo
|
|
32
39
|
] }) : /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
33
|
-
/* @__PURE__ */ jsxs(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
/* @__PURE__ */ jsxs(
|
|
41
|
+
Text,
|
|
42
|
+
{
|
|
43
|
+
as: "span",
|
|
44
|
+
prominence: "strong",
|
|
45
|
+
sentiment: "neutral",
|
|
46
|
+
variant: "bodyStrong",
|
|
47
|
+
children: [
|
|
48
|
+
locales["order.summary.total"],
|
|
49
|
+
additionalInfo ? ` ${additionalInfo}` : null,
|
|
50
|
+
":"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
),
|
|
38
54
|
totalPriceDescription
|
|
39
55
|
] }),
|
|
40
|
-
totalPrice.totalPrice === totalPrice.totalPriceWithDiscount ? /* @__PURE__ */ jsxs(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
56
|
+
totalPrice.totalPrice === totalPrice.totalPriceWithDiscount ? /* @__PURE__ */ jsxs(
|
|
57
|
+
Text,
|
|
58
|
+
{
|
|
59
|
+
as: "span",
|
|
60
|
+
"data-testid": "total-price",
|
|
61
|
+
prominence: "strong",
|
|
62
|
+
sentiment: "neutral",
|
|
63
|
+
variant: "headingSmallStrong",
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: totalPrice }),
|
|
66
|
+
hideDetails ? `/${unit}` : null
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) : /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
Text,
|
|
72
|
+
{
|
|
73
|
+
as: "span",
|
|
74
|
+
prominence: "weak",
|
|
75
|
+
sentiment: "neutral",
|
|
76
|
+
strikeThrough: true,
|
|
77
|
+
variant: "bodySmallStrong",
|
|
78
|
+
children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "before", price: totalPrice })
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsxs(
|
|
82
|
+
Text,
|
|
83
|
+
{
|
|
84
|
+
as: "span",
|
|
85
|
+
"data-testid": "total-price",
|
|
86
|
+
prominence: "strong",
|
|
87
|
+
sentiment: "neutral",
|
|
88
|
+
variant: "headingSmallStrong",
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: totalPrice }),
|
|
91
|
+
hideDetails ? `/${unit}` : null
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
)
|
|
49
95
|
] })
|
|
50
96
|
] }),
|
|
51
97
|
footer
|
|
@@ -4,10 +4,7 @@ const OrderSummaryContext = createContext({
|
|
|
4
4
|
categoriesPrice: {},
|
|
5
5
|
currency: "EUR",
|
|
6
6
|
hideTimeUnit: false,
|
|
7
|
-
items: [{
|
|
8
|
-
category: "",
|
|
9
|
-
subCategories: []
|
|
10
|
-
}],
|
|
7
|
+
items: [{ category: "", subCategories: [] }],
|
|
11
8
|
localeFormat: "en-US",
|
|
12
9
|
locales: orderSummaryLocales,
|
|
13
10
|
timePeriodAmount: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const ScrollableContent: () => import("
|
|
1
|
+
export declare const ScrollableContent: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Text, NumberInput } from "@ultraviolet/ui";
|
|
3
3
|
import { useContext } from "react";
|
|
4
4
|
import { DisplayPrice, calculateSubCategoryPrice, formatNumber } from "./helpers.js";
|
|
5
5
|
import { OrderSummaryContext } from "./Provider.js";
|
|
6
6
|
import { orderSummaryScrollableContainer, orderSummaryCategory, orderSummaryNumberInput, orderSummaryDetails } from "./styles.css.js";
|
|
7
|
-
const CategoryName = ({
|
|
8
|
-
|
|
9
|
-
}) => {
|
|
10
|
-
const {
|
|
11
|
-
categoriesPrice
|
|
12
|
-
} = useContext(OrderSummaryContext);
|
|
7
|
+
const CategoryName = ({ category }) => {
|
|
8
|
+
const { categoriesPrice } = useContext(OrderSummaryContext);
|
|
13
9
|
const categoryPrice = categoriesPrice[category.category] ?? {
|
|
14
10
|
maxPrice: 0,
|
|
15
11
|
maxPriceWithDiscount: 0,
|
|
@@ -19,21 +15,75 @@ const CategoryName = ({
|
|
|
19
15
|
};
|
|
20
16
|
return category.category ? /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
21
17
|
category.additionalInfo ? /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
22
|
-
/* @__PURE__ */ jsx(
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
Text,
|
|
20
|
+
{
|
|
21
|
+
as: "span",
|
|
22
|
+
prominence: "strong",
|
|
23
|
+
sentiment: "neutral",
|
|
24
|
+
variant: "bodyStrong",
|
|
25
|
+
children: category.category
|
|
26
|
+
}
|
|
27
|
+
),
|
|
23
28
|
/* @__PURE__ */ jsx(Text, { as: "span", italic: true, sentiment: "primary", variant: "bodySmall", children: category.additionalInfo })
|
|
24
|
-
] }) : /* @__PURE__ */ jsx(
|
|
29
|
+
] }) : /* @__PURE__ */ jsx(
|
|
30
|
+
Text,
|
|
31
|
+
{
|
|
32
|
+
as: "span",
|
|
33
|
+
prominence: "strong",
|
|
34
|
+
sentiment: "neutral",
|
|
35
|
+
variant: "bodyStrong",
|
|
36
|
+
children: category.category
|
|
37
|
+
}
|
|
38
|
+
),
|
|
25
39
|
category.customContent,
|
|
26
|
-
category.numberInput ? /* @__PURE__ */ jsx(
|
|
27
|
-
|
|
40
|
+
category.numberInput ? /* @__PURE__ */ jsx(
|
|
41
|
+
NumberInput,
|
|
42
|
+
{
|
|
43
|
+
className: orderSummaryNumberInput,
|
|
44
|
+
controls: category.numberInputControls,
|
|
45
|
+
onChange: category.onChangeInput,
|
|
46
|
+
size: "small",
|
|
47
|
+
unit: category.numberInputUnit,
|
|
48
|
+
value: category.numberInputValue
|
|
49
|
+
}
|
|
50
|
+
) : null,
|
|
51
|
+
!category.customContent && !category.numberInput && categoryPrice.totalPrice === categoryPrice.totalPriceWithDiscount ? /* @__PURE__ */ jsx(
|
|
52
|
+
Text,
|
|
53
|
+
{
|
|
54
|
+
as: "span",
|
|
55
|
+
prominence: "strong",
|
|
56
|
+
sentiment: "neutral",
|
|
57
|
+
variant: "bodyStrong",
|
|
58
|
+
children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: categoryPrice })
|
|
59
|
+
}
|
|
60
|
+
) : null,
|
|
28
61
|
!category.customContent && !category.numberInput && categoryPrice.totalPrice !== categoryPrice.totalPriceWithDiscount ? /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
29
|
-
/* @__PURE__ */ jsx(
|
|
30
|
-
|
|
62
|
+
/* @__PURE__ */ jsx(
|
|
63
|
+
Text,
|
|
64
|
+
{
|
|
65
|
+
as: "span",
|
|
66
|
+
prominence: "weak",
|
|
67
|
+
sentiment: "neutral",
|
|
68
|
+
strikeThrough: true,
|
|
69
|
+
variant: "bodySmallStrong",
|
|
70
|
+
children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "before", price: categoryPrice })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
Text,
|
|
75
|
+
{
|
|
76
|
+
as: "span",
|
|
77
|
+
prominence: "strong",
|
|
78
|
+
sentiment: "neutral",
|
|
79
|
+
variant: "bodyStrong",
|
|
80
|
+
children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: categoryPrice })
|
|
81
|
+
}
|
|
82
|
+
)
|
|
31
83
|
] }) : null
|
|
32
84
|
] }) : null;
|
|
33
85
|
};
|
|
34
|
-
const SubCategory = ({
|
|
35
|
-
subCategory
|
|
36
|
-
}) => {
|
|
86
|
+
const SubCategory = ({ subCategory }) => {
|
|
37
87
|
const {
|
|
38
88
|
currency,
|
|
39
89
|
localeFormat,
|
|
@@ -42,31 +92,122 @@ const SubCategory = ({
|
|
|
42
92
|
timePeriodUnit,
|
|
43
93
|
fractionDigits
|
|
44
94
|
} = useContext(OrderSummaryContext);
|
|
45
|
-
const subCategoryPrice = calculateSubCategoryPrice(
|
|
95
|
+
const subCategoryPrice = calculateSubCategoryPrice(
|
|
96
|
+
subCategory,
|
|
97
|
+
hideTimeUnit,
|
|
98
|
+
timePeriodAmount,
|
|
99
|
+
timePeriodUnit
|
|
100
|
+
);
|
|
46
101
|
return /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: 1, children: [
|
|
47
102
|
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
48
103
|
subCategory.additionalInfo ? /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
|
|
49
|
-
/* @__PURE__ */ jsx(
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Text,
|
|
106
|
+
{
|
|
107
|
+
as: "span",
|
|
108
|
+
prominence: "strong",
|
|
109
|
+
sentiment: "neutral",
|
|
110
|
+
variant: "bodySmallStrong",
|
|
111
|
+
children: subCategory.title
|
|
112
|
+
}
|
|
113
|
+
),
|
|
50
114
|
/* @__PURE__ */ jsx(Text, { as: "span", italic: true, sentiment: "primary", variant: "bodySmall", children: subCategory.additionalInfo })
|
|
51
|
-
] }) : /* @__PURE__ */ jsx(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
115
|
+
] }) : /* @__PURE__ */ jsx(
|
|
116
|
+
Text,
|
|
117
|
+
{
|
|
118
|
+
as: "span",
|
|
119
|
+
prominence: "strong",
|
|
120
|
+
sentiment: "neutral",
|
|
121
|
+
variant: "bodySmallStrong",
|
|
122
|
+
children: subCategory.title
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
subCategory.customContent ? /* @__PURE__ */ jsx(
|
|
126
|
+
Text,
|
|
127
|
+
{
|
|
128
|
+
as: "span",
|
|
129
|
+
prominence: "strong",
|
|
130
|
+
sentiment: "neutral",
|
|
131
|
+
variant: "bodySmallStrong",
|
|
132
|
+
children: subCategory.customContent
|
|
133
|
+
}
|
|
134
|
+
) : null,
|
|
135
|
+
subCategory.numberInput ? /* @__PURE__ */ jsx(
|
|
136
|
+
NumberInput,
|
|
137
|
+
{
|
|
138
|
+
className: orderSummaryNumberInput,
|
|
139
|
+
controls: subCategory.numberInputControls,
|
|
140
|
+
onChange: subCategory.onChangeInput,
|
|
141
|
+
size: "small",
|
|
142
|
+
unit: subCategory.numberInputUnit,
|
|
143
|
+
value: subCategory.numberInputValue
|
|
144
|
+
}
|
|
145
|
+
) : null,
|
|
146
|
+
subCategory.price !== void 0 && !subCategory.hidePrice ? /* @__PURE__ */ jsxs(
|
|
147
|
+
Text,
|
|
148
|
+
{
|
|
149
|
+
as: "span",
|
|
150
|
+
prominence: "strong",
|
|
151
|
+
sentiment: "neutral",
|
|
152
|
+
variant: "bodySmallStrong",
|
|
153
|
+
children: [
|
|
154
|
+
subCategoryPrice[0] === subCategoryPrice[1] || subCategory.priceUnit ? formatNumber(
|
|
155
|
+
subCategory.priceUnit ? subCategory.price : subCategoryPrice[0],
|
|
156
|
+
localeFormat,
|
|
157
|
+
currency,
|
|
158
|
+
fractionDigits
|
|
159
|
+
) : `${formatNumber(
|
|
160
|
+
subCategoryPrice[0],
|
|
161
|
+
localeFormat,
|
|
162
|
+
currency,
|
|
163
|
+
fractionDigits
|
|
164
|
+
)} - ${formatNumber(
|
|
165
|
+
subCategoryPrice[1],
|
|
166
|
+
localeFormat,
|
|
167
|
+
currency,
|
|
168
|
+
fractionDigits
|
|
169
|
+
)}`,
|
|
170
|
+
subCategory.priceUnit ? ` /${subCategory.priceUnit}` : ""
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
) : null
|
|
58
174
|
] }),
|
|
59
|
-
/* @__PURE__ */ jsx(Stack, { className: orderSummaryDetails, direction: "column", gap: 0.5, children: subCategory.details?.map(
|
|
175
|
+
/* @__PURE__ */ jsx(Stack, { className: orderSummaryDetails, direction: "column", gap: 0.5, children: subCategory.details?.map(
|
|
176
|
+
(detail) => detail ? /* @__PURE__ */ jsx(
|
|
177
|
+
Text,
|
|
178
|
+
{
|
|
179
|
+
as: "span",
|
|
180
|
+
sentiment: "neutral",
|
|
181
|
+
variant: "bodySmall",
|
|
182
|
+
children: detail
|
|
183
|
+
},
|
|
184
|
+
detail
|
|
185
|
+
) : null
|
|
186
|
+
) })
|
|
60
187
|
] });
|
|
61
188
|
};
|
|
62
189
|
const ScrollableContent = () => {
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
190
|
+
const { items } = useContext(OrderSummaryContext);
|
|
191
|
+
return /* @__PURE__ */ jsx(Stack, { className: orderSummaryScrollableContainer, gap: 3, children: items.map(
|
|
192
|
+
(category) => Object.keys(category).length > 0 && category.category ? /* @__PURE__ */ jsxs(
|
|
193
|
+
Stack,
|
|
194
|
+
{
|
|
195
|
+
className: orderSummaryCategory,
|
|
196
|
+
gap: 1.5,
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ jsx(CategoryName, { category }),
|
|
199
|
+
category.subCategories && Object.keys(category.subCategories).length > 0 ? /* @__PURE__ */ jsx(Stack, { gap: 1, children: category.subCategories.map((subCategory, index) => /* @__PURE__ */ jsx(
|
|
200
|
+
SubCategory,
|
|
201
|
+
{
|
|
202
|
+
subCategory
|
|
203
|
+
},
|
|
204
|
+
subCategory.title ?? `${index}`
|
|
205
|
+
)) }) : null
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
category.category
|
|
209
|
+
) : null
|
|
210
|
+
) });
|
|
70
211
|
};
|
|
71
212
|
export {
|
|
72
213
|
ScrollableContent
|