@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, jsx, Fragment } from "
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { HelpCircleOutlineIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { Stack, Text, Tooltip, Badge } from "@ultraviolet/ui";
|
|
5
5
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
@@ -10,212 +10,312 @@ import { calculatePrice } from "../helper.js";
|
|
|
10
10
|
import { useOverlay } from "../OverlayContext.js";
|
|
11
11
|
import { estimateCostOverlayRow, estimateCostCell, paddingLeftCell, estimateCostPriceCell } from "../styles.css.js";
|
|
12
12
|
import { estimateCostTr, estimateCostLeftSide, styledDiv, estimateCostTooltip, estimateCostTextItem, estimateCostBadgeItem, estimateCostMaxWidthText, estimateCostResourceName } from "./components.css.js";
|
|
13
|
-
const TIME_RELATED_UNIT = [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (monthlyPrice && basePrice === 0) {
|
|
90
|
-
return monthlyPrice / multiplier.months;
|
|
91
|
-
}
|
|
92
|
-
return basePrice;
|
|
93
|
-
}, [basePrice, monthlyPrice]);
|
|
94
|
-
const unit = useMemo(() => {
|
|
95
|
-
if (!baseUnit) {
|
|
96
|
-
return locales["estimate.cost.units.gb.label"];
|
|
13
|
+
const TIME_RELATED_UNIT = [
|
|
14
|
+
"seconds",
|
|
15
|
+
"minutes",
|
|
16
|
+
"hours",
|
|
17
|
+
"days",
|
|
18
|
+
"months"
|
|
19
|
+
];
|
|
20
|
+
const Item = memo(
|
|
21
|
+
({
|
|
22
|
+
discount = 0,
|
|
23
|
+
priceText,
|
|
24
|
+
discountText,
|
|
25
|
+
label,
|
|
26
|
+
tooltipInfo,
|
|
27
|
+
// Shows an icon with tooltip that contains this text
|
|
28
|
+
subLabel = "",
|
|
29
|
+
// Usually used for showing amount that is free
|
|
30
|
+
price: basePrice = 0,
|
|
31
|
+
// Hourly price for one unit
|
|
32
|
+
monthlyPrice = 0,
|
|
33
|
+
// Price per month
|
|
34
|
+
unit: baseUnit,
|
|
35
|
+
// Can be GB, MB, Node, Queries, etc.
|
|
36
|
+
amount: currentAmount = 1,
|
|
37
|
+
// Current number of items
|
|
38
|
+
onAmountChange,
|
|
39
|
+
amountFree = 0,
|
|
40
|
+
// Amount that is free - offered by company
|
|
41
|
+
maxAmount = 0,
|
|
42
|
+
// Max amount - used for kubernetes for example
|
|
43
|
+
longFractionDigits = false,
|
|
44
|
+
// In case price is really long 0.0000076 - up 7 fraction digits
|
|
45
|
+
noIteration = false,
|
|
46
|
+
// if item is not based on time (ex: download, upload, transfer)
|
|
47
|
+
noIterationText,
|
|
48
|
+
noBorder,
|
|
49
|
+
// remove the border bottom of the item
|
|
50
|
+
noPrice,
|
|
51
|
+
// remove the price on right side of the table
|
|
52
|
+
isDefined = true,
|
|
53
|
+
children = null,
|
|
54
|
+
isFirstElement = false,
|
|
55
|
+
isLastElement = false,
|
|
56
|
+
isPrimaryBackground = false,
|
|
57
|
+
productsCallback,
|
|
58
|
+
iteration: receivedIteration,
|
|
59
|
+
// Object from parent that contains time period (hours, days, months)
|
|
60
|
+
shouldBeHidden = false,
|
|
61
|
+
// Hide element from overlay if screen width is small
|
|
62
|
+
hideFromOverlay = false,
|
|
63
|
+
// Hide element from overlay in any case
|
|
64
|
+
textNotDefined,
|
|
65
|
+
// Text to display in case of not defined value
|
|
66
|
+
animated = false,
|
|
67
|
+
// if true, zoomIn animation is triggered
|
|
68
|
+
tabulation,
|
|
69
|
+
// Increase left padding of the item
|
|
70
|
+
labelTextVariant,
|
|
71
|
+
// To change left cell typography variant
|
|
72
|
+
labelTextProminence,
|
|
73
|
+
// To change left cell typography prominence
|
|
74
|
+
notice,
|
|
75
|
+
// To display a gray text below the label
|
|
76
|
+
strikeThrough,
|
|
77
|
+
// To strike through the price
|
|
78
|
+
style
|
|
79
|
+
}) => {
|
|
80
|
+
const { locales, formatNumber } = useEstimateCost();
|
|
81
|
+
let iteration;
|
|
82
|
+
if (noIteration) {
|
|
83
|
+
iteration = {
|
|
84
|
+
...receivedIteration ?? { value: 0 },
|
|
85
|
+
unit: "hours"
|
|
86
|
+
};
|
|
87
|
+
} else {
|
|
88
|
+
iteration = receivedIteration;
|
|
97
89
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
90
|
+
const price = useMemo(() => {
|
|
91
|
+
if (monthlyPrice && basePrice === 0) {
|
|
92
|
+
return monthlyPrice / multiplier.months;
|
|
93
|
+
}
|
|
94
|
+
return basePrice;
|
|
95
|
+
}, [basePrice, monthlyPrice]);
|
|
96
|
+
const unit = useMemo(() => {
|
|
97
|
+
if (!baseUnit) {
|
|
98
|
+
return locales["estimate.cost.units.gb.label"];
|
|
99
|
+
}
|
|
100
|
+
return baseUnit;
|
|
101
|
+
}, [baseUnit, locales]);
|
|
102
|
+
const { isOverlay } = useOverlay();
|
|
103
|
+
const Row = isOverlay ? "li" : "tr";
|
|
104
|
+
const Cell = isOverlay ? "div" : "td";
|
|
105
|
+
const LeftSide = "div";
|
|
106
|
+
const [amount, setAmount] = useState(currentAmount);
|
|
107
|
+
const [isVariant, setIsVariant] = useState(false);
|
|
108
|
+
useEffect(() => setAmount(currentAmount), [setAmount, currentAmount]);
|
|
109
|
+
useEffect(() => onAmountChange?.(amount), [onAmountChange, amount]);
|
|
110
|
+
const itemCallback = useCallback(
|
|
111
|
+
(localAmount, localIsVariant) => {
|
|
112
|
+
setAmount(localAmount);
|
|
113
|
+
setIsVariant(localIsVariant);
|
|
114
|
+
},
|
|
115
|
+
[setAmount, setIsVariant]
|
|
116
|
+
);
|
|
117
|
+
const id = useId();
|
|
118
|
+
useEffect(
|
|
119
|
+
() => () => productsCallback?.remove({ id }),
|
|
120
|
+
[id, productsCallback]
|
|
121
|
+
);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (!isOverlay) {
|
|
124
|
+
productsCallback?.add({
|
|
125
|
+
amount,
|
|
126
|
+
amountFree,
|
|
127
|
+
discount,
|
|
128
|
+
id,
|
|
129
|
+
isVariant,
|
|
130
|
+
longFractionDigits,
|
|
131
|
+
maxAmount,
|
|
132
|
+
noIteration,
|
|
133
|
+
price
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}, [
|
|
137
|
+
price,
|
|
138
|
+
discount,
|
|
139
|
+
amount,
|
|
140
|
+
id,
|
|
141
|
+
productsCallback,
|
|
142
|
+
maxAmount,
|
|
143
|
+
noIteration,
|
|
144
|
+
isVariant,
|
|
145
|
+
amountFree,
|
|
146
|
+
isOverlay,
|
|
147
|
+
longFractionDigits
|
|
148
|
+
]);
|
|
149
|
+
const computedItemPrice = useMemo(
|
|
150
|
+
() => calculatePrice({
|
|
121
151
|
amount,
|
|
122
152
|
amountFree,
|
|
123
153
|
discount,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
})
|
|
154
|
+
price,
|
|
155
|
+
timeAmount: noIteration ? 1 : iteration?.value ?? 1,
|
|
156
|
+
timeUnit: noIteration ? "hours" : iteration?.unit ?? "hours"
|
|
157
|
+
}),
|
|
158
|
+
[price, amount, amountFree, iteration, noIteration, discount]
|
|
159
|
+
);
|
|
160
|
+
const computedMaxItemPrice = useMemo(
|
|
161
|
+
() => calculatePrice({
|
|
162
|
+
amount: maxAmount,
|
|
163
|
+
amountFree,
|
|
164
|
+
discount,
|
|
165
|
+
price,
|
|
166
|
+
timeAmount: noIteration ? 1 : iteration?.value ?? 1,
|
|
167
|
+
timeUnit: noIteration ? "hours" : iteration?.unit ?? "hours"
|
|
168
|
+
}),
|
|
169
|
+
[price, maxAmount, amountFree, iteration, noIteration, discount]
|
|
170
|
+
);
|
|
171
|
+
const formatMaximumFractionDigits = useMemo(() => {
|
|
172
|
+
if (!iteration?.unit) {
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
return longFractionDigits ? maximumFractionDigitsLong[iteration?.unit] : maximumFractionDigits[iteration?.unit];
|
|
176
|
+
}, [iteration?.unit, longFractionDigits]);
|
|
177
|
+
return /* @__PURE__ */ jsxs(
|
|
178
|
+
Row,
|
|
179
|
+
{
|
|
180
|
+
className: isOverlay ? estimateCostOverlayRow({
|
|
181
|
+
hideFromOverlay,
|
|
182
|
+
isFirstElement,
|
|
183
|
+
shouldBeHidden
|
|
184
|
+
}) : estimateCostTr,
|
|
185
|
+
style,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(
|
|
188
|
+
Cell,
|
|
189
|
+
{
|
|
190
|
+
className: estimateCostCell({
|
|
191
|
+
hasBorder: !isLastElement && !noBorder && !isOverlay
|
|
192
|
+
}),
|
|
193
|
+
style: assignInlineVars({
|
|
194
|
+
[paddingLeftCell]: `${(tabulation ?? 0) * 8 + 16}px`
|
|
195
|
+
}),
|
|
196
|
+
children: /* @__PURE__ */ jsxs(LeftSide, { className: isOverlay ? "" : estimateCostLeftSide, children: [
|
|
197
|
+
/* @__PURE__ */ jsxs(Stack, { children: [
|
|
198
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
Text,
|
|
201
|
+
{
|
|
202
|
+
as: "p",
|
|
203
|
+
prominence: labelTextProminence ?? "default",
|
|
204
|
+
variant: labelTextVariant ?? "body",
|
|
205
|
+
children: label
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
tooltipInfo ? /* @__PURE__ */ jsx("div", { className: styledDiv, children: /* @__PURE__ */ jsx(Tooltip, { className: estimateCostTooltip, text: tooltipInfo, children: /* @__PURE__ */ jsx(HelpCircleOutlineIcon, { size: "medium" }) }) }) : null,
|
|
209
|
+
subLabel && !isOverlay ? /* @__PURE__ */ jsx(
|
|
210
|
+
Text,
|
|
211
|
+
{
|
|
212
|
+
as: "p",
|
|
213
|
+
className: estimateCostTextItem,
|
|
214
|
+
italic: true,
|
|
215
|
+
sentiment: "primary",
|
|
216
|
+
variant: "body",
|
|
217
|
+
children: subLabel
|
|
218
|
+
}
|
|
219
|
+
) : null,
|
|
220
|
+
discount > 0 && discountText ? /* @__PURE__ */ jsx(
|
|
221
|
+
Badge,
|
|
222
|
+
{
|
|
223
|
+
className: estimateCostBadgeItem,
|
|
224
|
+
prominence: "strong",
|
|
225
|
+
sentiment: "warning",
|
|
226
|
+
size: "small",
|
|
227
|
+
children: discountText
|
|
228
|
+
}
|
|
229
|
+
) : null
|
|
230
|
+
] }),
|
|
231
|
+
notice ? /* @__PURE__ */ jsx(
|
|
232
|
+
Text,
|
|
233
|
+
{
|
|
234
|
+
as: "p",
|
|
235
|
+
className: estimateCostMaxWidthText,
|
|
236
|
+
prominence: "weak",
|
|
237
|
+
variant: "caption",
|
|
238
|
+
children: notice
|
|
239
|
+
}
|
|
240
|
+
) : null
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsx(
|
|
243
|
+
"div",
|
|
244
|
+
{
|
|
245
|
+
className: estimateCostResourceName({
|
|
246
|
+
isAnimated: isOverlay && animated,
|
|
247
|
+
isOverlay
|
|
248
|
+
}),
|
|
249
|
+
children: isDefined ? Children.map(
|
|
250
|
+
children,
|
|
251
|
+
(child) => isValidElement(child) ? cloneElement(child, {
|
|
252
|
+
amount,
|
|
253
|
+
itemCallback,
|
|
254
|
+
maxAmount,
|
|
255
|
+
unit
|
|
256
|
+
}) : null
|
|
257
|
+
) : textNotDefined || locales["estimate.cost.notDefined"]
|
|
258
|
+
}
|
|
259
|
+
)
|
|
260
|
+
] })
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
!isOverlay ? /* @__PURE__ */ jsx(
|
|
264
|
+
"td",
|
|
265
|
+
{
|
|
266
|
+
className: `${estimateCostCell({ hasBorder: !isLastElement && !noBorder, primary: isPrimaryBackground })} ${estimateCostPriceCell}`,
|
|
267
|
+
style: assignInlineVars({
|
|
268
|
+
[paddingLeftCell]: `16px`
|
|
269
|
+
}),
|
|
270
|
+
children: !noPrice ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
271
|
+
/* @__PURE__ */ jsxs(
|
|
272
|
+
Text,
|
|
273
|
+
{
|
|
274
|
+
as: "p",
|
|
275
|
+
placement: "right",
|
|
276
|
+
prominence: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "weak" : "default",
|
|
277
|
+
sentiment: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "neutral" : "primary",
|
|
278
|
+
strikeThrough,
|
|
279
|
+
variant: noIterationText ? "headingSmall" : "bodyStrong",
|
|
280
|
+
children: [
|
|
281
|
+
priceText,
|
|
282
|
+
!priceText ? formatNumber(computedItemPrice, {
|
|
283
|
+
maximumFractionDigits: formatMaximumFractionDigits
|
|
284
|
+
}) : null,
|
|
285
|
+
noIterationText ? /* @__PURE__ */ jsxs(Text, { as: "span", sentiment: "primary", variant: "bodySmall", children: [
|
|
286
|
+
"/",
|
|
287
|
+
noIterationText
|
|
288
|
+
] }) : null,
|
|
289
|
+
!priceText && computedMaxItemPrice > 0 ? ` - ${formatNumber(computedMaxItemPrice, {
|
|
290
|
+
maximumFractionDigits: formatMaximumFractionDigits
|
|
291
|
+
})}` : null
|
|
292
|
+
]
|
|
293
|
+
}
|
|
294
|
+
),
|
|
295
|
+
amount - amountFree !== 1 && computedItemPrice > 0 || maxAmount > 0 && computedMaxItemPrice > 0 ? /* @__PURE__ */ jsxs(Text, { as: "p", placement: "right", variant: "body", children: [
|
|
296
|
+
formatNumber(
|
|
297
|
+
calculatePrice({
|
|
298
|
+
amount: 1,
|
|
299
|
+
discount,
|
|
300
|
+
price,
|
|
301
|
+
timeAmount: 1,
|
|
302
|
+
timeUnit: "hours"
|
|
303
|
+
}),
|
|
304
|
+
{
|
|
305
|
+
maximumFractionDigits: longFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
TIME_RELATED_UNIT.includes(unit) ? locales[`estimate.cost.units.${unit}.label`].toLowerCase() : `/${unit}`,
|
|
309
|
+
!noIteration ? `/${locales["estimate.cost.units.hours.label"].toLowerCase()}` : null
|
|
310
|
+
] }) : null
|
|
311
|
+
] }) : null
|
|
312
|
+
}
|
|
313
|
+
) : null
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
);
|
|
219
319
|
export {
|
|
220
320
|
Item
|
|
221
321
|
};
|
|
@@ -2,5 +2,5 @@ import type { ComponentProps } from 'react';
|
|
|
2
2
|
type LineThroughProps = ComponentProps<'span'> & {
|
|
3
3
|
isActive?: boolean;
|
|
4
4
|
};
|
|
5
|
-
export declare const LineThrough: ({ isActive, className, ...props }: LineThroughProps) => import("
|
|
5
|
+
export declare const LineThrough: ({ isActive, className, ...props }: LineThroughProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { estimateCostLineThrough } from "./components.css.js";
|
|
4
4
|
const LineThrough = ({
|
|
5
5
|
isActive,
|
|
6
6
|
className,
|
|
7
7
|
...props
|
|
8
|
-
}) => /* @__PURE__ */ jsx(
|
|
8
|
+
}) => /* @__PURE__ */ jsx(
|
|
9
|
+
"span",
|
|
10
|
+
{
|
|
11
|
+
className: `${className ? `${className} ` : ""} ${isActive ? estimateCostLineThrough : ""}`,
|
|
12
|
+
...props
|
|
13
|
+
}
|
|
14
|
+
);
|
|
9
15
|
export {
|
|
10
16
|
LineThrough
|
|
11
17
|
};
|
|
@@ -6,5 +6,5 @@ type NumberInputProps = {
|
|
|
6
6
|
maxValue?: number;
|
|
7
7
|
controls?: boolean;
|
|
8
8
|
};
|
|
9
|
-
export declare const NumberInput: ({ amount, minValue, maxValue, getAmountValue, itemCallback, controls, }: NumberInputProps) => import("
|
|
9
|
+
export declare const NumberInput: ({ amount, minValue, maxValue, getAmountValue, itemCallback, controls, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx } from "
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { NumberInput as NumberInput$1 } from "@ultraviolet/ui";
|
|
4
4
|
import { useState, useEffect } from "react";
|
|
5
5
|
import { useOverlay } from "../OverlayContext.js";
|
|
@@ -13,18 +13,26 @@ const NumberInput = ({
|
|
|
13
13
|
itemCallback,
|
|
14
14
|
controls = true
|
|
15
15
|
}) => {
|
|
16
|
-
const {
|
|
17
|
-
isOverlay
|
|
18
|
-
} = useOverlay();
|
|
16
|
+
const { isOverlay } = useOverlay();
|
|
19
17
|
const [value, setValue] = useState(amount);
|
|
20
18
|
useEffect(() => {
|
|
21
19
|
getAmountValue?.(amount);
|
|
22
20
|
}, [getAmountValue, amount]);
|
|
23
|
-
return isOverlay ? /* @__PURE__ */ jsx("div", { className: estimateCostItemResourceName(), children: /* @__PURE__ */ jsx(Regular, { children: amount }) }) : /* @__PURE__ */ jsx(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
return isOverlay ? /* @__PURE__ */ jsx("div", { className: estimateCostItemResourceName(), children: /* @__PURE__ */ jsx(Regular, { children: amount }) }) : /* @__PURE__ */ jsx(
|
|
22
|
+
NumberInput$1,
|
|
23
|
+
{
|
|
24
|
+
controls,
|
|
25
|
+
max: maxValue,
|
|
26
|
+
min: minValue,
|
|
27
|
+
onChange: (newValue) => {
|
|
28
|
+
setValue(newValue);
|
|
29
|
+
itemCallback?.(newValue, true);
|
|
30
|
+
getAmountValue?.(newValue);
|
|
31
|
+
},
|
|
32
|
+
size: "small",
|
|
33
|
+
value
|
|
34
|
+
}
|
|
35
|
+
);
|
|
28
36
|
};
|
|
29
37
|
export {
|
|
30
38
|
NumberInput
|
|
@@ -18,5 +18,5 @@ type RegionProps = {
|
|
|
18
18
|
noBorder?: boolean;
|
|
19
19
|
noPrice?: boolean;
|
|
20
20
|
} & Pick<ComponentProps<typeof Item>, 'hideFromOverlay' | 'style'>;
|
|
21
|
-
export declare const Region: import("react").MemoExoticComponent<({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, noBorder, noPrice, hideFromOverlay, style, }: RegionProps) => import("
|
|
21
|
+
export declare const Region: import("react").MemoExoticComponent<({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, noBorder, noPrice, hideFromOverlay, style, }: RegionProps) => import("react/jsx-runtime").JSX.Element>;
|
|
22
22
|
export {};
|