@ultraviolet/plus 3.4.5 → 3.5.1

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 (222) hide show
  1. package/dist/.vite/license.md +3 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/defineProperty.js +15 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js +28 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js +18 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutPropertiesLoose.js +15 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPrimitive.js +17 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPropertyKey.js +12 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/typeof.js +14 -0
  9. package/dist/_virtual/_rolldown/runtime.js +9 -0
  10. package/dist/components/CodeEditor/CodeEditor.d.ts +1 -1
  11. package/dist/components/CodeEditor/CodeEditor.d.ts.map +1 -1
  12. package/dist/components/CodeEditor/CodeEditor.js +111 -137
  13. package/dist/components/CodeEditor/styles.css.js +18 -15
  14. package/dist/components/ContentCard/Skeleton.d.ts.map +1 -1
  15. package/dist/components/ContentCard/Skeleton.js +31 -27
  16. package/dist/components/ContentCard/index.js +107 -140
  17. package/dist/components/ContentCard/styles.css.d.ts +1 -1
  18. package/dist/components/ContentCard/styles.css.js +23 -19
  19. package/dist/components/ContentCardGroup/Card.js +55 -69
  20. package/dist/components/ContentCardGroup/SkeletonCard.js +28 -14
  21. package/dist/components/ContentCardGroup/index.d.ts +7 -7
  22. package/dist/components/ContentCardGroup/index.js +20 -25
  23. package/dist/components/ContentCardGroup/styles.css.js +6 -11
  24. package/dist/components/Conversation/index.d.ts +29 -23
  25. package/dist/components/Conversation/index.d.ts.map +1 -1
  26. package/dist/components/Conversation/index.js +46 -48
  27. package/dist/components/Conversation/styles.css.js +19 -13
  28. package/dist/components/CustomerSatisfaction/assets/1-5.js +5 -0
  29. package/dist/components/CustomerSatisfaction/assets/1-5NB.js +5 -0
  30. package/dist/components/CustomerSatisfaction/assets/2-5.js +5 -0
  31. package/dist/components/CustomerSatisfaction/assets/2-5NB.js +5 -0
  32. package/dist/components/CustomerSatisfaction/assets/3-5.js +5 -0
  33. package/dist/components/CustomerSatisfaction/assets/3-5NB.js +5 -0
  34. package/dist/components/CustomerSatisfaction/assets/4-5.js +5 -0
  35. package/dist/components/CustomerSatisfaction/assets/4-5NB.js +5 -0
  36. package/dist/components/CustomerSatisfaction/assets/5-5.js +5 -0
  37. package/dist/components/CustomerSatisfaction/assets/5-5NB.js +5 -0
  38. package/dist/components/CustomerSatisfaction/index.d.ts +1 -1
  39. package/dist/components/CustomerSatisfaction/index.d.ts.map +1 -1
  40. package/dist/components/CustomerSatisfaction/index.js +85 -100
  41. package/dist/components/CustomerSatisfaction/styles.css.js +18 -6
  42. package/dist/components/EstimateCost/Components/CustomUnitInput.d.ts.map +1 -1
  43. package/dist/components/EstimateCost/Components/CustomUnitInput.js +39 -52
  44. package/dist/components/EstimateCost/Components/Item.d.ts.map +1 -1
  45. package/dist/components/EstimateCost/Components/Item.js +223 -323
  46. package/dist/components/EstimateCost/Components/LineThrough.d.ts.map +1 -1
  47. package/dist/components/EstimateCost/Components/LineThrough.js +16 -16
  48. package/dist/components/EstimateCost/Components/NumberInput.d.ts.map +1 -1
  49. package/dist/components/EstimateCost/Components/NumberInput.js +33 -37
  50. package/dist/components/EstimateCost/Components/Region.d.ts.map +1 -1
  51. package/dist/components/EstimateCost/Components/Region.js +34 -57
  52. package/dist/components/EstimateCost/Components/Regular.d.ts.map +1 -1
  53. package/dist/components/EstimateCost/Components/Regular.js +21 -26
  54. package/dist/components/EstimateCost/Components/Strong.d.ts.map +1 -1
  55. package/dist/components/EstimateCost/Components/Strong.js +14 -19
  56. package/dist/components/EstimateCost/Components/Unit.d.ts.map +1 -1
  57. package/dist/components/EstimateCost/Components/Unit.js +47 -40
  58. package/dist/components/EstimateCost/Components/Zone.d.ts.map +1 -1
  59. package/dist/components/EstimateCost/Components/Zone.js +33 -55
  60. package/dist/components/EstimateCost/Components/components.css.js +122 -86
  61. package/dist/components/EstimateCost/EstimateCost.d.ts +138 -121
  62. package/dist/components/EstimateCost/EstimateCost.d.ts.map +1 -1
  63. package/dist/components/EstimateCost/EstimateCost.js +79 -124
  64. package/dist/components/EstimateCost/EstimateCostContent.d.ts.map +1 -1
  65. package/dist/components/EstimateCost/EstimateCostContent.js +284 -394
  66. package/dist/components/EstimateCost/EstimateCostProvider.d.ts +1 -1
  67. package/dist/components/EstimateCost/EstimateCostProvider.d.ts.map +1 -1
  68. package/dist/components/EstimateCost/EstimateCostProvider.js +30 -37
  69. package/dist/components/EstimateCost/OverlayComponent.d.ts.map +1 -1
  70. package/dist/components/EstimateCost/OverlayComponent.js +95 -93
  71. package/dist/components/EstimateCost/OverlayContext.d.ts.map +1 -1
  72. package/dist/components/EstimateCost/OverlayContext.js +12 -10
  73. package/dist/components/EstimateCost/constants.js +19 -21
  74. package/dist/components/EstimateCost/helper.d.ts +2 -2
  75. package/dist/components/EstimateCost/helper.d.ts.map +1 -1
  76. package/dist/components/EstimateCost/helper.js +9 -14
  77. package/dist/components/EstimateCost/locales/en.js +24 -23
  78. package/dist/components/EstimateCost/styles.css.d.ts +2 -2
  79. package/dist/components/EstimateCost/styles.css.js +50 -36
  80. package/dist/components/EstimateCost/types.d.ts +1 -1
  81. package/dist/components/EstimateCost/types.d.ts.map +1 -1
  82. package/dist/components/FAQ/index.d.ts.map +1 -1
  83. package/dist/components/FAQ/index.js +37 -31
  84. package/dist/components/FAQ/styles.css.js +6 -4
  85. package/dist/components/InfoTable/InfoTable.d.ts +10 -13
  86. package/dist/components/InfoTable/InfoTable.d.ts.map +1 -1
  87. package/dist/components/InfoTable/InfoTable.js +24 -15
  88. package/dist/components/InfoTable/components/Cell.d.ts.map +1 -1
  89. package/dist/components/InfoTable/components/Cell.js +37 -45
  90. package/dist/components/InfoTable/components/Row.d.ts.map +1 -1
  91. package/dist/components/InfoTable/components/Row.js +19 -27
  92. package/dist/components/InfoTable/context.d.ts +1 -1
  93. package/dist/components/InfoTable/context.d.ts.map +1 -1
  94. package/dist/components/InfoTable/context.js +5 -3
  95. package/dist/components/InfoTable/styles.css.js +6 -10
  96. package/dist/components/Navigation/Footer.d.ts.map +1 -1
  97. package/dist/components/Navigation/Footer.js +59 -75
  98. package/dist/components/Navigation/Header.d.ts.map +1 -1
  99. package/dist/components/Navigation/Header.js +20 -17
  100. package/dist/components/Navigation/Navigation.d.ts +46 -43
  101. package/dist/components/Navigation/Navigation.d.ts.map +1 -1
  102. package/dist/components/Navigation/Navigation.js +23 -27
  103. package/dist/components/Navigation/NavigationContent.d.ts +1 -1
  104. package/dist/components/Navigation/NavigationContent.d.ts.map +1 -1
  105. package/dist/components/Navigation/NavigationContent.js +100 -138
  106. package/dist/components/Navigation/NavigationProvider.d.ts.map +1 -1
  107. package/dist/components/Navigation/NavigationProvider.js +116 -165
  108. package/dist/components/Navigation/components/Group.d.ts.map +1 -1
  109. package/dist/components/Navigation/components/Group.js +36 -43
  110. package/dist/components/Navigation/components/Item.d.ts +1 -1
  111. package/dist/components/Navigation/components/Item.d.ts.map +1 -1
  112. package/dist/components/Navigation/components/Item.js +440 -607
  113. package/dist/components/Navigation/components/ItemProvider.d.ts.map +1 -1
  114. package/dist/components/Navigation/components/ItemProvider.js +13 -8
  115. package/dist/components/Navigation/components/PinnedItems.d.ts.map +1 -1
  116. package/dist/components/Navigation/components/PinnedItems.js +101 -132
  117. package/dist/components/Navigation/components/Separator.js +10 -7
  118. package/dist/components/Navigation/components/ShowHide.d.ts +1 -1
  119. package/dist/components/Navigation/components/ShowHide.d.ts.map +1 -1
  120. package/dist/components/Navigation/components/ShowHide.js +51 -75
  121. package/dist/components/Navigation/components/items.css.js +72 -30
  122. package/dist/components/Navigation/components/styles.css.js +23 -13
  123. package/dist/components/Navigation/locales/en.js +12 -11
  124. package/dist/components/Navigation/styles.css.js +28 -14
  125. package/dist/components/Navigation/variables.css.js +6 -4
  126. package/dist/components/OfferList/OfferList.d.ts +5 -51
  127. package/dist/components/OfferList/OfferList.d.ts.map +1 -1
  128. package/dist/components/OfferList/OfferList.js +11 -78
  129. package/dist/components/OrderSummary/index.d.ts +5 -2
  130. package/dist/components/OrderSummary/index.d.ts.map +1 -1
  131. package/dist/components/OrderSummary/index.js +11 -204
  132. package/dist/components/Plans/index.d.ts +5 -21
  133. package/dist/components/Plans/index.d.ts.map +1 -1
  134. package/dist/components/Plans/index.js +11 -214
  135. package/dist/components/SteppedListCard/index.d.ts +5 -1
  136. package/dist/components/SteppedListCard/index.d.ts.map +1 -1
  137. package/dist/components/SteppedListCard/index.js +11 -0
  138. package/dist/index.js +5 -21
  139. package/dist/plus.css +2 -1
  140. package/package.json +9 -8
  141. package/LICENSE +0 -189
  142. package/dist/components/CustomerSatisfaction/assets/1-5.svg.js +0 -4
  143. package/dist/components/CustomerSatisfaction/assets/1-5NB.svg.js +0 -4
  144. package/dist/components/CustomerSatisfaction/assets/2-5.svg.js +0 -4
  145. package/dist/components/CustomerSatisfaction/assets/2-5NB.svg.js +0 -4
  146. package/dist/components/CustomerSatisfaction/assets/3-5.svg.js +0 -4
  147. package/dist/components/CustomerSatisfaction/assets/3-5NB.svg.js +0 -4
  148. package/dist/components/CustomerSatisfaction/assets/4-5.svg.js +0 -4
  149. package/dist/components/CustomerSatisfaction/assets/4-5NB.svg.js +0 -4
  150. package/dist/components/CustomerSatisfaction/assets/5-5.svg.js +0 -4
  151. package/dist/components/CustomerSatisfaction/assets/5-5NB.svg.js +0 -4
  152. package/dist/components/Navigation/constants.js +0 -10
  153. package/dist/components/OfferList/OfferListProvider.d.ts +0 -30
  154. package/dist/components/OfferList/OfferListProvider.d.ts.map +0 -1
  155. package/dist/components/OfferList/OfferListProvider.js +0 -48
  156. package/dist/components/OfferList/components/Banner.d.ts +0 -13
  157. package/dist/components/OfferList/components/Banner.d.ts.map +0 -1
  158. package/dist/components/OfferList/components/Banner.js +0 -43
  159. package/dist/components/OfferList/components/Cell.d.ts +0 -4
  160. package/dist/components/OfferList/components/Cell.d.ts.map +0 -1
  161. package/dist/components/OfferList/components/Cell.js +0 -35
  162. package/dist/components/OfferList/components/OfferListRowProvider.d.ts +0 -9
  163. package/dist/components/OfferList/components/OfferListRowProvider.d.ts.map +0 -1
  164. package/dist/components/OfferList/components/OfferListRowProvider.js +0 -10
  165. package/dist/components/OfferList/components/Row.d.ts +0 -18
  166. package/dist/components/OfferList/components/Row.d.ts.map +0 -1
  167. package/dist/components/OfferList/components/Row.js +0 -258
  168. package/dist/components/OfferList/styles.css.d.ts +0 -44
  169. package/dist/components/OfferList/styles.css.d.ts.map +0 -1
  170. package/dist/components/OfferList/styles.css.js +0 -40
  171. package/dist/components/OrderSummary/NonScrollableContent.d.ts +0 -20
  172. package/dist/components/OrderSummary/NonScrollableContent.d.ts.map +0 -1
  173. package/dist/components/OrderSummary/NonScrollableContent.js +0 -136
  174. package/dist/components/OrderSummary/Provider.d.ts +0 -15
  175. package/dist/components/OrderSummary/Provider.d.ts.map +0 -1
  176. package/dist/components/OrderSummary/Provider.js +0 -15
  177. package/dist/components/OrderSummary/ScrollableContent.d.ts +0 -2
  178. package/dist/components/OrderSummary/ScrollableContent.d.ts.map +0 -1
  179. package/dist/components/OrderSummary/ScrollableContent.js +0 -314
  180. package/dist/components/OrderSummary/constants.d.ts +0 -3
  181. package/dist/components/OrderSummary/constants.d.ts.map +0 -1
  182. package/dist/components/OrderSummary/constants.js +0 -18
  183. package/dist/components/OrderSummary/helpers.d.ts +0 -28
  184. package/dist/components/OrderSummary/helpers.d.ts.map +0 -1
  185. package/dist/components/OrderSummary/helpers.js +0 -156
  186. package/dist/components/OrderSummary/locales/en.d.ts +0 -11
  187. package/dist/components/OrderSummary/locales/en.d.ts.map +0 -1
  188. package/dist/components/OrderSummary/locales/en.js +0 -12
  189. package/dist/components/OrderSummary/styles.css.d.ts +0 -21
  190. package/dist/components/OrderSummary/styles.css.d.ts.map +0 -1
  191. package/dist/components/OrderSummary/styles.css.js +0 -26
  192. package/dist/components/OrderSummary/types.d.ts +0 -125
  193. package/dist/components/OrderSummary/types.d.ts.map +0 -1
  194. package/dist/components/Plans/FeatureHint.d.ts +0 -7
  195. package/dist/components/Plans/FeatureHint.d.ts.map +0 -1
  196. package/dist/components/Plans/FeatureHint.js +0 -42
  197. package/dist/components/Plans/PlanHeader.d.ts +0 -14
  198. package/dist/components/Plans/PlanHeader.d.ts.map +0 -1
  199. package/dist/components/Plans/PlanHeader.js +0 -96
  200. package/dist/components/Plans/locales/en.d.ts +0 -7
  201. package/dist/components/Plans/locales/en.d.ts.map +0 -1
  202. package/dist/components/Plans/locales/en.js +0 -8
  203. package/dist/components/Plans/styles.css.d.ts +0 -67
  204. package/dist/components/Plans/styles.css.d.ts.map +0 -1
  205. package/dist/components/Plans/styles.css.js +0 -26
  206. package/dist/components/Plans/types.d.ts +0 -38
  207. package/dist/components/Plans/types.d.ts.map +0 -1
  208. package/dist/components/SteppedListCard/Step.d.ts +0 -23
  209. package/dist/components/SteppedListCard/Step.d.ts.map +0 -1
  210. package/dist/components/SteppedListCard/Step.js +0 -61
  211. package/dist/components/SteppedListCard/SteppedListCard.d.ts +0 -69
  212. package/dist/components/SteppedListCard/SteppedListCard.d.ts.map +0 -1
  213. package/dist/components/SteppedListCard/SteppedListCard.js +0 -105
  214. package/dist/components/SteppedListCard/SteppedListContent.d.ts +0 -12
  215. package/dist/components/SteppedListCard/SteppedListContent.d.ts.map +0 -1
  216. package/dist/components/SteppedListCard/SteppedListContent.js +0 -53
  217. package/dist/components/SteppedListCard/helper.d.ts +0 -27
  218. package/dist/components/SteppedListCard/helper.d.ts.map +0 -1
  219. package/dist/components/SteppedListCard/helper.js +0 -41
  220. package/dist/components/SteppedListCard/styles.css.d.ts +0 -9
  221. package/dist/components/SteppedListCard/styles.css.d.ts.map +0 -1
  222. package/dist/components/SteppedListCard/styles.css.js +0 -19
