@jobber/components 9.2.0 → 9.4.0

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 (91) hide show
  1. package/dist/ActivityIndicator/ActivityIndicator.d.ts +1 -1
  2. package/dist/ActivityIndicator/index.cjs +3 -0
  3. package/dist/ActivityIndicator/index.mjs +3 -0
  4. package/dist/ActivityIndicator-cjs.js +5 -1
  5. package/dist/ActivityIndicator-es.js +5 -1
  6. package/dist/Autocomplete/index.cjs +1 -0
  7. package/dist/Autocomplete/index.mjs +1 -0
  8. package/dist/Chips/InternalChipDismissible/index.cjs +1 -0
  9. package/dist/Chips/InternalChipDismissible/index.mjs +1 -0
  10. package/dist/Chips/index.cjs +1 -0
  11. package/dist/Chips/index.mjs +1 -0
  12. package/dist/DataDump/DataDump.d.ts +1 -1
  13. package/dist/DataDump/DataDump.messages.d.ts +6 -0
  14. package/dist/DataDump/index.cjs +2 -2
  15. package/dist/DataDump/index.mjs +2 -2
  16. package/dist/DataDump-cjs.js +11 -1
  17. package/dist/DataDump-es.js +11 -1
  18. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +3 -2
  19. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +3 -2
  20. package/dist/DataList/components/DataListFilters/index.cjs +3 -2
  21. package/dist/DataList/components/DataListFilters/index.mjs +3 -2
  22. package/dist/DataList/components/DataListLoadMore/index.cjs +3 -0
  23. package/dist/DataList/components/DataListLoadMore/index.mjs +3 -0
  24. package/dist/DataList/components/DataListSearch/index.cjs +1 -0
  25. package/dist/DataList/components/DataListSearch/index.mjs +1 -0
  26. package/dist/DataList/index.cjs +3 -2
  27. package/dist/DataList/index.mjs +3 -2
  28. package/dist/DataTable/DataTable.messages.d.ts +22 -0
  29. package/dist/DataTable/index.cjs +3 -2
  30. package/dist/DataTable/index.mjs +3 -2
  31. package/dist/DataTable-cjs.js +34 -5
  32. package/dist/DataTable-es.js +34 -5
  33. package/dist/FeatureSwitch/FeatureSwitch.messages.d.ts +10 -0
  34. package/dist/FeatureSwitch/index.cjs +2 -0
  35. package/dist/FeatureSwitch/index.mjs +2 -0
  36. package/dist/FeatureSwitch-cjs.js +15 -2
  37. package/dist/FeatureSwitch-es.js +15 -2
  38. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/index.cjs +3 -0
  39. package/dist/FilterPicker/components/FilterPickerContent/FilterPickerContentList/index.mjs +3 -0
  40. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +3 -0
  41. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +3 -0
  42. package/dist/FilterPicker/index.cjs +3 -2
  43. package/dist/FilterPicker/index.mjs +3 -2
  44. package/dist/FormatFile/FormatFile.messages.d.ts +18 -0
  45. package/dist/FormatFile/index.cjs +2 -2
  46. package/dist/FormatFile/index.mjs +2 -2
  47. package/dist/FormatFile-cjs.js +24 -2
  48. package/dist/FormatFile-es.js +24 -2
  49. package/dist/InputDate/index.cjs +1 -0
  50. package/dist/InputDate/index.mjs +1 -0
  51. package/dist/InputEmail/index.cjs +1 -0
  52. package/dist/InputEmail/index.mjs +1 -0
  53. package/dist/InputPhoneNumber/index.cjs +1 -0
  54. package/dist/InputPhoneNumber/index.mjs +1 -0
  55. package/dist/InputText/index.cjs +1 -0
  56. package/dist/InputText/index.mjs +1 -0
  57. package/dist/LegacySelect/index.cjs +1 -0
  58. package/dist/LegacySelect/index.mjs +1 -0
  59. package/dist/Menu/menuComposableShared.d.ts +1 -1
  60. package/dist/Menu-cjs.js +1 -0
  61. package/dist/Menu-es.js +1 -1
  62. package/dist/Page/index.cjs +12 -12
  63. package/dist/Page/index.mjs +12 -12
  64. package/dist/Page-cjs.js +6 -3
  65. package/dist/Page-es.js +6 -3
  66. package/dist/ProgressBar/ProgressBar.messages.d.ts +6 -0
  67. package/dist/ProgressBar/index.cjs +2 -0
  68. package/dist/ProgressBar/index.mjs +2 -0
  69. package/dist/ProgressBar-cjs.js +13 -1
  70. package/dist/ProgressBar-es.js +13 -1
  71. package/dist/Spinner/index.cjs +3 -0
  72. package/dist/Spinner/index.mjs +3 -0
  73. package/dist/Spinner-cjs.js +4 -1
  74. package/dist/Spinner-es.js +4 -1
  75. package/dist/Toast/Toast.messages.d.ts +6 -0
  76. package/dist/Toast/index.cjs +3 -1
  77. package/dist/Toast/index.mjs +3 -1
  78. package/dist/Toast/showToast.d.ts +12 -1
  79. package/dist/docs/ActivityIndicator/ActivityIndicator.md +1 -1
  80. package/dist/docs/DataDump/DataDump.md +1 -1
  81. package/dist/docs/Page/Page.md +1 -1
  82. package/dist/index.cjs +2 -2
  83. package/dist/index.mjs +2 -2
  84. package/dist/primitives/InputNumberExperimental/index.cjs +3 -0
  85. package/dist/primitives/InputNumberExperimental/index.mjs +3 -0
  86. package/dist/primitives/index.cjs +3 -0
  87. package/dist/primitives/index.mjs +3 -0
  88. package/dist/sharedHelpers/i18n/renderWithLocale.d.ts +11 -0
  89. package/dist/showToast-cjs.js +20 -6
  90. package/dist/showToast-es.js +20 -6
  91. package/package.json +2 -2
