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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/components/CodeEditor/CodeEditor.d.ts +1 -1
  2. package/dist/components/CodeEditor/CodeEditor.js +41 -11
  3. package/dist/components/ContentCard/Skeleton.d.ts +1 -1
  4. package/dist/components/ContentCard/Skeleton.js +13 -8
  5. package/dist/components/ContentCard/index.js +131 -51
  6. package/dist/components/ContentCardGroup/Card.js +63 -22
  7. package/dist/components/ContentCardGroup/SkeletonCard.d.ts +1 -1
  8. package/dist/components/ContentCardGroup/SkeletonCard.js +1 -1
  9. package/dist/components/ContentCardGroup/index.js +11 -6
  10. package/dist/components/ContentCardGroup/styles.css.js +1 -0
  11. package/dist/components/Conversation/index.d.ts +9 -9
  12. package/dist/components/Conversation/index.js +23 -6
  13. package/dist/components/CustomerSatisfaction/index.d.ts +1 -1
  14. package/dist/components/CustomerSatisfaction/index.js +68 -39
  15. package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts +1 -1
  16. package/dist/components/EstimateCost/Components/CustomUnitInput.js +47 -27
  17. package/dist/components/EstimateCost/Components/Item.d.ts +1 -1
  18. package/dist/components/EstimateCost/Components/Item.js +303 -203
  19. package/dist/components/EstimateCost/Components/LineThrough.d.ts +1 -1
  20. package/dist/components/EstimateCost/Components/LineThrough.js +8 -2
  21. package/dist/components/EstimateCost/Components/NumberInput.d.ts +1 -1
  22. package/dist/components/EstimateCost/Components/NumberInput.js +17 -9
  23. package/dist/components/EstimateCost/Components/Region.d.ts +1 -1
  24. package/dist/components/EstimateCost/Components/Region.js +43 -25
  25. package/dist/components/EstimateCost/Components/Regular.d.ts +1 -1
  26. package/dist/components/EstimateCost/Components/Regular.js +20 -16
  27. package/dist/components/EstimateCost/Components/Strong.d.ts +1 -1
  28. package/dist/components/EstimateCost/Components/Strong.js +11 -10
  29. package/dist/components/EstimateCost/Components/Unit.d.ts +1 -1
  30. package/dist/components/EstimateCost/Components/Unit.js +20 -13
  31. package/dist/components/EstimateCost/Components/Zone.d.ts +1 -1
  32. package/dist/components/EstimateCost/Components/Zone.js +41 -24
  33. package/dist/components/EstimateCost/EstimateCost.d.ts +11 -11
  34. package/dist/components/EstimateCost/EstimateCost.js +61 -10
  35. package/dist/components/EstimateCost/EstimateCostContent.d.ts +1 -1
  36. package/dist/components/EstimateCost/EstimateCostContent.js +264 -120
  37. package/dist/components/EstimateCost/EstimateCostProvider.d.ts +1 -1
  38. package/dist/components/EstimateCost/EstimateCostProvider.js +24 -21
  39. package/dist/components/EstimateCost/OverlayComponent.d.ts +1 -1
  40. package/dist/components/EstimateCost/OverlayComponent.js +53 -41
  41. package/dist/components/EstimateCost/OverlayContext.d.ts +1 -1
  42. package/dist/components/EstimateCost/OverlayContext.js +2 -4
  43. package/dist/components/FAQ/index.d.ts +1 -1
  44. package/dist/components/FAQ/index.js +1 -1
  45. package/dist/components/InfoTable/InfoTable.d.ts +3 -3
  46. package/dist/components/InfoTable/InfoTable.js +10 -4
  47. package/dist/components/InfoTable/components/Cell.d.ts +1 -1
  48. package/dist/components/InfoTable/components/Cell.js +24 -4
  49. package/dist/components/InfoTable/components/Row.d.ts +1 -1
  50. package/dist/components/InfoTable/components/Row.js +16 -10
  51. package/dist/components/InfoTable/styles.css.d.ts +0 -1
  52. package/dist/components/InfoTable/styles.css.js +0 -2
  53. package/dist/components/Navigation/Footer.d.ts +1 -1
  54. package/dist/components/Navigation/Footer.js +34 -19
  55. package/dist/components/Navigation/Header.d.ts +1 -1
  56. package/dist/components/Navigation/Header.js +12 -9
  57. package/dist/components/Navigation/Navigation.d.ts +5 -5
  58. package/dist/components/Navigation/Navigation.js +2 -5
  59. package/dist/components/Navigation/NavigationContent.d.ts +1 -1
  60. package/dist/components/Navigation/NavigationContent.js +56 -18
  61. package/dist/components/Navigation/NavigationProvider.d.ts +1 -1
  62. package/dist/components/Navigation/NavigationProvider.js +108 -70
  63. package/dist/components/Navigation/components/Group.d.ts +1 -1
  64. package/dist/components/Navigation/components/Group.js +20 -19
  65. package/dist/components/Navigation/components/Item.d.ts +1 -1
  66. package/dist/components/Navigation/components/Item.js +551 -254
  67. package/dist/components/Navigation/components/ItemProvider.d.ts +1 -1
  68. package/dist/components/Navigation/components/ItemProvider.js +2 -4
  69. package/dist/components/Navigation/components/PinnedItems.d.ts +1 -1
  70. package/dist/components/Navigation/components/PinnedItems.js +91 -37
  71. package/dist/components/Navigation/components/Separator.d.ts +1 -1
  72. package/dist/components/Navigation/components/Separator.js +1 -1
  73. package/dist/components/Navigation/styles.css.js +0 -1
  74. package/dist/components/Navigation/variables.css.js +1 -0
  75. package/dist/components/OfferList/OfferList.d.ts +3 -3
  76. package/dist/components/OfferList/OfferList.js +41 -9
  77. package/dist/components/OfferList/OfferListProvider.d.ts +1 -1
  78. package/dist/components/OfferList/OfferListProvider.js +25 -15
  79. package/dist/components/OfferList/components/Banner.d.ts +1 -1
  80. package/dist/components/OfferList/components/Banner.js +30 -8
  81. package/dist/components/OfferList/components/Cell.d.ts +1 -1
  82. package/dist/components/OfferList/components/Cell.js +12 -5
  83. package/dist/components/OfferList/components/Row.d.ts +1 -1
  84. package/dist/components/OfferList/components/Row.js +135 -42
  85. package/dist/components/OrderSummary/NonScrollableContent.d.ts +1 -1
  86. package/dist/components/OrderSummary/NonScrollableContent.js +68 -22
  87. package/dist/components/OrderSummary/Provider.js +1 -4
  88. package/dist/components/OrderSummary/ScrollableContent.d.ts +1 -1
  89. package/dist/components/OrderSummary/ScrollableContent.js +174 -33
  90. package/dist/components/OrderSummary/constants.js +7 -1
  91. package/dist/components/OrderSummary/helpers.js +36 -18
  92. package/dist/components/OrderSummary/index.d.ts +1 -1
  93. package/dist/components/OrderSummary/index.js +135 -48
  94. package/dist/components/Plans/FeatureHint.d.ts +1 -1
  95. package/dist/components/Plans/FeatureHint.js +26 -8
  96. package/dist/components/Plans/PlanHeader.d.ts +1 -1
  97. package/dist/components/Plans/PlanHeader.js +79 -25
  98. package/dist/components/Plans/index.d.ts +1 -1
  99. package/dist/components/Plans/index.js +142 -53
  100. package/dist/components/Plans/styles.css.js +0 -1
  101. package/dist/components/SteppedListCard/Step.d.ts +1 -1
  102. package/dist/components/SteppedListCard/Step.js +42 -2
  103. package/dist/components/SteppedListCard/SteppedListCard.d.ts +2 -2
  104. package/dist/components/SteppedListCard/SteppedListCard.js +66 -19
  105. package/dist/components/SteppedListCard/SteppedListContent.d.ts +1 -1
  106. package/dist/components/SteppedListCard/SteppedListContent.js +13 -11
  107. package/dist/components/SteppedListCard/helper.js +3 -1
  108. package/dist/plus.css +1 -1
  109. package/package.json +6 -6
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs, Fragment, jsx } from "@emotion/react/jsx-runtime";
2
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
3
  import { 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("div", { className: offerListRowExpandable, style: assignInlineVars({
59
- [expandablePadding]: theme.space[expandablePadding$1 ?? 2]
60
- }), children: expandableContent }),
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
- }, [expandable, loading, expandedRowIds, banner, expandablePadding$1, id, expandableContent, disabled]);
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(List.Row, { className: `${className ? `${className} ` : ""}${banner ? offerListRowBanner : ""}${isSelected ? `${" "}${offerListRowSelected}` : ""} ${expandable ? offerListRowSelectedExpandable : offerListRowSelectedNotExpandable}`, "data-dragging": dataDragging, "data-testid": dataTestId, disabled, expandable: computedExpandableContent, expandablePadding: banner ? "0" : void 0, expanded: expanded ?? expandedRowIds[id], highlightAnimation, id, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style, children: [
78
- /* @__PURE__ */ jsxs(List.Cell, { className: offerListNoPaddingCell, children: [
79
- badge ? /* @__PURE__ */ jsx("div", { className: offerListBadgeContainer, children: /* @__PURE__ */ jsx(Badge, { className: offerListBadge, disabled, prominence: badge.prominence, sentiment: badge.sentiment, size: "small", children: badge.text }) }) : null,
80
- /* @__PURE__ */ jsx("div", { className: offerListRowSelectableContainer, children: /* @__PURE__ */ jsx(Tooltip, { text: typeof selectDisabled === "string" ? selectDisabled : void 0, children: selectable === "radio" ? /* @__PURE__ */ jsx(Radio, { checked: isRowSelected, disabled: disabled || loading || !!selectDisabled, id, name: `radio-offer-list-${id}`, onChange: () => {
81
- setRadioSelectedRow(offerName);
82
- onChangeSelect?.(offerName);
83
- if (expandedRowIds[id]) {
84
- expandRow(id);
85
- } else if (!autoCollapse) {
86
- collapseRow(id);
87
- }
88
- }, value: id }) : /* @__PURE__ */ jsx(Checkbox, { "aria-label": "select", checked: isRowSelected, disabled: disabled || loading || !!selectDisabled, id, name: `checkbox-offer-list-${id}`, onChange: () => {
89
- if (isRowSelected) {
90
- const newSelectedList = checkboxSelectedRows.filter((element) => element !== offerName);
91
- setCheckboxSelectedRows(newSelectedList);
92
- onChangeSelect?.(newSelectedList);
93
- } else {
94
- const newSelectedList = [...checkboxSelectedRows, offerName];
95
- setCheckboxSelectedRows(newSelectedList);
96
- onChangeSelect?.(newSelectedList);
97
- }
98
- if (expandedRowIds[id]) {
99
- expandRow(id);
100
- } else if (!autoCollapse) {
101
- collapseRow(id);
102
- }
103
- }, value: id }) }) })
104
- ] }),
105
- expandable ? /* @__PURE__ */ jsx(List.Cell, { className: offerListNoPaddingCell, children: /* @__PURE__ */ jsx(Button, { "aria-label": "expand", "data-testid": "list-expand-button", disabled: disabled || !expandable || loading, onClick: toggleRowExpand, sentiment: "neutral", size: "small", variant: "ghost", children: expandedRowIds[id] ? /* @__PURE__ */ jsx(ArrowUpIcon, {}) : /* @__PURE__ */ jsx(ArrowDownIcon, {}) }) }) : null,
106
- children
107
- ] }),
108
- banner && !expandedRowIds[id] ? /* @__PURE__ */ jsx(Banner, { colSpan: childrenNumber, disabled, sentiment: banner.sentiment, shouldHavePrimaryBorder: isHovered || isRowSelected, type: "cell", children: banner.text }) : null
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("@emotion/react/jsx-runtime").JSX.Element;
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 "@emotion/react/jsx-runtime";
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: [
26
- locales["order.summary.total"],
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: [
34
- locales["order.summary.total"],
35
- additionalInfo ? ` ${additionalInfo}` : null,
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(Text, { as: "span", "data-testid": "total-price", prominence: "strong", sentiment: "neutral", variant: "headingSmallStrong", children: [
41
- /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: totalPrice }),
42
- hideDetails ? `/${unit}` : null
43
- ] }) : /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
44
- /* @__PURE__ */ jsx(Text, { as: "span", prominence: "weak", sentiment: "neutral", strikeThrough: true, variant: "bodySmallStrong", children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "before", price: totalPrice }) }),
45
- /* @__PURE__ */ jsxs(Text, { as: "span", "data-testid": "total-price", prominence: "strong", sentiment: "neutral", variant: "headingSmallStrong", children: [
46
- /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: totalPrice }),
47
- hideDetails ? `/${unit}` : null
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("@emotion/react/jsx-runtime").JSX.Element;
1
+ export declare const ScrollableContent: () => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,11 @@
1
- import { jsx, jsxs } from "@emotion/react/jsx-runtime";
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
- category
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: category.category }),
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: category.category }),
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(NumberInput, { className: orderSummaryNumberInput, controls: category.numberInputControls, onChange: category.onChangeInput, size: "small", unit: category.numberInputUnit, value: category.numberInputValue }) : null,
27
- !category.customContent && !category.numberInput && categoryPrice.totalPrice === categoryPrice.totalPriceWithDiscount ? /* @__PURE__ */ jsx(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: categoryPrice }) }) : null,
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(Text, { as: "span", prominence: "weak", sentiment: "neutral", strikeThrough: true, variant: "bodySmallStrong", children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "before", price: categoryPrice }) }),
30
- /* @__PURE__ */ jsx(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: /* @__PURE__ */ jsx(DisplayPrice, { beforeOrAfter: "after", price: categoryPrice }) })
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(subCategory, hideTimeUnit, timePeriodAmount, timePeriodUnit);
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodyStrong", children: subCategory.title }),
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(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodySmallStrong", children: subCategory.title }),
52
- subCategory.customContent ? /* @__PURE__ */ jsx(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodySmallStrong", children: subCategory.customContent }) : null,
53
- subCategory.numberInput ? /* @__PURE__ */ jsx(NumberInput, { className: orderSummaryNumberInput, controls: subCategory.numberInputControls, onChange: subCategory.onChangeInput, size: "small", unit: subCategory.numberInputUnit, value: subCategory.numberInputValue }) : null,
54
- subCategory.price !== void 0 && !subCategory.hidePrice ? /* @__PURE__ */ jsxs(Text, { as: "span", prominence: "strong", sentiment: "neutral", variant: "bodySmallStrong", children: [
55
- subCategoryPrice[0] === subCategoryPrice[1] || subCategory.priceUnit ? formatNumber(subCategory.priceUnit ? subCategory.price : subCategoryPrice[0], localeFormat, currency, fractionDigits) : `${formatNumber(subCategoryPrice[0], localeFormat, currency, fractionDigits)} - ${formatNumber(subCategoryPrice[1], localeFormat, currency, fractionDigits)}`,
56
- subCategory.priceUnit ? ` /${subCategory.priceUnit}` : ""
57
- ] }) : null
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((detail) => detail ? /* @__PURE__ */ jsx(Text, { as: "span", sentiment: "neutral", variant: "bodySmall", children: detail }, detail) : null) })
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
- items
65
- } = useContext(OrderSummaryContext);
66
- return /* @__PURE__ */ jsx(Stack, { className: orderSummaryScrollableContainer, gap: 3, children: items.map((category) => Object.keys(category).length > 0 && category.category ? /* @__PURE__ */ jsxs(Stack, { className: orderSummaryCategory, gap: 1.5, children: [
67
- /* @__PURE__ */ jsx(CategoryName, { category }),
68
- category.subCategories && Object.keys(category.subCategories).length > 0 ? /* @__PURE__ */ jsx(Stack, { gap: 1, children: category.subCategories.map((subCategory, index) => /* @__PURE__ */ jsx(SubCategory, { subCategory }, subCategory.title ?? `${index}`)) }) : null
69
- ] }, category.category) : null) });
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
@@ -1,4 +1,10 @@
1
- const Units = ["seconds", "minutes", "hours", "days", "months"];
1
+ const Units = [
2
+ "seconds",
3
+ "minutes",
4
+ "hours",
5
+ "days",
6
+ "months"
7
+ ];
2
8
  const multiplier = {
3
9
  days: 24,
4
10
  hours: 1,