@@ -1,328 +1,228 @@
1
- "use client";
2
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
3
- import { HelpCircleOutlineIcon } from "@ultraviolet/icons/HelpCircleOutlineIcon";
4
- import { Stack, Text, Tooltip, Badge } from "@ultraviolet/ui";
5
- import { cn } from "@ultraviolet/utils";
6
- import { assignInlineVars } from "@vanilla-extract/dynamic";
7
- import { memo, useMemo, useState, useEffect, useCallback, useId, Children, cloneElement, isValidElement } from "react";
8
- import { multiplier, maximumFractionDigitsLong, maximumFractionDigits } from "../constants.js";
1
+ 'use client';
2
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
3
+ import { estimateCostBadgeItem, estimateCostLeftSide, estimateCostMaxWidthText, estimateCostResourceName, estimateCostTextItem, estimateCostTooltip, estimateCostTr, styledDiv } from "./components.css.js";
4
+ import { maximumFractionDigits, maximumFractionDigitsLong, multiplier } from "../constants.js";
5
+ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
9
6
  import { useEstimateCost } from "../EstimateCostProvider.js";
10
7
  import { calculatePrice } from "../helper.js";
11
8
  import { useOverlay } from "../OverlayContext.js";
12
- import { estimateCostOverlayRow, estimateCostCell, paddingLeftCell, estimateCostPriceCell } from "../styles.css.js";
13
- import { estimateCostTr, estimateCostLeftSide, styledDiv, estimateCostTooltip, estimateCostTextItem, estimateCostBadgeItem, estimateCostMaxWidthText, estimateCostResourceName } from "./components.css.js";
9
+ import { estimateCostCell, estimateCostOverlayRow, estimateCostPriceCell, paddingLeftCell } from "../styles.css.js";
10
+ import { Badge, Stack, Text, Tooltip } from "@ultraviolet/ui";
11
+ import { cn } from "@ultraviolet/utils";
12
+ import { assignInlineVars } from "@vanilla-extract/dynamic";
13
+ import { Children, cloneElement, isValidElement, memo, useCallback, useEffect, useId, useMemo, useState } from "react";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
+ import { HelpCircleOutlineIcon } from "@ultraviolet/icons/HelpCircleOutlineIcon";
16
+
17
+ //#region src/components/EstimateCost/Components/Item.tsx
14
18
  const TIME_RELATED_UNIT = [
15
- "seconds",
16
- "minutes",
17
- "hours",
18
- "days",
19
- "months"
19
+ "seconds",
20
+ "minutes",
21
+ "hours",
22
+ "days",
23
+ "months"
20
24
  ];