@@ -1,3 +1,5 @@
1
1
  export { P as ProgressBar } from '../ProgressBar-es.js';
2
2
  import 'react';
3
3
  import 'classnames';
4
+ import '../useAtlantisI18n-es.js';
5
+ import '../AtlantisContext-es.js';
@@ -2,14 +2,26 @@
2
2
 
3
3
  var React = require('react');
4
4
  var classnames = require('classnames');
5
+ var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
5
6
 
6
7
  var styles = {"ProgressBar":"p9AgTzIbTwY-","SteppedProgressBar":"w8NAw4ZMB6g-","wrapper":"d4oS-DGtcKA-","spinning":"f58JiDXlkHA-"};
7
8
 
8
9
  var sizes = {"smaller":"dylWWgubHwM-","small":"z92YJQrscvI-","base":"DKfNM1to61A-","spinning":"GHfs7cB4nQQ-"};
9
10
 
11
+ const progressBarMessages = useAtlantisI18n.defineMessages({
12
+ steppedProgress: {
13
+ en: "progress, {current} out of {total}",
14
+ es: "progreso, {current} de {total}",
15
+ },
16
+ });
17
+
10
18
  function ProgressBarStepped({ currentStep, totalSteps, percentage, size = "base", UNSAFE_className, UNSAFE_style, }) {
19
+ const { t } = useAtlantisI18n.useAtlantisI18n(progressBarMessages);
11
20
  const steppedProgressBarClassName = classnames(styles.ProgressBar, styles.SteppedProgressBar, sizes[size]);
12
- const ariaLabel = `progress, ${currentStep} out of ${totalSteps}`;
21
+ const ariaLabel = t("steppedProgress", {
22
+ current: currentStep,
23
+ total: totalSteps,
24
+ });
13
25
  return (React.createElement("div", { role: "progressbar", className: classnames(styles.wrapper, UNSAFE_className), "data-testid": "progressbar-wrapper", style: UNSAFE_style, "aria-valuenow": percentage, "aria-valuetext": ariaLabel }, Array.from({ length: totalSteps }).map((_, index) => {
14
26
  const step = index + 1;
15
27
  const value = step <= currentStep ? 100 : 0;
@@ -1,13 +1,25 @@
1
1
  import React__default from 'react';
2
2
  import classnames from 'classnames';
3
+ import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
3
4
 
4
5
  var styles = {"ProgressBar":"p9AgTzIbTwY-","SteppedProgressBar":"w8NAw4ZMB6g-","wrapper":"d4oS-DGtcKA-","spinning":"f58JiDXlkHA-"};
5
6
 
6
7
  var sizes = {"smaller":"dylWWgubHwM-","small":"z92YJQrscvI-","base":"DKfNM1to61A-","spinning":"GHfs7cB4nQQ-"};
7
8
 
9
+ const progressBarMessages = defineMessages({
10
+ steppedProgress: {
11
+ en: "progress, {current} out of {total}",
12
+ es: "progreso, {current} de {total}",
13
+ },
14
+ });
15
+
8
16
  function ProgressBarStepped({ currentStep, totalSteps, percentage, size = "base", UNSAFE_className, UNSAFE_style, }) {
17
+ const { t } = useAtlantisI18n(progressBarMessages);
9
18
  const steppedProgressBarClassName = classnames(styles.ProgressBar, styles.SteppedProgressBar, sizes[size]);
10
- const ariaLabel = `progress, ${currentStep} out of ${totalSteps}`;
19
+ const ariaLabel = t("steppedProgress", {
20
+ current: currentStep,
21
+ total: totalSteps,
22
+ });
11
23
  return (React__default.createElement("div", { role: "progressbar", className: classnames(styles.wrapper, UNSAFE_className), "data-testid": "progressbar-wrapper", style: UNSAFE_style, "aria-valuenow": percentage, "aria-valuetext": ariaLabel }, Array.from({ length: totalSteps }).map((_, index) => {
12
24
  const step = index + 1;
13
25
  const value = step <= currentStep ? 100 : 0;
@@ -3,6 +3,9 @@
3
3
  var Spinner = require('../Spinner-cjs.js');
4
4
  require('react');
5
5
  require('classnames');
6
+ require('../common.messages-cjs.js');
7
+ require('../useAtlantisI18n-cjs.js');
8
+ require('../AtlantisContext-cjs.js');
6
9
 
7
10
 
8
11
 
@@ -1,3 +1,6 @@
1
1
  export { S as Spinner } from '../Spinner-es.js';
2
2
  import 'react';
3
3
  import 'classnames';
4
+ import '../common.messages-es.js';
5
+ import '../useAtlantisI18n-es.js';
6
+ import '../AtlantisContext-es.js';
@@ -2,6 +2,8 @@
2
2
 
3
3
  var React = require('react');
4
4
  var classnames = require('classnames');
5
+ var common_messages = require('./common.messages-cjs.js');
6
+ var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
5
7
 
6
8
  var styles = {"spinner":"_6hfmGZoXNyg-","animationSpin":"aT3CETCJ4hQ-","small":"bMfynkzmlL4-","inline":"NA68eWblbLo-","spinning":"aCBq1WrkI4M-"};
7
9
 
@@ -9,11 +11,12 @@ var styles = {"spinner":"_6hfmGZoXNyg-","animationSpin":"aT3CETCJ4hQ-","small":"
9
11
  * @deprecated Use `ActivityIndicator` instead.
10
12
  */
11
13
  function Spinner({ size = "base", inline }) {
14
+ const { t } = useAtlantisI18n.useAtlantisI18n(common_messages.commonMessages);
12
15
  const spinnerStyles = classnames(styles.spinner, {
13
16
  [styles.small]: size === "small",
14
17
  [styles.inline]: inline,
15
18
  });
16
- return (React.createElement("div", { className: spinnerStyles, role: "alert", "aria-busy": true, "aria-label": "loading" }));
19
+ return (React.createElement("div", { className: spinnerStyles, role: "alert", "aria-busy": true, "aria-label": t("Loading") }));
17
20
  }
18
21
 
19
22
  exports.Spinner = Spinner;
@@ -1,5 +1,7 @@
1
1
  import React__default from 'react';
2
2
  import classnames from 'classnames';
3
+ import { c as commonMessages } from './common.messages-es.js';
4
+ import { u as useAtlantisI18n } from './useAtlantisI18n-es.js';
3
5
 
4
6
  var styles = {"spinner":"_6hfmGZoXNyg-","animationSpin":"aT3CETCJ4hQ-","small":"bMfynkzmlL4-","inline":"NA68eWblbLo-","spinning":"aCBq1WrkI4M-"};
5
7
 
@@ -7,11 +9,12 @@ var styles = {"spinner":"_6hfmGZoXNyg-","animationSpin":"aT3CETCJ4hQ-","small":"
7
9
  * @deprecated Use `ActivityIndicator` instead.
8
10
  */
9
11
  function Spinner({ size = "base", inline }) {
12
+ const { t } = useAtlantisI18n(commonMessages);
10
13
  const spinnerStyles = classnames(styles.spinner, {
11
14
  [styles.small]: size === "small",
12
15
  [styles.inline]: inline,
13
16
  });
14
- return (React__default.createElement("div", { className: spinnerStyles, role: "alert", "aria-busy": true, "aria-label": "loading" }));
17
+ return (React__default.createElement("div", { className: spinnerStyles, role: "alert", "aria-busy": true, "aria-label": t("Loading") }));
15
18
  }
16
19
 
17
20
  export { Spinner as S };
@@ -0,0 +1,6 @@
1
+ export declare const toastMessages: {
2
+ hideNotification: {
3
+ en: string;
4
+ es: string;
5
+ };
6
+ };
@@ -1,13 +1,15 @@
1
1
  'use strict';
2
2
 
3
3
  var showToast = require('../showToast-cjs.js');
4
+ require('../tslib.es6-cjs.js');
4
5
  require('react');
5
6
  require('react-dom/client');
6
7
  require('framer-motion');
8
+ require('../useAtlantisI18n-cjs.js');
9
+ require('../AtlantisContext-cjs.js');
7
10
  require('../Icon-cjs.js');
8
11
  require('@jobber/design');
9
12
  require('../Button-cjs.js');
10
- require('../tslib.es6-cjs.js');
11
13
  require('react-router-dom');
12
14
  require('classnames');
13
15
  require('../Typography-cjs.js');
@@ -1,11 +1,13 @@
1
1
  export { T as Toast, s as showToast } from '../showToast-es.js';
2
+ import '../tslib.es6-es.js';
2
3
  import 'react';
3
4
  import 'react-dom/client';
4
5
  import 'framer-motion';
6
+ import '../useAtlantisI18n-es.js';
7
+ import '../AtlantisContext-es.js';
5
8
  import '../Icon-es.js';
6
9
  import '@jobber/design';
7
10
  import '../Button-es.js';
8
- import '../tslib.es6-es.js';
9
11
  import 'react-router-dom';
10
12
  import 'classnames';
11
13
  import '../Typography-es.js';
@@ -1,2 +1,13 @@
1
1
  import type { ToastProps } from "./Toast";
2
- export declare function showToast(props: ToastProps): void;
2
+ interface ShowToastOptions {
3
+ /**
4
+ * The locale to use for translated strings inside the toast (e.g. the
5
+ * dismiss button aria-label). Defaults to `"en"`.
6
+ *
7
+ * Pass the same locale you provide to `AtlantisContext.Provider` in your
8
+ * app so that toast strings stay consistent with the rest of the UI.
9
+ */
10
+ readonly locale?: string;
11
+ }
12
+ export declare function showToast(props: ToastProps, options?: ShowToastOptions): void;
13
+ export {};
@@ -110,7 +110,7 @@ component from React Native.
110
110
 
111
111
  | Prop | Type | Required | Default | Description |
112
112
  |------|------|----------|---------|-------------|
113
- | `ariaLabel` | `string` | No | `Loading` | Accessible label exposed via `aria-label` on the root element. Override to localize or to describe the specific activ... |
113
+ | `ariaLabel` | `string` | No | `"Loading"` | Accessible label exposed via `aria-label` on the root element. Override to localize or to describe the specific activ... |
114
114
  | `className` | `string` | No | — | Custom class name merged onto the root element alongside the component's own classes. |
115
115
  | `size` | `"base" | "small"` | No | `base` | Visual size. `base` renders at 32px, `small` renders at 16px. |
116
116
  | `style` | `CSSProperties` | No | — | Custom inline styles applied to the root element. |
@@ -17,4 +17,4 @@ users.
17
17
  |------|------|----------|---------|-------------|
18
18
  | `data` | `unknown` | Yes | — | Data to display. |
19
19
  | `defaultOpen` | `boolean` | No | `false` | Should the `DataDump` default to open? |
20
- | `label` | `string` | No | `Raw Data` | Label for the DataDump |
20
+ | `label` | `string` | No | `"Raw Data"` | Label for the DataDump |
@@ -337,7 +337,7 @@ composable actions, this is the simplest way to use Page:
337
337
 
338
338
  | Prop | Type | Required | Default | Description |
339
339
  |------|------|----------|---------|-------------|
340
- | `triggerLabel` | `string` | No | `More Actions` | |
340
+ | `triggerLabel` | `string` | No | | |
341
341
 
342
342
  #### Page.PrimaryButton
343
343
 
package/dist/index.cjs CHANGED
@@ -91,6 +91,8 @@ var Tooltip = require('./Tooltip-cjs.js');
91
91
  var Typography = require('./Typography-cjs.js');
92
92
  var design = require('@jobber/design');
93
93
  require('classnames');
94
+ require('./common.messages-cjs.js');
95
+ require('./useAtlantisI18n-cjs.js');
94
96
  require('./_commonjsHelpers-cjs.js');
95
97
  require('./identity-cjs.js');
96
98
  require('./isTypedArray-cjs.js');
@@ -107,7 +109,6 @@ require('react/jsx-runtime');
107
109
  require('react-dom');
108
110
  require('./floating-ui.react-dom-cjs.js');
109
111
  require('./maxHeight-cjs.js');
110
- require('./useAtlantisI18n-cjs.js');
111
112
  require('./mergeRefs-cjs.js');
112
113
  require('./filterDataAttributes-cjs.js');
113
114
  require('color');
@@ -135,7 +136,6 @@ require('./FilterPickerAction-cjs.js');
135
136
  require('./FilterPickerTrigger-cjs.js');
136
137
  require('./noop-cjs.js');
137
138
  require('./FilterPickerActivator-cjs.js');
138
- require('./common.messages-cjs.js');
139
139
  require('./index-cjs.js');
140
140
  require('./DataList.module-cjs.js');
141
141
  require('./DataListTotalCount-cjs.js');
package/dist/index.mjs CHANGED
@@ -89,6 +89,8 @@ export { T as Tooltip } from './Tooltip-es.js';
89
89
  export { T as Typography } from './Typography-es.js';
90
90
  export { iconNames, isIconName } from '@jobber/design';
91
91
  import 'classnames';
92
+ import './common.messages-es.js';
93
+ import './useAtlantisI18n-es.js';
92
94
  import './_commonjsHelpers-es.js';
93
95
  import './identity-es.js';
94
96
  import './isTypedArray-es.js';
@@ -105,7 +107,6 @@ import 'react/jsx-runtime';
105
107
  import 'react-dom';
106
108
  import './floating-ui.react-dom-es.js';
107
109
  import './maxHeight-es.js';
108
- import './useAtlantisI18n-es.js';
109
110
  import './mergeRefs-es.js';
110
111
  import './filterDataAttributes-es.js';
111
112
  import 'color';
@@ -133,7 +134,6 @@ import './FilterPickerAction-es.js';
133
134
  import './FilterPickerTrigger-es.js';
134
135
  import './noop-es.js';
135
136
  import './FilterPickerActivator-es.js';
136
- import './common.messages-es.js';
137
137
  import './index-es.js';
138
138
  import './DataList.module-es.js';
139
139
  import './DataListTotalCount-es.js';
@@ -5,6 +5,9 @@ require('../../tslib.es6-cjs.js');
5
5
  require('react');
6
6
  require('classnames');
7
7
  require('../../ActivityIndicator-cjs.js');
8
+ require('../../common.messages-cjs.js');
9
+ require('../../useAtlantisI18n-cjs.js');
10
+ require('../../AtlantisContext-cjs.js');
8
11
  require('../../Button-cjs.js');
9
12
  require('react-router-dom');
10
13
  require('../../Icon-cjs.js');
@@ -3,6 +3,9 @@ import '../../tslib.es6-es.js';
3
3
  import 'react';
4
4
  import 'classnames';
5
5
  import '../../ActivityIndicator-es.js';
6
+ import '../../common.messages-es.js';
7
+ import '../../useAtlantisI18n-es.js';
8
+ import '../../AtlantisContext-es.js';
6
9
  import '../../Button-es.js';
7
10
  import 'react-router-dom';
8
11
  import '../../Icon-es.js';
@@ -35,6 +35,9 @@ require('../resolveAriaLabelledBy-cjs.js');
35
35
  require('../stringifyLocale-cjs.js');
36
36
  require('../useLabel-cjs.js');
37
37
  require('../ActivityIndicator-cjs.js');
38
+ require('../common.messages-cjs.js');
39
+ require('../useAtlantisI18n-cjs.js');
40
+ require('../AtlantisContext-cjs.js');
38
41
  require('../FieldDescription-cjs.js');
39
42
  require('../NumberFieldInput-cjs.js');
40
43
  require('../SelectGroupLabel-cjs.js');
@@ -33,6 +33,9 @@ import '../resolveAriaLabelledBy-es.js';
33
33
  import '../stringifyLocale-es.js';
34
34
  import '../useLabel-es.js';
35
35
  import '../ActivityIndicator-es.js';
36
+ import '../common.messages-es.js';
37
+ import '../useAtlantisI18n-es.js';
38
+ import '../AtlantisContext-es.js';
36
39
  import '../FieldDescription-es.js';
37
40
  import '../NumberFieldInput-es.js';
38
41
  import '../SelectGroupLabel-es.js';
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import type { RenderResult } from "@testing-library/react";
3
+ /**
4
+ * Test utility that renders a component wrapped in `AtlantisContext.Provider`
5
+ * with the given locale. Use this in i18n tests instead of manually wrapping
6
+ * in the provider.
7
+ *
8
+ * @example
9
+ * renderWithLocale(<MyComponent />, "es");
10
+ */
11
+ export declare function renderWithLocale(ui: React.ReactElement, locale: string): RenderResult;
@@ -1,17 +1,28 @@
1
1
  'use strict';
2
2
 
3
+ var tslib_es6 = require('./tslib.es6-cjs.js');
3
4
  var React = require('react');
4
5
  var client = require('react-dom/client');
5
6
  var framerMotion = require('framer-motion');
7
+ var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
6
8
  var Icon = require('./Icon-cjs.js');
7
9
  var Button = require('./Button-cjs.js');
8
10
  require('classnames');
9
11
  var Typography = require('./Typography-cjs.js');
12
+ var AtlantisContext = require('./AtlantisContext-cjs.js');
10
13
 
11
14
  var styles = {"wrapper":"_0Tvq24WjeX8-","container":"GznHKPkdb1s-","toast":"W8zgWZqmIlk-","slice":"ol3srk7PviM-","button":"ibhpdUt9YLo-","spinning":"_5Wy5Wra20Vk-"};
12
15
 
16
+ const toastMessages = useAtlantisI18n.defineMessages({
17
+ hideNotification: {
18
+ en: "Hide Notification",
19
+ es: "Ocultar notificación",
20
+ },
21
+ });
22
+
13
23
  function Toast({ message, variation = "success", action, actionLabel, }) {
14
24
  const [visible, setVisible] = React.useState(true);
25
+ const { t } = useAtlantisI18n.useAtlantisI18n(toastMessages);
15
26
  const icon = getIcon();
16
27
  let timer;
17
28
  React.useEffect(() => startTimer(), []);
@@ -26,7 +37,7 @@ function Toast({ message, variation = "success", action, actionLabel, }) {
26
37
  React.createElement(Typography.Typography, { element: "span", size: "large" }, message),
27
38
  action && (React.createElement(Button.Button, { label: `${actionLabel}`, onClick: action, type: "tertiary" })),
28
39
  React.createElement("div", { className: styles.button },
29
- React.createElement(Button.Button, { icon: "cross", ariaLabel: "Hide Notification", onClick: handleToastClose, type: "tertiary", variation: "subtle" })))))));
40
+ React.createElement(Button.Button, { icon: "cross", ariaLabel: t("hideNotification"), onClick: handleToastClose, type: "tertiary", variation: "subtle" })))))));
30
41
  function startTimer() {
31
42
  timer = setTimeout(() => handleToastClose(), getTimeout());
32
43
  }
@@ -62,7 +73,8 @@ function Toast({ message, variation = "success", action, actionLabel, }) {
62
73
 
63
74
  const targetId = "atlantis-toast-element";
64
75
  let root;
65
- function showToast(props) {
76
+ function showToast(props, options = {}) {
77
+ const { locale = "en" } = options;
66
78
  // Ensure target and body is still there when rendering the toast. This is due
67
79
  // to an issue with ReactDOM createRoot assuming document is always there and
68
80
  // Jest taking the document down.
@@ -79,14 +91,16 @@ function showToast(props) {
79
91
  root = client.createRoot(target);
80
92
  }
81
93
  if (root && target && globalThis.document.body.contains(target)) {
82
- root.render(React.createElement(ToasterOven, Object.assign({}, props)));
94
+ root.render(React.createElement(ToasterOven, Object.assign({ locale: locale }, props)));
83
95
  }
84
96
  }
85
97
  const ToastContainer = React.forwardRef(ToastInternal);
86
- function ToasterOven(props) {
98
+ function ToasterOven(_a) {
99
+ var { locale } = _a, toastProps = tslib_es6.__rest(_a, ["locale"]);
87
100
  const toastRef = React.useRef(null);
88
- React.useEffect(() => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.add(props); });
89
- return React.createElement(ToastContainer, { ref: toastRef });
101
+ React.useEffect(() => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.add(toastProps); });
102
+ return (React.createElement(AtlantisContext.AtlantisContext.Provider, { value: Object.assign(Object.assign({}, AtlantisContext.atlantisContextDefaultValues), { locale }) },
103
+ React.createElement(ToastContainer, { ref: toastRef })));
90
104
  }
91
105
  function ToastInternal(_, ref) {
92
106
  const [toastKey, setToastKey] = React.useState(0);
@@ -1,15 +1,26 @@
1
+ import { _ as __rest } from './tslib.es6-es.js';
1
2
  import React__default, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react';
2
3
  import { createRoot } from 'react-dom/client';
3
4
  import { AnimatePresence, motion } from 'framer-motion';
5
+ import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
4
6
  import { I as Icon } from './Icon-es.js';
5
7
  import { B as Button } from './Button-es.js';
6
8
  import 'classnames';
7
9
  import { T as Typography } from './Typography-es.js';
10
+ import { A as AtlantisContext, a as atlantisContextDefaultValues } from './AtlantisContext-es.js';
8
11
 
9
12
  var styles = {"wrapper":"_0Tvq24WjeX8-","container":"GznHKPkdb1s-","toast":"W8zgWZqmIlk-","slice":"ol3srk7PviM-","button":"ibhpdUt9YLo-","spinning":"_5Wy5Wra20Vk-"};
10
13
 
14
+ const toastMessages = defineMessages({
15
+ hideNotification: {
16
+ en: "Hide Notification",
17
+ es: "Ocultar notificación",
18
+ },
19
+ });
20
+
11
21
  function Toast({ message, variation = "success", action, actionLabel, }) {
12
22
  const [visible, setVisible] = useState(true);
23
+ const { t } = useAtlantisI18n(toastMessages);
13
24
  const icon = getIcon();
14
25
  let timer;
15
26
  useEffect(() => startTimer(), []);
@@ -24,7 +35,7 @@ function Toast({ message, variation = "success", action, actionLabel, }) {
24
35
  React__default.createElement(Typography, { element: "span", size: "large" }, message),
25
36
  action && (React__default.createElement(Button, { label: `${actionLabel}`, onClick: action, type: "tertiary" })),
26
37
  React__default.createElement("div", { className: styles.button },
27
- React__default.createElement(Button, { icon: "cross", ariaLabel: "Hide Notification", onClick: handleToastClose, type: "tertiary", variation: "subtle" })))))));
38
+ React__default.createElement(Button, { icon: "cross", ariaLabel: t("hideNotification"), onClick: handleToastClose, type: "tertiary", variation: "subtle" })))))));
28
39
  function startTimer() {
29
40
  timer = setTimeout(() => handleToastClose(), getTimeout());
30
41
  }
