@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
|
@@ -57,30 +57,48 @@ const calculateSubCategoryPrice = (subCategory, hideTimeUnit, timePeriodAmount,
|
|
|
57
57
|
return [price, price];
|
|
58
58
|
};
|
|
59
59
|
const calculateCategoryPrice = (category, hideTimeUnit, timePeriodAmount, timePeriodUnit) => {
|
|
60
|
-
const categoryPrice = category.subCategories?.reduce(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const categoryPrice = category.subCategories?.reduce(
|
|
61
|
+
(acc, subCategory) => {
|
|
62
|
+
const computedPrices = calculateSubCategoryPrice(
|
|
63
|
+
subCategory,
|
|
64
|
+
hideTimeUnit,
|
|
65
|
+
timePeriodAmount,
|
|
66
|
+
timePeriodUnit
|
|
67
|
+
);
|
|
68
|
+
return [acc[0] + computedPrices[0], acc[1] + computedPrices[1]];
|
|
69
|
+
},
|
|
70
|
+
[0, 0]
|
|
71
|
+
) || [0, 0];
|
|
64
72
|
const discountedPriceMin = category.discount && category.discount <= 1 ? categoryPrice[0] * category.discount : categoryPrice[0] - (category.discount ?? 0);
|
|
65
73
|
const discountedPriceMax = category.discount && category.discount <= 1 ? categoryPrice[1] * category.discount : categoryPrice[1] - (category.discount ?? 0);
|
|
66
74
|
const discountedPrice = category.allowNegative ? [discountedPriceMin, discountedPriceMax] : [Math.max(discountedPriceMin, 0), Math.max(discountedPriceMax, 0)];
|
|
67
|
-
categoryPrice.map(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
categoryPrice.map(
|
|
76
|
+
(price) => Math.max(
|
|
77
|
+
category.discount && category.discount <= 1 ? price * category.discount : price - (category.discount ?? 0),
|
|
78
|
+
0
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
return { categoryPrice, discountedPrice };
|
|
72
82
|
};
|
|
73
|
-
const DisplayPrice = ({
|
|
74
|
-
|
|
75
|
-
beforeOrAfter
|
|
76
|
-
|
|
77
|
-
|
|
83
|
+
const DisplayPrice = ({ price, beforeOrAfter }) => {
|
|
84
|
+
const { localeFormat, currency, fractionDigits } = useContext(OrderSummaryContext);
|
|
85
|
+
const withDiscount = beforeOrAfter === "after" ? "WithDiscount" : "";
|
|
86
|
+
return price.totalPrice === price.maxPrice ? formatNumber(
|
|
87
|
+
price[`totalPrice${withDiscount}`],
|
|
78
88
|
localeFormat,
|
|
79
89
|
currency,
|
|
80
|
-
fractionDigits
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
90
|
+
fractionDigits ?? 2
|
|
91
|
+
) : `${formatNumber(
|
|
92
|
+
price[`totalPrice${withDiscount}`],
|
|
93
|
+
localeFormat,
|
|
94
|
+
currency,
|
|
95
|
+
fractionDigits ?? 2
|
|
96
|
+
)} - ${formatNumber(
|
|
97
|
+
price[`maxPrice${withDiscount}`],
|
|
98
|
+
localeFormat,
|
|
99
|
+
currency,
|
|
100
|
+
fractionDigits ?? 2
|
|
101
|
+
)}`;
|
|
84
102
|
};
|
|
85
103
|
export {
|
|
86
104
|
DisplayPrice,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { OrderSummaryProps } from './types';
|
|
2
|
-
export declare const OrderSummary: ({ header, hideTimeUnit, periodOptions, valueUnitInput, unitUnitInput, items, locales, currency, localeFormat, footer, children, discount, totalPriceInfo, fractionDigits, hideDetails, onChange, onChangeUnitInput, totalPriceDescription, additionalInfo, className, "data-testid": dataTestId, style, }: OrderSummaryProps) => import("
|
|
2
|
+
export declare const OrderSummary: ({ header, hideTimeUnit, periodOptions, valueUnitInput, unitUnitInput, items, locales, currency, localeFormat, footer, children, discount, totalPriceInfo, fractionDigits, hideDetails, onChange, onChangeUnitInput, totalPriceDescription, additionalInfo, className, "data-testid": dataTestId, style, }: OrderSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Text, UnitInput } from "@ultraviolet/ui";
|
|
3
3
|
import { useState, useMemo, useEffect } from "react";
|
|
4
4
|
import { Units } from "./constants.js";
|
|
@@ -34,68 +34,155 @@ const OrderSummary = ({
|
|
|
34
34
|
}) => {
|
|
35
35
|
const [timePeriodUnit, setTimePeriodUnit] = useState(unitUnitInput);
|
|
36
36
|
const [timePeriodAmount, setTimePeriodAmount] = useState(valueUnitInput);
|
|
37
|
-
const categoriesPrice = useMemo(
|
|
38
|
-
|
|
39
|
-
categoryPrice,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
const categoriesPrice = useMemo(
|
|
38
|
+
() => items.reduce((acc, category) => {
|
|
39
|
+
const { categoryPrice, discountedPrice } = calculateCategoryPrice(
|
|
40
|
+
category,
|
|
41
|
+
hideTimeUnit,
|
|
42
|
+
timePeriodAmount,
|
|
43
|
+
timePeriodUnit
|
|
44
|
+
);
|
|
45
|
+
return {
|
|
46
|
+
...acc,
|
|
47
|
+
[category.category]: {
|
|
48
|
+
maxPrice: categoryPrice[1],
|
|
49
|
+
maxPriceWithDiscount: discountedPrice[1],
|
|
50
|
+
timeUnit: unitUnitInput,
|
|
51
|
+
totalPrice: categoryPrice[0],
|
|
52
|
+
totalPriceWithDiscount: discountedPrice[0]
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}, {}),
|
|
56
|
+
[hideTimeUnit, items, timePeriodAmount, timePeriodUnit, unitUnitInput]
|
|
57
|
+
);
|
|
53
58
|
const totalPrice = useMemo(() => {
|
|
54
|
-
const price = Object.values(categoriesPrice).reduce(
|
|
59
|
+
const price = Object.values(categoriesPrice).reduce(
|
|
60
|
+
(acc, categoryPrice) => [
|
|
61
|
+
acc[0] + categoryPrice.totalPriceWithDiscount,
|
|
62
|
+
acc[1] + categoryPrice.maxPriceWithDiscount
|
|
63
|
+
],
|
|
64
|
+
[0, 0]
|
|
65
|
+
);
|
|
55
66
|
const computedPrice = {
|
|
56
67
|
maxPrice: Math.max(price[1], 0),
|
|
57
|
-
maxPriceWithDiscount: Math.max(
|
|
68
|
+
maxPriceWithDiscount: Math.max(
|
|
69
|
+
price[1] * (discount < 1 ? 1 - discount : 1) - (discount >= 1 ? Math.abs(discount) : 0),
|
|
70
|
+
0
|
|
71
|
+
),
|
|
58
72
|
timeUnit: unitUnitInput,
|
|
59
73
|
totalPrice: Math.max(price[0], 0),
|
|
60
|
-
totalPriceWithDiscount: Math.max(
|
|
74
|
+
totalPriceWithDiscount: Math.max(
|
|
75
|
+
price[0] * (discount < 1 ? 1 - discount : 1) - (discount >= 1 ? Math.abs(discount) : 0),
|
|
76
|
+
0
|
|
77
|
+
)
|
|
61
78
|
};
|
|
62
79
|
return computedPrice;
|
|
63
80
|
}, [categoriesPrice, discount, unitUnitInput]);
|
|
64
|
-
const valueContext = useMemo(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
const valueContext = useMemo(
|
|
82
|
+
() => ({
|
|
83
|
+
categoriesPrice,
|
|
84
|
+
currency,
|
|
85
|
+
fractionDigits,
|
|
86
|
+
hideTimeUnit,
|
|
87
|
+
items,
|
|
88
|
+
localeFormat,
|
|
89
|
+
locales,
|
|
90
|
+
timePeriodAmount,
|
|
91
|
+
timePeriodUnit
|
|
92
|
+
}),
|
|
93
|
+
[
|
|
94
|
+
currency,
|
|
95
|
+
localeFormat,
|
|
96
|
+
items,
|
|
97
|
+
categoriesPrice,
|
|
98
|
+
hideTimeUnit,
|
|
99
|
+
timePeriodUnit,
|
|
100
|
+
timePeriodAmount,
|
|
101
|
+
locales,
|
|
102
|
+
fractionDigits
|
|
103
|
+
]
|
|
104
|
+
);
|
|
75
105
|
const computePeriodOptions = useMemo(() => {
|
|
76
106
|
const computedPeriodOptions = [];
|
|
77
|
-
periodOptions.forEach(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
107
|
+
periodOptions.forEach(
|
|
108
|
+
(option) => computedPeriodOptions.push({
|
|
109
|
+
label: locales[`order.summary.units.${option}.label`],
|
|
110
|
+
value: option
|
|
111
|
+
})
|
|
112
|
+
);
|
|
81
113
|
return computedPeriodOptions;
|
|
82
114
|
}, [periodOptions, locales]);
|
|
83
115
|
useEffect(() => {
|
|
84
116
|
onChange?.(categoriesPrice, totalPrice);
|
|
85
117
|
}, [categoriesPrice, totalPrice, onChange]);
|
|
86
|
-
return /* @__PURE__ */ jsx(OrderSummaryContext.Provider, { value: valueContext, children: /* @__PURE__ */ jsxs(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
118
|
+
return /* @__PURE__ */ jsx(OrderSummaryContext.Provider, { value: valueContext, children: /* @__PURE__ */ jsxs(
|
|
119
|
+
Stack,
|
|
120
|
+
{
|
|
121
|
+
className: `${className ? `${className} ` : ""}${orderSummaryContainer}`,
|
|
122
|
+
"data-testId": dataTestId,
|
|
123
|
+
justifyContent: hideDetails ? "flex-start" : "space-between",
|
|
124
|
+
style,
|
|
125
|
+
children: [
|
|
126
|
+
header ? /* @__PURE__ */ jsxs(
|
|
127
|
+
Stack,
|
|
128
|
+
{
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
className: orderSummaryHeaderContainer[hideDetails ? "hideDetails" : "showDetails"],
|
|
131
|
+
direction: "row",
|
|
132
|
+
gap: 2,
|
|
133
|
+
justifyContent: "space-between",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
Text,
|
|
137
|
+
{
|
|
138
|
+
as: "h3",
|
|
139
|
+
prominence: "strong",
|
|
140
|
+
sentiment: "neutral",
|
|
141
|
+
variant: "headingSmallStrong",
|
|
142
|
+
children: header
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
!hideTimeUnit && !hideDetails ? /* @__PURE__ */ jsx(Stack, { className: orderSummaryStackBackground, children: /* @__PURE__ */ jsx(
|
|
146
|
+
UnitInput,
|
|
147
|
+
{
|
|
148
|
+
dropdownAlign: "center",
|
|
149
|
+
maxWidth: "200px",
|
|
150
|
+
onChange: (value) => {
|
|
151
|
+
setTimePeriodAmount(value);
|
|
152
|
+
},
|
|
153
|
+
onChangeUnitValue: (val) => {
|
|
154
|
+
setTimePeriodUnit(val);
|
|
155
|
+
onChangeUnitInput?.(val);
|
|
156
|
+
},
|
|
157
|
+
options: computePeriodOptions,
|
|
158
|
+
selectInputWidth: "100%",
|
|
159
|
+
size: "small",
|
|
160
|
+
templateColumns: "2fr 3fr",
|
|
161
|
+
unitValue: unitUnitInput,
|
|
162
|
+
value: valueUnitInput
|
|
163
|
+
}
|
|
164
|
+
) }) : null
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
) : null,
|
|
168
|
+
!hideDetails ? /* @__PURE__ */ jsx(ScrollableContent, {}) : null,
|
|
169
|
+
/* @__PURE__ */ jsx(
|
|
170
|
+
NonScrollableContent,
|
|
171
|
+
{
|
|
172
|
+
additionalInfo,
|
|
173
|
+
discount,
|
|
174
|
+
footer,
|
|
175
|
+
hideDetails,
|
|
176
|
+
totalPrice,
|
|
177
|
+
totalPriceDescription,
|
|
178
|
+
totalPriceInfo,
|
|
179
|
+
unit: unitUnitInput,
|
|
180
|
+
children
|
|
181
|
+
}
|
|
182
|
+
)
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
) });
|
|
99
186
|
};
|
|
100
187
|
export {
|
|
101
188
|
OrderSummary
|
|
@@ -2,5 +2,5 @@ import type { Hint } from './types';
|
|
|
2
2
|
type FeatureHintProps = {
|
|
3
3
|
hint?: Hint;
|
|
4
4
|
};
|
|
5
|
-
export declare const FeatureHint: ({ hint }: FeatureHintProps) => import("
|
|
5
|
+
export declare const FeatureHint: ({ hint }: FeatureHintProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { InformationOutlineIcon } from "@ultraviolet/icons";
|
|
3
3
|
import { Tooltip, Popover } from "@ultraviolet/ui";
|
|
4
4
|
import { useState } from "react";
|
|
5
5
|
import { plansIconWrapper } from "./styles.css.js";
|
|
6
|
-
const FeatureHint = ({
|
|
7
|
-
hint
|
|
8
|
-
}) => {
|
|
6
|
+
const FeatureHint = ({ hint }) => {
|
|
9
7
|
const [visible, setVisible] = useState(false);
|
|
10
8
|
if (!hint) {
|
|
11
9
|
return /* @__PURE__ */ jsx("div", {});
|
|
@@ -13,11 +11,31 @@ const FeatureHint = ({
|
|
|
13
11
|
if (hint.type === "tooltip") {
|
|
14
12
|
return /* @__PURE__ */ jsx(Tooltip, { text: hint.text, children: /* @__PURE__ */ jsx(InformationOutlineIcon, { prominence: "weak", sentiment: "neutral" }) });
|
|
15
13
|
}
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Popover,
|
|
16
|
+
{
|
|
17
|
+
content: hint.content,
|
|
18
|
+
onClose: () => setVisible(false),
|
|
19
|
+
title: hint.title,
|
|
20
|
+
visible,
|
|
21
|
+
children: /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: plansIconWrapper,
|
|
25
|
+
"data-testid": "hint-popover",
|
|
26
|
+
onClick: () => setVisible(true),
|
|
27
|
+
onKeyDown: (event) => {
|
|
28
|
+
if (event.key === "Space" || event.key === "Enter") {
|
|
29
|
+
setVisible(true);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
role: "button",
|
|
33
|
+
tabIndex: 0,
|
|
34
|
+
children: /* @__PURE__ */ jsx(InformationOutlineIcon, { prominence: "weak", sentiment: "neutral" })
|
|
35
|
+
}
|
|
36
|
+
)
|
|
19
37
|
}
|
|
20
|
-
|
|
38
|
+
);
|
|
21
39
|
};
|
|
22
40
|
export {
|
|
23
41
|
FeatureHint
|
|
@@ -9,5 +9,5 @@ type PlanHeaderProps = {
|
|
|
9
9
|
disabled: boolean;
|
|
10
10
|
locales?: Record<keyof typeof PlansLocales, string>;
|
|
11
11
|
};
|
|
12
|
-
export declare const PlanHeader: ({ fieldName, setFocusedPlan, onChange, currentPlanValue, plan, disabled, locales, }: PlanHeaderProps) => import("
|
|
12
|
+
export declare const PlanHeader: ({ fieldName, setFocusedPlan, onChange, currentPlanValue, plan, disabled, locales, }: PlanHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Stack, Badge, Text, Separator } from "@ultraviolet/ui";
|
|
3
3
|
import locales from "./locales/en.js";
|
|
4
4
|
import { plansHeaderInput, plansHeaderFullHeight, plansDescription, plansCurrentWrapper, plansFullSizeSeparator } from "./styles.css.js";
|
|
@@ -11,31 +11,85 @@ const PlanHeader = ({
|
|
|
11
11
|
disabled,
|
|
12
12
|
locales: locales$1 = locales
|
|
13
13
|
}) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14
|
-
fieldName && onChange && !disabled ? /* @__PURE__ */ jsx(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
fieldName && onChange && !disabled ? /* @__PURE__ */ jsx(
|
|
15
|
+
"input",
|
|
16
|
+
{
|
|
17
|
+
className: plansHeaderInput,
|
|
18
|
+
"data-testid": plan.value,
|
|
19
|
+
id: plan.value,
|
|
20
|
+
name: fieldName,
|
|
21
|
+
onBlur: () => {
|
|
22
|
+
setFocusedPlan(void 0);
|
|
23
|
+
},
|
|
24
|
+
onChange: () => onChange(plan.value),
|
|
25
|
+
onFocus: () => {
|
|
26
|
+
setFocusedPlan(plan.value);
|
|
27
|
+
},
|
|
28
|
+
type: "radio",
|
|
29
|
+
value: plan.value
|
|
30
|
+
}
|
|
31
|
+
) : null,
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
Stack,
|
|
34
|
+
{
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
className: plansHeaderFullHeight,
|
|
37
|
+
gap: 2,
|
|
38
|
+
justifyContent: "space-between",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", gap: 3, width: "100%", children: [
|
|
41
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", gap: 1, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Badge,
|
|
44
|
+
{
|
|
45
|
+
disabled,
|
|
46
|
+
sentiment: plan.sentiment && plan.sentiment !== "black" && plan.sentiment !== "white" ? plan.sentiment : "primary",
|
|
47
|
+
children: /* @__PURE__ */ jsx("label", { htmlFor: plan.value, children: plan.title })
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
plan.titleHeader,
|
|
51
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", children: [
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Text,
|
|
54
|
+
{
|
|
55
|
+
as: "span",
|
|
56
|
+
disabled,
|
|
57
|
+
sentiment: plan.sentiment ?? "primary",
|
|
58
|
+
variant: "headingSmallStrong",
|
|
59
|
+
children: plan.header.price
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ jsx(Stack, { style: { minHeight: "16px" }, children: plan.header.priceDescription ? /* @__PURE__ */ jsx(
|
|
63
|
+
Text,
|
|
64
|
+
{
|
|
65
|
+
as: "span",
|
|
66
|
+
disabled,
|
|
67
|
+
sentiment: plan.sentiment ?? "primary",
|
|
68
|
+
variant: "caption",
|
|
69
|
+
children: plan.header.priceDescription
|
|
70
|
+
}
|
|
71
|
+
) : null })
|
|
72
|
+
] })
|
|
73
|
+
] }),
|
|
74
|
+
plan.header.description ? /* @__PURE__ */ jsx("div", { className: plansDescription, children: /* @__PURE__ */ jsx(Text, { as: "div", disabled, variant: "caption", children: plan.header.description }) }) : null
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", gap: 3, width: "100%", children: [
|
|
77
|
+
plan.header.cta && currentPlanValue !== plan.value ? plan.header.cta : null,
|
|
78
|
+
plan.header.cta && currentPlanValue === plan.value ? /* @__PURE__ */ jsx("div", { className: plansCurrentWrapper, children: /* @__PURE__ */ jsx(
|
|
79
|
+
Text,
|
|
80
|
+
{
|
|
81
|
+
as: "span",
|
|
82
|
+
disabled,
|
|
83
|
+
sentiment: plan.sentiment ?? "primary",
|
|
84
|
+
variant: "bodySmallStrong",
|
|
85
|
+
children: locales$1["plans.currentPlan"]
|
|
86
|
+
}
|
|
87
|
+
) }) : null,
|
|
88
|
+
plan.header.separator ? /* @__PURE__ */ jsx(Separator, { className: plansFullSizeSeparator }) : null
|
|
29
89
|
] })
|
|
30
|
-
]
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */ jsxs(Stack, { alignItems: "center", gap: 3, width: "100%", children: [
|
|
34
|
-
plan.header.cta && currentPlanValue !== plan.value ? plan.header.cta : null,
|
|
35
|
-
plan.header.cta && currentPlanValue === plan.value ? /* @__PURE__ */ jsx("div", { className: plansCurrentWrapper, children: /* @__PURE__ */ jsx(Text, { as: "span", disabled, sentiment: plan.sentiment ?? "primary", variant: "bodySmallStrong", children: locales$1["plans.currentPlan"] }) }) : null,
|
|
36
|
-
plan.header.separator ? /* @__PURE__ */ jsx(Separator, { className: plansFullSizeSeparator }) : null
|
|
37
|
-
] })
|
|
38
|
-
] })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
)
|
|
39
93
|
] });
|
|
40
94
|
export {
|
|
41
95
|
PlanHeader
|
|
@@ -12,5 +12,5 @@ type PlansProps<T extends string> = {
|
|
|
12
12
|
locales?: Record<keyof typeof PlansLocales, string>;
|
|
13
13
|
style?: CSSProperties;
|
|
14
14
|
};
|
|
15
|
-
export declare const Plans: <T extends string>({ fieldName, onChange, value, features, plans, hideFeatureText, hideLabels, locales, style, }: PlansProps<T>) => import("
|
|
15
|
+
export declare const Plans: <T extends string>({ fieldName, onChange, value, features, plans, hideFeatureText, hideLabels, locales, style, }: PlansProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|