@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, jsx, Fragment } from "@emotion/react/jsx-runtime";
2
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
3
  import { CalculatorIcon } from "@ultraviolet/icons";
4
4
  import { Stack, Alert, Badge, Text } from "@ultraviolet/ui";
5
5
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -16,16 +16,27 @@ import { OverlayComponent } from "./OverlayComponent.js";
16
16
  import { OverlayContextProvider } from "./OverlayContext.js";
17
17
  import { estimateCostTable, estimateCostPriceColumn, estimateCostPriceCellContent, estimateCostPriceCell, estimateCostTimeCell, estimateCostEmptyTable, estimateCostEmptyCell, estimateCostCell, estimateCostTotalPriceCell, estimateCostBadgeBeta, estimateCostText, paddingLeftCell, estimatecostFeesText, estimateCostFeesTable, estimateCostTitle, estimateCostCalculatorIcon } from "./styles.css.js";
18
18
  const DEFAULT_UNIT_LIST = ["hours", "days", "months"];
19
- const DescriptionComponent = memo(({
20
- description,
21
- locales
22
- }) => description === void 0 || typeof description === "string" ? /* @__PURE__ */ jsx(Text, { as: "span", variant: "body", children: description || locales["estimate.cost.description"] }) : description);
23
- const TitleComponent = memo(({
24
- locales
25
- }) => /* @__PURE__ */ jsxs("h3", { className: estimateCostTitle, children: [
26
- /* @__PURE__ */ jsx(CalculatorIcon, { className: estimateCostCalculatorIcon, sentiment: "primary", size: "medium" }),
27
- locales?.["estimate.cost.label"]
28
- ] }));
19
+ const DescriptionComponent = memo(
20
+ ({
21
+ description,
22
+ locales
23
+ }) => description === void 0 || typeof description === "string" ? /* @__PURE__ */ jsx(Text, { as: "span", variant: "body", children: description || locales["estimate.cost.description"] }) : description
24
+ );
25
+ const TitleComponent = memo(
26
+ ({
27
+ locales
28
+ }) => /* @__PURE__ */ jsxs("h3", { className: estimateCostTitle, children: [
29
+ /* @__PURE__ */ jsx(
30
+ CalculatorIcon,
31
+ {
32
+ className: estimateCostCalculatorIcon,
33
+ sentiment: "primary",
34
+ size: "medium"
35
+ }
36
+ ),
37
+ locales?.["estimate.cost.label"]
38
+ ] })
39
+ );
29
40
  const EstimateCostContent = ({
30
41
  description,
31
42
  alert,
@@ -55,9 +66,7 @@ const EstimateCostContent = ({
55
66
  onTotalPriceChange,
56
67
  style
57
68
  }) => {
58
- const {
59
- formatNumber
60
- } = useEstimateCost();
69
+ const { formatNumber } = useEstimateCost();
61
70
  const [ref, inView] = useInView();
62
71
  const [products, setProducts] = useState([]);
63
72
  const [totalPrice, setTotalPrice] = useState({
@@ -73,130 +82,265 @@ const EstimateCostContent = ({
73
82
  value: 1
74
83
  });
75
84
  const [isLongFractionDigits, setIsLongFractionDigits] = useState(false);
76
- const providerValue = useMemo(() => ({
77
- isOverlay: false
78
- }), []);
79
- const totalValue = useMemo(() => formatNumber(totalPrice.total < 0 ? 0 : totalPrice.total, {
80
- maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit]
81
- }), [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.total]);
82
- const totalMaxValue = useMemo(() => formatNumber(totalPrice.maxTotal < 0 ? 0 : totalPrice.maxTotal, {
83
- maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit]
84
- }), [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.maxTotal]);
85
- const productsCallback = useMemo(() => ({
86
- add: (newProduct) => {
87
- setProducts((total) => {
88
- if (total.find((product) => product.id === newProduct.id)) {
89
- return total.map((product) => product.id === newProduct.id ? newProduct : product);
90
- }
91
- return [...total, newProduct];
92
- });
93
- },
94
- remove: ({
95
- id
96
- }) => {
97
- setProducts((total) => total.filter((product) => product.id !== id));
98
- }
99
- }), [setProducts]);
85
+ const providerValue = useMemo(() => ({ isOverlay: false }), []);
86
+ const totalValue = useMemo(
87
+ () => formatNumber(totalPrice.total < 0 ? 0 : totalPrice.total, {
88
+ maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit]
89
+ }),
90
+ [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.total]
91
+ );
92
+ const totalMaxValue = useMemo(
93
+ () => formatNumber(totalPrice.maxTotal < 0 ? 0 : totalPrice.maxTotal, {
94
+ maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong[iteration.unit] : maximumFractionDigits[iteration.unit]
95
+ }),
96
+ [formatNumber, isLongFractionDigits, iteration.unit, totalPrice.maxTotal]
97
+ );
98
+ const productsCallback = useMemo(
99
+ () => ({
100
+ add: (newProduct) => {
101
+ setProducts((total) => {
102
+ if (total.find((product) => product.id === newProduct.id)) {
103
+ return total.map(
104
+ (product) => product.id === newProduct.id ? newProduct : product
105
+ );
106
+ }
107
+ return [...total, newProduct];
108
+ });
109
+ },
110
+ remove: ({ id }) => {
111
+ setProducts((total) => total.filter((product) => product.id !== id));
112
+ }
113
+ }),
114
+ [setProducts]
115
+ );
100
116
  useEffect(() => {
101
117
  const isMaxAmountInProducts = products.find((product) => product.maxAmount);
102
- setIsLongFractionDigits(!!products.find((product) => product.longFractionDigits));
118
+ setIsLongFractionDigits(
119
+ !!products.find((product) => product.longFractionDigits)
120
+ );
103
121
  setTotalPrice({
104
- hourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
105
- maxHourly: isMaxAmountInProducts ? products.reduce((acc, product) => acc && product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0), 0) : 0,
106
- maxOverlayHourly: isMaxAmountInProducts ? products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0)), 0) : 0,
107
- maxTotal: isMaxAmountInProducts ? products.reduce((acc, product) => acc + calculatePrice({
108
- amount: product.maxAmount || product.amount,
109
- // Not all products have maxAmount, so we need to check both
110
- amountFree: product.amountFree,
111
- discount: product.discount,
112
- price: product.price,
113
- timeAmount: product.noIteration ? 1 : iteration.value,
114
- timeUnit: product.noIteration ? "hours" : iteration.unit
115
- }), 0) : 0,
116
- overlayHourly: products.reduce((acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)), 0),
117
- total: !hideTotal ? products.reduce((acc, product) => acc + calculatePrice({
118
- amount: product.amount,
119
- amountFree: product.amountFree,
120
- discount: product.discount,
121
- price: product.price,
122
- timeAmount: product.noIteration ? 1 : iteration.value,
123
- timeUnit: product.noIteration ? "hours" : iteration.unit
124
- }), 0) : 0
122
+ hourly: products.reduce(
123
+ (acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)),
124
+ 0
125
+ ),
126
+ maxHourly: isMaxAmountInProducts ? products.reduce(
127
+ (acc, product) => acc && product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0),
128
+ 0
129
+ ) : 0,
130
+ maxOverlayHourly: isMaxAmountInProducts ? products.reduce(
131
+ (acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.maxAmount - product.amountFree, 0)),
132
+ 0
133
+ ) : 0,
134
+ maxTotal: isMaxAmountInProducts ? products.reduce(
135
+ (acc, product) => acc + calculatePrice({
136
+ amount: product.maxAmount || product.amount,
137
+ // Not all products have maxAmount, so we need to check both
138
+ amountFree: product.amountFree,
139
+ discount: product.discount,
140
+ price: product.price,
141
+ timeAmount: product.noIteration ? 1 : iteration.value,
142
+ timeUnit: product.noIteration ? "hours" : iteration.unit
143
+ }),
144
+ 0
145
+ ) : 0,
146
+ overlayHourly: products.reduce(
147
+ (acc, product) => acc + (product.noIteration ? 0 : (product.price - product.price * product.discount) * Math.max(product.amount - product.amountFree, 0)),
148
+ 0
149
+ ),
150
+ total: !hideTotal ? products.reduce(
151
+ (acc, product) => acc + calculatePrice({
152
+ amount: product.amount,
153
+ amountFree: product.amountFree,
154
+ discount: product.discount,
155
+ price: product.price,
156
+ timeAmount: product.noIteration ? 1 : iteration.value,
157
+ timeUnit: product.noIteration ? "hours" : iteration.unit
158
+ }),
159
+ 0
160
+ ) : 0
125
161
  });
