@techsio/ui-kit 0.59.2 → 0.60.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.
- package/README.md +35 -1
- package/dist/atoms/label.js +3 -2
- package/dist/atoms/numeric-input.js +12 -4
- package/dist/atoms/rating.js +21 -9
- package/dist/atoms/skeleton.js +9 -3
- package/dist/atoms/tooltip.js +2 -1
- package/dist/internal/popover-template-content.js +13 -0
- package/dist/internal/required-label-text.js +12 -0
- package/dist/messages/ui-messages-provider.js +47 -0
- package/dist/messages/ui-messages.js +273 -0
- package/dist/molecules/carousel.js +11 -4
- package/dist/molecules/cascade-select.js +10 -6
- package/dist/molecules/chart.js +12 -8
- package/dist/molecules/color-select.js +9 -6
- package/dist/molecules/combobox.js +22 -16
- package/dist/molecules/date-picker.js +46 -31
- package/dist/molecules/dialog.js +5 -3
- package/dist/molecules/drawer.js +3 -1
- package/dist/molecules/file-upload.js +19 -8
- package/dist/molecules/form-error-summary.js +4 -2
- package/dist/molecules/menu.js +4 -2
- package/dist/molecules/pagination.js +12 -3
- package/dist/molecules/phone-input.js +24 -7
- package/dist/molecules/popover.js +9 -1
- package/dist/molecules/search-form.js +9 -5
- package/dist/molecules/select.js +16 -6
- package/dist/molecules/steps.js +6 -3
- package/dist/molecules/tabs.js +3 -0
- package/dist/molecules/toast.js +5 -3
- package/dist/molecules/tour.js +10 -2
- package/dist/molecules/tree-view.js +9 -1
- package/dist/organisms/data-table.fields.js +82 -65
- package/dist/organisms/data-table.js +90 -74
- package/dist/organisms/gallery.js +6 -5
- package/dist/organisms/header.js +4 -2
- package/dist/src/atoms/label.d.ts +2 -2
- package/dist/src/atoms/label.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +1 -1
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +1 -1
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +1 -1
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/internal/popover-template-content.d.ts +11 -0
- package/dist/src/internal/popover-template-content.d.ts.map +1 -0
- package/dist/src/internal/required-label-text.d.ts +3 -0
- package/dist/src/internal/required-label-text.d.ts.map +1 -0
- package/dist/src/messages/ui-messages-provider.d.ts +18 -0
- package/dist/src/messages/ui-messages-provider.d.ts.map +1 -0
- package/dist/src/messages/ui-messages.d.ts +331 -0
- package/dist/src/messages/ui-messages.d.ts.map +1 -0
- package/dist/src/molecules/carousel.d.ts +1 -1
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +2 -2
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/chart.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +1 -1
- package/dist/src/molecules/color-select.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +2 -2
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/date-picker.d.ts +11 -8
- package/dist/src/molecules/date-picker.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +1 -1
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/drawer.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +1 -1
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-error-summary.d.ts +1 -1
- package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +1 -1
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +1 -1
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +1 -1
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/popover.d.ts +1 -1
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +1 -1
- package/dist/src/molecules/search-form.d.ts +1 -1
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +1 -1
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/toast.d.ts +4 -4
- package/dist/src/molecules/toast.d.ts.map +1 -1
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/molecules/tour.d.ts.map +1 -1
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/organisms/data-table.d.ts +4 -48
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/data-table.fields.d.ts +6 -1
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +2 -2
- package/dist/src/organisms/gallery.d.ts.map +1 -1
- package/dist/src/organisms/header.d.ts +1 -1
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/templates/carousel.d.ts +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/templates/popover.d.ts +1 -1
- package/dist/src/templates/popover.d.ts.map +1 -1
- package/dist/src/templates/product-card.d.ts +1 -1
- package/dist/src/templates/product-card.d.ts.map +1 -1
- package/dist/src/templates/select.d.ts +1 -1
- package/dist/src/templates/tabs.d.ts +1 -1
- package/dist/src/theme/theme-toggle.d.ts.map +1 -1
- package/dist/templates/facet-filter-panel.js +16 -11
- package/dist/templates/popover.js +5 -4
- package/dist/templates/product-card.js +12 -8
- package/dist/theme/theme-toggle.js +10 -8
- package/package.json +5 -1
- package/src/tokens/components/atoms/_tooltip.css +13 -0
|
@@ -12,6 +12,8 @@ import { StatusText } from "../atoms/status-text.js";
|
|
|
12
12
|
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
13
13
|
import { subscribeOwnerFormReset } from "../internal/form-control-lifecycle.js";
|
|
14
14
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
15
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
16
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
15
17
|
import { tv } from "../utils.js";
|
|
16
18
|
const fileUploadStyles = tv({
|
|
17
19
|
slots: {
|
|
@@ -93,6 +95,7 @@ function useFileUploadItemContext() {
|
|
|
93
95
|
return context;
|
|
94
96
|
}
|
|
95
97
|
function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, className, defaultAcceptedFiles, dir = "ltr", directory, disabled: explicitDisabled, getRootNode, id, ids, invalid, locale, maxFileSize, maxFiles, minFileSize, name, onFileAccept, onFileChange, onFileReject, preventDocumentDrop, readOnly, ref, required, size = "md", transformFiles, translations, validate, ...props }) {
|
|
98
|
+
const messages = useUiMessages();
|
|
96
99
|
const generatedId = useId();
|
|
97
100
|
const probeRef = useRef(null);
|
|
98
101
|
const [disabledElement, setDisabledElement] = useState(null);
|
|
@@ -128,6 +131,7 @@ function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, class
|
|
|
128
131
|
interaction.current.epoch += 1;
|
|
129
132
|
interaction.current.pending.clear();
|
|
130
133
|
}, []);
|
|
134
|
+
const processingFailed = messages.fileUpload.processingFailed;
|
|
131
135
|
const coordinatedMachine = useMemo(()=>{
|
|
132
136
|
const actions = machine.implementations?.actions;
|
|
133
137
|
if (!(actions?.setEventFiles && actions.clearFiles)) throw new Error("FileUpload machine actions unavailable");
|
|
@@ -240,7 +244,7 @@ function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, class
|
|
|
240
244
|
prop: withoutTransform
|
|
241
245
|
});
|
|
242
246
|
}).catch(()=>{
|
|
243
|
-
if (fresh()) setProcessingError(
|
|
247
|
+
if (fresh()) setProcessingError(processingFailed);
|
|
244
248
|
}).finally(()=>{
|
|
245
249
|
interaction.current.pending.delete(token);
|
|
246
250
|
context.set("transforming", interaction.current.pending.size > 0);
|
|
@@ -249,7 +253,9 @@ function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, class
|
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
};
|
|
252
|
-
}, [
|
|
256
|
+
}, [
|
|
257
|
+
processingFailed
|
|
258
|
+
]);
|
|
253
259
|
const service = useMachine(coordinatedMachine, {
|
|
254
260
|
accept,
|
|
255
261
|
acceptedFiles,
|
|
@@ -289,7 +295,10 @@ function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, class
|
|
|
289
295
|
readOnly,
|
|
290
296
|
required,
|
|
291
297
|
transformFiles,
|
|
292
|
-
translations
|
|
298
|
+
translations: {
|
|
299
|
+
...messages.fileUpload.translations,
|
|
300
|
+
...definedEntries(translations)
|
|
301
|
+
},
|
|
293
302
|
validate
|
|
294
303
|
});
|
|
295
304
|
useLayoutEffect(()=>{
|
|
@@ -343,7 +352,7 @@ function FileUpload({ accept, acceptedFiles, allowDrop, capture, children, class
|
|
|
343
352
|
ref: ref,
|
|
344
353
|
tabIndex: readOnly && !disabled ? 0 : -1,
|
|
345
354
|
...rootProps,
|
|
346
|
-
"aria-description": readOnly ?
|
|
355
|
+
"aria-description": readOnly ? messages.fileUpload.readOnly : void 0,
|
|
347
356
|
"aria-disabled": disabled || void 0,
|
|
348
357
|
children: [
|
|
349
358
|
/*#__PURE__*/ jsx("input", {
|
|
@@ -384,11 +393,12 @@ FileUpload.Dropzone = function({ "aria-label": ariaLabel, "aria-labelledby": ari
|
|
|
384
393
|
const { onClick: onMachineClick, onKeyDown: onMachineKeyDown, ...machineDropzoneProps } = api.getDropzoneProps({
|
|
385
394
|
disableClick
|
|
386
395
|
});
|
|
396
|
+
const messages = useUiMessages();
|
|
387
397
|
const dropzoneProps = mergeProps(props, machineDropzoneProps, {
|
|
388
398
|
role: disableClick || api.readOnly ? "group" : "button",
|
|
389
399
|
tabIndex: api.disabled ? void 0 : 0,
|
|
390
400
|
"aria-disabled": api.disabled || void 0,
|
|
391
|
-
"aria-description": api.readOnly ?
|
|
401
|
+
"aria-description": api.readOnly ? messages.fileUpload.readOnly : void 0,
|
|
392
402
|
"aria-describedby": joinDescribedBy(props["aria-describedby"], descriptions.describedById),
|
|
393
403
|
"aria-invalid": invalid || Boolean(errorDescriptions.describedById) || void 0,
|
|
394
404
|
"aria-errormessage": invalid || errorDescriptions.describedById ? errorDescriptions.describedById : void 0,
|
|
@@ -656,17 +666,18 @@ FileUpload.ItemDeleteTrigger = function({ className, disabled, icon = "token-ico
|
|
|
656
666
|
tone: "neutral",
|
|
657
667
|
type: "button",
|
|
658
668
|
...deleteProps,
|
|
659
|
-
"aria-label": deleteProps["aria-label"] ??
|
|
669
|
+
"aria-label": deleteProps["aria-label"] ?? ""
|
|
660
670
|
});
|
|
661
671
|
};
|
|
662
|
-
FileUpload.ClearTrigger = function({ "aria-label": ariaLabel
|
|
672
|
+
FileUpload.ClearTrigger = function({ "aria-label": ariaLabel, className, disabled, icon = "token-icon-file-upload-clear", onClick, ref, ...props }) {
|
|
663
673
|
const { api, styles, size } = useFileUploadContext();
|
|
674
|
+
const messages = useUiMessages();
|
|
664
675
|
const { disabled: machineDisabled, onClick: onMachineClick, ...machineClearProps } = api.getClearTriggerProps();
|
|
665
676
|
const clearProps = mergeProps(props, machineClearProps);
|
|
666
677
|
const isDisabled = Boolean(disabled || machineDisabled);
|
|
667
678
|
if (api.readOnly) return null;
|
|
668
679
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
669
|
-
"aria-label": ariaLabel,
|
|
680
|
+
"aria-label": ariaLabel ?? messages.fileUpload.clear,
|
|
670
681
|
className: styles.clearTrigger({
|
|
671
682
|
className
|
|
672
683
|
}),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
4
5
|
import { tv } from "../utils.js";
|
|
5
6
|
const formErrorSummaryVariants = tv({
|
|
6
7
|
slots: {
|
|
@@ -30,7 +31,8 @@ const formErrorSummaryVariants = tv({
|
|
|
30
31
|
]
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
function FormErrorSummary({ title
|
|
34
|
+
function FormErrorSummary({ title, errors, onFieldFocus, revealField, className, ref }) {
|
|
35
|
+
const messages = useUiMessages();
|
|
34
36
|
const titleId = useId();
|
|
35
37
|
if (0 === errors.length) return null;
|
|
36
38
|
const styles = formErrorSummaryVariants();
|
|
@@ -46,7 +48,7 @@ function FormErrorSummary({ title = "There is a problem", errors, onFieldFocus,
|
|
|
46
48
|
/*#__PURE__*/ jsx("h2", {
|
|
47
49
|
className: styles.title(),
|
|
48
50
|
id: titleId,
|
|
49
|
-
children: title
|
|
51
|
+
children: title ?? messages.formErrorSummary.title
|
|
50
52
|
}),
|
|
51
53
|
/*#__PURE__*/ jsx("ul", {
|
|
52
54
|
className: styles.list(),
|
package/dist/molecules/menu.js
CHANGED
|
@@ -6,6 +6,7 @@ import { tv } from "tailwind-variants";
|
|
|
6
6
|
import { Button } from "../atoms/button.js";
|
|
7
7
|
import { Icon } from "../atoms/icon.js";
|
|
8
8
|
import { OverlayPortal } from "../internal/overlay-portal.js";
|
|
9
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
9
10
|
import * as __rspack_external__zag_js_menu_d3b38dd2 from "@zag-js/menu";
|
|
10
11
|
const menuVariants = tv({
|
|
11
12
|
slots: {
|
|
@@ -263,8 +264,9 @@ function SubmenuItem({ item, parentApi, parentService, size = "md", onCheckedCha
|
|
|
263
264
|
]
|
|
264
265
|
});
|
|
265
266
|
}
|
|
266
|
-
function Menu({ "aria-label": ariaLabel, dir, id, closeOnSelect = true, loopFocus = true, typeahead = true, positioning, anchorPoint, open, defaultOpen, composite, navigate, defaultHighlightedValue, highlightedValue, onHighlightChange, onSelect, onOpenChange, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onFocusOutside, items, triggerText
|
|
267
|
+
function Menu({ "aria-label": ariaLabel, dir, id, closeOnSelect = true, loopFocus = true, typeahead = true, positioning, anchorPoint, open, defaultOpen, composite, navigate, defaultHighlightedValue, highlightedValue, onHighlightChange, onSelect, onOpenChange, onEscapeKeyDown, onPointerDownOutside, onInteractOutside, onFocusOutside, items, triggerText, triggerIcon, customTrigger, contextMenu = false, className, size = "md", onCheckedChange }) {
|
|
267
268
|
const generatedId = useId();
|
|
269
|
+
const messages = useUiMessages();
|
|
268
270
|
const contextInvoker = useRef(null);
|
|
269
271
|
const restoreContextFocus = useRef(false);
|
|
270
272
|
const contextMenuWasOpen = useRef(false);
|
|
@@ -368,7 +370,7 @@ function Menu({ "aria-label": ariaLabel, dir, id, closeOnSelect = true, loopFocu
|
|
|
368
370
|
className: triggerClassName,
|
|
369
371
|
size: "xs" === size ? "sm" : size,
|
|
370
372
|
children: [
|
|
371
|
-
"string" == typeof customTrigger || "number" == typeof customTrigger ? customTrigger : triggerText,
|
|
373
|
+
"string" == typeof customTrigger || "number" == typeof customTrigger ? customTrigger : triggerText ?? messages.menu.trigger,
|
|
372
374
|
/*#__PURE__*/ jsx("span", {
|
|
373
375
|
...api.getIndicatorProps(),
|
|
374
376
|
children: /*#__PURE__*/ jsx(Icon, {
|
|
@@ -5,6 +5,8 @@ import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
|
5
5
|
import { useEffect, useId, useRef, useState } from "react";
|
|
6
6
|
import { Icon } from "../atoms/icon.js";
|
|
7
7
|
import { LinkButton } from "../atoms/link-button.js";
|
|
8
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
9
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
8
10
|
import { tv } from "../utils.js";
|
|
9
11
|
const paginationVariants = tv({
|
|
10
12
|
slots: {
|
|
@@ -155,6 +157,7 @@ function usePaginationPage({ page, defaultPage = 1, count, pageSize = 10, onChan
|
|
|
155
157
|
};
|
|
156
158
|
}
|
|
157
159
|
function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount = 1, boundaryCount = 1, showPrevNext = true, variant, className, dir = "ltr", getPageUrl, linkAs, linkProps, size, compact = false, compactLabel, onChange, onPageChange, translations, ...props }) {
|
|
160
|
+
const messages = useUiMessages();
|
|
158
161
|
const uniqueId = useId();
|
|
159
162
|
const { safeCount, safePageSize, totalPages, effectivePage, pendingCorrection, setUncontrolledPage } = usePaginationPage({
|
|
160
163
|
page,
|
|
@@ -180,7 +183,10 @@ function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount
|
|
|
180
183
|
onChange?.(details.page);
|
|
181
184
|
onPageChange?.(details.page);
|
|
182
185
|
},
|
|
183
|
-
translations
|
|
186
|
+
translations: {
|
|
187
|
+
...messages.pagination.translations,
|
|
188
|
+
...definedEntries(translations)
|
|
189
|
+
}
|
|
184
190
|
});
|
|
185
191
|
const api = connect(service, normalizeProps);
|
|
186
192
|
const { base, list, link, item, ellipsis, compactText } = paginationVariants({
|
|
@@ -233,7 +239,7 @@ function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount
|
|
|
233
239
|
...rootProps,
|
|
234
240
|
children: pendingCorrection ? /*#__PURE__*/ jsx("span", {
|
|
235
241
|
role: "status",
|
|
236
|
-
children:
|
|
242
|
+
children: messages.pagination.unavailable
|
|
237
243
|
}) : /*#__PURE__*/ jsxs("ul", {
|
|
238
244
|
className: list(),
|
|
239
245
|
children: [
|
|
@@ -253,7 +259,10 @@ function Pagination({ page, defaultPage = 1, count, pageSize = 10, siblingCount
|
|
|
253
259
|
children: compactLabel?.({
|
|
254
260
|
page: 0 === totalPages ? 0 : effectivePage,
|
|
255
261
|
totalPages
|
|
256
|
-
}) ??
|
|
262
|
+
}) ?? messages.pagination.compact({
|
|
263
|
+
page: 0 === totalPages ? 0 : effectivePage,
|
|
264
|
+
totalPages
|
|
265
|
+
})
|
|
257
266
|
})
|
|
258
267
|
}) : api.pages.map((paginationPage, index)=>{
|
|
259
268
|
if ("page" === paginationPage.type) return /*#__PURE__*/ jsx("li", {
|
|
@@ -7,11 +7,11 @@ import { Label } from "../atoms/label.js";
|
|
|
7
7
|
import { StatusText } from "../atoms/status-text.js";
|
|
8
8
|
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
9
9
|
import { subscribeOwnerFormReset } from "../internal/form-control-lifecycle.js";
|
|
10
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
10
11
|
import { tv } from "../utils.js";
|
|
11
12
|
import { Select } from "./select.js";
|
|
12
13
|
const phoneDigit = /\d/;
|
|
13
14
|
const phoneNonDigits = /\D/g;
|
|
14
|
-
const defaultNativeValidationMessage = "Enter a valid phone number.";
|
|
15
15
|
const defaultPhoneInputCountries = [
|
|
16
16
|
{
|
|
17
17
|
value: "SK",
|
|
@@ -148,12 +148,18 @@ function usePhoneInputItemContext() {
|
|
|
148
148
|
if (!context) throw new Error("PhoneInput item components must be used within PhoneInput.Item");
|
|
149
149
|
return context;
|
|
150
150
|
}
|
|
151
|
-
function PhoneInput({ countries: countriesProp
|
|
151
|
+
function PhoneInput({ countries: countriesProp, value, defaultValue = "", country, defaultCountry = "CZ", name, countryName, form, required = false, disabled = false, readOnly = false, nativeValidation = false, nativeValidationMessage, validateStatus = "default", onValueChange, onCountryChange, size = "md", id: providedId, className, children, ref, ...props }) {
|
|
152
|
+
const messages = useUiMessages();
|
|
152
153
|
const generatedId = useId();
|
|
153
154
|
const id = providedId || generatedId;
|
|
154
|
-
const
|
|
155
|
-
|
|
155
|
+
const localizedDefaultCountries = useMemo(()=>localizePhoneInputCountries(defaultPhoneInputCountries, messages.phoneInput.countries), [
|
|
156
|
+
messages
|
|
156
157
|
]);
|
|
158
|
+
const countries = useMemo(()=>normalizePhoneInputCountries(countriesProp && countriesProp.length > 0 ? countriesProp : localizedDefaultCountries), [
|
|
159
|
+
countriesProp,
|
|
160
|
+
localizedDefaultCountries
|
|
161
|
+
]);
|
|
162
|
+
const resolvedNativeValidationMessage = nativeValidationMessage ?? messages.phoneInput.invalid;
|
|
157
163
|
const fallbackCountry = resolveCountry(countries, getInitialCountry(value ?? defaultValue, defaultCountry, countries));
|
|
158
164
|
const [internalCountry, setInternalCountry] = useState(fallbackCountry);
|
|
159
165
|
const selectedCountry = resolveCountry(countries, country ?? internalCountry);
|
|
@@ -242,7 +248,7 @@ function PhoneInput({ countries: countriesProp = defaultPhoneInputCountries, val
|
|
|
242
248
|
details,
|
|
243
249
|
disabled,
|
|
244
250
|
nativeValidation,
|
|
245
|
-
nativeValidationMessage,
|
|
251
|
+
nativeValidationMessage: resolvedNativeValidationMessage,
|
|
246
252
|
readOnly,
|
|
247
253
|
required,
|
|
248
254
|
validateStatus,
|
|
@@ -450,7 +456,8 @@ PhoneInput.CountryCallingCode = function({ item, className, ref, ...props }) {
|
|
|
450
456
|
]
|
|
451
457
|
});
|
|
452
458
|
};
|
|
453
|
-
PhoneInput.Input = function({ className, onChange, placeholder
|
|
459
|
+
PhoneInput.Input = function({ className, onChange, placeholder, ref, ...props }) {
|
|
460
|
+
const messages = useUiMessages();
|
|
454
461
|
const { details, disabled, form, inputId, inputValue, nativeValidation, nativeValidationMessage, onFormReset, setResetting, readOnly, required, setInputValue, size, describedById, errorDescriptions, validateStatus } = usePhoneInputContext();
|
|
455
462
|
const styles = phoneInputVariants({
|
|
456
463
|
size
|
|
@@ -586,7 +593,7 @@ PhoneInput.Input = function({ className, onChange, placeholder = "Phone number",
|
|
|
586
593
|
setCompositionValue(event.currentTarget.value);
|
|
587
594
|
props.onCompositionStart?.(event);
|
|
588
595
|
},
|
|
589
|
-
placeholder: placeholder,
|
|
596
|
+
placeholder: placeholder ?? messages.phoneInput.placeholder,
|
|
590
597
|
readOnly: readOnly,
|
|
591
598
|
ref: setInputRef,
|
|
592
599
|
required: required,
|
|
@@ -716,6 +723,16 @@ function getPhoneInputValueDetailsInternal(value, country, options = {}) {
|
|
|
716
723
|
isValid
|
|
717
724
|
};
|
|
718
725
|
}
|
|
726
|
+
function localizePhoneInputCountries(countries, names) {
|
|
727
|
+
return countries.map((item)=>{
|
|
728
|
+
const name = names[item.value];
|
|
729
|
+
return void 0 === name ? item : {
|
|
730
|
+
...item,
|
|
731
|
+
label: name,
|
|
732
|
+
name
|
|
733
|
+
};
|
|
734
|
+
});
|
|
735
|
+
}
|
|
719
736
|
function normalizePhoneInputCountries(countries) {
|
|
720
737
|
return countries.map((item)=>{
|
|
721
738
|
const displayValue = getCountryDisplayValue(item);
|
|
@@ -7,6 +7,8 @@ import { createPortal } from "react-dom";
|
|
|
7
7
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
8
8
|
import { Button } from "../atoms/button.js";
|
|
9
9
|
import { OverlayContainerProvider, OverlayPortal } from "../internal/overlay-portal.js";
|
|
10
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
11
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
10
12
|
import { tv } from "../utils.js";
|
|
11
13
|
const popoverVariants = tv({
|
|
12
14
|
slots: {
|
|
@@ -90,12 +92,17 @@ function Popover({ autoFocus = true, border, children, closeOnEscape = true, clo
|
|
|
90
92
|
mainAxis: 8,
|
|
91
93
|
crossAxis: 0
|
|
92
94
|
}, onOpenChange, onPointerDownOutside, open, overflowPadding = 8, placement = "bottom", portalled = true, sameWidth = false, shadow, size, slide = true, ...props }) {
|
|
95
|
+
const messages = useUiMessages();
|
|
93
96
|
const generatedId = useId();
|
|
94
97
|
const uniqueId = id || generatedId;
|
|
95
98
|
const [titleId, setTitleId] = useState();
|
|
96
99
|
const [descriptionId, setDescriptionId] = useState();
|
|
97
100
|
const service = useMachine(machine, {
|
|
98
101
|
...props,
|
|
102
|
+
translations: {
|
|
103
|
+
...messages.popover.translations,
|
|
104
|
+
...definedEntries(props.translations)
|
|
105
|
+
},
|
|
99
106
|
autoFocus,
|
|
100
107
|
closeOnEscape,
|
|
101
108
|
closeOnInteractOutside,
|
|
@@ -296,6 +303,7 @@ Popover.Description = function({ className, ref, ...props }) {
|
|
|
296
303
|
});
|
|
297
304
|
};
|
|
298
305
|
Popover.CloseTrigger = function({ children, className, icon, onClick, ref, size = "current", theme = "unstyled", type = "button", ...props }) {
|
|
306
|
+
const messages = useUiMessages();
|
|
299
307
|
const { api, styles } = usePopoverContext();
|
|
300
308
|
const chromeContainer = useContext(PopoverChromeContext);
|
|
301
309
|
const { onClick: onMachineClick, ...machineCloseTriggerProps } = api.getCloseTriggerProps();
|
|
@@ -318,7 +326,7 @@ Popover.CloseTrigger = function({ children, className, icon, onClick, ref, size
|
|
|
318
326
|
children: children
|
|
319
327
|
}) : /*#__PURE__*/ jsx(ActionIcon, {
|
|
320
328
|
...buttonProps,
|
|
321
|
-
"aria-label": props["aria-label"] ??
|
|
329
|
+
"aria-label": props["aria-label"] ?? messages.popover.close,
|
|
322
330
|
className: styles.closeTrigger({
|
|
323
331
|
className
|
|
324
332
|
}),
|
|
@@ -10,6 +10,7 @@ import { StatusText } from "../atoms/status-text.js";
|
|
|
10
10
|
import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../internal/described-by.js";
|
|
11
11
|
import { subscribeOwnerFormReset } from "../internal/form-control-lifecycle.js";
|
|
12
12
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
13
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
13
14
|
import { tv } from "../utils.js";
|
|
14
15
|
const searchFormVariants = tv({
|
|
15
16
|
slots: {
|
|
@@ -204,7 +205,8 @@ SearchForm.Control = function({ children, className, ref, ...props }) {
|
|
|
204
205
|
children: children
|
|
205
206
|
});
|
|
206
207
|
};
|
|
207
|
-
SearchForm.Input = function({ className, placeholder
|
|
208
|
+
SearchForm.Input = function({ className, placeholder, ref, ...props }) {
|
|
209
|
+
const messages = useUiMessages();
|
|
208
210
|
const { inputId, inputValue, setInputValue, size, gapped, hasValue, hasClearButton, setClearSlot, readOnly, disabled, setInputReadOnly, setInputDisabled, hasLabel, hasButton, descriptions, errors, validateStatus } = useSearchFormContext();
|
|
209
211
|
useEffect(()=>{
|
|
210
212
|
setInputReadOnly(Boolean(props.readOnly));
|
|
@@ -228,14 +230,14 @@ SearchForm.Input = function({ className, placeholder = "Search...", ref, ...prop
|
|
|
228
230
|
className: styles.inputWrapper(),
|
|
229
231
|
ref: setClearSlot,
|
|
230
232
|
children: /*#__PURE__*/ jsx(Input, {
|
|
231
|
-
"aria-label": props["aria-label"] ?? (hasLabel ? void 0 :
|
|
233
|
+
"aria-label": props["aria-label"] ?? (hasLabel ? void 0 : messages.searchForm.search),
|
|
232
234
|
className: styles.input({
|
|
233
235
|
className
|
|
234
236
|
}),
|
|
235
237
|
"data-clearable": hasValue && hasClearButton && !readOnly && !disabled ? "" : void 0,
|
|
236
238
|
id: inputId,
|
|
237
239
|
onChange: (e)=>setInputValue(e.target.value),
|
|
238
|
-
placeholder: placeholder,
|
|
240
|
+
placeholder: placeholder ?? messages.searchForm.placeholder,
|
|
239
241
|
ref: ref,
|
|
240
242
|
size: size,
|
|
241
243
|
type: "search",
|
|
@@ -252,6 +254,7 @@ SearchForm.Input = function({ className, placeholder = "Search...", ref, ...prop
|
|
|
252
254
|
});
|
|
253
255
|
};
|
|
254
256
|
SearchForm.Button = function({ className, children, showSearchIcon = false, icon, iconPosition = "right", ...props }) {
|
|
257
|
+
const messages = useUiMessages();
|
|
255
258
|
const { size, gapped, disabled, setHasButton } = useSearchFormContext();
|
|
256
259
|
useEffect(()=>{
|
|
257
260
|
setHasButton(true);
|
|
@@ -265,7 +268,7 @@ SearchForm.Button = function({ className, children, showSearchIcon = false, icon
|
|
|
265
268
|
});
|
|
266
269
|
const effectiveIcon = icon ?? (showSearchIcon ? "token-icon-search" : void 0);
|
|
267
270
|
return /*#__PURE__*/ jsx(Button, {
|
|
268
|
-
"aria-label": children ? void 0 :
|
|
271
|
+
"aria-label": children ? void 0 : messages.searchForm.search,
|
|
269
272
|
className: styles.button({
|
|
270
273
|
className
|
|
271
274
|
}),
|
|
@@ -279,6 +282,7 @@ SearchForm.Button = function({ className, children, showSearchIcon = false, icon
|
|
|
279
282
|
});
|
|
280
283
|
};
|
|
281
284
|
SearchForm.ClearButton = function({ className, icon = "token-icon-close", tone = "neutral", ...props }) {
|
|
285
|
+
const messages = useUiMessages();
|
|
282
286
|
const { size, gapped, clearInput, hasValue, inputValue, clearSlot, setHasClearButton, readOnly, disabled } = useSearchFormContext();
|
|
283
287
|
const styles = searchFormVariants({
|
|
284
288
|
size,
|
|
@@ -292,7 +296,7 @@ SearchForm.ClearButton = function({ className, icon = "token-icon-close", tone =
|
|
|
292
296
|
]);
|
|
293
297
|
if (readOnly || disabled || !(hasValue && clearSlot)) return null;
|
|
294
298
|
return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(ActionIcon, {
|
|
295
|
-
"aria-label":
|
|
299
|
+
"aria-label": messages.searchForm.clear(inputValue),
|
|
296
300
|
className: styles.clearButton({
|
|
297
301
|
className
|
|
298
302
|
}),
|
package/dist/molecules/select.js
CHANGED
|
@@ -12,6 +12,8 @@ import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../inte
|
|
|
12
12
|
import { subscribeOwnerFormReset } from "../internal/form-control-lifecycle.js";
|
|
13
13
|
import { OverlayPortal } from "../internal/overlay-portal.js";
|
|
14
14
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
15
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
16
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
15
17
|
import { tv } from "../utils.js";
|
|
16
18
|
const selectResetValues = new WeakMap();
|
|
17
19
|
const nativeSelectMachine = {
|
|
@@ -164,7 +166,8 @@ function useSelectItemContext() {
|
|
|
164
166
|
if (!context) throw new Error("Select.Item components must be used within Select.Item");
|
|
165
167
|
return context;
|
|
166
168
|
}
|
|
167
|
-
function Select({ items, id: providedId, size = "md", value, defaultValue, multiple = false, disabled: explicitDisabled = false, validateStatus = "default", required = false, readOnly = false, closeOnSelect = true, loopFocus = true, name, form, onValueChange, onOpenChange, onHighlightChange, className, children, ref, ...machineProps }) {
|
|
169
|
+
function Select({ items, id: providedId, size = "md", value, defaultValue, multiple = false, disabled: explicitDisabled = false, validateStatus = "default", required = false, readOnly = false, closeOnSelect = true, loopFocus = true, name, form, onValueChange, onOpenChange, onHighlightChange, className, children, ref, translations, ...machineProps }) {
|
|
170
|
+
const messages = useUiMessages();
|
|
168
171
|
const generatedId = useId();
|
|
169
172
|
const [disabledElement, setDisabledElement] = useState(null);
|
|
170
173
|
const disabled = useEffectiveDisabled(disabledElement, explicitDisabled);
|
|
@@ -209,7 +212,12 @@ function Select({ items, id: providedId, size = "md", value, defaultValue, multi
|
|
|
209
212
|
}
|
|
210
213
|
},
|
|
211
214
|
onOpenChange,
|
|
212
|
-
onHighlightChange
|
|
215
|
+
onHighlightChange,
|
|
216
|
+
translations: {
|
|
217
|
+
clearTriggerLabel: messages.select.clear,
|
|
218
|
+
...messages.select.translations,
|
|
219
|
+
...definedEntries(translations)
|
|
220
|
+
}
|
|
213
221
|
});
|
|
214
222
|
useEffect(()=>{
|
|
215
223
|
if (effectiveValue.length === requestedValue.length) {
|
|
@@ -328,7 +336,7 @@ function Select({ items, id: providedId, size = "md", value, defaultValue, multi
|
|
|
328
336
|
readOnly && !disabled && /*#__PURE__*/ jsx("span", {
|
|
329
337
|
className: "sr-only",
|
|
330
338
|
id: `${id}-readonly`,
|
|
331
|
-
children:
|
|
339
|
+
children: messages.select.readOnly
|
|
332
340
|
})
|
|
333
341
|
]
|
|
334
342
|
})
|
|
@@ -392,7 +400,8 @@ Select.Trigger = function({ children, className, size: sizeProp, iconSize, ref,
|
|
|
392
400
|
]
|
|
393
401
|
});
|
|
394
402
|
};
|
|
395
|
-
Select.ValueText = function({ placeholder
|
|
403
|
+
Select.ValueText = function({ placeholder, className, size: sizeProp, ref, children, ...props }) {
|
|
404
|
+
const messages = useUiMessages();
|
|
396
405
|
const { api, size: contextSize, items } = useSelectContext();
|
|
397
406
|
const effectiveSize = sizeProp ?? contextSize;
|
|
398
407
|
const styles = selectVariants({
|
|
@@ -401,7 +410,7 @@ Select.ValueText = function({ placeholder = "Select an option", className, size:
|
|
|
401
410
|
const hasValue = api.value.length > 0;
|
|
402
411
|
const selectedItems = api.value.map((v)=>items.find((item)=>item.value === v)).filter((item)=>void 0 !== item);
|
|
403
412
|
const renderContent = ()=>{
|
|
404
|
-
if (!hasValue) return placeholder;
|
|
413
|
+
if (!hasValue) return placeholder ?? messages.select.placeholder;
|
|
405
414
|
if ("function" == typeof children) return children(selectedItems);
|
|
406
415
|
if (void 0 !== children) return children;
|
|
407
416
|
return selectedItems.map((item, index)=>/*#__PURE__*/ jsxs("span", {
|
|
@@ -423,6 +432,7 @@ Select.ValueText = function({ placeholder = "Select an option", className, size:
|
|
|
423
432
|
});
|
|
424
433
|
};
|
|
425
434
|
Select.ClearTrigger = function({ className, ref, ...props }) {
|
|
435
|
+
const messages = useUiMessages();
|
|
426
436
|
const { api, size, readOnly, disabled } = useSelectContext();
|
|
427
437
|
const styles = selectVariants({
|
|
428
438
|
size
|
|
@@ -437,7 +447,7 @@ Select.ClearTrigger = function({ className, ref, ...props }) {
|
|
|
437
447
|
size: toControlSize(size),
|
|
438
448
|
tone: "neutral",
|
|
439
449
|
...mergeProps(api.getClearTriggerProps(), props),
|
|
440
|
-
"aria-label": props["aria-label"] ??
|
|
450
|
+
"aria-label": props["aria-label"] ?? messages.select.clear,
|
|
441
451
|
disabled: disabled || props.disabled,
|
|
442
452
|
type: "button"
|
|
443
453
|
});
|
package/dist/molecules/steps.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, u
|
|
|
6
6
|
import { flushSync } from "react-dom";
|
|
7
7
|
import { Button } from "../atoms/button.js";
|
|
8
8
|
import { Icon } from "../atoms/icon.js";
|
|
9
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
9
10
|
import { tv } from "../utils.js";
|
|
10
11
|
const stepsVariants = tv({
|
|
11
12
|
slots: {
|
|
@@ -615,8 +616,9 @@ Steps.Content = function({ index, children, className, ref, ...props }) {
|
|
|
615
616
|
children: children
|
|
616
617
|
});
|
|
617
618
|
};
|
|
618
|
-
Steps.Progress = function({ "aria-label": ariaLabel
|
|
619
|
+
Steps.Progress = function({ "aria-label": ariaLabel, className, ref, style, ...props }) {
|
|
619
620
|
const { api, orientation, styles } = useStepsContext();
|
|
621
|
+
const messages = useUiMessages();
|
|
620
622
|
const progressProps = mergeProps(props, api.getProgressProps());
|
|
621
623
|
return /*#__PURE__*/ jsx("div", {
|
|
622
624
|
className: styles.progress({
|
|
@@ -624,7 +626,7 @@ Steps.Progress = function({ "aria-label": ariaLabel = "Step progress", className
|
|
|
624
626
|
}),
|
|
625
627
|
ref: ref,
|
|
626
628
|
...progressProps,
|
|
627
|
-
"aria-label": ariaLabel,
|
|
629
|
+
"aria-label": ariaLabel ?? messages.steps.progress,
|
|
628
630
|
"data-orientation": orientation,
|
|
629
631
|
role: "progressbar",
|
|
630
632
|
style: style,
|
|
@@ -637,6 +639,7 @@ Steps.Progress = function({ "aria-label": ariaLabel = "Step progress", className
|
|
|
637
639
|
};
|
|
638
640
|
Steps.CompletedContent = function({ children, className, ref, ...props }) {
|
|
639
641
|
const { api, styles } = useStepsContext();
|
|
642
|
+
const messages = useUiMessages();
|
|
640
643
|
const { "aria-labelledby": _triggerLabel, role: _tabPanelRole, ...machineContentProps } = api.getContentProps({
|
|
641
644
|
index: api.count
|
|
642
645
|
});
|
|
@@ -648,7 +651,7 @@ Steps.CompletedContent = function({ children, className, ref, ...props }) {
|
|
|
648
651
|
ref: ref,
|
|
649
652
|
role: "group",
|
|
650
653
|
...contentProps,
|
|
651
|
-
"aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 :
|
|
654
|
+
"aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : messages.steps.complete),
|
|
652
655
|
"data-complete": api.isCompleted || void 0,
|
|
653
656
|
"data-part": "completed-content",
|
|
654
657
|
tabIndex: -1,
|
package/dist/molecules/tabs.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { mergeProps, normalizeProps, useMachine } from "@zag-js/react";
|
|
4
4
|
import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { Button } from "../atoms/button.js";
|
|
6
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
6
7
|
import { tv } from "../utils.js";
|
|
7
8
|
import * as __rspack_external__zag_js_tabs_b98983a9 from "@zag-js/tabs";
|
|
8
9
|
const tabsVariants = tv({
|
|
@@ -168,8 +169,10 @@ function Tabs({ id, defaultValue, value, orientation = "horizontal", dir = "ltr"
|
|
|
168
169
|
const previousValues = useRef([]);
|
|
169
170
|
const lastFocused = useRef(null);
|
|
170
171
|
const recoveryRequest = useRef(null);
|
|
172
|
+
const messages = useUiMessages();
|
|
171
173
|
const service = useMachine(__rspack_external__zag_js_tabs_b98983a9.machine, {
|
|
172
174
|
id: uniqueId,
|
|
175
|
+
translations: messages.tabs.translations,
|
|
173
176
|
value,
|
|
174
177
|
defaultValue,
|
|
175
178
|
orientation,
|
package/dist/molecules/toast.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createPortal } from "react-dom";
|
|
|
6
6
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
7
7
|
import { Button } from "../atoms/button.js";
|
|
8
8
|
import { useActiveModalContainer } from "../internal/overlay-portal.js";
|
|
9
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
9
10
|
import { tv } from "../utils.js";
|
|
10
11
|
import * as __rspack_external__zag_js_toast_856c971b from "@zag-js/toast";
|
|
11
12
|
const toastVariants = tv({
|
|
@@ -51,7 +52,8 @@ const toastVariants = tv({
|
|
|
51
52
|
]
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
|
-
function Toast({ actor, index, parent, placement, closeLabel
|
|
55
|
+
function Toast({ actor, index, parent, placement, closeLabel, loadingLabel }) {
|
|
56
|
+
const messages = useUiMessages();
|
|
55
57
|
const composedProps = {
|
|
56
58
|
...actor,
|
|
57
59
|
index,
|
|
@@ -89,7 +91,7 @@ function Toast({ actor, index, parent, placement, closeLabel = "Close notificati
|
|
|
89
91
|
className: title(),
|
|
90
92
|
...api.getTitleProps(),
|
|
91
93
|
"data-type": api.type,
|
|
92
|
-
children: "loading" === api.type ? api.title ?? loadingLabel : api.title
|
|
94
|
+
children: "loading" === api.type ? api.title ?? loadingLabel ?? messages.toast.loading : api.title
|
|
93
95
|
}),
|
|
94
96
|
api.closable && /*#__PURE__*/ jsx(ActionIcon, {
|
|
95
97
|
className: closeButton(),
|
|
@@ -97,7 +99,7 @@ function Toast({ actor, index, parent, placement, closeLabel = "Close notificati
|
|
|
97
99
|
size: "sm",
|
|
98
100
|
tone: "neutral",
|
|
99
101
|
...api.getCloseTriggerProps(),
|
|
100
|
-
"aria-label": closeLabel
|
|
102
|
+
"aria-label": closeLabel ?? messages.toast.close
|
|
101
103
|
})
|
|
102
104
|
]
|
|
103
105
|
}),
|
package/dist/molecules/tour.js
CHANGED
|
@@ -6,6 +6,8 @@ import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef }
|
|
|
6
6
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
7
7
|
import { Button } from "../atoms/button.js";
|
|
8
8
|
import { BodyPortal } from "../internal/overlay-portal.js";
|
|
9
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
10
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
9
11
|
import { tv } from "../utils.js";
|
|
10
12
|
const tourStyles = tv({
|
|
11
13
|
slots: {
|
|
@@ -30,12 +32,17 @@ function useTourContext() {
|
|
|
30
32
|
return api;
|
|
31
33
|
}
|
|
32
34
|
function Tour({ children, getRootNode, id, onStatusChange, steps, ...props }) {
|
|
35
|
+
const messages = useUiMessages();
|
|
33
36
|
const generatedId = useId();
|
|
34
37
|
const previousFocus = useRef(null);
|
|
35
38
|
const effectCleanup = useRef(void 0);
|
|
36
39
|
const service = useMachine(machine, {
|
|
37
40
|
...props,
|
|
38
41
|
preventInteraction: false,
|
|
42
|
+
translations: {
|
|
43
|
+
...messages.tour.translations,
|
|
44
|
+
...definedEntries(props.translations)
|
|
45
|
+
},
|
|
39
46
|
getRootNode,
|
|
40
47
|
id: id ?? generatedId,
|
|
41
48
|
steps: steps.map(prepareStep),
|
|
@@ -249,9 +256,10 @@ Tour.Title = function({ children, className, ref, ...props }) {
|
|
|
249
256
|
};
|
|
250
257
|
Tour.Description = function({ children, className, ref, ...props }) {
|
|
251
258
|
const api = useTourContext();
|
|
259
|
+
const messages = useUiMessages();
|
|
252
260
|
return /*#__PURE__*/ jsx("div", {
|
|
253
261
|
...mergeProps(props, api.getDescriptionProps()),
|
|
254
|
-
"aria-label": props["aria-label"] ??
|
|
262
|
+
"aria-label": props["aria-label"] ?? messages.tour.guidance,
|
|
255
263
|
className: tourStyles().description({
|
|
256
264
|
className
|
|
257
265
|
}),
|
|
@@ -307,7 +315,7 @@ Tour.CloseTrigger = function({ className, icon = "token-icon-close", onClick, re
|
|
|
307
315
|
const { onClick: onMachineClick, "aria-label": machineLabel, ...machineProps } = api.getCloseTriggerProps();
|
|
308
316
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
309
317
|
...mergeProps(props, machineProps),
|
|
310
|
-
"aria-label": props["aria-label"] ?? machineLabel ?? "
|
|
318
|
+
"aria-label": props["aria-label"] ?? machineLabel ?? "",
|
|
311
319
|
className: tourStyles().closeTrigger({
|
|
312
320
|
className
|
|
313
321
|
}),
|