@@ -60,7 +71,8 @@ function Toast({ message, variation = "success", action, actionLabel, }) {
60
71
 
61
72
  const targetId = "atlantis-toast-element";
62
73
  let root;
63
- function showToast(props) {
74
+ function showToast(props, options = {}) {
75
+ const { locale = "en" } = options;
64
76
  // Ensure target and body is still there when rendering the toast. This is due
65
77
  // to an issue with ReactDOM createRoot assuming document is always there and
66
78
  // Jest taking the document down.
@@ -77,14 +89,16 @@ function showToast(props) {
77
89
  root = createRoot(target);
78
90
  }
79
91
  if (root && target && globalThis.document.body.contains(target)) {
80
- root.render(React__default.createElement(ToasterOven, Object.assign({}, props)));
92
+ root.render(React__default.createElement(ToasterOven, Object.assign({ locale: locale }, props)));
81
93
  }
82
94
  }
83
95
  const ToastContainer = forwardRef(ToastInternal);
84
- function ToasterOven(props) {
96
+ function ToasterOven(_a) {
97
+ var { locale } = _a, toastProps = __rest(_a, ["locale"]);
85
98
  const toastRef = useRef(null);
86
- useEffect(() => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.add(props); });
87
- return React__default.createElement(ToastContainer, { ref: toastRef });
99
+ useEffect(() => { var _a; return (_a = toastRef.current) === null || _a === void 0 ? void 0 : _a.add(toastProps); });
100
+ return (React__default.createElement(AtlantisContext.Provider, { value: Object.assign(Object.assign({}, atlantisContextDefaultValues), { locale }) },
101
+ React__default.createElement(ToastContainer, { ref: toastRef })));
88
102
  }
89
103
  function ToastInternal(_, ref) {
90
104
  const [toastKey, setToastKey] = useState(0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "9.2.0",
3
+ "version": "9.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -545,5 +545,5 @@
545
545
  "> 1%",
546
546
  "IE 10"
547
547
  ],
548
- "gitHead": "93071542338ffaca3cd81bf6701a1ac8319e5341"
548
+ "gitHead": "bd5837d81e26f7413b9377c415bc6e03ca199580"
549
549
  }