@ultraviolet/plus 0.5.1 → 0.5.3

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/index.d.ts CHANGED
@@ -92,6 +92,7 @@ type EstimateCostProps = {
92
92
  * Text to display into an alert on the top of the EstimateCost component.
93
93
  */
94
94
  alert?: ReactNode;
95
+ alertTitle?: string;
95
96
  /**
96
97
  * Type of the alert defined by the Scaleway UI Alert component.
97
98
  */
@@ -285,7 +286,7 @@ declare const EstimateCost: {
285
286
  theme?: _emotion_react.Theme | undefined;
286
287
  as?: react.ElementType<any> | undefined;
287
288
  }, react.DetailedHTMLProps<react.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
288
- Region: ({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, }: {
289
+ Region: ({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, noBorder, noPrice, }: {
289
290
  shouldBeHidden?: boolean | undefined;
290
291
  priceText?: ReactNode;
291
292
  animated?: boolean | undefined;
@@ -299,8 +300,10 @@ declare const EstimateCost: {
299
300
  discount?: number | undefined;
300
301
  label: string;
301
302
  image: string;
303
+ noBorder?: boolean | undefined;
304
+ noPrice?: boolean | undefined;
302
305
  }) => _emotion_react_jsx_runtime.JSX.Element;
303
- Zone: ({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, }: {
306
+ Zone: ({ label, image, shouldBeHidden, priceText, animated, isFirstElement, isLastElement, productsCallback, iteration, discount, noBorder, noPrice, }: {
304
307
  shouldBeHidden?: boolean | undefined;
305
308
  priceText?: string | undefined;
306
309
  animated?: boolean | undefined;
@@ -314,6 +317,8 @@ declare const EstimateCost: {
314
317
  discount?: number | undefined;
315
318
  label: string;
316
319
  image: string;
320
+ noBorder?: boolean | undefined;
321
+ noPrice?: boolean | undefined;
317
322
  }) => _emotion_react_jsx_runtime.JSX.Element;
318
323
  Ellipsis: ({ children, maxWidth, "data-testid": dataTestId, }: {
319
324
  children: ReactNode;
@@ -322,4 +327,4 @@ declare const EstimateCost: {
322
327
  }) => _emotion_react_jsx_runtime.JSX.Element;
323
328
  };
324
329
 
325
- export { CodeEditor, ContentCard, ContentCardGroup, EstimateCost };
330
+ export { CodeEditor, ContentCard, ContentCardGroup, EstimateCost, _default as estimateCostDefaultLocales };
@@ -239,7 +239,7 @@ const Item = _ref6 => {
239
239
  hideFromOverlay: hideFromOverlay,
240
240
  children: [jsx(Cell$1, {
241
241
  width: !isOverlay ? MAX_CELL_WIDTH : 'inherit',
242
- hasBorder: !isLastElement && !noBorder,
242
+ hasBorder: !isLastElement && !noBorder && !isOverlay,
243
243
  tabulation: tabulation,
244
244
  children: jsxs(LeftSide, {
245
245
  children: [jsxs(Stack, {
@@ -306,7 +306,7 @@ const Item = _ref6 => {
306
306
  }) : null, !priceText && computedMaxItemPrice > 0 ? ` - ${formatNumber(computedMaxItemPrice, {
307
307
  maximumFractionDigits: formatMaximumFractionDigits
308
308
  })}` : null]
309
- }), amount - amountFree > 1 && computedItemPrice > 0 || maxAmount > 0 && computedMaxItemPrice > 0 ? jsxs(TextAlignRight, {
309
+ }), amount - amountFree !== 1 && computedItemPrice > 0 || maxAmount > 0 && computedMaxItemPrice > 0 ? jsxs(TextAlignRight, {
310
310
  as: "p",
311
311
  variant: "body",
312
312
  children: [formatNumber(calculatePrice({
@@ -23,7 +23,9 @@ const Region = _ref2 => {
23
23
  isLastElement,
24
24
  productsCallback,
25
25
  iteration,
26
- discount
26
+ discount,
27
+ noBorder,
28
+ noPrice
27
29
  } = _ref2;
28
30
  const {
29
31
  locales
@@ -38,6 +40,8 @@ const Region = _ref2 => {
38
40
  productsCallback: productsCallback,
39
41
  iteration: iteration,
40
42
  discount: discount,
43
+ noBorder: noBorder,
44
+ noPrice: noPrice,
41
45
  children: jsxs(Strong, {
42
46
  children: [jsx(StyledImage, {
43
47
  alt: label,
@@ -23,7 +23,9 @@ const Zone = _ref2 => {
23
23
  isLastElement,
24
24
  productsCallback,
25
25
  iteration,
26
- discount
26
+ discount,
27
+ noBorder,
28
+ noPrice
27
29
  } = _ref2;
28
30
  const {
29
31
  locales
@@ -38,6 +40,8 @@ const Zone = _ref2 => {
38
40
  productsCallback: productsCallback,
39
41
  iteration: iteration,
40
42
  discount: discount,
43
+ noBorder: noBorder,
44
+ noPrice: noPrice,
41
45
  children: jsxs(Strong, {
42
46
  children: [jsx(StyledImage, {
43
47
  alt: label,
@@ -1,6 +1,6 @@
1
1
  import _styled from '@emotion/styled/base';
2
2
  import { Text, Stack, Alert, Icon } from '@ultraviolet/ui';
3
- import { useState, useMemo, useEffect, Children, cloneElement } from 'react';
3
+ import { useState, useMemo, useEffect, Children, isValidElement, cloneElement } from 'react';
4
4
  import flattenChildren from 'react-flatten-children';
5
5
  import { useInView } from 'react-intersection-observer';
6
6
  import { CustomUnitInput } from './Components/CustomUnitInput.js';
@@ -60,12 +60,13 @@ const StyledPriceCell = /*#__PURE__*/_styled(Cell.withComponent('th', {
60
60
  theme
61
61
  } = _ref4;
62
62
  return PriceCell(theme);
63
- }, ";");
63
+ }, " padding:0;");
64
64
  const DEFAULT_UNIT_LIST = ['hours', 'days', 'months'];
65
65
  const EstimateCostContent = _ref5 => {
66
66
  let {
67
67
  description,
68
68
  alert,
69
+ alertTitle,
69
70
  alertVariant = 'warning',
70
71
  defaultTimeUnit = 'hours',
71
72
  timeUnits = DEFAULT_UNIT_LIST,
@@ -181,6 +182,7 @@ const EstimateCostContent = _ref5 => {
181
182
  children: description || locales['estimate.cost.description']
182
183
  }) : description, alert ? jsx(Alert, {
183
184
  sentiment: alertVariant,
185
+ title: alertTitle,
184
186
  children: alert
185
187
  }) : null, jsx(OverlayContextProvider, {
186
188
  value: providerValue,
@@ -215,15 +217,12 @@ const EstimateCostContent = _ref5 => {
215
217
  })]
216
218
  })
217
219
  }) : null, jsx("tbody", {
218
- children: Children.map(list, (child, index) =>
219
-
220
- /* @ts-expect-error I'm too dumb to understand this sorcery */
221
- cloneElement(child, {
220
+ children: Children.map(list, (child, index) => /*#__PURE__*/isValidElement(child) ? /*#__PURE__*/cloneElement(child, {
222
221
  isLastElement: index === list.length - 1,
223
222
  productsCallback,
224
223
  iteration,
225
224
  discount: discount && !child.props.discount ? discount : child.props.discount
226
- }))
225
+ }) : child)
227
226
  })]
228
227
  }) : null, !hideTotal ? jsxs(EmptyTable, {
229
228
  cellPadding: "0",
@@ -23,7 +23,7 @@ const OverlayContainer = /*#__PURE__*/_styled("div", {
23
23
  theme
24
24
  } = _ref2;
25
25
  return theme.colors.neutral.background;
26
- }, ";margin:0 0 0 200px;display:flex;justify-content:center;box-shadow:", _ref3 => {
26
+ }, ";margin:0 0 0 260px;display:flex;justify-content:center;box-shadow:", _ref3 => {
27
27
  let {
28
28
  inView,
29
29
  theme
@@ -81,7 +81,7 @@ const TotalPriceCell = /*#__PURE__*/_styled(Cell, {
81
81
  theme
82
82
  } = _ref8;
83
83
  return theme.colors.neutral.border;
84
- }, ";border-style:solid;border-width:0 1px 1px 1px;border-radius:0 0 4px 4px;min-width:195px;height:56px;background-color:", _ref9 => {
84
+ }, ";border-style:solid;border-width:0 1px 1px 1px;border-radius:0 0 4px 4px;min-width:202px;height:56px;background-color:", _ref9 => {
85
85
  let {
86
86
  theme
87
87
  } = _ref9;
@@ -123,11 +123,11 @@ const EmptyCell = /*#__PURE__*/_styled("td", {
123
123
  const TimeCell = /*#__PURE__*/_styled("div", {
124
124
  target: "e1xb5k8j5"
125
125
  })(process.env.NODE_ENV === "production" ? {
126
- name: "vvsuqs",
127
- styles: "max-width:220px;padding:16px;align-items:start;text-align:left;float:right"
126
+ name: "1dh7njz",
127
+ styles: "max-width:200px;padding:16px;align-items:start;text-align:left;float:right"
128
128
  } : {
129
- name: "vvsuqs",
130
- styles: "max-width:220px;padding:16px;align-items:start;text-align:left;float:right",
129
+ name: "1dh7njz",
130
+ styles: "max-width:200px;padding:16px;align-items:start;text-align:left;float:right",
131
131
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
132
132
  });
133
133
  const BadgeBeta = /*#__PURE__*/_styled(Badge, {
@@ -26,6 +26,6 @@ const maximumFractionDigitsLong = {
26
26
  days: 4,
27
27
  months: 2
28
28
  };
29
- const MAX_CELL_WIDTH = '537px';
29
+ const MAX_CELL_WIDTH = '530px';
30
30
 
31
31
  export { APPROXIMATE_HOURS_IN_MONTH, MAX_CELL_WIDTH, maximumFractionDigits, maximumFractionDigitsLong, multiplier };
package/dist/src/index.js CHANGED
@@ -2,3 +2,4 @@ export { ContentCard } from './components/ContentCard/index.js';
2
2
  export { ContentCardGroup } from './components/ContentCardGroup/index.js';
3
3
  export { CodeEditor } from './components/CodeEditor/CodeEditor.js';
4
4
  export { EstimateCost } from './components/EstimateCost/EstimateCost.js';
5
+ export { default as estimateCostDefaultLocales } from './components/EstimateCost/locales/en.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraviolet/plus",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Ultraviolet Plus",
5
5
  "homepage": "https://github.com/scaleway/ultraviolet#readme",
6
6
  "repository": {
@@ -56,7 +56,7 @@
56
56
  "react-flatten-children": "1.1.2",
57
57
  "react-intersection-observer": "9.5.3",
58
58
  "@ultraviolet/themes": "1.5.0",
59
- "@ultraviolet/ui": "1.27.1"
59
+ "@ultraviolet/ui": "1.27.2"
60
60
  },
61
61
  "scripts": {
62
62
  "build": "rollup -c ../../rollup.config.mjs"