@techsio/ui-kit 0.59.3 → 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 +32 -0
- 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/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
|
@@ -12,6 +12,7 @@ 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 { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
15
16
|
import { tv } from "../utils.js";
|
|
16
17
|
const toControlSize = (size)=>"xs" === size ? "sm" : size;
|
|
17
18
|
const controlGlyphClass = {
|
|
@@ -395,7 +396,8 @@ CascadeSelect.Trigger = function({ className, ref, ...props }) {
|
|
|
395
396
|
theme: "unstyled"
|
|
396
397
|
});
|
|
397
398
|
};
|
|
398
|
-
CascadeSelect.ValueText = function({ children, className, placeholder
|
|
399
|
+
CascadeSelect.ValueText = function({ children, className, placeholder, ref, ...props }) {
|
|
400
|
+
const messages = useUiMessages();
|
|
399
401
|
const { api, formatValue, size } = useCascadeSelectContext();
|
|
400
402
|
const styles = cascadeSelectVariants({
|
|
401
403
|
size
|
|
@@ -403,7 +405,7 @@ CascadeSelect.ValueText = function({ children, className, placeholder = "Select
|
|
|
403
405
|
const selectedItems = resolveSelectedItems(api);
|
|
404
406
|
const valueText = formatValue?.(selectedItems) ?? formatSelectedItems(api, selectedItems);
|
|
405
407
|
const hasValue = api.hasSelectedItems;
|
|
406
|
-
let content = hasValue ? valueText : placeholder;
|
|
408
|
+
let content = hasValue ? valueText : placeholder ?? messages.cascadeSelect.placeholder;
|
|
407
409
|
if (hasValue && "function" == typeof children) content = children(selectedItems);
|
|
408
410
|
else if (hasValue && void 0 !== children && "function" != typeof children) content = children;
|
|
409
411
|
return /*#__PURE__*/ jsx("span", {
|
|
@@ -434,7 +436,8 @@ CascadeSelect.Indicator = function({ children, className, iconSize = "current",
|
|
|
434
436
|
})
|
|
435
437
|
});
|
|
436
438
|
};
|
|
437
|
-
CascadeSelect.ClearTrigger = function({ "aria-label": ariaLabel
|
|
439
|
+
CascadeSelect.ClearTrigger = function({ "aria-label": ariaLabel, className, ref, ...props }) {
|
|
440
|
+
const messages = useUiMessages();
|
|
438
441
|
const { api, size, readOnly } = useCascadeSelectContext();
|
|
439
442
|
const styles = cascadeSelectVariants({
|
|
440
443
|
size
|
|
@@ -442,7 +445,7 @@ CascadeSelect.ClearTrigger = function({ "aria-label": ariaLabel = "Clear selecti
|
|
|
442
445
|
if (readOnly) return null;
|
|
443
446
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
444
447
|
...mergeProps(api.getClearTriggerProps(), props),
|
|
445
|
-
"aria-label": ariaLabel,
|
|
448
|
+
"aria-label": ariaLabel ?? messages.cascadeSelect.clear,
|
|
446
449
|
className: styles.clearTrigger({
|
|
447
450
|
className
|
|
448
451
|
}),
|
|
@@ -725,12 +728,13 @@ function CascadeSelectTreeNode({ indexPath, node, rootLabel, value }) {
|
|
|
725
728
|
]
|
|
726
729
|
});
|
|
727
730
|
}
|
|
728
|
-
CascadeSelect.Node = function({ indexPath = [], node, rootLabel
|
|
731
|
+
CascadeSelect.Node = function({ indexPath = [], node, rootLabel, value = [] }) {
|
|
732
|
+
const messages = useUiMessages();
|
|
729
733
|
const { api } = useCascadeSelectContext();
|
|
730
734
|
return /*#__PURE__*/ jsx(CascadeSelectTreeNode, {
|
|
731
735
|
indexPath: indexPath,
|
|
732
736
|
node: node ?? api.collection.rootNode,
|
|
733
|
-
rootLabel: rootLabel,
|
|
737
|
+
rootLabel: rootLabel ?? messages.cascadeSelect.rootLabel,
|
|
734
738
|
value: value
|
|
735
739
|
});
|
|
736
740
|
};
|
package/dist/molecules/chart.js
CHANGED
|
@@ -12,6 +12,7 @@ import { scaleUtc } from "d3-scale";
|
|
|
12
12
|
import { curveMonotoneX, pie } from "d3-shape";
|
|
13
13
|
import { useMemo, useRef, useState } from "react";
|
|
14
14
|
import { usePrefersReducedMotion } from "../internal/reduced-motion.js";
|
|
15
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
15
16
|
import { tv } from "../utils.js";
|
|
16
17
|
const chartVariants = tv({
|
|
17
18
|
slots: {
|
|
@@ -577,6 +578,7 @@ function invalidPolarData(data, validData, getY) {
|
|
|
577
578
|
return validData.length !== data.length || validData.some((datum)=>getY(datum) < 0) || validData.length > 0 && (!Number.isFinite(total) || total <= 0);
|
|
578
579
|
}
|
|
579
580
|
function ChartDataAlternative({ data, x, y, series, xLabel, yLabel, legendLabel, formatValue, ariaLabel, dataTableLabel }) {
|
|
581
|
+
const messages = useUiMessages();
|
|
580
582
|
const { alternative, summary, cell } = chartVariants();
|
|
581
583
|
const getX = toAccessor(x);
|
|
582
584
|
const getY = toAccessor(y);
|
|
@@ -600,17 +602,17 @@ function ChartDataAlternative({ data, x, y, series, xLabel, yLabel, legendLabel,
|
|
|
600
602
|
getSeries && /*#__PURE__*/ jsx("th", {
|
|
601
603
|
className: cell(),
|
|
602
604
|
scope: "col",
|
|
603
|
-
children: legendLabel ?? ("string" == typeof series ? series :
|
|
605
|
+
children: legendLabel ?? ("string" == typeof series ? series : messages.chart.seriesHeader)
|
|
604
606
|
}),
|
|
605
607
|
/*#__PURE__*/ jsx("th", {
|
|
606
608
|
className: cell(),
|
|
607
609
|
scope: "col",
|
|
608
|
-
children: xLabel ?? ("string" == typeof x ? x :
|
|
610
|
+
children: xLabel ?? ("string" == typeof x ? x : messages.chart.categoryHeader)
|
|
609
611
|
}),
|
|
610
612
|
/*#__PURE__*/ jsx("th", {
|
|
611
613
|
className: cell(),
|
|
612
614
|
scope: "col",
|
|
613
|
-
children: yLabel ?? ("string" == typeof y ? y :
|
|
615
|
+
children: yLabel ?? ("string" == typeof y ? y : messages.chart.valueHeader)
|
|
614
616
|
})
|
|
615
617
|
]
|
|
616
618
|
})
|
|
@@ -674,7 +676,9 @@ function ChartLineLegend({ identities, domain, label }) {
|
|
|
674
676
|
})
|
|
675
677
|
});
|
|
676
678
|
}
|
|
677
|
-
function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, valueLabel, formatCategory, formatTooltipValue, locale, height, aspectRatio, initialWidth = 640, animate, tooltip = true, ariaLabel, ariaDescription, className, dataTableLabel
|
|
679
|
+
function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked, points = false, smooth = false, grid = true, legend, legendLabel, xLabel, yLabel, formatValue, valueLabel, formatCategory, formatTooltipValue, locale, height, aspectRatio, initialWidth = 640, animate, tooltip = true, ariaLabel, ariaDescription, className, dataTableLabel, emptyLabel, invalidLabel, onSelect }) {
|
|
680
|
+
const messages = useUiMessages();
|
|
681
|
+
const resolvedLocale = locale ?? messages.locale;
|
|
678
682
|
const { root, tooltip: tooltipSlot, fallback } = chartVariants();
|
|
679
683
|
const tooltipClassName = tooltipSlot();
|
|
680
684
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
@@ -711,7 +715,7 @@ function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked,
|
|
|
711
715
|
valueLabel,
|
|
712
716
|
formatCategory,
|
|
713
717
|
formatTooltipValue,
|
|
714
|
-
locale,
|
|
718
|
+
locale: resolvedLocale,
|
|
715
719
|
animate: shouldAnimate,
|
|
716
720
|
showTooltip: tooltip && !dismissed,
|
|
717
721
|
tooltipClassName
|
|
@@ -736,7 +740,7 @@ function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked,
|
|
|
736
740
|
valueLabel,
|
|
737
741
|
formatCategory,
|
|
738
742
|
formatTooltipValue,
|
|
739
|
-
|
|
743
|
+
resolvedLocale,
|
|
740
744
|
shouldAnimate,
|
|
741
745
|
tooltip,
|
|
742
746
|
tooltipClassName
|
|
@@ -767,7 +771,7 @@ function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked,
|
|
|
767
771
|
invalidPolar || 0 === validData.length ? /*#__PURE__*/ jsx("p", {
|
|
768
772
|
className: fallback(),
|
|
769
773
|
role: "status",
|
|
770
|
-
children: invalidPolar ? invalidLabel : emptyLabel
|
|
774
|
+
children: invalidPolar ? invalidLabel ?? messages.chart.invalidLabel : emptyLabel ?? messages.chart.emptyLabel
|
|
771
775
|
}) : /*#__PURE__*/ jsx(Chart, {
|
|
772
776
|
ariaDescription: ariaDescription,
|
|
773
777
|
ariaLabel: ariaLabel,
|
|
@@ -788,7 +792,7 @@ function chart_Chart({ type = "line", data, x, y, series, seriesDomain, stacked,
|
|
|
788
792
|
validData.length > 0 && !invalidPolar && /*#__PURE__*/ jsx(ChartDataAlternative, {
|
|
789
793
|
ariaLabel: ariaLabel,
|
|
790
794
|
data: validData,
|
|
791
|
-
dataTableLabel: dataTableLabel,
|
|
795
|
+
dataTableLabel: dataTableLabel ?? messages.chart.dataTableLabel,
|
|
792
796
|
formatValue: formatValue,
|
|
793
797
|
legendLabel: legendLabel,
|
|
794
798
|
series: series,
|
|
@@ -7,6 +7,7 @@ import { StatusText } from "../atoms/status-text.js";
|
|
|
7
7
|
import { useChoiceFocusRecovery } from "../internal/choice-control.js";
|
|
8
8
|
import { joinDescribedBy } from "../internal/described-by.js";
|
|
9
9
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
10
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
10
11
|
import { tv } from "../utils.js";
|
|
11
12
|
const colorSelectVariants = tv({
|
|
12
13
|
slots: {
|
|
@@ -127,7 +128,9 @@ function getNextIndex(key, current, count, rtl) {
|
|
|
127
128
|
const forward = "ArrowDown" === key || key === (rtl ? "ArrowLeft" : "ArrowRight");
|
|
128
129
|
return (current + (forward ? 1 : -1) + count) % count;
|
|
129
130
|
}
|
|
130
|
-
const ColorSelect = ({ colors, layout = "grid", size = "md", radius = "full", disabled: explicitDisabled, onColorClick, selectionMode = "single", label
|
|
131
|
+
const ColorSelect = ({ colors, layout = "grid", size = "md", radius = "full", disabled: explicitDisabled, onColorClick, selectionMode = "single", label, name, readOnly = false, helpText, validateStatus = "default", ...props })=>{
|
|
132
|
+
const messages = useUiMessages();
|
|
133
|
+
const resolvedLabel = label ?? messages.colorSelect.label;
|
|
131
134
|
const id = useId();
|
|
132
135
|
const recoveryRef = useChoiceFocusRecovery('button[role="radio"], button[role="checkbox"]');
|
|
133
136
|
const [groupElement, setGroupElement] = useState(null);
|
|
@@ -172,16 +175,16 @@ const ColorSelect = ({ colors, layout = "grid", size = "md", radius = "full", di
|
|
|
172
175
|
return /*#__PURE__*/ jsxs("div", {
|
|
173
176
|
className: root(),
|
|
174
177
|
children: [
|
|
175
|
-
|
|
178
|
+
resolvedLabel && /*#__PURE__*/ jsx(Label, {
|
|
176
179
|
id: `${id}-label`,
|
|
177
180
|
size: controlSize,
|
|
178
|
-
children:
|
|
181
|
+
children: resolvedLabel
|
|
179
182
|
}),
|
|
180
183
|
/*#__PURE__*/ jsx("div", {
|
|
181
184
|
...props,
|
|
182
185
|
"aria-describedby": describedBy,
|
|
183
186
|
"aria-label": props["aria-label"],
|
|
184
|
-
"aria-labelledby": props["aria-labelledby"] ?? (props["aria-label"] || !
|
|
187
|
+
"aria-labelledby": props["aria-labelledby"] ?? (props["aria-label"] || !resolvedLabel ? void 0 : `${id}-label`),
|
|
185
188
|
"aria-readonly": "single" === selectionMode && immutable || void 0,
|
|
186
189
|
className: group({
|
|
187
190
|
className: props.className
|
|
@@ -200,7 +203,7 @@ const ColorSelect = ({ colors, layout = "grid", size = "md", radius = "full", di
|
|
|
200
203
|
"aria-describedby": describedBy,
|
|
201
204
|
"aria-errormessage": errorMessageId,
|
|
202
205
|
"aria-invalid": invalid || void 0,
|
|
203
|
-
"aria-label":
|
|
206
|
+
"aria-label": messages.colorSelect.selectColor(colorItem.label ?? colorItem.color),
|
|
204
207
|
"aria-readonly": checkboxReadOnly,
|
|
205
208
|
className: `${atom()} ${colorItem.disabled ? "select-disabled" : ""}`,
|
|
206
209
|
"data-readonly": readOnly ? "" : void 0,
|
|
@@ -264,7 +267,7 @@ const ColorSelect = ({ colors, layout = "grid", size = "md", radius = "full", di
|
|
|
264
267
|
immutable && /*#__PURE__*/ jsx("span", {
|
|
265
268
|
className: "sr-only",
|
|
266
269
|
id: readOnlyId,
|
|
267
|
-
children:
|
|
270
|
+
children: messages.colorSelect.readOnly
|
|
268
271
|
}),
|
|
269
272
|
helpText && /*#__PURE__*/ jsx(StatusText, {
|
|
270
273
|
id: messageId,
|
|
@@ -14,6 +14,8 @@ import { joinDescribedBy } from "../internal/described-by.js";
|
|
|
14
14
|
import { subscribeOwnerFormReset, syncReactFormControl } from "../internal/form-control-lifecycle.js";
|
|
15
15
|
import { OverlayPortal } from "../internal/overlay-portal.js";
|
|
16
16
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
17
|
+
import { definedEntries } from "../messages/ui-messages.js";
|
|
18
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
17
19
|
import { tv } from "../utils.js";
|
|
18
20
|
const comboboxVariants = tv({
|
|
19
21
|
slots: {
|
|
@@ -259,6 +261,7 @@ function getResultsState({ loading, error, hasOptions, inputValue }) {
|
|
|
259
261
|
return inputValue ? "empty" : "idle";
|
|
260
262
|
}
|
|
261
263
|
function ComboboxClearTrigger({ api, navigation, clearable, clearIcon, size, disabled, readOnly }) {
|
|
264
|
+
const messages = useUiMessages();
|
|
262
265
|
const hasValue = navigation ? Boolean(api.inputValue) : api.value.length > 0;
|
|
263
266
|
if (readOnly || !(clearable && hasValue)) return null;
|
|
264
267
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
@@ -266,7 +269,7 @@ function ComboboxClearTrigger({ api, navigation, clearable, clearIcon, size, dis
|
|
|
266
269
|
size: size ?? "md",
|
|
267
270
|
tone: "neutral",
|
|
268
271
|
...api.getClearTriggerProps(),
|
|
269
|
-
"aria-label": api.getClearTriggerProps()["aria-label"] ??
|
|
272
|
+
"aria-label": api.getClearTriggerProps()["aria-label"] ?? messages.combobox.clear,
|
|
270
273
|
disabled: disabled || readOnly,
|
|
271
274
|
hidden: false,
|
|
272
275
|
onClick: (event)=>{
|
|
@@ -316,7 +319,8 @@ function ComboboxStatus({ state, styles, loadingMessage, error, onRetry, disable
|
|
|
316
319
|
});
|
|
317
320
|
return null;
|
|
318
321
|
}
|
|
319
|
-
function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, label, size, placeholder
|
|
322
|
+
function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, label, size, placeholder, disabled: explicitDisabled = false, readOnly = false, required = false, requiredLabel, items, groups, value, defaultValue, inputValue, defaultInputValue, multiple = false, validateStatus, helpText, showHelpTextIcon = true, noResultsMessage, clearable = true, selectionBehavior = "replace", closeOnSelect = true, allowCustomValue = false, loopFocus = true, autoFocus = false, open, defaultOpen, triggerIcon = "token-icon-combobox-chevron", triggerIconSize, clearIcon = "token-icon-combobox-clear", inputBehavior = "autocomplete", filterBehavior = "local", loading = false, loadingMessage, error, retryLabel, onRetry, renderItem, onChange, onInputValueChange, onOpenChange, mode = "selection", navigate, footer, portalled = true, openOnClick = false, translations, ref, inputProps = {}, className, ...rootProps }) {
|
|
323
|
+
const messages = useUiMessages();
|
|
320
324
|
const generatedId = useId();
|
|
321
325
|
const uniqueId = id || generatedId;
|
|
322
326
|
const listId = `${uniqueId}-listbox`;
|
|
@@ -447,7 +451,11 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
447
451
|
readOnly,
|
|
448
452
|
closeOnSelect,
|
|
449
453
|
openOnClick,
|
|
450
|
-
translations
|
|
454
|
+
translations: {
|
|
455
|
+
clearTriggerLabel: messages.combobox.clear,
|
|
456
|
+
...messages.combobox.translations,
|
|
457
|
+
...definedEntries(translations)
|
|
458
|
+
},
|
|
451
459
|
selectionBehavior: navigation ? "preserve" : selectionBehavior,
|
|
452
460
|
allowCustomValue: !navigation && allowCustomValue,
|
|
453
461
|
autoFocus,
|
|
@@ -554,11 +562,12 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
554
562
|
return input ? subscribeOwnerFormReset(input, ()=>reset.current()) : void 0;
|
|
555
563
|
}, []);
|
|
556
564
|
useEffect(()=>{
|
|
557
|
-
inputRef.current?.setCustomValidity(!navigation && required && 0 === api.value.length ?
|
|
565
|
+
inputRef.current?.setCustomValidity(!navigation && required && 0 === api.value.length ? messages.combobox.chooseSuggestion : "");
|
|
558
566
|
}, [
|
|
559
567
|
navigation,
|
|
560
568
|
required,
|
|
561
|
-
api.value.length
|
|
569
|
+
api.value.length,
|
|
570
|
+
messages.combobox.chooseSuggestion
|
|
562
571
|
]);
|
|
563
572
|
const selectedText = api.value.map((selectedValue)=>allItems.find((item)=>item.value === selectedValue)?.label ?? api.selectedItems.find((item)=>item.value === selectedValue)?.label ?? selectedValue).join(", ");
|
|
564
573
|
useEffect(()=>{
|
|
@@ -670,7 +679,7 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
670
679
|
}
|
|
671
680
|
api.getInputProps().onKeyDown?.(event);
|
|
672
681
|
},
|
|
673
|
-
placeholder: placeholder,
|
|
682
|
+
placeholder: placeholder ?? messages.combobox.placeholder,
|
|
674
683
|
readOnly: readOnly,
|
|
675
684
|
ref: focusableRef,
|
|
676
685
|
required: navigation && required,
|
|
@@ -724,11 +733,11 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
724
733
|
disabled: disabled,
|
|
725
734
|
error: error,
|
|
726
735
|
inputValue: api.inputValue,
|
|
727
|
-
loadingMessage: loadingMessage,
|
|
728
|
-
noResultsMessage: noResultsMessage,
|
|
736
|
+
loadingMessage: loadingMessage ?? messages.combobox.loading,
|
|
737
|
+
noResultsMessage: noResultsMessage ?? messages.combobox.noResults,
|
|
729
738
|
onRetry: onRetry,
|
|
730
739
|
readOnly: readOnly,
|
|
731
|
-
retryLabel: retryLabel,
|
|
740
|
+
retryLabel: retryLabel ?? messages.combobox.retry,
|
|
732
741
|
state: state,
|
|
733
742
|
styles: styles
|
|
734
743
|
}),
|
|
@@ -759,17 +768,14 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
759
768
|
}),
|
|
760
769
|
multiple && !navigation && api.value.length > 0 && /*#__PURE__*/ jsxs("div", {
|
|
761
770
|
children: [
|
|
762
|
-
/*#__PURE__*/
|
|
771
|
+
/*#__PURE__*/ jsx(StatusText, {
|
|
763
772
|
className: "sr-only",
|
|
764
773
|
id: selectedTextId,
|
|
765
774
|
size: size,
|
|
766
|
-
children:
|
|
767
|
-
"Selected: ",
|
|
768
|
-
selectedText
|
|
769
|
-
]
|
|
775
|
+
children: messages.combobox.selectedStatus(selectedText)
|
|
770
776
|
}),
|
|
771
777
|
/*#__PURE__*/ jsx("ul", {
|
|
772
|
-
"aria-label":
|
|
778
|
+
"aria-label": messages.combobox.selectedValues,
|
|
773
779
|
className: styles.selectedList(),
|
|
774
780
|
children: api.value.map((selectedValue)=>{
|
|
775
781
|
const selectedLabel = allItems.find((item)=>item.value === selectedValue)?.label ?? api.selectedItems.find((item)=>item.value === selectedValue)?.label ?? selectedValue;
|
|
@@ -781,7 +787,7 @@ function Combobox({ id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLa
|
|
|
781
787
|
children: selectedLabel
|
|
782
788
|
}),
|
|
783
789
|
!readOnly && /*#__PURE__*/ jsx(ActionIcon, {
|
|
784
|
-
"aria-label":
|
|
790
|
+
"aria-label": messages.combobox.removeValue(selectedLabel),
|
|
785
791
|
disabled: disabled,
|
|
786
792
|
icon: "token-icon-combobox-clear",
|
|
787
793
|
onClick: ()=>{
|
|
@@ -15,21 +15,12 @@ import { joinDescribedBy, useDescribedBy, useRegisterDescription } from "../inte
|
|
|
15
15
|
import { subscribeOwnerFormReset } from "../internal/form-control-lifecycle.js";
|
|
16
16
|
import { OverlayPortal, restoreFocusAfterOverlayClose } from "../internal/overlay-portal.js";
|
|
17
17
|
import { useEffectiveDisabled } from "../internal/use-effective-disabled.js";
|
|
18
|
+
import { definedEntries, enUiMessages } from "../messages/ui-messages.js";
|
|
19
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
18
20
|
import { tv } from "../utils.js";
|
|
19
|
-
const DATE_PICKER_ENGLISH_SEGMENT_LABELS = {
|
|
20
|
-
era: "Era",
|
|
21
|
-
year: "Year",
|
|
22
|
-
month: "Month",
|
|
23
|
-
day: "Day",
|
|
24
|
-
hour: "Hour",
|
|
25
|
-
minute: "Minute",
|
|
26
|
-
second: "Second",
|
|
27
|
-
dayPeriod: "AM/PM",
|
|
28
|
-
timeZoneName: "Time zone"
|
|
29
|
-
};
|
|
30
21
|
function formatDatePickerSegmentAnnouncement(segment, options) {
|
|
31
|
-
const name = options.segmentLabels?.[segment.type] ??
|
|
32
|
-
const valueText = segment.isPlaceholder ? options.emptySegmentLabel ??
|
|
22
|
+
const name = options.segmentLabels?.[segment.type] ?? enUiMessages.datePicker.segments[segment.type] ?? segment.type;
|
|
23
|
+
const valueText = segment.isPlaceholder ? options.emptySegmentLabel ?? enUiMessages.datePicker.emptySegment : segment.text;
|
|
33
24
|
return `${name}, ${valueText}`;
|
|
34
25
|
}
|
|
35
26
|
const announceLocalizedSegment = (params)=>{
|
|
@@ -386,11 +377,22 @@ function useDatePickerEnvironment(explicitDisabled, explicitDir, ref) {
|
|
|
386
377
|
dir
|
|
387
378
|
};
|
|
388
379
|
}
|
|
389
|
-
function DatePicker({ children, className, defaultOpen = false, defaultValue, disabled: explicitDisabled, dir: explicitDir, endName, flip = true, form, granularity = "day", gutter = 8, hideTimeZone = false, hourCycle, id, invalid, isDateUnavailable, isTimeUnavailable, locale
|
|
380
|
+
function DatePicker({ children, className, defaultOpen = false, defaultValue, disabled: explicitDisabled, dir: explicitDir, endName, flip = true, form, granularity = "day", gutter = 8, hideTimeZone = false, hourCycle, id, invalid, isDateUnavailable, isTimeUnavailable, locale: explicitLocale, max: maximum, min: minimum, name, numOfMonths, offset = {
|
|
390
381
|
mainAxis: 8,
|
|
391
382
|
crossAxis: 0
|
|
392
383
|
}, onOpenChange, onValueChange, open, overflowPadding = 8, placement = "bottom-start", readOnly, ref, required, sameWidth = false, selectionMode = "single", shouldForceLeadingZeros = false, size = "md", slide = true, startOfWeek, startName, timeZone = "UTC", translations, value, ...htmlProps }) {
|
|
393
|
-
const
|
|
384
|
+
const messages = useUiMessages();
|
|
385
|
+
const { emptySegment: explicitEmptySegment, segmentLabels: explicitSegmentLabels, ...explicitPickerTranslations } = translations ?? {};
|
|
386
|
+
const emptySegment = explicitEmptySegment ?? messages.datePicker.emptySegment;
|
|
387
|
+
const segmentLabels = {
|
|
388
|
+
...messages.datePicker.segments,
|
|
389
|
+
...definedEntries(explicitSegmentLabels)
|
|
390
|
+
};
|
|
391
|
+
const pickerTranslations = {
|
|
392
|
+
...messages.datePicker.translations,
|
|
393
|
+
...definedEntries(explicitPickerTranslations)
|
|
394
|
+
};
|
|
395
|
+
const locale = explicitLocale ?? messages.locale ?? "en-US";
|
|
394
396
|
const generatedId = useId();
|
|
395
397
|
const uniqueId = id ?? generatedId;
|
|
396
398
|
const { rootElementRef, disabledProbeRef, rootRef, disabled, dir } = useDatePickerEnvironment(explicitDisabled, explicitDir, ref);
|
|
@@ -703,7 +705,7 @@ function DatePicker({ children, className, defaultOpen = false, defaultValue, di
|
|
|
703
705
|
index: 0 === index ? 0 : 1
|
|
704
706
|
})).flat().some((segment)=>segment.isEditable && segment.isPlaceholder);
|
|
705
707
|
const candidate = "range" === selectionMode ? rangeInputDraft ?? acceptedValues : segmentInputDraft?.[0] ?? acceptedScalarValue;
|
|
706
|
-
probe.setCustomValidity(required && incomplete || !candidateAllowed(Array.isArray(candidate) && 0 === candidate.length ? null : candidate) ?
|
|
708
|
+
probe.setCustomValidity(required && incomplete || !candidateAllowed(Array.isArray(candidate) && 0 === candidate.length ? null : candidate) ? messages.datePicker.unavailableValue : "");
|
|
707
709
|
});
|
|
708
710
|
const canConfirm = !interactionBlocked && canConfirmDatePickerDraft(coordinator, isTimeUnavailable, min, max, isDateUnavailable ? (date)=>isDateUnavailable(date, locale) : void 0);
|
|
709
711
|
const submitDraft = ()=>{
|
|
@@ -730,8 +732,11 @@ function DatePicker({ children, className, defaultOpen = false, defaultValue, di
|
|
|
730
732
|
};
|
|
731
733
|
const validationMessageId = `${uniqueId}-validation`;
|
|
732
734
|
const invalidCandidate = null !== segmentInputDraft && !candidateAllowed("range" === selectionMode ? segmentInputDraft : segmentInputDraft[0] ?? null) || null !== rangeInputDraft && 2 === rangeInputDraft.length && !candidateAllowed(rangeInputDraft) || coordinator.draft?.candidate != null && !candidateAllowed(coordinator.draft.candidate);
|
|
733
|
-
let validationMessage = nativeInvalid ?
|
|
734
|
-
if (invalidCandidate) validationMessage =
|
|
735
|
+
let validationMessage = nativeInvalid ? messages.datePicker.incompleteValue : void 0;
|
|
736
|
+
if (invalidCandidate) validationMessage = messages.datePicker.outOfRange({
|
|
737
|
+
min: min?.toString(),
|
|
738
|
+
max: max?.toString()
|
|
739
|
+
});
|
|
735
740
|
const rootProps = mergeProps(htmlProps, pickerApi.getRootProps());
|
|
736
741
|
return /*#__PURE__*/ jsx(DatePickerContext.Provider, {
|
|
737
742
|
value: {
|
|
@@ -912,7 +917,10 @@ DatePicker.Control = function({ children, className, ref, ...props }) {
|
|
|
912
917
|
})
|
|
913
918
|
});
|
|
914
919
|
};
|
|
915
|
-
DatePicker.Segments = function({ className, endLabel
|
|
920
|
+
DatePicker.Segments = function({ className, endLabel: explicitEndLabel, ref, separator = "–", startLabel: explicitStartLabel, ...props }) {
|
|
921
|
+
const messages = useUiMessages();
|
|
922
|
+
const endLabel = explicitEndLabel ?? messages.datePicker.end;
|
|
923
|
+
const startLabel = explicitStartLabel ?? messages.datePicker.start;
|
|
916
924
|
const { dateInputApi, locale, sendSegmentInput, prepareSegmentDeletion, validationMessage, validationMessageId, required, segmentLabels, selectionMode, styles, descriptions, errorDescriptions } = useDatePickerContext();
|
|
917
925
|
const startDescriptorId = useId();
|
|
918
926
|
const endDescriptorId = useId();
|
|
@@ -1634,23 +1642,26 @@ DatePicker.Calendar = function({ className, ref, ...props }) {
|
|
|
1634
1642
|
children: panelMonths.map(renderDayPanel)
|
|
1635
1643
|
});
|
|
1636
1644
|
};
|
|
1637
|
-
DatePicker.TimeControl = function({ className, endLabel
|
|
1645
|
+
DatePicker.TimeControl = function({ className, endLabel: explicitEndLabel, ref, startLabel: explicitStartLabel, ...props }) {
|
|
1646
|
+
const messages = useUiMessages();
|
|
1647
|
+
const endLabel = explicitEndLabel ?? messages.datePicker.endTime;
|
|
1648
|
+
const startLabel = explicitStartLabel ?? messages.datePicker.startTime;
|
|
1638
1649
|
const { coordinator, granularity, hideTimeZone, hourCycle, isTimed, pickerApi, selectionMode, setDraftTimePart, validationMessage, validationMessageId, styles } = useDatePickerContext();
|
|
1639
1650
|
if (!isTimed) return null;
|
|
1640
1651
|
const visibleParts = [
|
|
1641
1652
|
{
|
|
1642
|
-
label:
|
|
1653
|
+
label: messages.datePicker.segments.hour,
|
|
1643
1654
|
part: "hour"
|
|
1644
1655
|
},
|
|
1645
1656
|
..."minute" === granularity || "second" === granularity ? [
|
|
1646
1657
|
{
|
|
1647
|
-
label:
|
|
1658
|
+
label: messages.datePicker.segments.minute,
|
|
1648
1659
|
part: "minute"
|
|
1649
1660
|
}
|
|
1650
1661
|
] : [],
|
|
1651
1662
|
..."second" === granularity ? [
|
|
1652
1663
|
{
|
|
1653
|
-
label:
|
|
1664
|
+
label: messages.datePicker.segments.second,
|
|
1654
1665
|
part: "second"
|
|
1655
1666
|
}
|
|
1656
1667
|
] : []
|
|
@@ -1749,10 +1760,10 @@ DatePicker.TimeControl = function({ className, endLabel = "End time", ref, start
|
|
|
1749
1760
|
children: [
|
|
1750
1761
|
/*#__PURE__*/ jsx("span", {
|
|
1751
1762
|
className: styles.timeLabel(),
|
|
1752
|
-
children:
|
|
1763
|
+
children: messages.datePicker.dayPeriod
|
|
1753
1764
|
}),
|
|
1754
1765
|
/*#__PURE__*/ jsxs("select", {
|
|
1755
|
-
"aria-label": "range" === selectionMode ?
|
|
1766
|
+
"aria-label": "range" === selectionMode ? messages.datePicker.dayPeriodOf(accessibleLabel) : messages.datePicker.dayPeriod,
|
|
1756
1767
|
className: styles.dayPeriod(),
|
|
1757
1768
|
disabled: isDisabled,
|
|
1758
1769
|
onChange: (event)=>{
|
|
@@ -1767,11 +1778,11 @@ DatePicker.TimeControl = function({ className, endLabel = "End time", ref, start
|
|
|
1767
1778
|
}),
|
|
1768
1779
|
/*#__PURE__*/ jsx("option", {
|
|
1769
1780
|
value: "0",
|
|
1770
|
-
children:
|
|
1781
|
+
children: messages.datePicker.am
|
|
1771
1782
|
}),
|
|
1772
1783
|
/*#__PURE__*/ jsx("option", {
|
|
1773
1784
|
value: "12",
|
|
1774
|
-
children:
|
|
1785
|
+
children: messages.datePicker.pm
|
|
1775
1786
|
})
|
|
1776
1787
|
]
|
|
1777
1788
|
})
|
|
@@ -1789,7 +1800,7 @@ DatePicker.TimeControl = function({ className, endLabel = "End time", ref, start
|
|
|
1789
1800
|
};
|
|
1790
1801
|
return /*#__PURE__*/ jsxs("div", {
|
|
1791
1802
|
...props,
|
|
1792
|
-
"aria-label": props["aria-label"] ?? ("single" === selectionMode ?
|
|
1803
|
+
"aria-label": props["aria-label"] ?? ("single" === selectionMode ? messages.datePicker.time : messages.datePicker.startAndEndTimes),
|
|
1793
1804
|
className: styles.timeControl({
|
|
1794
1805
|
className
|
|
1795
1806
|
}),
|
|
@@ -1801,7 +1812,7 @@ DatePicker.TimeControl = function({ className, endLabel = "End time", ref, start
|
|
|
1801
1812
|
ref: ref,
|
|
1802
1813
|
role: "group",
|
|
1803
1814
|
children: [
|
|
1804
|
-
renderTimeGroup(0, "range" === selectionMode ? startLabel :
|
|
1815
|
+
renderTimeGroup(0, "range" === selectionMode ? startLabel : messages.datePicker.time),
|
|
1805
1816
|
"range" === selectionMode ? renderTimeGroup(1, endLabel) : null
|
|
1806
1817
|
]
|
|
1807
1818
|
});
|
|
@@ -1818,7 +1829,9 @@ DatePicker.Footer = function({ className, ref, ...props }) {
|
|
|
1818
1829
|
ref: ref
|
|
1819
1830
|
});
|
|
1820
1831
|
};
|
|
1821
|
-
DatePicker.CancelTrigger = function({ children
|
|
1832
|
+
DatePicker.CancelTrigger = function({ children: explicitChildren, className, onClick, ref, size: sizeProp, theme = "borderless", type = "button", variant = "secondary", ...props }) {
|
|
1833
|
+
const messages = useUiMessages();
|
|
1834
|
+
const children = explicitChildren ?? messages.datePicker.cancel;
|
|
1822
1835
|
const { requestOpen, size, styles } = useDatePickerContext();
|
|
1823
1836
|
const actionSize = sizeProp ?? ("lg" === size ? "md" : "sm");
|
|
1824
1837
|
const handleClick = (event)=>{
|
|
@@ -1841,7 +1854,9 @@ DatePicker.CancelTrigger = function({ children = "Cancel", className, onClick, r
|
|
|
1841
1854
|
children: children
|
|
1842
1855
|
});
|
|
1843
1856
|
};
|
|
1844
|
-
DatePicker.ConfirmTrigger = function({ children
|
|
1857
|
+
DatePicker.ConfirmTrigger = function({ children: explicitChildren, className, disabled, onClick, ref, size: sizeProp, theme = "solid", type = "button", variant = "primary", ...props }) {
|
|
1858
|
+
const messages = useUiMessages();
|
|
1859
|
+
const children = explicitChildren ?? messages.datePicker.confirm;
|
|
1845
1860
|
const { canConfirm, size, styles, submitDraft } = useDatePickerContext();
|
|
1846
1861
|
const actionSize = sizeProp ?? ("lg" === size ? "md" : "sm");
|
|
1847
1862
|
const handleClick = (event)=>{
|
package/dist/molecules/dialog.js
CHANGED
|
@@ -8,6 +8,7 @@ import { ActionIcon } from "../atoms/action-icon.js";
|
|
|
8
8
|
import { Button } from "../atoms/button.js";
|
|
9
9
|
import { useComposedRefs } from "../internal/molecules/drawer.context.js";
|
|
10
10
|
import { BodyPortal, OverlayContainerProvider } from "../internal/overlay-portal.js";
|
|
11
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
11
12
|
const dialogVariants = tv({
|
|
12
13
|
slots: {
|
|
13
14
|
backdrop: [
|
|
@@ -248,7 +249,8 @@ const dialogVariants = tv({
|
|
|
248
249
|
position: "fixed"
|
|
249
250
|
}
|
|
250
251
|
});
|
|
251
|
-
function Dialog({ "aria-label": ariaLabel, id, open, onOpenChange, initialFocusEl, finalFocusEl, role = "dialog", placement = "center", position = "fixed", size = "md", behavior = "modal", closeOnEscape = true, closeOnInteractOutside = true, preventScroll, trapFocus, customTrigger = false, triggerText
|
|
252
|
+
function Dialog({ "aria-label": ariaLabel, id, open, onOpenChange, initialFocusEl, finalFocusEl, role = "dialog", placement = "center", position = "fixed", size = "md", behavior = "modal", closeOnEscape = true, closeOnInteractOutside = true, preventScroll, trapFocus, customTrigger = false, triggerText, title, description, children, hideCloseButton = false, closeLabel, actions, className, contentRef, contentStyle, modal, portal = true }) {
|
|
253
|
+
const messages = useUiMessages();
|
|
252
254
|
const generatedId = useId();
|
|
253
255
|
const uniqueId = id || generatedId;
|
|
254
256
|
const isModal = modal ?? "modeless" !== behavior;
|
|
@@ -305,7 +307,7 @@ function Dialog({ "aria-label": ariaLabel, id, open, onOpenChange, initialFocusE
|
|
|
305
307
|
size: "md",
|
|
306
308
|
tone: "neutral",
|
|
307
309
|
...api.getCloseTriggerProps(),
|
|
308
|
-
"aria-label": closeLabel
|
|
310
|
+
"aria-label": closeLabel ?? messages.dialog.close
|
|
309
311
|
}),
|
|
310
312
|
/*#__PURE__*/ jsxs("div", {
|
|
311
313
|
className: scrollViewport(),
|
|
@@ -340,7 +342,7 @@ function Dialog({ "aria-label": ariaLabel, id, open, onOpenChange, initialFocusE
|
|
|
340
342
|
size: "sm",
|
|
341
343
|
variant: "primary",
|
|
342
344
|
...api.getTriggerProps(),
|
|
343
|
-
children: triggerText
|
|
345
|
+
children: triggerText ?? messages.dialog.open
|
|
344
346
|
}),
|
|
345
347
|
api.open && (portal ? /*#__PURE__*/ jsx(BodyPortal, {
|
|
346
348
|
children: dialogContent()
|
package/dist/molecules/drawer.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Button } from "../atoms/button.js";
|
|
|
8
8
|
import { DrawerProvider, DrawerStackProvider, getDrawerPresenceProps, useComposedRefs, useDrawer, useDrawerContext, useDrawerPresence, useDrawerStackContext } from "../internal/molecules/drawer.context.js";
|
|
9
9
|
import { drawerVariants } from "../internal/molecules/drawer.styles.js";
|
|
10
10
|
import { BodyPortal, OverlayContainerProvider, restoreFocusAfterOverlayClose } from "../internal/overlay-portal.js";
|
|
11
|
+
import { useUiMessages } from "../messages/ui-messages-provider.js";
|
|
11
12
|
function getDrawerQueryRoot(root) {
|
|
12
13
|
return 9 === root.nodeType || 11 === root.nodeType ? root : root.ownerDocument ?? document;
|
|
13
14
|
}
|
|
@@ -213,6 +214,7 @@ Drawer.Description = function({ className, ref, ...props }) {
|
|
|
213
214
|
});
|
|
214
215
|
};
|
|
215
216
|
Drawer.CloseTrigger = function(props) {
|
|
217
|
+
const messages = useUiMessages();
|
|
216
218
|
const { api, styles } = useDrawerContext();
|
|
217
219
|
const { onClick: onMachineClick, ...machineProps } = api.getCloseTriggerProps();
|
|
218
220
|
if (null == props.children) {
|
|
@@ -220,7 +222,7 @@ Drawer.CloseTrigger = function(props) {
|
|
|
220
222
|
const mergedProps = mergeProps(iconProps, machineProps);
|
|
221
223
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
222
224
|
...mergedProps,
|
|
223
|
-
"aria-label": mergedProps["aria-label"] ??
|
|
225
|
+
"aria-label": mergedProps["aria-label"] ?? messages.drawer.close,
|
|
224
226
|
className: styles.closeTrigger({
|
|
225
227
|
className: iconClassName
|
|
226
228
|
}),
|