126
162
  onTotalPriceChange?.({
127
163
  total: totalPrice.total,
128
164
  totalMax: totalPrice.maxTotal > 0 ? totalPrice.maxTotal : void 0
129
165
  });
130
- }, [hideTotal, products, iteration, setTotalPrice, onTotalPriceChange, totalPrice.total, totalPrice.maxTotal, totalValue, totalMaxValue]);
166
+ }, [
167
+ hideTotal,
168
+ products,
169
+ iteration,
170
+ setTotalPrice,
171
+ onTotalPriceChange,
172
+ totalPrice.total,
173
+ totalPrice.maxTotal,
174
+ totalValue,
175
+ totalMaxValue
176
+ ]);
131
177
  useEffect(() => {
132
178
  if (hideTimeUnit && (iteration.value > 1 || iteration.unit !== (defaultTimeUnit ?? "hours"))) {
133
- setIteration({
134
- unit: defaultTimeUnit ?? "hours",
135
- value: 1
136
- });
179
+ setIteration({ unit: defaultTimeUnit ?? "hours", value: 1 });
137
180
  }
138
181
  }, [hideTimeUnit, iteration, defaultTimeUnit]);
139
182
  return /* @__PURE__ */ jsxs(Stack, { gap: 2, style, children: [
140
- !hideOverlay ? /* @__PURE__ */ jsx(OverlayComponent, { disableOverlayLeft, disableOverlayRight, discount, inView, isBeta, OverlayLeft, OverlayRight, overlayMargin, totalPrice, unit: overlayUnit ?? "hours", children }) : null,
183
+ !hideOverlay ? /* @__PURE__ */ jsx(
184
+ OverlayComponent,
185
+ {
186
+ disableOverlayLeft,
187
+ disableOverlayRight,
188
+ discount,
189
+ inView,
190
+ isBeta,
191
+ OverlayLeft,
192
+ OverlayRight,
193
+ overlayMargin,
194
+ totalPrice,
195
+ unit: overlayUnit ?? "hours",
196
+ children
197
+ }
198
+ ) : null,
141
199
  description === false ? null : /* @__PURE__ */ jsx(DescriptionComponent, { description, locales }),
142
200
  alert ? /* @__PURE__ */ jsx(Alert, { sentiment: alertVariant, title: alertTitle, children: alert }) : null,
143
201
  /* @__PURE__ */ jsx(OverlayContextProvider, { value: providerValue, children: /* @__PURE__ */ jsxs("div", { children: [
144
- children ? /* @__PURE__ */ jsxs("table", { cellPadding: "0", cellSpacing: "0", className: estimateCostTable[hideTotal ? "noTotal" : "total"], "data-testid": "summary", ref, children: [
145
- /* @__PURE__ */ jsxs("colgroup", { children: [
146
- /* @__PURE__ */ jsx("col", {}),
147
- /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })
148
- ] }),
149
- !hideTimeUnit ? /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
150
- /* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(TitleComponent, { locales }) }),
151
- /* @__PURE__ */ jsx("th", { className: `${estimateCostPriceCellContent} ${estimateCostPriceCell}`, children: /* @__PURE__ */ jsx("div", { className: estimateCostTimeCell, children: /* @__PURE__ */ jsx(CustomUnitInput, { defaultTimeUnit, iteration, setIteration, timeUnits }) }) })
152
- ] }) }) : null,
153
- /* @__PURE__ */ jsx("tbody", { children: Children.map(children, (child, index) => isValidElement(child) ? cloneElement(child, {
154
- discount: discount && !child.props.discount ? discount : child.props.discount,
155
- isLastElement: index === Children.count(children) - 1,
156
- iteration,
157
- productsCallback
158
- }) : child) })
159
- ] }) : null,
160
- !hideTotal ? /* @__PURE__ */ jsxs("table", { cellPadding: "0", cellSpacing: "0", className: estimateCostEmptyTable, children: [
161
- /* @__PURE__ */ jsxs("colgroup", { children: [
162
- /* @__PURE__ */ jsx("col", {}),
163
- /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })
164
- ] }),
165
- /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
166
- /* @__PURE__ */ jsx("td", { "aria-label": "control", className: estimateCostEmptyCell }),
167
- /* @__PURE__ */ jsxs("td", { className: `${estimateCostCell({
168
- hasBorder: false,
169
- primary: false
170
- })} ${estimateCostTotalPriceCell}`, style: assignInlineVars({
171
- [paddingLeftCell]: `16px`
172
- }), children: [
173
- isBeta ? /* @__PURE__ */ jsx(Badge, { className: estimateCostBadgeBeta[locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`].length > 25 ? "long" : "short"], prominence: "strong", sentiment: "warning", children: `${discount > 0 ? discount * 100 : ""}
174
- ${locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]}` }) : null,
175
- /* @__PURE__ */ jsx(Text, { as: "h3", className: estimateCostText[isBeta ? "beta" : "notBeta"], sentiment: "primary", variant: "heading", children: /* @__PURE__ */ jsxs(LineThrough, { isActive: isBeta && (discount === 0 || discount >= 1), children: [
176
- totalValue,
177
- totalPrice.maxTotal > 0 ? ` - ${totalMaxValue}` : null
178
- ] }) }),
179
- hideHourlyPriceOnTotal && totalPrice.hourly > 0 && totalPrice.hourly !== totalPrice.total && totalPrice.total > 0 ? /* @__PURE__ */ jsx(Text, { as: "p", placement: "right", variant: "body", children: /* @__PURE__ */ jsxs(LineThrough, { isActive: isBeta && (discount === 0 || discount >= 1), children: [
180
- formatNumber(totalPrice.hourly, {
181
- maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
182
- }),
183
- totalPrice.maxHourly > 0 ? ` - ${formatNumber(totalPrice.maxHourly, {
184
- maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
185
- })}` : null,
186
- "/",
187
- locales[`estimate.cost.units.hours.label`].toLowerCase()
188
- ] }) }) : null
189
- ] })
190
- ] }) })
191
- ] }) : null,
202
+ children ? /* @__PURE__ */ jsxs(
203
+ "table",
204
+ {
205
+ cellPadding: "0",
206
+ cellSpacing: "0",
207
+ className: estimateCostTable[hideTotal ? "noTotal" : "total"],
208
+ "data-testid": "summary",
209
+ ref,
210
+ children: [
211
+ /* @__PURE__ */ jsxs("colgroup", { children: [
212
+ /* @__PURE__ */ jsx("col", {}),
213
+ /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })
214
+ ] }),
215
+ !hideTimeUnit ? /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
216
+ /* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsx(TitleComponent, { locales }) }),
217
+ /* @__PURE__ */ jsx(
218
+ "th",
219
+ {
220
+ className: `${estimateCostPriceCellContent} ${estimateCostPriceCell}`,
221
+ children: /* @__PURE__ */ jsx("div", { className: estimateCostTimeCell, children: /* @__PURE__ */ jsx(
222
+ CustomUnitInput,
223
+ {
224
+ defaultTimeUnit,
225
+ iteration,
226
+ setIteration,
227
+ timeUnits
228
+ }
229
+ ) })
230
+ }
231
+ )
232
+ ] }) }) : null,
233
+ /* @__PURE__ */ jsx("tbody", { children: Children.map(
234
+ children,
235
+ (child, index) => isValidElement(child) ? cloneElement(child, {
236
+ discount: discount && !child.props.discount ? discount : child.props.discount,
237
+ isLastElement: index === Children.count(children) - 1,
238
+ iteration,
239
+ productsCallback
240
+ }) : child
241
+ ) })
242
+ ]
243
+ }
244
+ ) : null,
245
+ !hideTotal ? /* @__PURE__ */ jsxs(
246
+ "table",
247
+ {
248
+ cellPadding: "0",
249
+ cellSpacing: "0",
250
+ className: estimateCostEmptyTable,
251
+ children: [
252
+ /* @__PURE__ */ jsxs("colgroup", { children: [
253
+ /* @__PURE__ */ jsx("col", {}),
254
+ /* @__PURE__ */ jsx("col", { className: estimateCostPriceColumn })
255
+ ] }),
256
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
257
+ /* @__PURE__ */ jsx("td", { "aria-label": "control", className: estimateCostEmptyCell }),
258
+ /* @__PURE__ */ jsxs(
259
+ "td",
260
+ {
261
+ className: `${estimateCostCell({ hasBorder: false, primary: false })} ${estimateCostTotalPriceCell}`,
262
+ style: assignInlineVars({
263
+ [paddingLeftCell]: `16px`
264
+ }),
265
+ children: [
266
+ isBeta ? /* @__PURE__ */ jsx(
267
+ Badge,
268
+ {
269
+ className: estimateCostBadgeBeta[locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`].length > 25 ? "long" : "short"],
270
+ prominence: "strong",
271
+ sentiment: "warning",
272
+ children: `${discount > 0 ? discount * 100 : ""}
273
+ ${locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]}`
274
+ }
275
+ ) : null,
276
+ /* @__PURE__ */ jsx(
277
+ Text,
278
+ {
279
+ as: "h3",
280
+ className: estimateCostText[isBeta ? "beta" : "notBeta"],
281
+ sentiment: "primary",
282
+ variant: "heading",
283
+ children: /* @__PURE__ */ jsxs(
284
+ LineThrough,
285
+ {
286
+ isActive: isBeta && (discount === 0 || discount >= 1),
287
+ children: [
288
+ totalValue,
289
+ totalPrice.maxTotal > 0 ? ` - ${totalMaxValue}` : null
290
+ ]
291
+ }
292
+ )
293
+ }
294
+ ),
295
+ hideHourlyPriceOnTotal && totalPrice.hourly > 0 && totalPrice.hourly !== totalPrice.total && totalPrice.total > 0 ? /* @__PURE__ */ jsx(Text, { as: "p", placement: "right", variant: "body", children: /* @__PURE__ */ jsxs(
296
+ LineThrough,
297
+ {
298
+ isActive: isBeta && (discount === 0 || discount >= 1),
299
+ children: [
300
+ formatNumber(totalPrice.hourly, {
301
+ maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
302
+ }),
303
+ totalPrice.maxHourly > 0 ? ` - ${formatNumber(totalPrice.maxHourly, {
304
+ maximumFractionDigits: isLongFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
305
+ })}` : null,
306
+ "/",
307
+ locales[`estimate.cost.units.hours.label`].toLowerCase()
308
+ ]
309
+ }
310
+ ) }) : null
311
+ ]
312
+ }
313
+ )
314
+ ] }) })
315
+ ]
316
+ }
317
+ ) : null,
192
318
  commitmentFees !== void 0 || monthlyFees !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
