@jobber/components 9.7.0 → 9.9.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/dist/Combobox/Combobox.messages.d.ts +34 -0
- package/dist/Combobox/index.cjs +2 -1
- package/dist/Combobox/index.mjs +2 -1
- package/dist/Combobox-cjs.js +69 -27
- package/dist/Combobox-es.js +69 -27
- package/dist/DataTable/components/DataTableSortableHeader.d.ts +6 -0
- package/dist/DataTableTable-cjs.js +9 -4
- package/dist/DataTableTable-es.js +9 -4
- package/dist/InputNumber/InputNumber.messages.d.ts +18 -0
- package/dist/InputNumber/index.cjs +2 -2
- package/dist/InputNumber/index.mjs +2 -2
- package/dist/InputNumber-cjs.js +33 -4
- package/dist/InputNumber-es.js +33 -4
- package/dist/docs/DataTable/DataTable.md +15 -0
- package/dist/styles.css +18 -0
- package/package.json +2 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const comboboxMessages: {
|
|
2
|
+
noResults: {
|
|
3
|
+
en: string;
|
|
4
|
+
es: string;
|
|
5
|
+
};
|
|
6
|
+
clearSelection: {
|
|
7
|
+
en: string;
|
|
8
|
+
es: string;
|
|
9
|
+
};
|
|
10
|
+
openOptions: {
|
|
11
|
+
en: string;
|
|
12
|
+
es: string;
|
|
13
|
+
};
|
|
14
|
+
loadingOptions: {
|
|
15
|
+
en: string;
|
|
16
|
+
es: string;
|
|
17
|
+
};
|
|
18
|
+
"Remove {label}": {
|
|
19
|
+
en: string;
|
|
20
|
+
es: string;
|
|
21
|
+
};
|
|
22
|
+
"{count} selected": {
|
|
23
|
+
en: string;
|
|
24
|
+
es: string;
|
|
25
|
+
};
|
|
26
|
+
selectAll: {
|
|
27
|
+
en: string;
|
|
28
|
+
es: string;
|
|
29
|
+
};
|
|
30
|
+
clear: {
|
|
31
|
+
en: string;
|
|
32
|
+
es: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
package/dist/Combobox/index.cjs
CHANGED
|
@@ -4,6 +4,8 @@ var Combobox = require('../Combobox-cjs.js');
|
|
|
4
4
|
require('../tslib.es6-cjs.js');
|
|
5
5
|
require('react');
|
|
6
6
|
require('classnames');
|
|
7
|
+
require('../useAtlantisI18n-cjs.js');
|
|
8
|
+
require('../AtlantisContext-cjs.js');
|
|
7
9
|
require('../Button-cjs.js');
|
|
8
10
|
require('react-router-dom');
|
|
9
11
|
require('../Icon-cjs.js');
|
|
@@ -23,7 +25,6 @@ require('../floating-ui.react-dom-cjs.js');
|
|
|
23
25
|
require('../stringifyLocale-cjs.js');
|
|
24
26
|
require('../useLabel-cjs.js');
|
|
25
27
|
require('../Separator-cjs.js');
|
|
26
|
-
require('../AtlantisContext-cjs.js');
|
|
27
28
|
require('../Glimmer-cjs.js');
|
|
28
29
|
require('../Content-cjs.js');
|
|
29
30
|
require('../HelperText-cjs.js');
|
package/dist/Combobox/index.mjs
CHANGED
|
@@ -2,6 +2,8 @@ export { C as Combobox } from '../Combobox-es.js';
|
|
|
2
2
|
import '../tslib.es6-es.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'classnames';
|
|
5
|
+
import '../useAtlantisI18n-es.js';
|
|
6
|
+
import '../AtlantisContext-es.js';
|
|
5
7
|
import '../Button-es.js';
|
|
6
8
|
import 'react-router-dom';
|
|
7
9
|
import '../Icon-es.js';
|
|
@@ -21,7 +23,6 @@ import '../floating-ui.react-dom-es.js';
|
|
|
21
23
|
import '../stringifyLocale-es.js';
|
|
22
24
|
import '../useLabel-es.js';
|
|
23
25
|
import '../Separator-es.js';
|
|
24
|
-
import '../AtlantisContext-es.js';
|
|
25
26
|
import '../Glimmer-es.js';
|
|
26
27
|
import '../Content-es.js';
|
|
27
28
|
import '../HelperText-es.js';
|
package/dist/Combobox-cjs.js
CHANGED
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
+
var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
|
|
7
|
+
var AtlantisContext = require('./AtlantisContext-cjs.js');
|
|
6
8
|
var Button = require('./Button-cjs.js');
|
|
7
9
|
var buttonRenderAdapter = require('./buttonRenderAdapter-cjs.js');
|
|
8
10
|
var ComboboxPrimitive = require('./ComboboxPrimitive-cjs.js');
|
|
9
11
|
var useRenderElement = require('./useRenderElement-cjs.js');
|
|
10
12
|
var Icon = require('./Icon-cjs.js');
|
|
11
13
|
var mergeClassName = require('./mergeClassName-cjs.js');
|
|
12
|
-
var AtlantisContext = require('./AtlantisContext-cjs.js');
|
|
13
14
|
var Glimmer = require('./Glimmer-cjs.js');
|
|
14
15
|
var HelperText = require('./HelperText-cjs.js');
|
|
15
16
|
var FieldDescription = require('./FieldDescription-cjs.js');
|
|
@@ -167,6 +168,41 @@ const isComboboxContentSlotElement = comboboxContentSlotSystem.isSlotElement;
|
|
|
167
168
|
|
|
168
169
|
var styles = {"root":"B0QmBtwlnHs-","sizeBase":"RViH4KcR7S4-","sizeSmall":"PhTQQLSQRfU-","sizeLarge":"_2GAP0lCM9iU-","hasLabel":"dCxC3YMhuE8-","label":"_0Ro-CPw-pBk-","innerLabel":"DZ76oTE8arw-","screenReaderOnly":"g6OcEs38-W4-","labelNote":"glfCUzOoqRs-","description":"hJLDca6C4mg-","error":"Otz3vBkHwV4-","itemContent":"CU-nnrvSp74-","itemPrefix":"YSCJxqQHVik-","itemSuffix":"N-6lDLwoViE-","itemIndicator":"UBwTOYJSaBc-","itemText":"TysU0fU7VI0-","itemLabel":"oV92tIYbjmQ-","itemDescription":"xN4obreiDIQ-","clear":"wOdZIAytarU-","triggerIconRotate":"_0jDShCnQjxc-","trigger":"mKKJ60Qxxmw-","triggerValueControl":"v6DatDYO-gk-","triggerValue":"LyrziI4LY5w-","triggerValueText":"ayWSHF3Mwfc-","triggerValueIcon":"Glijnn9-fUw-","mobileBackdrop":"_-0af5xRGjJ8-","input":"-io5LRdyoKw-","actions":"QW4rICN6z4c-","action":"_5BO0h44F148-","actionPrefix":"Anagh40JJn8-","actionLabel":"h7YEFty4FKU-","footer":"_9lX7ptB9-fA-","selectedCount":"OrcuITnCXZk-","empty":"ba6Qla9fx-g-","loading":"_5zl8TjDQSnQ-","loadingRow":"eir2NHzbDEQ-","loadingGlimmer":"eCs-SVKfAYc-","multipleChips":"eGxgqB0y1PA-","multiplePlaceholder":"Z07vGalCLy0-","multipleChip":"d3M1dXi1qlU-","multipleInput":"_-3jWBOtOWpY-","content":"m417c1Vd--E-","list":"zKAmeSlRRN4-","spinning":"mqMvu8yxz2w-"};
|
|
169
170
|
|
|
171
|
+
const comboboxMessages = useAtlantisI18n.defineMessages({
|
|
172
|
+
noResults: {
|
|
173
|
+
en: "No results found",
|
|
174
|
+
es: "No se encontraron resultados",
|
|
175
|
+
},
|
|
176
|
+
clearSelection: {
|
|
177
|
+
en: "Clear selection",
|
|
178
|
+
es: "Borrar selección",
|
|
179
|
+
},
|
|
180
|
+
openOptions: {
|
|
181
|
+
en: "Open options",
|
|
182
|
+
es: "Abrir opciones",
|
|
183
|
+
},
|
|
184
|
+
loadingOptions: {
|
|
185
|
+
en: "Loading options",
|
|
186
|
+
es: "Cargando opciones",
|
|
187
|
+
},
|
|
188
|
+
"Remove {label}": {
|
|
189
|
+
en: "Remove {label}",
|
|
190
|
+
es: "Eliminar {label}",
|
|
191
|
+
},
|
|
192
|
+
"{count} selected": {
|
|
193
|
+
en: "{count} selected",
|
|
194
|
+
es: "{count} seleccionados",
|
|
195
|
+
},
|
|
196
|
+
selectAll: {
|
|
197
|
+
en: "Select all",
|
|
198
|
+
es: "Seleccionar todo",
|
|
199
|
+
},
|
|
200
|
+
clear: {
|
|
201
|
+
en: "Clear",
|
|
202
|
+
es: "Borrar",
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
|
|
170
206
|
function renderFooterActionButton(_a) {
|
|
171
207
|
var { actionButtonRecipe, children, label } = _a, buttonProps = tslib_es6.__rest(_a, ["actionButtonRecipe", "children", "label"]);
|
|
172
208
|
if (children) {
|
|
@@ -188,10 +224,10 @@ function renderFooterChildren(children, multiple) {
|
|
|
188
224
|
return children;
|
|
189
225
|
return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => children(getComboboxFooterState(selectedValue, multiple))));
|
|
190
226
|
}
|
|
191
|
-
function getSelectedCountContent(selectedCount, children) {
|
|
227
|
+
function getSelectedCountContent(selectedCount, defaultMessage, children) {
|
|
192
228
|
if (children)
|
|
193
229
|
return children(selectedCount);
|
|
194
|
-
return
|
|
230
|
+
return defaultMessage;
|
|
195
231
|
}
|
|
196
232
|
function shouldShowSelectAll({ onSelectAll, selectAllState, }) {
|
|
197
233
|
if (!selectAllState || !onSelectAll)
|
|
@@ -231,15 +267,17 @@ function ComboboxFooterBase({ children, className, style, }) {
|
|
|
231
267
|
}
|
|
232
268
|
const ComboboxFooter = assignComboboxContentSlot(ComboboxFooterBase, "footer");
|
|
233
269
|
function ComboboxSelectedCount({ children, className, }) {
|
|
270
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
234
271
|
const { multiple } = useComboboxContext();
|
|
235
272
|
return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => {
|
|
236
273
|
const state = getComboboxFooterState(selectedValue, multiple);
|
|
237
274
|
if (!state.multiple || !state.hasSelection)
|
|
238
275
|
return null;
|
|
239
|
-
return (React.createElement("span", { className: classnames(styles.selectedCount, className) }, getSelectedCountContent(state.selectedCount, children)));
|
|
276
|
+
return (React.createElement("span", { className: classnames(styles.selectedCount, className) }, getSelectedCountContent(state.selectedCount, t("{count} selected", { count: state.selectedCount }), children)));
|
|
240
277
|
}));
|
|
241
278
|
}
|
|
242
|
-
const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelectionFooter({ className, style, showSelectedCount = true, selectAllLabel
|
|
279
|
+
const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelectionFooter({ className, style, showSelectedCount = true, selectAllLabel, selectAllState, onSelectAll, }) {
|
|
280
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
243
281
|
const { multiple } = useComboboxContext();
|
|
244
282
|
if (!multiple)
|
|
245
283
|
return null;
|
|
@@ -254,27 +292,27 @@ const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelec
|
|
|
254
292
|
return (React.createElement(ComboboxFooter, { className: className, style: style },
|
|
255
293
|
showSelectedCount && React.createElement(ComboboxSelectedCount, null),
|
|
256
294
|
React.createElement(ComboboxClearSelection, null),
|
|
257
|
-
showSelectAll && (React.createElement(ComboboxSelectAll, { label: selectAllLabel, onClick: onSelectAll }))));
|
|
295
|
+
showSelectAll && (React.createElement(ComboboxSelectAll, { label: selectAllLabel !== null && selectAllLabel !== void 0 ? selectAllLabel : t("selectAll"), onClick: onSelectAll }))));
|
|
258
296
|
}));
|
|
259
297
|
}, "footer");
|
|
260
298
|
function ComboboxClearSelection(_a) {
|
|
261
|
-
var { children, label
|
|
299
|
+
var { children, label, tabIndex } = _a, clearProps = tslib_es6.__rest(_a, ["children", "label", "tabIndex"]);
|
|
300
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
262
301
|
const { multiple, responsive } = useComboboxContext();
|
|
263
302
|
return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => {
|
|
264
303
|
const state = getComboboxFooterState(selectedValue, multiple);
|
|
265
304
|
if (!state.multiple || !state.hasSelection)
|
|
266
305
|
return null;
|
|
267
|
-
return (React.createElement(ComboboxPrimitive.ComboboxClear, { render: renderFooterClearButton(Object.assign(Object.assign({}, clearProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
|
|
268
|
-
label })), tabIndex: tabIndex }));
|
|
306
|
+
return (React.createElement(ComboboxPrimitive.ComboboxClear, { render: renderFooterClearButton(Object.assign(Object.assign({}, clearProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children, label: label !== null && label !== void 0 ? label : t("clear") })), tabIndex: tabIndex }));
|
|
269
307
|
}));
|
|
270
308
|
}
|
|
271
309
|
function ComboboxSelectAll(_a) {
|
|
272
|
-
var { children, label
|
|
310
|
+
var { children, label } = _a, buttonProps = tslib_es6.__rest(_a, ["children", "label"]);
|
|
311
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
273
312
|
const { multiple, responsive } = useComboboxContext();
|
|
274
313
|
if (!multiple)
|
|
275
314
|
return null;
|
|
276
|
-
return renderFooterActionButton(Object.assign(Object.assign({}, buttonProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
|
|
277
|
-
label }));
|
|
315
|
+
return renderFooterActionButton(Object.assign(Object.assign({}, buttonProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children, label: label !== null && label !== void 0 ? label : t("selectAll") }));
|
|
278
316
|
}
|
|
279
317
|
|
|
280
318
|
function getFallbackChildren(children) {
|
|
@@ -401,7 +439,6 @@ function ComboboxAction(_a) {
|
|
|
401
439
|
|
|
402
440
|
const DEFAULT_LOADING_ROWS = 4;
|
|
403
441
|
const DEFAULT_SIZE = "base";
|
|
404
|
-
const DEFAULT_EMPTY_MESSAGE = "No results found";
|
|
405
442
|
function getSizeClass(size) {
|
|
406
443
|
switch (size) {
|
|
407
444
|
case "small":
|
|
@@ -462,7 +499,7 @@ function parseComboboxContentChildren(children) {
|
|
|
462
499
|
});
|
|
463
500
|
return parsedChildren;
|
|
464
501
|
}
|
|
465
|
-
function getDefaultEmptyChildren({ empty, hasLoading }, emptyContent) {
|
|
502
|
+
function getDefaultEmptyChildren({ empty, hasLoading }, defaultMessage, emptyContent) {
|
|
466
503
|
if (empty.length > 0)
|
|
467
504
|
return empty;
|
|
468
505
|
if (hasLoading)
|
|
@@ -472,7 +509,7 @@ function getDefaultEmptyChildren({ empty, hasLoading }, emptyContent) {
|
|
|
472
509
|
return null;
|
|
473
510
|
return React.createElement(ComboboxEmpty, null, emptyContent);
|
|
474
511
|
}
|
|
475
|
-
return React.createElement(ComboboxEmpty, null,
|
|
512
|
+
return React.createElement(ComboboxEmpty, null, defaultMessage);
|
|
476
513
|
}
|
|
477
514
|
function ComboboxRoot(_a) {
|
|
478
515
|
var { children, className, description, disabled, error, invalid, label, modal, style, multiple, readOnly, size = DEFAULT_SIZE } = _a, rootProps = tslib_es6.__rest(_a, ["children", "className", "description", "disabled", "error", "invalid", "label", "modal", "style", "multiple", "readOnly", "size"]);
|
|
@@ -558,13 +595,14 @@ function DefaultClearIcon() {
|
|
|
558
595
|
return React.createElement(Icon.Icon, { name: "cross", color: "icon", size: "small" });
|
|
559
596
|
}
|
|
560
597
|
function ComboboxTriggerInput(_a) {
|
|
561
|
-
var { className, clearLabel
|
|
598
|
+
var { className, clearLabel, showOptionsLabel } = _a, inputProps = tslib_es6.__rest(_a, ["className", "clearLabel", "showOptionsLabel"]);
|
|
599
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
562
600
|
const context = useOptionalComboboxContext();
|
|
563
601
|
return (React.createElement(ComboboxLabeledInputGroup, null,
|
|
564
602
|
React.createElement(ComboboxInput, Object.assign({}, inputProps, { className: className })),
|
|
565
|
-
!(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly) && (React.createElement(ComboboxClear, { "aria-label": clearLabel },
|
|
603
|
+
!(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly) && (React.createElement(ComboboxClear, { "aria-label": clearLabel !== null && clearLabel !== void 0 ? clearLabel : t("clearSelection") },
|
|
566
604
|
React.createElement(DefaultClearIcon, null))),
|
|
567
|
-
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
605
|
+
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
568
606
|
React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
569
607
|
}
|
|
570
608
|
function ComboboxTriggerValue(_a) {
|
|
@@ -594,11 +632,12 @@ function renderMultipleValueChips({ getItemLabel, renderChipContent, resolveRemo
|
|
|
594
632
|
}
|
|
595
633
|
function ComboboxTriggerMultipleWithInput(_a) {
|
|
596
634
|
var _b;
|
|
597
|
-
var { className, getItemLabel = getDefaultItemLabel, getRemoveLabel, renderItem, showOptionsLabel
|
|
635
|
+
var { className, getItemLabel = getDefaultItemLabel, getRemoveLabel, renderItem, showOptionsLabel } = _a, inputProps = tslib_es6.__rest(_a, ["className", "getItemLabel", "getRemoveLabel", "renderItem", "showOptionsLabel"]);
|
|
636
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
598
637
|
const context = useOptionalComboboxContext();
|
|
599
638
|
const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
600
639
|
const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
|
|
601
|
-
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) =>
|
|
640
|
+
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => t("Remove {label}", { label: getItemLabel(value) }));
|
|
602
641
|
const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
|
|
603
642
|
return (React.createElement(ComboboxLabeledInputGroup, null,
|
|
604
643
|
React.createElement(ComboboxChips, null,
|
|
@@ -610,16 +649,17 @@ function ComboboxTriggerMultipleWithInput(_a) {
|
|
|
610
649
|
showChipRemove,
|
|
611
650
|
})),
|
|
612
651
|
React.createElement(ComboboxPrimitive.ComboboxInput, Object.assign({}, inputProps, { className: mergeClassName.mergeClassName(styles.multipleInput, className) }))),
|
|
613
|
-
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
652
|
+
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
614
653
|
React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
615
654
|
}
|
|
616
655
|
function ComboboxTriggerMultipleValue(_a) {
|
|
617
656
|
var _b;
|
|
618
|
-
var { getItemLabel = getDefaultItemLabel, getRemoveLabel, placeholder, renderItem, showOptionsLabel
|
|
657
|
+
var { getItemLabel = getDefaultItemLabel, getRemoveLabel, placeholder, renderItem, showOptionsLabel } = _a, chipsProps = tslib_es6.__rest(_a, ["getItemLabel", "getRemoveLabel", "placeholder", "renderItem", "showOptionsLabel"]);
|
|
658
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
619
659
|
const context = useOptionalComboboxContext();
|
|
620
660
|
const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
621
661
|
const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
|
|
622
|
-
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) =>
|
|
662
|
+
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => t("Remove {label}", { label: getItemLabel(value) }));
|
|
623
663
|
const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
|
|
624
664
|
const setPositionerAnchor = context === null || context === void 0 ? void 0 : context.setPositionerAnchor;
|
|
625
665
|
const inputGroupRef = React.useCallback((anchor) => setPositionerAnchor === null || setPositionerAnchor === void 0 ? void 0 : setPositionerAnchor(anchor), [setPositionerAnchor]);
|
|
@@ -634,15 +674,16 @@ function ComboboxTriggerMultipleValue(_a) {
|
|
|
634
674
|
showChipRemove,
|
|
635
675
|
})
|
|
636
676
|
: hasPlaceholder(placeholder) && (React.createElement("span", { className: styles.multiplePlaceholder }, placeholder)))),
|
|
637
|
-
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
677
|
+
React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
638
678
|
React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
639
679
|
}
|
|
640
680
|
function ComboboxContent({ ariaLabel, children, className, empty, style, }) {
|
|
641
681
|
var _a;
|
|
682
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
642
683
|
const context = useOptionalComboboxContext();
|
|
643
684
|
const responsive = (_a = context === null || context === void 0 ? void 0 : context.responsive) !== null && _a !== void 0 ? _a : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
644
685
|
const contentChildren = parseComboboxContentChildren(children);
|
|
645
|
-
const emptyChildren = getDefaultEmptyChildren(contentChildren, empty);
|
|
686
|
+
const emptyChildren = getDefaultEmptyChildren(contentChildren, t("noResults"), empty);
|
|
646
687
|
return (React.createElement(ComboboxPrimitive.ComboboxPortal, null,
|
|
647
688
|
React.createElement(ComboboxPrimitive.ComboboxBackdrop, { className: styles.mobileBackdrop }),
|
|
648
689
|
React.createElement(ComboboxPrimitive.ComboboxPositioner, Object.assign({}, responsive.positionerProps, { anchor: context === null || context === void 0 ? void 0 : context.positionerAnchor }),
|
|
@@ -667,12 +708,13 @@ function getLoadingRowCount(rows) {
|
|
|
667
708
|
return Math.max(0, Math.floor(rows));
|
|
668
709
|
}
|
|
669
710
|
function ComboboxLoadingComponent(_a) {
|
|
670
|
-
var { children, className, rows = DEFAULT_LOADING_ROWS, role = "status", "aria-label": ariaLabel
|
|
711
|
+
var { children, className, rows = DEFAULT_LOADING_ROWS, role = "status", "aria-label": ariaLabel } = _a, loadingProps = tslib_es6.__rest(_a, ["children", "className", "rows", "role", "aria-label"]);
|
|
712
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(comboboxMessages);
|
|
671
713
|
const rowCount = getLoadingRowCount(rows);
|
|
672
714
|
const content = children !== null && children !== void 0 ? children : Array.from({ length: rowCount }, (_, index) => (React.createElement("div", { "aria-hidden": "true", className: styles.loadingRow, key: `loading-row-${index}` },
|
|
673
715
|
React.createElement("div", { className: styles.loadingGlimmer },
|
|
674
716
|
React.createElement(Glimmer.Glimmer, { shape: "rectangle", size: "auto" })))));
|
|
675
|
-
return (React.createElement("div", Object.assign({}, loadingProps, { "aria-label": ariaLabel, className: classnames(styles.loading, className), role: role }), content));
|
|
717
|
+
return (React.createElement("div", Object.assign({}, loadingProps, { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("loadingOptions"), className: classnames(styles.loading, className), role: role }), content));
|
|
676
718
|
}
|
|
677
719
|
const ComboboxLoading = assignComboboxContentSlot(ComboboxLoadingComponent, "loading");
|
|
678
720
|
const Combobox = Object.assign(ComboboxRoot, {
|
package/dist/Combobox-es.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
2
|
import React__default, { useState, useEffect } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
|
|
5
|
+
import { u as useAtlantisContext } from './AtlantisContext-es.js';
|
|
4
6
|
import { B as Button } from './Button-es.js';
|
|
5
7
|
import { n as normalizeBaseUiButtonProps } from './buttonRenderAdapter-es.js';
|
|
6
8
|
import { a as ComboboxValue, b as ComboboxClear$1, c as ComboboxList$1, d as ComboboxItem$1, e as ComboboxItemIndicator$1, f as ComboboxRow$1, g as ComboboxCollection$1, h as ComboboxGroup$1, i as ComboboxGroupLabel$1, j as ComboboxSeparator$1, k as ComboboxIcon, l as ComboboxChip, m as ComboboxChipRemove, n as ComboboxStatus, u as useFilter$1, o as useFilteredItems$1, p as ComboboxRoot$1, q as ComboboxInputGroup$1, r as ComboboxInput$1, s as ComboboxTrigger$1, t as ComboboxPortal, v as ComboboxBackdrop, w as ComboboxPositioner, x as ComboboxPopup, y as ComboboxChips$1, z as ComboboxEmpty$1 } from './ComboboxPrimitive-es.js';
|
|
7
9
|
import { m as mergeProps } from './useRenderElement-es.js';
|
|
8
10
|
import { I as Icon } from './Icon-es.js';
|
|
9
11
|
import { m as mergeClassName } from './mergeClassName-es.js';
|
|
10
|
-
import { u as useAtlantisContext } from './AtlantisContext-es.js';
|
|
11
12
|
import { G as Glimmer } from './Glimmer-es.js';
|
|
12
13
|
import { H as HelperText } from './HelperText-es.js';
|
|
13
14
|
import { F as FieldRoot, a as FieldLabel, b as FieldDescription, c as FieldError } from './FieldDescription-es.js';
|
|
@@ -165,6 +166,41 @@ const isComboboxContentSlotElement = comboboxContentSlotSystem.isSlotElement;
|
|
|
165
166
|
|
|
166
167
|
var styles = {"root":"B0QmBtwlnHs-","sizeBase":"RViH4KcR7S4-","sizeSmall":"PhTQQLSQRfU-","sizeLarge":"_2GAP0lCM9iU-","hasLabel":"dCxC3YMhuE8-","label":"_0Ro-CPw-pBk-","innerLabel":"DZ76oTE8arw-","screenReaderOnly":"g6OcEs38-W4-","labelNote":"glfCUzOoqRs-","description":"hJLDca6C4mg-","error":"Otz3vBkHwV4-","itemContent":"CU-nnrvSp74-","itemPrefix":"YSCJxqQHVik-","itemSuffix":"N-6lDLwoViE-","itemIndicator":"UBwTOYJSaBc-","itemText":"TysU0fU7VI0-","itemLabel":"oV92tIYbjmQ-","itemDescription":"xN4obreiDIQ-","clear":"wOdZIAytarU-","triggerIconRotate":"_0jDShCnQjxc-","trigger":"mKKJ60Qxxmw-","triggerValueControl":"v6DatDYO-gk-","triggerValue":"LyrziI4LY5w-","triggerValueText":"ayWSHF3Mwfc-","triggerValueIcon":"Glijnn9-fUw-","mobileBackdrop":"_-0af5xRGjJ8-","input":"-io5LRdyoKw-","actions":"QW4rICN6z4c-","action":"_5BO0h44F148-","actionPrefix":"Anagh40JJn8-","actionLabel":"h7YEFty4FKU-","footer":"_9lX7ptB9-fA-","selectedCount":"OrcuITnCXZk-","empty":"ba6Qla9fx-g-","loading":"_5zl8TjDQSnQ-","loadingRow":"eir2NHzbDEQ-","loadingGlimmer":"eCs-SVKfAYc-","multipleChips":"eGxgqB0y1PA-","multiplePlaceholder":"Z07vGalCLy0-","multipleChip":"d3M1dXi1qlU-","multipleInput":"_-3jWBOtOWpY-","content":"m417c1Vd--E-","list":"zKAmeSlRRN4-","spinning":"mqMvu8yxz2w-"};
|
|
167
168
|
|
|
169
|
+
const comboboxMessages = defineMessages({
|
|
170
|
+
noResults: {
|
|
171
|
+
en: "No results found",
|
|
172
|
+
es: "No se encontraron resultados",
|
|
173
|
+
},
|
|
174
|
+
clearSelection: {
|
|
175
|
+
en: "Clear selection",
|
|
176
|
+
es: "Borrar selección",
|
|
177
|
+
},
|
|
178
|
+
openOptions: {
|
|
179
|
+
en: "Open options",
|
|
180
|
+
es: "Abrir opciones",
|
|
181
|
+
},
|
|
182
|
+
loadingOptions: {
|
|
183
|
+
en: "Loading options",
|
|
184
|
+
es: "Cargando opciones",
|
|
185
|
+
},
|
|
186
|
+
"Remove {label}": {
|
|
187
|
+
en: "Remove {label}",
|
|
188
|
+
es: "Eliminar {label}",
|
|
189
|
+
},
|
|
190
|
+
"{count} selected": {
|
|
191
|
+
en: "{count} selected",
|
|
192
|
+
es: "{count} seleccionados",
|
|
193
|
+
},
|
|
194
|
+
selectAll: {
|
|
195
|
+
en: "Select all",
|
|
196
|
+
es: "Seleccionar todo",
|
|
197
|
+
},
|
|
198
|
+
clear: {
|
|
199
|
+
en: "Clear",
|
|
200
|
+
es: "Borrar",
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
|
|
168
204
|
function renderFooterActionButton(_a) {
|
|
169
205
|
var { actionButtonRecipe, children, label } = _a, buttonProps = __rest(_a, ["actionButtonRecipe", "children", "label"]);
|
|
170
206
|
if (children) {
|
|
@@ -186,10 +222,10 @@ function renderFooterChildren(children, multiple) {
|
|
|
186
222
|
return children;
|
|
187
223
|
return (React__default.createElement(ComboboxValue, null, (selectedValue) => children(getComboboxFooterState(selectedValue, multiple))));
|
|
188
224
|
}
|
|
189
|
-
function getSelectedCountContent(selectedCount, children) {
|
|
225
|
+
function getSelectedCountContent(selectedCount, defaultMessage, children) {
|
|
190
226
|
if (children)
|
|
191
227
|
return children(selectedCount);
|
|
192
|
-
return
|
|
228
|
+
return defaultMessage;
|
|
193
229
|
}
|
|
194
230
|
function shouldShowSelectAll({ onSelectAll, selectAllState, }) {
|
|
195
231
|
if (!selectAllState || !onSelectAll)
|
|
@@ -229,15 +265,17 @@ function ComboboxFooterBase({ children, className, style, }) {
|
|
|
229
265
|
}
|
|
230
266
|
const ComboboxFooter = assignComboboxContentSlot(ComboboxFooterBase, "footer");
|
|
231
267
|
function ComboboxSelectedCount({ children, className, }) {
|
|
268
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
232
269
|
const { multiple } = useComboboxContext();
|
|
233
270
|
return (React__default.createElement(ComboboxValue, null, (selectedValue) => {
|
|
234
271
|
const state = getComboboxFooterState(selectedValue, multiple);
|
|
235
272
|
if (!state.multiple || !state.hasSelection)
|
|
236
273
|
return null;
|
|
237
|
-
return (React__default.createElement("span", { className: classnames(styles.selectedCount, className) }, getSelectedCountContent(state.selectedCount, children)));
|
|
274
|
+
return (React__default.createElement("span", { className: classnames(styles.selectedCount, className) }, getSelectedCountContent(state.selectedCount, t("{count} selected", { count: state.selectedCount }), children)));
|
|
238
275
|
}));
|
|
239
276
|
}
|
|
240
|
-
const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelectionFooter({ className, style, showSelectedCount = true, selectAllLabel
|
|
277
|
+
const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelectionFooter({ className, style, showSelectedCount = true, selectAllLabel, selectAllState, onSelectAll, }) {
|
|
278
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
241
279
|
const { multiple } = useComboboxContext();
|
|
242
280
|
if (!multiple)
|
|
243
281
|
return null;
|
|
@@ -252,27 +290,27 @@ const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelec
|
|
|
252
290
|
return (React__default.createElement(ComboboxFooter, { className: className, style: style },
|
|
253
291
|
showSelectedCount && React__default.createElement(ComboboxSelectedCount, null),
|
|
254
292
|
React__default.createElement(ComboboxClearSelection, null),
|
|
255
|
-
showSelectAll && (React__default.createElement(ComboboxSelectAll, { label: selectAllLabel, onClick: onSelectAll }))));
|
|
293
|
+
showSelectAll && (React__default.createElement(ComboboxSelectAll, { label: selectAllLabel !== null && selectAllLabel !== void 0 ? selectAllLabel : t("selectAll"), onClick: onSelectAll }))));
|
|
256
294
|
}));
|
|
257
295
|
}, "footer");
|
|
258
296
|
function ComboboxClearSelection(_a) {
|
|
259
|
-
var { children, label
|
|
297
|
+
var { children, label, tabIndex } = _a, clearProps = __rest(_a, ["children", "label", "tabIndex"]);
|
|
298
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
260
299
|
const { multiple, responsive } = useComboboxContext();
|
|
261
300
|
return (React__default.createElement(ComboboxValue, null, (selectedValue) => {
|
|
262
301
|
const state = getComboboxFooterState(selectedValue, multiple);
|
|
263
302
|
if (!state.multiple || !state.hasSelection)
|
|
264
303
|
return null;
|
|
265
|
-
return (React__default.createElement(ComboboxClear$1, { render: renderFooterClearButton(Object.assign(Object.assign({}, clearProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
|
|
266
|
-
label })), tabIndex: tabIndex }));
|
|
304
|
+
return (React__default.createElement(ComboboxClear$1, { render: renderFooterClearButton(Object.assign(Object.assign({}, clearProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children, label: label !== null && label !== void 0 ? label : t("clear") })), tabIndex: tabIndex }));
|
|
267
305
|
}));
|
|
268
306
|
}
|
|
269
307
|
function ComboboxSelectAll(_a) {
|
|
270
|
-
var { children, label
|
|
308
|
+
var { children, label } = _a, buttonProps = __rest(_a, ["children", "label"]);
|
|
309
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
271
310
|
const { multiple, responsive } = useComboboxContext();
|
|
272
311
|
if (!multiple)
|
|
273
312
|
return null;
|
|
274
|
-
return renderFooterActionButton(Object.assign(Object.assign({}, buttonProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
|
|
275
|
-
label }));
|
|
313
|
+
return renderFooterActionButton(Object.assign(Object.assign({}, buttonProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children, label: label !== null && label !== void 0 ? label : t("selectAll") }));
|
|
276
314
|
}
|
|
277
315
|
|
|
278
316
|
function getFallbackChildren(children) {
|
|
@@ -399,7 +437,6 @@ function ComboboxAction(_a) {
|
|
|
399
437
|
|
|
400
438
|
const DEFAULT_LOADING_ROWS = 4;
|
|
401
439
|
const DEFAULT_SIZE = "base";
|
|
402
|
-
const DEFAULT_EMPTY_MESSAGE = "No results found";
|
|
403
440
|
function getSizeClass(size) {
|
|
404
441
|
switch (size) {
|
|
405
442
|
case "small":
|
|
@@ -460,7 +497,7 @@ function parseComboboxContentChildren(children) {
|
|
|
460
497
|
});
|
|
461
498
|
return parsedChildren;
|
|
462
499
|
}
|
|
463
|
-
function getDefaultEmptyChildren({ empty, hasLoading }, emptyContent) {
|
|
500
|
+
function getDefaultEmptyChildren({ empty, hasLoading }, defaultMessage, emptyContent) {
|
|
464
501
|
if (empty.length > 0)
|
|
465
502
|
return empty;
|
|
466
503
|
if (hasLoading)
|
|
@@ -470,7 +507,7 @@ function getDefaultEmptyChildren({ empty, hasLoading }, emptyContent) {
|
|
|
470
507
|
return null;
|
|
471
508
|
return React__default.createElement(ComboboxEmpty, null, emptyContent);
|
|
472
509
|
}
|
|
473
|
-
return React__default.createElement(ComboboxEmpty, null,
|
|
510
|
+
return React__default.createElement(ComboboxEmpty, null, defaultMessage);
|
|
474
511
|
}
|
|
475
512
|
function ComboboxRoot(_a) {
|
|
476
513
|
var { children, className, description, disabled, error, invalid, label, modal, style, multiple, readOnly, size = DEFAULT_SIZE } = _a, rootProps = __rest(_a, ["children", "className", "description", "disabled", "error", "invalid", "label", "modal", "style", "multiple", "readOnly", "size"]);
|
|
@@ -556,13 +593,14 @@ function DefaultClearIcon() {
|
|
|
556
593
|
return React__default.createElement(Icon, { name: "cross", color: "icon", size: "small" });
|
|
557
594
|
}
|
|
558
595
|
function ComboboxTriggerInput(_a) {
|
|
559
|
-
var { className, clearLabel
|
|
596
|
+
var { className, clearLabel, showOptionsLabel } = _a, inputProps = __rest(_a, ["className", "clearLabel", "showOptionsLabel"]);
|
|
597
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
560
598
|
const context = useOptionalComboboxContext();
|
|
561
599
|
return (React__default.createElement(ComboboxLabeledInputGroup, null,
|
|
562
600
|
React__default.createElement(ComboboxInput, Object.assign({}, inputProps, { className: className })),
|
|
563
|
-
!(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly) && (React__default.createElement(ComboboxClear, { "aria-label": clearLabel },
|
|
601
|
+
!(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly) && (React__default.createElement(ComboboxClear, { "aria-label": clearLabel !== null && clearLabel !== void 0 ? clearLabel : t("clearSelection") },
|
|
564
602
|
React__default.createElement(DefaultClearIcon, null))),
|
|
565
|
-
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
603
|
+
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
566
604
|
React__default.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
567
605
|
}
|
|
568
606
|
function ComboboxTriggerValue(_a) {
|
|
@@ -592,11 +630,12 @@ function renderMultipleValueChips({ getItemLabel, renderChipContent, resolveRemo
|
|
|
592
630
|
}
|
|
593
631
|
function ComboboxTriggerMultipleWithInput(_a) {
|
|
594
632
|
var _b;
|
|
595
|
-
var { className, getItemLabel = getDefaultItemLabel, getRemoveLabel, renderItem, showOptionsLabel
|
|
633
|
+
var { className, getItemLabel = getDefaultItemLabel, getRemoveLabel, renderItem, showOptionsLabel } = _a, inputProps = __rest(_a, ["className", "getItemLabel", "getRemoveLabel", "renderItem", "showOptionsLabel"]);
|
|
634
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
596
635
|
const context = useOptionalComboboxContext();
|
|
597
636
|
const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
598
637
|
const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
|
|
599
|
-
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) =>
|
|
638
|
+
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => t("Remove {label}", { label: getItemLabel(value) }));
|
|
600
639
|
const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
|
|
601
640
|
return (React__default.createElement(ComboboxLabeledInputGroup, null,
|
|
602
641
|
React__default.createElement(ComboboxChips, null,
|
|
@@ -608,16 +647,17 @@ function ComboboxTriggerMultipleWithInput(_a) {
|
|
|
608
647
|
showChipRemove,
|
|
609
648
|
})),
|
|
610
649
|
React__default.createElement(ComboboxInput$1, Object.assign({}, inputProps, { className: mergeClassName(styles.multipleInput, className) }))),
|
|
611
|
-
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
650
|
+
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
612
651
|
React__default.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
613
652
|
}
|
|
614
653
|
function ComboboxTriggerMultipleValue(_a) {
|
|
615
654
|
var _b;
|
|
616
|
-
var { getItemLabel = getDefaultItemLabel, getRemoveLabel, placeholder, renderItem, showOptionsLabel
|
|
655
|
+
var { getItemLabel = getDefaultItemLabel, getRemoveLabel, placeholder, renderItem, showOptionsLabel } = _a, chipsProps = __rest(_a, ["getItemLabel", "getRemoveLabel", "placeholder", "renderItem", "showOptionsLabel"]);
|
|
656
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
617
657
|
const context = useOptionalComboboxContext();
|
|
618
658
|
const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
619
659
|
const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
|
|
620
|
-
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) =>
|
|
660
|
+
const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => t("Remove {label}", { label: getItemLabel(value) }));
|
|
621
661
|
const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
|
|
622
662
|
const setPositionerAnchor = context === null || context === void 0 ? void 0 : context.setPositionerAnchor;
|
|
623
663
|
const inputGroupRef = React__default.useCallback((anchor) => setPositionerAnchor === null || setPositionerAnchor === void 0 ? void 0 : setPositionerAnchor(anchor), [setPositionerAnchor]);
|
|
@@ -632,15 +672,16 @@ function ComboboxTriggerMultipleValue(_a) {
|
|
|
632
672
|
showChipRemove,
|
|
633
673
|
})
|
|
634
674
|
: hasPlaceholder(placeholder) && (React__default.createElement("span", { className: styles.multiplePlaceholder }, placeholder)))),
|
|
635
|
-
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
|
|
675
|
+
React__default.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel !== null && showOptionsLabel !== void 0 ? showOptionsLabel : t("openOptions") },
|
|
636
676
|
React__default.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
|
|
637
677
|
}
|
|
638
678
|
function ComboboxContent({ ariaLabel, children, className, empty, style, }) {
|
|
639
679
|
var _a;
|
|
680
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
640
681
|
const context = useOptionalComboboxContext();
|
|
641
682
|
const responsive = (_a = context === null || context === void 0 ? void 0 : context.responsive) !== null && _a !== void 0 ? _a : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
|
|
642
683
|
const contentChildren = parseComboboxContentChildren(children);
|
|
643
|
-
const emptyChildren = getDefaultEmptyChildren(contentChildren, empty);
|
|
684
|
+
const emptyChildren = getDefaultEmptyChildren(contentChildren, t("noResults"), empty);
|
|
644
685
|
return (React__default.createElement(ComboboxPortal, null,
|
|
645
686
|
React__default.createElement(ComboboxBackdrop, { className: styles.mobileBackdrop }),
|
|
646
687
|
React__default.createElement(ComboboxPositioner, Object.assign({}, responsive.positionerProps, { anchor: context === null || context === void 0 ? void 0 : context.positionerAnchor }),
|
|
@@ -665,12 +706,13 @@ function getLoadingRowCount(rows) {
|
|
|
665
706
|
return Math.max(0, Math.floor(rows));
|
|
666
707
|
}
|
|
667
708
|
function ComboboxLoadingComponent(_a) {
|
|
668
|
-
var { children, className, rows = DEFAULT_LOADING_ROWS, role = "status", "aria-label": ariaLabel
|
|
709
|
+
var { children, className, rows = DEFAULT_LOADING_ROWS, role = "status", "aria-label": ariaLabel } = _a, loadingProps = __rest(_a, ["children", "className", "rows", "role", "aria-label"]);
|
|
710
|
+
const { t } = useAtlantisI18n(comboboxMessages);
|
|
669
711
|
const rowCount = getLoadingRowCount(rows);
|
|
670
712
|
const content = children !== null && children !== void 0 ? children : Array.from({ length: rowCount }, (_, index) => (React__default.createElement("div", { "aria-hidden": "true", className: styles.loadingRow, key: `loading-row-${index}` },
|
|
671
713
|
React__default.createElement("div", { className: styles.loadingGlimmer },
|
|
672
714
|
React__default.createElement(Glimmer, { shape: "rectangle", size: "auto" })))));
|
|
673
|
-
return (React__default.createElement("div", Object.assign({}, loadingProps, { "aria-label": ariaLabel, className: classnames(styles.loading, className), role: role }), content));
|
|
715
|
+
return (React__default.createElement("div", Object.assign({}, loadingProps, { "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("loadingOptions"), className: classnames(styles.loading, className), role: role }), content));
|
|
674
716
|
}
|
|
675
717
|
const ComboboxLoading = assignComboboxContentSlot(ComboboxLoadingComponent, "loading");
|
|
676
718
|
const Combobox = Object.assign(ComboboxRoot, {
|
|
@@ -14,5 +14,11 @@ export interface DataTableSortableHeaderProps {
|
|
|
14
14
|
* When undefined, the header renders as non-interactive.
|
|
15
15
|
*/
|
|
16
16
|
readonly onSort?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* The horizontal alignment of the header content and sort icon.
|
|
19
|
+
*
|
|
20
|
+
* @default "start"
|
|
21
|
+
*/
|
|
22
|
+
readonly align?: "start" | "center" | "end";
|
|
17
23
|
}
|
|
18
24
|
export declare function DataTableSortableHeader(props: DataTableSortableHeaderProps & React.HTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
|
|
@@ -39,7 +39,7 @@ function SortIcon({ direction }) {
|
|
|
39
39
|
React.createElement("path", { className: finalStyle.downArrowStyle, d: "M8.29292 13.3339C8.68345 12.9434 9.31661 12.9434 9.70714 13.3339L12.2968 15.8573L14.8787 13.3339C15.2692 12.9434 15.9024 12.9434 16.2929 13.3339C16.6834 13.7244 16.6834 14.3576 16.2929 14.7481L13 18.041C12.6095 18.4315 11.9763 18.4315 11.5858 18.041L8.29292 14.7481C7.9024 14.3576 7.9024 13.7244 8.29292 13.3339Z" }))));
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","row":"sJQbtw-NEHU-","clickableRow":"J2p1EeT252A-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
|
|
42
|
+
var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","alignCenter":"w4UHxTf-Z0Q-","alignEnd":"O7R9Tt281nY-","row":"sJQbtw-NEHU-","clickableRow":"J2p1EeT252A-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
|
|
43
43
|
|
|
44
44
|
function DataTableActions(props) {
|
|
45
45
|
return (React.createElement("div", Object.assign({}, props, { className: classnames(styles.actions, props.className) }), props.children));
|
|
@@ -94,13 +94,18 @@ function DataTableRowActions(props) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function DataTableSortableHeader(props) {
|
|
97
|
-
const { children, direction, onSort } = props, rest = tslib_es6.__rest(props, ["children", "direction", "onSort"]);
|
|
97
|
+
const { children, direction, onSort, align = "start" } = props, rest = tslib_es6.__rest(props, ["children", "direction", "onSort", "align"]);
|
|
98
98
|
const isSortable = direction !== undefined && onSort !== undefined;
|
|
99
|
+
const alignmentClass = {
|
|
100
|
+
start: undefined,
|
|
101
|
+
center: styles.alignCenter,
|
|
102
|
+
end: styles.alignEnd,
|
|
103
|
+
}[align];
|
|
99
104
|
if (!isSortable) {
|
|
100
|
-
return React.createElement(DataTableHeaderCell, Object.assign({}, rest), children);
|
|
105
|
+
return (React.createElement(DataTableHeaderCell, Object.assign({}, rest, { className: classnames(rest.className, alignmentClass) }), children));
|
|
101
106
|
}
|
|
102
107
|
return (React.createElement(DataTableHeaderCell, Object.assign({}, rest),
|
|
103
|
-
React.createElement("button", { type: "button", onClick: onSort, className: styles.sortableButton },
|
|
108
|
+
React.createElement("button", { type: "button", onClick: onSort, className: classnames(styles.sortableButton, alignmentClass) },
|
|
104
109
|
React.createElement("span", { className: styles.focusArea },
|
|
105
110
|
children,
|
|
106
111
|
React.createElement(SortIcon, { direction: direction })))));
|
|
@@ -37,7 +37,7 @@ function SortIcon({ direction }) {
|
|
|
37
37
|
React__default.createElement("path", { className: finalStyle.downArrowStyle, d: "M8.29292 13.3339C8.68345 12.9434 9.31661 12.9434 9.70714 13.3339L12.2968 15.8573L14.8787 13.3339C15.2692 12.9434 15.9024 12.9434 16.2929 13.3339C16.6834 13.7244 16.6834 14.3576 16.2929 14.7481L13 18.041C12.6095 18.4315 11.9763 18.4315 11.5858 18.041L8.29292 14.7481C7.9024 14.3576 7.9024 13.7244 8.29292 13.3339Z" }))));
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","row":"sJQbtw-NEHU-","clickableRow":"J2p1EeT252A-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
|
|
40
|
+
var styles = {"container":"_1-DPmbxOkZ8-","tableElement":"kJeYcsgg700-","header":"_5d2OcsTVgzU-","headerCell":"LTx0tCU3F2I-","sortableButton":"WTQCrd2d8nw-","focusArea":"RipbH3rRU-E-","alignCenter":"w4UHxTf-Z0Q-","alignEnd":"O7R9Tt281nY-","row":"sJQbtw-NEHU-","clickableRow":"J2p1EeT252A-","cell":"_1UpLYTK64uY-","footer":"qe-6UrAFLTo-","actions":"_2fZsLSaNPnI-","rowActions":"pElxuwpGmCI-","pagination":"thJ-CSoe0ps-","spinning":"EBpmC7cZzCs-"};
|
|
41
41
|
|
|
42
42
|
function DataTableActions(props) {
|
|
43
43
|
return (React__default.createElement("div", Object.assign({}, props, { className: classnames(styles.actions, props.className) }), props.children));
|
|
@@ -92,13 +92,18 @@ function DataTableRowActions(props) {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
function DataTableSortableHeader(props) {
|
|
95
|
-
const { children, direction, onSort } = props, rest = __rest(props, ["children", "direction", "onSort"]);
|
|
95
|
+
const { children, direction, onSort, align = "start" } = props, rest = __rest(props, ["children", "direction", "onSort", "align"]);
|
|
96
96
|
const isSortable = direction !== undefined && onSort !== undefined;
|
|
97
|
+
const alignmentClass = {
|
|
98
|
+
start: undefined,
|
|
99
|
+
center: styles.alignCenter,
|
|
100
|
+
end: styles.alignEnd,
|
|
101
|
+
}[align];
|
|
97
102
|
if (!isSortable) {
|
|
98
|
-
return React__default.createElement(DataTableHeaderCell, Object.assign({}, rest), children);
|
|
103
|
+
return (React__default.createElement(DataTableHeaderCell, Object.assign({}, rest, { className: classnames(rest.className, alignmentClass) }), children));
|
|
99
104
|
}
|
|
100
105
|
return (React__default.createElement(DataTableHeaderCell, Object.assign({}, rest),
|
|
101
|
-
React__default.createElement("button", { type: "button", onClick: onSort, className: styles.sortableButton },
|
|
106
|
+
React__default.createElement("button", { type: "button", onClick: onSort, className: classnames(styles.sortableButton, alignmentClass) },
|
|
102
107
|
React__default.createElement("span", { className: styles.focusArea },
|
|
103
108
|
children,
|
|
104
109
|
React__default.createElement(SortIcon, { direction: direction })))));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const inputNumberMessages: {
|
|
2
|
+
"Increase {label}": {
|
|
3
|
+
en: string;
|
|
4
|
+
es: string;
|
|
5
|
+
};
|
|
6
|
+
"Decrease {label}": {
|
|
7
|
+
en: string;
|
|
8
|
+
es: string;
|
|
9
|
+
};
|
|
10
|
+
value: {
|
|
11
|
+
en: string;
|
|
12
|
+
es: string;
|
|
13
|
+
};
|
|
14
|
+
Action: {
|
|
15
|
+
en: string;
|
|
16
|
+
es: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -4,10 +4,10 @@ var InputNumber = require('../InputNumber-cjs.js');
|
|
|
4
4
|
require('../tslib.es6-cjs.js');
|
|
5
5
|
require('react');
|
|
6
6
|
require('classnames');
|
|
7
|
-
require('../ActivityIndicator-cjs.js');
|
|
8
|
-
require('../common.messages-cjs.js');
|
|
9
7
|
require('../useAtlantisI18n-cjs.js');
|
|
10
8
|
require('../AtlantisContext-cjs.js');
|
|
9
|
+
require('../ActivityIndicator-cjs.js');
|
|
10
|
+
require('../common.messages-cjs.js');
|
|
11
11
|
require('../Button-cjs.js');
|
|
12
12
|
require('react-router-dom');
|
|
13
13
|
require('../Icon-cjs.js');
|
|
@@ -2,10 +2,10 @@ export { I as InputNumber } from '../InputNumber-es.js';
|
|
|
2
2
|
import '../tslib.es6-es.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import 'classnames';
|
|
5
|
-
import '../ActivityIndicator-es.js';
|
|
6
|
-
import '../common.messages-es.js';
|
|
7
5
|
import '../useAtlantisI18n-es.js';
|
|
8
6
|
import '../AtlantisContext-es.js';
|
|
7
|
+
import '../ActivityIndicator-es.js';
|
|
8
|
+
import '../common.messages-es.js';
|
|
9
9
|
import '../Button-es.js';
|
|
10
10
|
import 'react-router-dom';
|
|
11
11
|
import '../Icon-es.js';
|
package/dist/InputNumber-cjs.js
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var classnames = require('classnames');
|
|
6
|
+
var useAtlantisI18n = require('./useAtlantisI18n-cjs.js');
|
|
7
|
+
require('./AtlantisContext-cjs.js');
|
|
6
8
|
var ActivityIndicator = require('./ActivityIndicator-cjs.js');
|
|
7
9
|
var Button = require('./Button-cjs.js');
|
|
8
10
|
var Icon = require('./Icon-cjs.js');
|
|
@@ -16,6 +18,25 @@ var NumberFieldInput = require('./NumberFieldInput-cjs.js');
|
|
|
16
18
|
|
|
17
19
|
var styles = {"container":"-W4QiocGsR4-","inline":"_9-f2CjSVojs-","wrapper":"_4y342TRP-y8-","disabled":"d-YOq6z4ZxM-","small":"YTL0AyJdbC8-","large":"mUfanIovnVg-","center":"_8MM9keFOeD0-","right":"mTeuCQufdj4-","inputWrapper":"IgE0pfetwVM-","input":"MxShJMNKSB4-","stepper":"SE8DXlYN02U-","loadingIndicator":"VmKH2-NlbDI-","label":"f1OiicY3UzU-","hideLabel":"j9oUhNvNwsE-","affixLabel":"oR6I7xtSbL4-","prefix":"s-WnNh4k-kw-","suffix":"Ep7K8jug-Xc-","affixIcon":"E3w3BEJoBFE-","compoundAffix":"znvaejix3iE-","affixLabelText":"m1ZP5T4QOAQ-","stepperButton":"_22AXoGKVAjc-","belowField":"kkywg49kgrg-","description":"buIzMqBEpSQ-","spinning":"p8ebLlGf8JY-"};
|
|
18
20
|
|
|
21
|
+
const inputNumberMessages = useAtlantisI18n.defineMessages({
|
|
22
|
+
"Increase {label}": {
|
|
23
|
+
en: "Increase {label}",
|
|
24
|
+
es: "Aumentar {label}",
|
|
25
|
+
},
|
|
26
|
+
"Decrease {label}": {
|
|
27
|
+
en: "Decrease {label}",
|
|
28
|
+
es: "Disminuir {label}",
|
|
29
|
+
},
|
|
30
|
+
value: {
|
|
31
|
+
en: "value",
|
|
32
|
+
es: "valor",
|
|
33
|
+
},
|
|
34
|
+
Action: {
|
|
35
|
+
en: "Action",
|
|
36
|
+
es: "Acción",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
19
40
|
/**
|
|
20
41
|
* Default formatting used only when the consumer does not pass `format`.
|
|
21
42
|
* Thousands grouping is left at Intl's default (on) to match the
|
|
@@ -178,13 +199,15 @@ function InputNumberStepper({ children, incrementLabel, decrementLabel, classNam
|
|
|
178
199
|
}
|
|
179
200
|
function InputNumberIncrement({ children, ariaLabel, className, style, }) {
|
|
180
201
|
useInputNumberContext("Increment");
|
|
202
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(inputNumberMessages);
|
|
181
203
|
const rootProps = useRenderElement.mergeProps({ className: styles.stepperButton }, { className, style });
|
|
182
|
-
return (React.createElement(NumberFieldInput.NumberFieldIncrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Increase value" }, rootProps), children !== null && children !== void 0 ? children : (React.createElement(Icon.Icon, { name: "arrowUp", size: "small", customColor: "currentColor" }))));
|
|
204
|
+
return (React.createElement(NumberFieldInput.NumberFieldIncrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Increase {label}", { label: t("value") }) }, rootProps), children !== null && children !== void 0 ? children : (React.createElement(Icon.Icon, { name: "arrowUp", size: "small", customColor: "currentColor" }))));
|
|
183
205
|
}
|
|
184
206
|
function InputNumberDecrement({ children, ariaLabel, className, style, }) {
|
|
185
207
|
useInputNumberContext("Decrement");
|
|
208
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(inputNumberMessages);
|
|
186
209
|
const rootProps = useRenderElement.mergeProps({ className: styles.stepperButton }, { className, style });
|
|
187
|
-
return (React.createElement(NumberFieldInput.NumberFieldDecrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Decrease value" }, rootProps), children !== null && children !== void 0 ? children : (React.createElement(Icon.Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
210
|
+
return (React.createElement(NumberFieldInput.NumberFieldDecrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Decrease {label}", { label: t("value") }) }, rootProps), children !== null && children !== void 0 ? children : (React.createElement(Icon.Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
188
211
|
}
|
|
189
212
|
function InputNumberAffixCompound({ variation, label, icon, onClick, ariaLabel, children, className, style, }) {
|
|
190
213
|
const ctx = useInputNumberContext("Affix");
|
|
@@ -219,9 +242,10 @@ function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
|
|
|
219
242
|
React.createElement(AffixIconContent, { icon: icon, size: size, onClick: onClick, ariaLabel: ariaLabel })));
|
|
220
243
|
}
|
|
221
244
|
function AffixIconContent({ icon, size, onClick, ariaLabel, }) {
|
|
245
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(inputNumberMessages);
|
|
222
246
|
const iconSize = size === "small" ? "small" : "base";
|
|
223
247
|
if (onClick) {
|
|
224
|
-
return (React.createElement(Button.Button, { ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Action", icon: icon, onClick: onClick, size: iconSize, type: "tertiary", variation: "subtle" }));
|
|
248
|
+
return (React.createElement(Button.Button, { ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Action"), icon: icon, onClick: onClick, size: iconSize, type: "tertiary", variation: "subtle" }));
|
|
225
249
|
}
|
|
226
250
|
return React.createElement(Icon.Icon, { name: icon, size: iconSize, color: "greyBlue" });
|
|
227
251
|
}
|
|
@@ -243,6 +267,7 @@ function resolveAutoComplete(autoComplete) {
|
|
|
243
267
|
function InputNumber(_a) {
|
|
244
268
|
var _b;
|
|
245
269
|
var { ref } = _a, props = tslib_es6.__rest(_a, ["ref"]);
|
|
270
|
+
const { t } = useAtlantisI18n.useAtlantisI18n(inputNumberMessages);
|
|
246
271
|
const { label, description, error, prefix, suffix } = props, config = tslib_es6.__rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
247
272
|
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
248
273
|
return (React.createElement(InputNumberWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
@@ -250,7 +275,11 @@ function InputNumber(_a) {
|
|
|
250
275
|
prefix && renderDefaultAffix("prefix", prefix, size),
|
|
251
276
|
React.createElement(InputNumberInput, null,
|
|
252
277
|
React.createElement(InputNumberLabel, null, label),
|
|
253
|
-
config.loading ? (React.createElement(InputNumberLoading, null)) : (React.createElement(InputNumberStepper, { incrementLabel:
|
|
278
|
+
config.loading ? (React.createElement(InputNumberLoading, null)) : (React.createElement(InputNumberStepper, { incrementLabel: t("Increase {label}", {
|
|
279
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
280
|
+
}), decrementLabel: t("Decrease {label}", {
|
|
281
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
282
|
+
}) }))),
|
|
254
283
|
suffix && renderDefaultAffix("suffix", suffix, size)),
|
|
255
284
|
(description || error) && (React.createElement(InputNumberFooter, null,
|
|
256
285
|
React.createElement(InputNumberDescription, null, description),
|
package/dist/InputNumber-es.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
2
|
import React__default, { createContext, useId, useRef, useImperativeHandle, useCallback, useMemo, useContext } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
+
import { d as defineMessages, u as useAtlantisI18n } from './useAtlantisI18n-es.js';
|
|
5
|
+
import './AtlantisContext-es.js';
|
|
4
6
|
import { A as ActivityIndicator } from './ActivityIndicator-es.js';
|
|
5
7
|
import { B as Button } from './Button-es.js';
|
|
6
8
|
import { I as Icon } from './Icon-es.js';
|
|
@@ -14,6 +16,25 @@ import { N as NumberFieldRoot, a as NumberFieldGroup, b as NumberFieldInput, c a
|
|
|
14
16
|
|
|
15
17
|
var styles = {"container":"-W4QiocGsR4-","inline":"_9-f2CjSVojs-","wrapper":"_4y342TRP-y8-","disabled":"d-YOq6z4ZxM-","small":"YTL0AyJdbC8-","large":"mUfanIovnVg-","center":"_8MM9keFOeD0-","right":"mTeuCQufdj4-","inputWrapper":"IgE0pfetwVM-","input":"MxShJMNKSB4-","stepper":"SE8DXlYN02U-","loadingIndicator":"VmKH2-NlbDI-","label":"f1OiicY3UzU-","hideLabel":"j9oUhNvNwsE-","affixLabel":"oR6I7xtSbL4-","prefix":"s-WnNh4k-kw-","suffix":"Ep7K8jug-Xc-","affixIcon":"E3w3BEJoBFE-","compoundAffix":"znvaejix3iE-","affixLabelText":"m1ZP5T4QOAQ-","stepperButton":"_22AXoGKVAjc-","belowField":"kkywg49kgrg-","description":"buIzMqBEpSQ-","spinning":"p8ebLlGf8JY-"};
|
|
16
18
|
|
|
19
|
+
const inputNumberMessages = defineMessages({
|
|
20
|
+
"Increase {label}": {
|
|
21
|
+
en: "Increase {label}",
|
|
22
|
+
es: "Aumentar {label}",
|
|
23
|
+
},
|
|
24
|
+
"Decrease {label}": {
|
|
25
|
+
en: "Decrease {label}",
|
|
26
|
+
es: "Disminuir {label}",
|
|
27
|
+
},
|
|
28
|
+
value: {
|
|
29
|
+
en: "value",
|
|
30
|
+
es: "valor",
|
|
31
|
+
},
|
|
32
|
+
Action: {
|
|
33
|
+
en: "Action",
|
|
34
|
+
es: "Acción",
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
17
38
|
/**
|
|
18
39
|
* Default formatting used only when the consumer does not pass `format`.
|
|
19
40
|
* Thousands grouping is left at Intl's default (on) to match the
|
|
@@ -176,13 +197,15 @@ function InputNumberStepper({ children, incrementLabel, decrementLabel, classNam
|
|
|
176
197
|
}
|
|
177
198
|
function InputNumberIncrement({ children, ariaLabel, className, style, }) {
|
|
178
199
|
useInputNumberContext("Increment");
|
|
200
|
+
const { t } = useAtlantisI18n(inputNumberMessages);
|
|
179
201
|
const rootProps = mergeProps({ className: styles.stepperButton }, { className, style });
|
|
180
|
-
return (React__default.createElement(NumberFieldIncrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Increase value" }, rootProps), children !== null && children !== void 0 ? children : (React__default.createElement(Icon, { name: "arrowUp", size: "small", customColor: "currentColor" }))));
|
|
202
|
+
return (React__default.createElement(NumberFieldIncrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Increase {label}", { label: t("value") }) }, rootProps), children !== null && children !== void 0 ? children : (React__default.createElement(Icon, { name: "arrowUp", size: "small", customColor: "currentColor" }))));
|
|
181
203
|
}
|
|
182
204
|
function InputNumberDecrement({ children, ariaLabel, className, style, }) {
|
|
183
205
|
useInputNumberContext("Decrement");
|
|
206
|
+
const { t } = useAtlantisI18n(inputNumberMessages);
|
|
184
207
|
const rootProps = mergeProps({ className: styles.stepperButton }, { className, style });
|
|
185
|
-
return (React__default.createElement(NumberFieldDecrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Decrease value" }, rootProps), children !== null && children !== void 0 ? children : (React__default.createElement(Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
208
|
+
return (React__default.createElement(NumberFieldDecrement, Object.assign({ "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Decrease {label}", { label: t("value") }) }, rootProps), children !== null && children !== void 0 ? children : (React__default.createElement(Icon, { name: "arrowDown", size: "small", customColor: "currentColor" }))));
|
|
186
209
|
}
|
|
187
210
|
function InputNumberAffixCompound({ variation, label, icon, onClick, ariaLabel, children, className, style, }) {
|
|
188
211
|
const ctx = useInputNumberContext("Affix");
|
|
@@ -217,9 +240,10 @@ function AffixIconSlot({ variation, icon, size, onClick, ariaLabel, }) {
|
|
|
217
240
|
React__default.createElement(AffixIconContent, { icon: icon, size: size, onClick: onClick, ariaLabel: ariaLabel })));
|
|
218
241
|
}
|
|
219
242
|
function AffixIconContent({ icon, size, onClick, ariaLabel, }) {
|
|
243
|
+
const { t } = useAtlantisI18n(inputNumberMessages);
|
|
220
244
|
const iconSize = size === "small" ? "small" : "base";
|
|
221
245
|
if (onClick) {
|
|
222
|
-
return (React__default.createElement(Button, { ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : "Action", icon: icon, onClick: onClick, size: iconSize, type: "tertiary", variation: "subtle" }));
|
|
246
|
+
return (React__default.createElement(Button, { ariaLabel: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t("Action"), icon: icon, onClick: onClick, size: iconSize, type: "tertiary", variation: "subtle" }));
|
|
223
247
|
}
|
|
224
248
|
return React__default.createElement(Icon, { name: icon, size: iconSize, color: "greyBlue" });
|
|
225
249
|
}
|
|
@@ -241,6 +265,7 @@ function resolveAutoComplete(autoComplete) {
|
|
|
241
265
|
function InputNumber(_a) {
|
|
242
266
|
var _b;
|
|
243
267
|
var { ref } = _a, props = __rest(_a, ["ref"]);
|
|
268
|
+
const { t } = useAtlantisI18n(inputNumberMessages);
|
|
244
269
|
const { label, description, error, prefix, suffix } = props, config = __rest(props, ["label", "description", "error", "prefix", "suffix"]);
|
|
245
270
|
const size = (_b = config.size) !== null && _b !== void 0 ? _b : "default";
|
|
246
271
|
return (React__default.createElement(InputNumberWrapper, Object.assign({}, config, { invalid: config.invalid || Boolean(error), ref: ref }),
|
|
@@ -248,7 +273,11 @@ function InputNumber(_a) {
|
|
|
248
273
|
prefix && renderDefaultAffix("prefix", prefix, size),
|
|
249
274
|
React__default.createElement(InputNumberInput, null,
|
|
250
275
|
React__default.createElement(InputNumberLabel, null, label),
|
|
251
|
-
config.loading ? (React__default.createElement(InputNumberLoading, null)) : (React__default.createElement(InputNumberStepper, { incrementLabel:
|
|
276
|
+
config.loading ? (React__default.createElement(InputNumberLoading, null)) : (React__default.createElement(InputNumberStepper, { incrementLabel: t("Increase {label}", {
|
|
277
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
278
|
+
}), decrementLabel: t("Decrease {label}", {
|
|
279
|
+
label: label !== null && label !== void 0 ? label : t("value"),
|
|
280
|
+
}) }))),
|
|
252
281
|
suffix && renderDefaultAffix("suffix", suffix, size)),
|
|
253
282
|
(description || error) && (React__default.createElement(InputNumberFooter, null,
|
|
254
283
|
React__default.createElement(InputNumberDescription, null, description),
|
|
@@ -305,6 +305,20 @@ The `direction` prop accepts:
|
|
|
305
305
|
When both `direction` and `onSort` are provided, the header becomes interactive
|
|
306
306
|
with a sort icon. When either is missing, it renders as a regular header cell.
|
|
307
307
|
|
|
308
|
+
Use the `align` prop to align the header content and sort icon. This is useful
|
|
309
|
+
for numerical columns, where both the values and the header should be
|
|
310
|
+
end-aligned:
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
<DataTable.SortableHeader
|
|
314
|
+
align="end"
|
|
315
|
+
direction={currentSort}
|
|
316
|
+
onSort={() => handleColumnSort("totalPrice")}
|
|
317
|
+
>
|
|
318
|
+
Total price
|
|
319
|
+
</DataTable.SortableHeader>
|
|
320
|
+
```
|
|
321
|
+
|
|
308
322
|
The `direction` prop represents the current sort state of the column. Your
|
|
309
323
|
`onSort` callback should handle the state transitions (ascending → descending →
|
|
310
324
|
equilibrium) based on your application's logic.
|
|
@@ -526,6 +540,7 @@ const table = useReactTable({
|
|
|
526
540
|
|
|
527
541
|
| Prop | Type | Required | Default | Description |
|
|
528
542
|
|------|------|----------|---------|-------------|
|
|
543
|
+
| `align` | `"center" | "end" | "start"` | No | `"start"` | The horizontal alignment of the header content and sort icon. |
|
|
529
544
|
| `children` | `ReactNode` | No | — | The header content to display (text, icons, etc.) |
|
|
530
545
|
| `direction` | `SortDirection` | No | — | The current sort direction for this column. When undefined, the header renders as non-interactive. |
|
|
531
546
|
| `onSort` | `() => void` | No | — | Callback function triggered when the sortable header is clicked. When undefined, the header renders as non-interactive. |
|
package/dist/styles.css
CHANGED
|
@@ -9565,6 +9565,24 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
9565
9565
|
box-shadow: var(--shadow-focus);
|
|
9566
9566
|
}
|
|
9567
9567
|
|
|
9568
|
+
.WTQCrd2d8nw-.w4UHxTf-Z0Q- {
|
|
9569
|
+
-ms-flex-pack: center;
|
|
9570
|
+
justify-content: center;
|
|
9571
|
+
}
|
|
9572
|
+
|
|
9573
|
+
.WTQCrd2d8nw-.O7R9Tt281nY- {
|
|
9574
|
+
-ms-flex-pack: end;
|
|
9575
|
+
justify-content: flex-end;
|
|
9576
|
+
}
|
|
9577
|
+
|
|
9578
|
+
.LTx0tCU3F2I-.w4UHxTf-Z0Q- {
|
|
9579
|
+
text-align: center;
|
|
9580
|
+
}
|
|
9581
|
+
|
|
9582
|
+
.LTx0tCU3F2I-.O7R9Tt281nY- {
|
|
9583
|
+
text-align: right;
|
|
9584
|
+
}
|
|
9585
|
+
|
|
9568
9586
|
.sJQbtw-NEHU- {
|
|
9569
9587
|
position: relative;
|
|
9570
9588
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -549,5 +549,5 @@
|
|
|
549
549
|
"> 1%",
|
|
550
550
|
"IE 10"
|
|
551
551
|
],
|
|
552
|
-
"gitHead": "
|
|
552
|
+
"gitHead": "384a88d1d70cfd6069c4a54436f58fa9b5d40c66"
|
|
553
553
|
}
|