21
- const Item = memo(
22
- ({
23
- discount = 0,
24
- priceText,
25
- discountText,
26
- label,
27
- tooltipInfo,
28
- // Shows an icon with tooltip that contains this text
29
- subLabel = "",
30
- // Usually used for showing amount that is free
31
- price: basePrice = 0,
32
- // Hourly price for one unit
33
- monthlyPrice = 0,
34
- // Price per month
35
- unit: baseUnit,
36
- // Can be GB, MB, Node, Queries, etc.
37
- amount: currentAmount = 1,
38
- // Current number of items
39
- onAmountChange,
40
- amountFree = 0,
41
- // Amount that is free - offered by company
42
- maxAmount = 0,
43
- // Max amount - used for kubernetes for example
44
- longFractionDigits = false,
45
- // In case price is really long 0.0000076 - up 7 fraction digits
46
- noIteration = false,
47
- // if item is not based on time (ex: download, upload, transfer)
48
- noIterationText,
49
- noBorder,
50
- // remove the border bottom of the item
51
- noPrice,
52
- // remove the price on right side of the table
53
- isDefined = true,
54
- children = null,
55
- isFirstElement = false,
56
- isLastElement = false,
57
- isPrimaryBackground = false,
58
- productsCallback,
59
- iteration: receivedIteration,
60
- // Object from parent that contains time period (hours, days, months)
61
- shouldBeHidden = false,
62
- // Hide element from overlay if screen width is small
63
- hideFromOverlay = false,
64
- // Hide element from overlay in any case
65
- textNotDefined,
66
- // Text to display in case of not defined value
67
- animated = false,
68
- // if true, zoomIn animation is triggered
69
- tabulation,
70
- // Increase left padding of the item
71
- labelTextVariant,
72
- // To change left cell typography variant
73
- labelTextProminence,
74
- // To change left cell typography prominence
75
- notice,
76
- // To display a gray text below the label
77
- strikeThrough,
78
- // To strike through the price
79
- style
80
- }) => {
81
- const { locales, formatNumber } = useEstimateCost();
82
- let iteration;
83
- if (noIteration) {
84
- iteration = {
85
- ...receivedIteration ?? { value: 0 },
86
- unit: "hours"
87
- };
88
- } else {
89
- iteration = receivedIteration;
90
- }
91
- const price = useMemo(() => {
92
- if (monthlyPrice && basePrice === 0) {
93
- return monthlyPrice / multiplier.months;
94
- }
95
- return basePrice;
96
- }, [basePrice, monthlyPrice]);
97
- const unit = useMemo(() => {
98
- if (!baseUnit) {
99
- return locales["estimate.cost.units.gb.label"];
100
- }
101
- return baseUnit;
102
- }, [baseUnit, locales]);
103
- const { isOverlay } = useOverlay();
104
- const Row = isOverlay ? "li" : "tr";
105
- const Cell = isOverlay ? "div" : "td";
106
- const LeftSide = "div";
107
- const [amount, setAmount] = useState(currentAmount);
108
- const [isVariant, setIsVariant] = useState(false);
109
- useEffect(() => setAmount(currentAmount), [setAmount, currentAmount]);
110
- useEffect(() => onAmountChange?.(amount), [onAmountChange, amount]);
111
- const itemCallback = useCallback(
112
- (localAmount, localIsVariant) => {
113
- setAmount(localAmount);
114
- setIsVariant(localIsVariant);
115
- },
116
- [setAmount, setIsVariant]
117
- );
118
- const id = useId();
119
- useEffect(
120
- () => () => productsCallback?.remove({ id }),
121
- [id, productsCallback]
122
- );
123
- useEffect(() => {
124
- if (!isOverlay) {
125
- productsCallback?.add({
126
- amount,
127
- amountFree,
128
- discount,
129
- id,
130
- isVariant,
131
- longFractionDigits,
132
- maxAmount,
133
- noIteration,
134
- price
135
- });
136
- }
137
- }, [
138
- price,
139
- discount,
140
- amount,
141
- id,
142
- productsCallback,
143
- maxAmount,
144
- noIteration,
145
- isVariant,
146
- amountFree,
147
- isOverlay,
148
- longFractionDigits
149
- ]);
150
- const computedItemPrice = useMemo(
151
- () => calculatePrice({
152
- amount,
153
- amountFree,
154
- discount,
155
- price,
156
- timeAmount: noIteration ? 1 : iteration?.value ?? 1,
157
- timeUnit: noIteration ? "hours" : iteration?.unit ?? "hours"
158
- }),
159
- [price, amount, amountFree, iteration, noIteration, discount]
160
- );
161
- const computedMaxItemPrice = useMemo(
162
- () => calculatePrice({
163
- amount: maxAmount,
164
- amountFree,
165
- discount,
166
- price,
167
- timeAmount: noIteration ? 1 : iteration?.value ?? 1,
168
- timeUnit: noIteration ? "hours" : iteration?.unit ?? "hours"
169
- }),
170
- [price, maxAmount, amountFree, iteration, noIteration, discount]
171
- );
172
- const formatMaximumFractionDigits = useMemo(() => {
173
- if (!iteration?.unit) {
174
- return void 0;
175
- }
176
- return longFractionDigits ? maximumFractionDigitsLong[iteration?.unit] : maximumFractionDigits[iteration?.unit];
177
- }, [iteration?.unit, longFractionDigits]);
178
- return /* @__PURE__ */ jsxs(
179
- Row,
180
- {
181
- className: isOverlay ? estimateCostOverlayRow({
182
- hideFromOverlay,
183
- isFirstElement,
184
- shouldBeHidden
185
- }) : estimateCostTr,
186
- style,
187
- children: [
188
- /* @__PURE__ */ jsx(
189
- Cell,
190
- {
191
- className: estimateCostCell({
192
- hasBorder: !(isLastElement || noBorder || isOverlay)
193
- }),
194
- style: assignInlineVars({
195
- [paddingLeftCell]: `${(tabulation ?? 0) * 8 + 16}px`
196
- }),
197
- children: /* @__PURE__ */ jsxs(LeftSide, { className: isOverlay ? "" : estimateCostLeftSide, children: [
198
- /* @__PURE__ */ jsxs(Stack, { children: [
199
- /* @__PURE__ */ jsxs(Stack, { direction: "row", children: [
200
- /* @__PURE__ */ jsx(
201
- Text,
202
- {
203
- as: "p",
204
- prominence: labelTextProminence ?? "default",
205
- variant: labelTextVariant ?? "body",
206
- children: label
207
- }
208
- ),
209
- tooltipInfo ? /* @__PURE__ */ jsx("div", { className: styledDiv, children: /* @__PURE__ */ jsx(Tooltip, { className: estimateCostTooltip, text: tooltipInfo, children: /* @__PURE__ */ jsx(HelpCircleOutlineIcon, { size: "medium" }) }) }) : null,
210
- subLabel && !isOverlay ? /* @__PURE__ */ jsx(
211
- Text,
212
- {
213
- as: "p",
214
- className: estimateCostTextItem,
215
- italic: true,
216
- sentiment: "primary",
217
- variant: "body",
218
- children: subLabel
219
- }
220
- ) : null,
221
- discount > 0 && discountText ? /* @__PURE__ */ jsx(
222
- Badge,
223
- {
224
- className: estimateCostBadgeItem,
225
- prominence: "strong",
226
- sentiment: "warning",
227
- size: "small",
228
- children: discountText
229
- }
230
- ) : null
231
- ] }),
232
- notice ? /* @__PURE__ */ jsx(
233
- Text,
234
- {
235
- as: "p",
236
- className: estimateCostMaxWidthText,
237
- prominence: "weak",
238
- variant: "caption",
239
- children: notice
240
- }
241
- ) : null
242
- ] }),
243
- /* @__PURE__ */ jsx(
244
- "div",
245
- {
246
- className: estimateCostResourceName({
247
- isAnimated: isOverlay && animated,
248
- isOverlay
249
- }),
250
- children: isDefined ? Children.map(
251
- children,
252
- (child) => isValidElement(child) ? cloneElement(child, {
253
- amount,
254
- itemCallback,
255
- maxAmount,
256
- unit
257
- }) : null
258
- ) : textNotDefined || locales["estimate.cost.notDefined"]
259
- }
260
- )
261
- ] })
262
- }
263
- ),
264
- isOverlay ? null : /* @__PURE__ */ jsx(
265
- "td",
266
- {
267
- className: cn(
268
- estimateCostCell({
269
- hasBorder: !(isLastElement || noBorder),
270
- primary: isPrimaryBackground
271
- }),
272
- estimateCostPriceCell
273
- ),
274
- style: assignInlineVars({
275
- [paddingLeftCell]: "16px"
276
- }),
277
- children: noPrice ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
278
- /* @__PURE__ */ jsxs(
279
- Text,
280
- {
281
- as: "p",
282
- placement: "right",
283
- prominence: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "weak" : "default",
284
- sentiment: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "neutral" : "primary",
285
- strikeThrough,
286
- variant: noIterationText ? "headingSmall" : "bodyStrong",
287
- children: [
288
- priceText,
289
- priceText ? null : formatNumber(computedItemPrice, {
290
- maximumFractionDigits: formatMaximumFractionDigits
291
- }),
292
- noIterationText ? /* @__PURE__ */ jsxs(Text, { as: "span", sentiment: "primary", variant: "bodySmall", children: [
293
- "/",
294
- noIterationText
295
- ] }) : null,
296
- !priceText && computedMaxItemPrice > 0 ? ` - ${formatNumber(computedMaxItemPrice, {
297
- maximumFractionDigits: formatMaximumFractionDigits
298
- })}` : null
299
- ]
300
- }
301
- ),
302
- amount - amountFree !== 1 && computedItemPrice > 0 || maxAmount > 0 && computedMaxItemPrice > 0 ? /* @__PURE__ */ jsxs(Text, { as: "p", placement: "right", variant: "body", children: [
303
- formatNumber(
304
- calculatePrice({
305
- amount: 1,
306
- discount,
307
- price,
308
- timeAmount: 1,
309
- timeUnit: "hours"
310
- }),
311
- {
312
- maximumFractionDigits: longFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours
313
- }
314
- ),
315
- TIME_RELATED_UNIT.includes(unit) ? locales[`estimate.cost.units.${unit}.label`].toLowerCase() : `/${unit}`,
316
- noIteration ? null : `/${locales["estimate.cost.units.hours.label"].toLowerCase()}`
317
- ] }) : null
318
- ] })
319
- }
320
- )
321
- ]
322
- }
323
- );
324
- }
325
- );
326
- export {
327
- Item
328
- };
25
+ const Item = memo(({ discount = 0, priceText, discountText, label, tooltipInfo, subLabel = "", price: basePrice = 0, monthlyPrice = 0, unit: baseUnit, amount: currentAmount = 1, onAmountChange, amountFree = 0, maxAmount = 0, longFractionDigits = false, noIteration = false, noIterationText, noBorder, noPrice, isDefined = true, children = null, isFirstElement = false, isLastElement = false, isPrimaryBackground = false, productsCallback, iteration: receivedIteration, shouldBeHidden = false, hideFromOverlay = false, textNotDefined, animated = false, tabulation, labelTextVariant, labelTextProminence, notice, strikeThrough, style }) => {
26
+ const { locales, formatNumber } = useEstimateCost();
27
+ let iteration;
28
+ if (noIteration) iteration = _objectSpread2(_objectSpread2({}, receivedIteration !== null && receivedIteration !== void 0 ? receivedIteration : { value: 0 }), {}, { unit: "hours" });
29
+ else iteration = receivedIteration;
30
+ const price = useMemo(() => {
31
+ if (monthlyPrice && basePrice === 0) return monthlyPrice / multiplier.months;
32
+ return basePrice;
33
+ }, [basePrice, monthlyPrice]);
34
+ const unit = useMemo(() => {
35
+ if (!baseUnit) return locales["estimate.cost.units.gb.label"];
36
+ return baseUnit;
37
+ }, [baseUnit, locales]);
38
+ const { isOverlay } = useOverlay();
39
+ const Row = isOverlay ? "li" : "tr";
40
+ const Cell = isOverlay ? "div" : "td";
41
+ const LeftSide = "div";
42
+ const [amount, setAmount] = useState(currentAmount);
43
+ const [isVariant, setIsVariant] = useState(false);
44
+ useEffect(() => setAmount(currentAmount), [setAmount, currentAmount]);
45
+ useEffect(() => onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(amount), [onAmountChange, amount]);
46
+ const itemCallback = useCallback((localAmount, localIsVariant) => {
47
+ setAmount(localAmount);
48
+ setIsVariant(localIsVariant);
49
+ }, [setAmount, setIsVariant]);
50
+ const id = useId();
51
+ useEffect(() => () => productsCallback === null || productsCallback === void 0 ? void 0 : productsCallback.remove({ id }), [id, productsCallback]);
52
+ useEffect(() => {
53
+ if (!isOverlay) productsCallback === null || productsCallback === void 0 || productsCallback.add({
54
+ amount,
55
+ amountFree,
56
+ discount,
57
+ id,
58
+ isVariant,
59
+ longFractionDigits,
60
+ maxAmount,
61
+ noIteration,
62
+ price
63
+ });
64
+ }, [
65
+ price,
66
+ discount,
67
+ amount,
68
+ id,
69
+ productsCallback,
70
+ maxAmount,
71
+ noIteration,
72
+ isVariant,
73
+ amountFree,
74
+ isOverlay,
75
+ longFractionDigits
76
+ ]);
77
+ const computedItemPrice = useMemo(() => {
78
+ var _iteration$value;
79
+ var _iteration$unit;
80
+ return calculatePrice({
81
+ amount,
82
+ amountFree,
83
+ discount,
84
+ price,
85
+ timeAmount: noIteration ? 1 : (_iteration$value = iteration === null || iteration === void 0 ? void 0 : iteration.value) !== null && _iteration$value !== void 0 ? _iteration$value : 1,
86
+ timeUnit: noIteration ? "hours" : (_iteration$unit = iteration === null || iteration === void 0 ? void 0 : iteration.unit) !== null && _iteration$unit !== void 0 ? _iteration$unit : "hours"
87
+ });
88
+ }, [
89
+ price,
90
+ amount,
91
+ amountFree,
92
+ iteration,
93
+ noIteration,
94
+ discount
95
+ ]);
96
+ const computedMaxItemPrice = useMemo(() => {
97
+ var _iteration$value2;
98
+ var _iteration$unit2;
99
+ return calculatePrice({
100
+ amount: maxAmount,
101
+ amountFree,
102
+ discount,
103
+ price,
104
+ timeAmount: noIteration ? 1 : (_iteration$value2 = iteration === null || iteration === void 0 ? void 0 : iteration.value) !== null && _iteration$value2 !== void 0 ? _iteration$value2 : 1,
105
+ timeUnit: noIteration ? "hours" : (_iteration$unit2 = iteration === null || iteration === void 0 ? void 0 : iteration.unit) !== null && _iteration$unit2 !== void 0 ? _iteration$unit2 : "hours"
106
+ });
107
+ }, [
108
+ price,
109
+ maxAmount,
110
+ amountFree,
111
+ iteration,
112
+ noIteration,
113
+ discount
114
+ ]);
115
+ const formatMaximumFractionDigits = useMemo(() => {
116
+ if (!(iteration === null || iteration === void 0 ? void 0 : iteration.unit)) return;
117
+ return longFractionDigits ? maximumFractionDigitsLong[iteration === null || iteration === void 0 ? void 0 : iteration.unit] : maximumFractionDigits[iteration === null || iteration === void 0 ? void 0 : iteration.unit];
118
+ }, [iteration === null || iteration === void 0 ? void 0 : iteration.unit, longFractionDigits]);
119
+ return /* @__PURE__ */ jsxs(Row, {
120
+ className: isOverlay ? estimateCostOverlayRow({
121
+ hideFromOverlay,
122
+ isFirstElement,
123
+ shouldBeHidden
124
+ }) : estimateCostTr,
125
+ style,
126
+ children: [/* @__PURE__ */ jsx(Cell, {
127
+ className: estimateCostCell({ hasBorder: !(isLastElement || noBorder || isOverlay) }),
128
+ style: assignInlineVars({ [paddingLeftCell]: `${(tabulation !== null && tabulation !== void 0 ? tabulation : 0) * 8 + 16}px` }),
129
+ children: /* @__PURE__ */ jsxs(LeftSide, {
130
+ className: isOverlay ? "" : estimateCostLeftSide,
131
+ children: [/* @__PURE__ */ jsxs(Stack, { children: [/* @__PURE__ */ jsxs(Stack, {
132
+ direction: "row",
133
+ children: [
134
+ /* @__PURE__ */ jsx(Text, {
135
+ as: "p",
136
+ prominence: labelTextProminence !== null && labelTextProminence !== void 0 ? labelTextProminence : "default",
137
+ variant: labelTextVariant !== null && labelTextVariant !== void 0 ? labelTextVariant : "body",
138
+ children: label
139
+ }),
140
+ tooltipInfo ? /* @__PURE__ */ jsx("div", {
141
+ className: styledDiv,
142
+ children: /* @__PURE__ */ jsx(Tooltip, {
143
+ className: estimateCostTooltip,
144
+ text: tooltipInfo,
145
+ children: /* @__PURE__ */ jsx(HelpCircleOutlineIcon, { size: "medium" })
146
+ })
147
+ }) : null,
148
+ subLabel && !isOverlay ? /* @__PURE__ */ jsx(Text, {
149
+ as: "p",
150
+ className: estimateCostTextItem,
151
+ italic: true,
152
+ sentiment: "primary",
153
+ variant: "body",
154
+ children: subLabel
155
+ }) : null,
156
+ discount > 0 && discountText ? /* @__PURE__ */ jsx(Badge, {
157
+ className: estimateCostBadgeItem,
158
+ prominence: "strong",
159
+ sentiment: "warning",
160
+ size: "small",
161
+ children: discountText
162
+ }) : null
163
+ ]
164
+ }), notice ? /* @__PURE__ */ jsx(Text, {
165
+ as: "p",
166
+ className: estimateCostMaxWidthText,
167
+ prominence: "weak",
168
+ variant: "caption",
169
+ children: notice
170
+ }) : null] }), /* @__PURE__ */ jsx("div", {
171
+ className: estimateCostResourceName({
172
+ isAnimated: isOverlay && animated,
173
+ isOverlay
174
+ }),
175
+ children: isDefined ? Children.map(children, (child) => isValidElement(child) ? cloneElement(child, {
176
+ amount,
177
+ itemCallback,
178
+ maxAmount,
179
+ unit
180
+ }) : null) : textNotDefined || locales["estimate.cost.notDefined"]
181
+ })]
182
+ })
183
+ }), isOverlay ? null : /* @__PURE__ */ jsx("td", {
184
+ className: cn(estimateCostCell({
185
+ hasBorder: !(isLastElement || noBorder),
186
+ primary: isPrimaryBackground
187
+ }), estimateCostPriceCell),
188
+ style: assignInlineVars({ [paddingLeftCell]: "16px" }),
189
+ children: noPrice ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Text, {
190
+ as: "p",
191
+ placement: "right",
192
+ prominence: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "weak" : "default",
193
+ sentiment: computedItemPrice === 0 && computedMaxItemPrice === 0 ? "neutral" : "primary",
194
+ strikeThrough,
195
+ variant: noIterationText ? "headingSmall" : "bodyStrong",
196
+ children: [
197
+ priceText,
198
+ priceText ? null : formatNumber(computedItemPrice, { maximumFractionDigits: formatMaximumFractionDigits }),
199
+ noIterationText ? /* @__PURE__ */ jsxs(Text, {
200
+ as: "span",
201
+ sentiment: "primary",
202
+ variant: "bodySmall",
203
+ children: ["/", noIterationText]
204
+ }) : null,
205
+ !priceText && computedMaxItemPrice > 0 ? ` - ${formatNumber(computedMaxItemPrice, { maximumFractionDigits: formatMaximumFractionDigits })}` : null
206
+ ]
207
+ }), amount - amountFree !== 1 && computedItemPrice > 0 || maxAmount > 0 && computedMaxItemPrice > 0 ? /* @__PURE__ */ jsxs(Text, {
208
+ as: "p",
209
+ placement: "right",
210
+ variant: "body",
211
+ children: [
212
+ formatNumber(calculatePrice({
213
+ amount: 1,
214
+ discount,
215
+ price,
216
+ timeAmount: 1,
217
+ timeUnit: "hours"
218
+ }), { maximumFractionDigits: longFractionDigits ? maximumFractionDigitsLong.hours : maximumFractionDigits.hours }),
219
+ TIME_RELATED_UNIT.includes(unit) ? locales[`estimate.cost.units.${unit}.label`].toLowerCase() : `/${unit}`,
220
+ noIteration ? null : `/${locales["estimate.cost.units.hours.label"].toLowerCase()}`
221
+ ]
222
+ }) : null] })
223
+ })]
224
+ });
225
+ });
226
+
227
+ //#endregion
228
+ export { Item };
@@ -1 +1 @@
1
- {"version":3,"file":"LineThrough.d.ts","sourceRoot":"","sources":["../../../../src/components/EstimateCost/Components/LineThrough.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C,KAAK,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,mCAIzB,gBAAgB,4CAMlB,CAAA"}
1
+ {"version":3,"file":"LineThrough.d.ts","sourceRoot":"","sources":["../../../../src/components/EstimateCost/Components/LineThrough.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAG3C,KAAK,gBAAgB,GAAG,cAAc,CAAC,MAAM,CAAC,GAAG;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,kGAUvB,CAAA"}
@@ -1,18 +1,18 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { cn } from "@ultraviolet/utils";
1
+ 'use client';
2
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
4
3
  import { estimateCostLineThrough } from "./components.css.js";
5
- const LineThrough = ({
6
- isActive,
7
- className,
8
- ...props
9
- }) => /* @__PURE__ */ jsx(
10
- "span",
11
- {
12
- className: cn(className, isActive ? estimateCostLineThrough : ""),
13
- ...props
14
- }
15
- );
16
- export {
17
- LineThrough
4
+ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
5
+ import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
6
+ import { cn } from "@ultraviolet/utils";
7
+ import { jsx } from "react/jsx-runtime";
8
+
9
+ //#region src/components/EstimateCost/Components/LineThrough.tsx
10
+ const _excluded = ["isActive", "className"];
11
+ const LineThrough = (_ref) => {
12
+ let { isActive, className } = _ref;
13
+ let props = _objectWithoutProperties(_ref, _excluded);
14
+ return /* @__PURE__ */ jsx("span", _objectSpread2({ className: cn(className, isActive ? estimateCostLineThrough : "") }, props));
18
15
  };
16
+
17
+ //#endregion
18
+ export { LineThrough };
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../src/components/EstimateCost/Components/NumberInput.tsx"],"names":[],"mappings":"AAQA,KAAK,gBAAgB,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACpE,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,yEAOzB,gBAAgB,4CA0BlB,CAAA"}
1
+ {"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../src/components/EstimateCost/Components/NumberInput.tsx"],"names":[],"mappings":"AAQA,KAAK,gBAAgB,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IACpE,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,wIAiCvB,CAAA"}