193
- /* @__PURE__ */ jsx(Text, { as: "h3", className: estimatecostFeesText, variant: "headingSmall", children: locales[`estimate.cost.fees.${commitmentFees ? "oneTime" : "monthly"}.title`] }),
194
- /* @__PURE__ */ jsx("table", { className: estimateCostFeesTable, children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Item, { isLastElement: true, label: commitmentFees ? locales["estimate.cost.fees.commitment"] : monthlyFeesLabel, noIteration: true, price: commitmentFees || monthlyFees, productsCallback: {
195
- add: () => {
196
- },
197
- remove: () => {
319
+ /* @__PURE__ */ jsx(
320
+ Text,
321
+ {
322
+ as: "h3",
323
+ className: estimatecostFeesText,
324
+ variant: "headingSmall",
325
+ children: locales[`estimate.cost.fees.${commitmentFees ? "oneTime" : "monthly"}.title`]
326
+ }
327
+ ),
328
+ /* @__PURE__ */ jsx("table", { className: estimateCostFeesTable, children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(
329
+ Item,
330
+ {
331
+ isLastElement: true,
332
+ label: commitmentFees ? locales["estimate.cost.fees.commitment"] : monthlyFeesLabel,
333
+ noIteration: true,
334
+ price: commitmentFees || monthlyFees,
335
+ productsCallback: {
336
+ add: () => {
337
+ },
338
+ remove: () => {
339
+ }
340
+ },
341
+ children: commitmentFees ? commitmentFeesContent : monthlyFeesContent
198
342
  }
199
- }, children: commitmentFees ? commitmentFeesContent : monthlyFeesContent }) }) })
343
+ ) }) })
200
344
  ] }) : null
201
345
  ] }) })
202
346
  ] });
@@ -21,5 +21,5 @@ type FormatNumberOption = {
21
21
  minimumSignificantDigits?: number;
22
22
  maximumSignificantDigits?: number;
23
23
  };
24
- export declare const EstimateCostProvider: ({ children, locales, currency, numberLocales, }: EstimateCostProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
24
+ export declare const EstimateCostProvider: ({ children, locales, currency, numberLocales, }: EstimateCostProviderProps) => import("react/jsx-runtime").JSX.Element;
25
25
  export {};
@@ -1,11 +1,8 @@
1
1
  "use client";
2
- import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useCallback, createContext, useContext } from "react";
4
4
  import EstimateCostLocales from "./locales/en.js";
5
- const EstimateCostContext = createContext({
6
- formatNumber: () => "",
7
- locales: EstimateCostLocales
8
- });
5
+ const EstimateCostContext = createContext({ formatNumber: () => "", locales: EstimateCostLocales });
9
6
  const useEstimateCost = () => useContext(EstimateCostContext);
10
7
  const EstimateCostProvider = ({
11
8
  children,
@@ -13,22 +10,28 @@ const EstimateCostProvider = ({
13
10
  currency,
14
11
  numberLocales
15
12
  }) => {
16
- const newLocales = useMemo(() => locales ? {
17
- ...EstimateCostLocales,
18
- ...locales
19
- } : EstimateCostLocales, [locales]);
20
- const formatNumber = useCallback((number, options) => {
21
- const numberFormat = new Intl.NumberFormat(numberLocales, {
22
- currency,
23
- style: "currency",
24
- ...options
25
- });
26
- return numberFormat.format(number);
27
- }, [currency, numberLocales]);
28
- const value = useMemo(() => ({
29
- formatNumber,
30
- locales: newLocales
31
- }), [formatNumber, newLocales]);
13
+ const newLocales = useMemo(
14
+ () => locales ? { ...EstimateCostLocales, ...locales } : EstimateCostLocales,
15
+ [locales]
16
+ );
17
+ const formatNumber = useCallback(
18
+ (number, options) => {
19
+ const numberFormat = new Intl.NumberFormat(numberLocales, {
20
+ currency,
21
+ style: "currency",
22
+ ...options
23
+ });
24
+ return numberFormat.format(number);
25
+ },
26
+ [currency, numberLocales]
27
+ );
28
+ const value = useMemo(
29
+ () => ({
30
+ formatNumber,
31
+ locales: newLocales
32
+ }),
33
+ [formatNumber, newLocales]
34
+ );
32
35
  return /* @__PURE__ */ jsx(EstimateCostContext.Provider, { value, children });
33
36
  };
34
37
  export {
@@ -22,5 +22,5 @@ type OverlayComponentProps = {
22
22
  };
23
23
  overlayMargin?: string;
24
24
  };
25
- export declare const OverlayComponent: ({ children, inView, discount, OverlayRight, disableOverlayRight, OverlayLeft, disableOverlayLeft, totalPrice, unit, isBeta, overlayMargin, }: OverlayComponentProps) => import("@emotion/react/jsx-runtime").JSX.Element;
25
+ export declare const OverlayComponent: ({ children, inView, discount, OverlayRight, disableOverlayRight, OverlayLeft, disableOverlayLeft, totalPrice, unit, isBeta, overlayMargin, }: OverlayComponentProps) => import("react/jsx-runtime").JSX.Element;
26
26
  export {};
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "@emotion/react/jsx-runtime";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { CalculatorIcon } from "@ultraviolet/icons";
4
4
  import { Stack, Badge } from "@ultraviolet/ui";
5
5
  import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -24,13 +24,8 @@ const OverlayComponent = ({
24
24
  isBeta = false,
25
25
  overlayMargin
26
26
  }) => {
27
- const {
28
- locales,
29
- formatNumber
30
- } = useEstimateCost();
31
- const value = useMemo(() => ({
32
- isOverlay: true
33
- }), []);
27
+ const { locales, formatNumber } = useEstimateCost();
28
+ const value = useMemo(() => ({ isOverlay: true }), []);
34
29
  const totalOverlayPrice = {
35
30
  days: totalPrice.maxOverlayHourly * multiplier.days,
36
31
  hours: totalPrice.maxOverlayHourly,
@@ -45,40 +40,57 @@ const OverlayComponent = ({
45
40
  months: totalPrice.overlayHourly * multiplier.months,
46
41
  seconds: totalPrice.overlayHourly * multiplier.seconds
47
42
  }[unit];
48
- return /* @__PURE__ */ jsx(OverlayContextProvider, { value, children: /* @__PURE__ */ jsx("div", { className: estimateCostOverlayContainer({
49
- inView
50
- }), "data-testid": "summary-overlay", style: assignInlineVars({
51
- [overlayMarginVar]: overlayMargin ?? "0"
52
- }), children: /* @__PURE__ */ jsxs("ul", { className: estimateCostList, children: [
53
- OverlayLeft ? /* @__PURE__ */ jsx("li", { className: estimateCostSideItem, children: /* @__PURE__ */ jsx(OverlayLeft, { disabled: disableOverlayLeft, children: locales["estimate.cost.submit.label"] }) }) : null,
54
- Children.map(children, (child, index) => isValidElement(child) ? cloneElement(child, {
55
- isFirstElement: index === 0,
56
- isLastElement: index === Children.count(children) - 1
57
- }) : null),
58
- /* @__PURE__ */ jsxs("li", { className: estimateCostOverlayRow(), children: [
59
- /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
60
- /* @__PURE__ */ jsx(CalculatorIcon, { sentiment: "primary", size: "medium" }),
61
- locales["estimate.cost.label"]
62
- ] }),
63
- /* @__PURE__ */ jsxs("div", { className: estimateCostResourceName(), children: [
64
- /* @__PURE__ */ jsx(Strong, { variant: "big", children: /* @__PURE__ */ jsxs(LineThrough, { isActive: isBeta && discount === 0, children: [
65
- formatNumber(overlayPrice, {
66
- maximumFractionDigits: maximumFractionDigits[unit]
67
- }),
68
- totalOverlayPrice > 0 ? ` - ${formatNumber(totalOverlayPrice, {
69
- maximumFractionDigits: maximumFractionDigits[unit]
70
- })}` : null,
71
- "/",
72
- locales[`estimate.cost.units.${unit}.label`]
73
- ] }) }),
74
- isBeta ? /* @__PURE__ */ jsxs(Badge, { className: estimateCostBadge, prominence: "strong", sentiment: "warning", children: [
75
- discount > 0 ? discount * 100 : "",
76
- locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]
77
- ] }) : null
43
+ return /* @__PURE__ */ jsx(OverlayContextProvider, { value, children: /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: estimateCostOverlayContainer({ inView }),
47
+ "data-testid": "summary-overlay",
48
+ style: assignInlineVars({
49
+ [overlayMarginVar]: overlayMargin ?? "0"
50
+ }),
51
+ children: /* @__PURE__ */ jsxs("ul", { className: estimateCostList, children: [
52
+ OverlayLeft ? /* @__PURE__ */ jsx("li", { className: estimateCostSideItem, children: /* @__PURE__ */ jsx(OverlayLeft, { disabled: disableOverlayLeft, children: locales["estimate.cost.submit.label"] }) }) : null,
53
+ Children.map(
54
+ children,
55
+ (child, index) => isValidElement(child) ? cloneElement(child, {
56
+ isFirstElement: index === 0,
57
+ isLastElement: index === Children.count(children) - 1
58
+ }) : null
59
+ ),
60
+ /* @__PURE__ */ jsxs("li", { className: estimateCostOverlayRow(), children: [
61
+ /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [
62
+ /* @__PURE__ */ jsx(CalculatorIcon, { sentiment: "primary", size: "medium" }),
63
+ locales["estimate.cost.label"]
64
+ ] }),
65
+ /* @__PURE__ */ jsxs("div", { className: estimateCostResourceName(), children: [
66
+ /* @__PURE__ */ jsx(Strong, { variant: "big", children: /* @__PURE__ */ jsxs(LineThrough, { isActive: isBeta && discount === 0, children: [
67
+ formatNumber(overlayPrice, {
68
+ maximumFractionDigits: maximumFractionDigits[unit]
69
+ }),
70
+ totalOverlayPrice > 0 ? ` - ${formatNumber(totalOverlayPrice, {
71
+ maximumFractionDigits: maximumFractionDigits[unit]
72
+ })}` : null,
73
+ "/",
74
+ locales[`estimate.cost.units.${unit}.label`]
75
+ ] }) }),
76
+ isBeta ? /* @__PURE__ */ jsxs(
77
+ Badge,
78
+ {
79
+ className: estimateCostBadge,
80
+ prominence: "strong",
81
+ sentiment: "warning",
82
+ children: [
83
+ discount > 0 ? discount * 100 : "",
84
+ locales[`estimate.cost.beta.${discount > 0 ? "discount" : "free"}`]
85
+ ]
86
+ }
87
+ ) : null
88
+ ] })
89
+ ] }),
90
+ OverlayRight ? /* @__PURE__ */ jsx("li", { className: estimateCostSideItem, children: /* @__PURE__ */ jsx(OverlayRight, { disabled: disableOverlayRight, children: locales["estimate.cost.submit.label"] }) }) : null
78
91
  ] })
79
- ] }),
80
- OverlayRight ? /* @__PURE__ */ jsx("li", { className: estimateCostSideItem, children: /* @__PURE__ */ jsx(OverlayRight, { disabled: disableOverlayRight, children: locales["estimate.cost.submit.label"] }) }) : null
81
- ] }) }) });
92
+ }
93
+ ) });
82
94
  };
83
95
  export {
84
96
  OverlayComponent
@@ -8,5 +8,5 @@ type OverlayContextProviderProps = {
8
8
  isOverlay: boolean;
9
9
  };
10
10
  };
11
- export declare const OverlayContextProvider: ({ children, value, }: OverlayContextProviderProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
+ export declare const OverlayContextProvider: ({ children, value, }: OverlayContextProviderProps) => import("react/jsx-runtime").JSX.Element;
12
12
  export {};