@carto/meridian-ds 2.6.0 → 2.6.1-alpha-searchfield.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/{Alert-DHd9hCGz.js → Alert-BN993lHa.js} +8 -5
- package/dist/{Alert-DOeOwxOe.cjs → Alert-CL9Y3l7D.cjs} +8 -5
- package/dist/{MenuItem-CYJN2OVU.cjs → MenuItem-Bssr5qGq.cjs} +1 -1
- package/dist/{MenuItem-MUmADf3e.js → MenuItem-COajCLkS.js} +1 -1
- package/dist/{SwatchSquare-CaaLsjAC.js → Search-C7wkXu3f.js} +4 -23
- package/dist/{SwatchSquare-B8PIY3Rd.cjs → Search-CMWbM9nD.cjs} +3 -22
- package/dist/SwatchSquare-B6KYVoqV.js +24 -0
- package/dist/SwatchSquare-DuXPIL7t.cjs +23 -0
- package/dist/components/index.cjs +315 -33
- package/dist/components/index.js +318 -36
- package/dist/{css-utils-CCi3p7os.cjs → css-utils-CqIN_t7x.cjs} +3 -0
- package/dist/{css-utils-WejOmkiI.js → css-utils-hxI-qUxK.js} +3 -0
- package/dist/custom-icons/index.cjs +643 -558
- package/dist/custom-icons/index.js +643 -558
- package/dist/theme/index.cjs +14 -4
- package/dist/theme/index.js +15 -5
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts +25 -0
- package/dist/types/components/Autocomplete/CreatableAutocomplete/CreatableAutocomplete.stories.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/CreatableAutocomplete/useCreatableAutocomplete.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/MultipleAutocomplete/useMultipleAutocomplete.d.ts.map +1 -1
- package/dist/types/components/Autocomplete/types.d.ts +4 -1
- package/dist/types/components/Autocomplete/types.d.ts.map +1 -1
- package/dist/types/components/CopiableComponent/CopiableComponent.d.ts.map +1 -1
- package/dist/types/components/CopiableComponent/CopiableComponent.stories.d.ts +3 -0
- package/dist/types/components/CopiableComponent/CopiableComponent.stories.d.ts.map +1 -1
- package/dist/types/components/CopiableComponent/types.d.ts +8 -1
- package/dist/types/components/CopiableComponent/types.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdown.d.ts +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdown.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdown.stories.d.ts +48 -0
- package/dist/types/components/FilterDropdown/FilterDropdown.stories.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/types.d.ts +8 -0
- package/dist/types/components/FilterDropdown/types.d.ts.map +1 -1
- package/dist/types/components/Menu/MenuItemFilter/MenuItemFilter.d.ts.map +1 -1
- package/dist/types/components/Menu/types.d.ts +1 -0
- package/dist/types/components/Menu/types.d.ts.map +1 -1
- package/dist/types/components/SearchField/SearchField.d.ts +4 -0
- package/dist/types/components/SearchField/SearchField.d.ts.map +1 -0
- package/dist/types/components/SearchField/SearchField.stories.d.ts +131 -0
- package/dist/types/components/SearchField/SearchField.stories.d.ts.map +1 -0
- package/dist/types/components/SearchField/SearchField.styled.d.ts +23 -0
- package/dist/types/components/SearchField/SearchField.styled.d.ts.map +1 -0
- package/dist/types/components/SearchField/SearchField.test.d.ts +2 -0
- package/dist/types/components/SearchField/SearchField.test.d.ts.map +1 -0
- package/dist/types/components/SearchField/index.d.ts +3 -0
- package/dist/types/components/SearchField/index.d.ts.map +1 -0
- package/dist/types/components/SearchField/types.d.ts +31 -0
- package/dist/types/components/SearchField/types.d.ts.map +1 -0
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.d.ts.map +1 -1
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts +22 -2
- package/dist/types/components/SelectField/MultipleSelectField/MultipleSelectField.stories.d.ts.map +1 -1
- package/dist/types/components/SelectField/types.d.ts +4 -0
- package/dist/types/components/SelectField/types.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/custom-icons/FoldersStackedOutlined.d.ts +4 -0
- package/dist/types/custom-icons/FoldersStackedOutlined.d.ts.map +1 -0
- package/dist/types/custom-icons/RedoAlt.d.ts +4 -0
- package/dist/types/custom-icons/RedoAlt.d.ts.map +1 -0
- package/dist/types/custom-icons/SelectFeature.d.ts.map +1 -1
- package/dist/types/custom-icons/UndoAlt.d.ts +4 -0
- package/dist/types/custom-icons/UndoAlt.d.ts.map +1 -0
- package/dist/types/custom-icons/index.d.ts +3 -0
- package/dist/types/custom-icons/index.d.ts.map +1 -1
- package/dist/types/localization/en.d.ts +1 -0
- package/dist/types/localization/en.d.ts.map +1 -1
- package/dist/types/localization/es.d.ts +1 -0
- package/dist/types/localization/es.d.ts.map +1 -1
- package/dist/types/localization/id.d.ts +1 -0
- package/dist/types/localization/id.d.ts.map +1 -1
- package/dist/types/localization/index.d.ts +3 -0
- package/dist/types/localization/index.d.ts.map +1 -1
- package/dist/types/theme/carto-theme.d.ts.map +1 -1
- package/dist/types/theme/components/layout.d.ts +3 -0
- package/dist/types/theme/components/layout.d.ts.map +1 -0
- package/dist/types/theme/components/navigation.d.ts.map +1 -1
- package/dist/types/utils/useTranslationWithFallback.d.ts +39 -0
- package/dist/types/utils/useTranslationWithFallback.d.ts.map +1 -0
- package/dist/types/utils/useTranslationWithFallback.test.d.ts +2 -0
- package/dist/types/utils/useTranslationWithFallback.test.d.ts.map +1 -0
- package/dist/widgets/index.cjs +8 -7
- package/dist/widgets/index.js +4 -3
- package/package.json +1 -1
- package/dist/types/utils/useTranslationFallback.d.ts +0 -20
- package/dist/types/utils/useTranslationFallback.d.ts.map +0 -1
- package/dist/types/utils/useTranslationFallback.test.d.ts +0 -2
- package/dist/types/utils/useTranslationFallback.test.d.ts.map +0 -1
package/dist/components/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, useImperativeHandle } from "react";
|
|
3
|
-
import { styled, Box, Button as Button$1, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, Select, FormControl, InputLabel, FormHelperText, Link, Checkbox, IconButton as IconButton$1, ListItemText, Tooltip, ToggleButtonGroup as ToggleButtonGroup$1, Autocomplete as Autocomplete$1, Divider, ListItemIcon, createFilterOptions, alpha, useTheme, AppBar as AppBar$1, Toolbar, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip, DialogContent as DialogContent$1, DialogActions as DialogActions$1, Slide, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Menu as Menu$2, useMediaQuery, Snackbar as Snackbar$1, Portal, Fade } from "@mui/material";
|
|
3
|
+
import { styled, Box, Button as Button$1, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, TextField, InputAdornment, Select, FormControl, InputLabel, FormHelperText, Link, Checkbox, IconButton as IconButton$1, ListItemText, Tooltip, ToggleButtonGroup as ToggleButtonGroup$1, Autocomplete as Autocomplete$1, Divider, ListItemIcon, createFilterOptions, alpha, useTheme, AppBar as AppBar$1, Toolbar, Dialog as Dialog$1, DialogTitle as DialogTitle$1, Chip, DialogContent as DialogContent$1, DialogActions as DialogActions$1, Slide, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Menu as Menu$2, useMediaQuery, Stack, Snackbar as Snackbar$1, Portal, Fade } from "@mui/material";
|
|
4
4
|
import { OpenInNewOutlined, VisibilityOffOutlined, VisibilityOutlined, Cancel, ContentCopyOutlined, AddCircleOutlineOutlined, MenuOutlined, MoreVertOutlined, HelpOutline, ErrorOutline, CloseOutlined, Check, TodayOutlined } from "@mui/icons-material";
|
|
5
|
-
import { u as
|
|
6
|
-
import { L } from "../Alert-
|
|
7
|
-
import { T as Typography, c as ICON_SIZE_SMALL, u as useImperativeIntl, i as IconButton, f as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, h as MENU_ITEM_SIZE_EXTENDED, M as MENU_ITEM_SIZE_DEFAULT, A as APPBAR_SIZE, N as NOTIFICATION_DURATION_IN_MS, e as ellipsisStyles } from "../css-utils-
|
|
8
|
-
import { a } from "../css-utils-
|
|
5
|
+
import { u as useTranslationWithFallback, S as ScreenReaderOnly, A as Alert$1 } from "../Alert-BN993lHa.js";
|
|
6
|
+
import { L } from "../Alert-BN993lHa.js";
|
|
7
|
+
import { T as Typography, c as ICON_SIZE_SMALL, u as useImperativeIntl, i as IconButton, f as MENU_ITEM_SIZE_DENSE, d as MENU_LIST_MAX_SIZE, h as MENU_ITEM_SIZE_EXTENDED, M as MENU_ITEM_SIZE_DEFAULT, A as APPBAR_SIZE, b as ICON_SIZE_MEDIUM, N as NOTIFICATION_DURATION_IN_MS, e as ellipsisStyles } from "../css-utils-hxI-qUxK.js";
|
|
8
|
+
import { a } from "../css-utils-hxI-qUxK.js";
|
|
9
9
|
import { A as ArrowDown } from "../ArrowDown-d6bxUL0F.js";
|
|
10
10
|
import { A as ArrowUp, O as OpenDiagonallyRight, C as CloseDiagonallyRight } from "../OpenDiagonallyRight-CGdCEXlF.js";
|
|
11
11
|
import { useIntl } from "react-intl";
|
|
12
|
-
import { M as MenuItem$1 } from "../MenuItem-
|
|
12
|
+
import { M as MenuItem$1 } from "../MenuItem-COajCLkS.js";
|
|
13
13
|
import "cartocolor";
|
|
14
14
|
import { FixedSizeList } from "react-window";
|
|
15
15
|
import { Controlled, UnControlled } from "react-codemirror2";
|
|
@@ -41,6 +41,7 @@ import { DatePicker as DatePicker$1 } from "@mui/x-date-pickers/DatePicker";
|
|
|
41
41
|
import { PickersDay as PickersDay$1 } from "@mui/x-date-pickers";
|
|
42
42
|
import { TimePicker as TimePicker$1 } from "@mui/x-date-pickers/TimePicker";
|
|
43
43
|
import { DateTimePicker as DateTimePicker$1 } from "@mui/x-date-pickers/DateTimePicker";
|
|
44
|
+
import { S as Search } from "../Search-C7wkXu3f.js";
|
|
44
45
|
import DOMPurify from "dompurify";
|
|
45
46
|
const IndicatorIcon = styled(Box)({
|
|
46
47
|
position: "absolute",
|
|
@@ -69,7 +70,7 @@ function _Button({
|
|
|
69
70
|
"aria-describedby": ariaDescribedby,
|
|
70
71
|
...otherProps
|
|
71
72
|
}, ref) {
|
|
72
|
-
const screenReaderTextValue =
|
|
73
|
+
const screenReaderTextValue = useTranslationWithFallback(
|
|
73
74
|
"c4r.button.opensInNewTab",
|
|
74
75
|
screenReaderText
|
|
75
76
|
);
|
|
@@ -522,11 +523,14 @@ function _MenuItemFilter({
|
|
|
522
523
|
areAnySelected,
|
|
523
524
|
selectAll,
|
|
524
525
|
selectAllDisabled,
|
|
526
|
+
selectAllText,
|
|
525
527
|
"aria-label": ariaLabel,
|
|
526
528
|
"data-testid": dataTestId
|
|
527
529
|
}, ref) {
|
|
528
|
-
const
|
|
529
|
-
|
|
530
|
+
const selectAllLabel = useTranslationWithFallback(
|
|
531
|
+
"c4r.form.selectAll",
|
|
532
|
+
selectAllText
|
|
533
|
+
);
|
|
530
534
|
return /* @__PURE__ */ jsx(
|
|
531
535
|
StyledMenuItem$1,
|
|
532
536
|
{
|
|
@@ -554,7 +558,7 @@ function _MenuItemFilter({
|
|
|
554
558
|
disabled: selectAllDisabled
|
|
555
559
|
}
|
|
556
560
|
),
|
|
557
|
-
|
|
561
|
+
selectAllLabel
|
|
558
562
|
]
|
|
559
563
|
}
|
|
560
564
|
)
|
|
@@ -601,6 +605,10 @@ function _MultipleSelectField({
|
|
|
601
605
|
selectAllDisabled,
|
|
602
606
|
tooltipPlacement,
|
|
603
607
|
variant,
|
|
608
|
+
allSelectedText,
|
|
609
|
+
noneSelectedText,
|
|
610
|
+
selectedText,
|
|
611
|
+
selectAllText,
|
|
604
612
|
...props
|
|
605
613
|
}, ref) {
|
|
606
614
|
const {
|
|
@@ -617,11 +625,19 @@ function _MultipleSelectField({
|
|
|
617
625
|
});
|
|
618
626
|
const isSmall = size === "small";
|
|
619
627
|
const paddingSize = isSmall || variant === "standard" ? 0 : 2;
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
628
|
+
const allSelectedLabel = useTranslationWithFallback(
|
|
629
|
+
"c4r.form.allSelected",
|
|
630
|
+
allSelectedText
|
|
631
|
+
);
|
|
632
|
+
const noneSelectedLabel = useTranslationWithFallback(
|
|
633
|
+
"c4r.form.noneSelected",
|
|
634
|
+
noneSelectedText
|
|
635
|
+
);
|
|
636
|
+
const selectedLabel = useTranslationWithFallback(
|
|
637
|
+
"c4r.form.selected",
|
|
638
|
+
selectedText
|
|
639
|
+
);
|
|
640
|
+
const counterText = `${currentOptions.length} ${selectedLabel}`;
|
|
625
641
|
const renderValue = useMemo(() => {
|
|
626
642
|
if (areAllSelected) {
|
|
627
643
|
return /* @__PURE__ */ jsx(
|
|
@@ -631,7 +647,7 @@ function _MultipleSelectField({
|
|
|
631
647
|
variant: isSmall ? "body2" : "body1",
|
|
632
648
|
color: "textPrimary",
|
|
633
649
|
ml: paddingSize,
|
|
634
|
-
children:
|
|
650
|
+
children: allSelectedLabel
|
|
635
651
|
}
|
|
636
652
|
);
|
|
637
653
|
}
|
|
@@ -654,16 +670,17 @@ function _MultipleSelectField({
|
|
|
654
670
|
variant: isSmall ? "body2" : "body1",
|
|
655
671
|
color: "text.hint",
|
|
656
672
|
ml: paddingSize,
|
|
657
|
-
children: placeholder ??
|
|
673
|
+
children: placeholder ?? noneSelectedLabel
|
|
658
674
|
}
|
|
659
675
|
);
|
|
660
676
|
}, [
|
|
661
677
|
areAllSelected,
|
|
662
678
|
areAnySelected,
|
|
679
|
+
allSelectedLabel,
|
|
663
680
|
counterText,
|
|
664
681
|
currentOptions,
|
|
665
|
-
intlConfig,
|
|
666
682
|
isSmall,
|
|
683
|
+
noneSelectedLabel,
|
|
667
684
|
paddingSize,
|
|
668
685
|
placeholder,
|
|
669
686
|
showCounter
|
|
@@ -704,7 +721,8 @@ function _MultipleSelectField({
|
|
|
704
721
|
areAllSelected,
|
|
705
722
|
areAnySelected,
|
|
706
723
|
selectAll,
|
|
707
|
-
selectAllDisabled
|
|
724
|
+
selectAllDisabled,
|
|
725
|
+
selectAllText
|
|
708
726
|
}
|
|
709
727
|
)
|
|
710
728
|
}
|
|
@@ -871,10 +889,13 @@ const _CopiableComponent = ({
|
|
|
871
889
|
copiedText,
|
|
872
890
|
button,
|
|
873
891
|
buttonLabel,
|
|
892
|
+
buttonIcon,
|
|
874
893
|
buttonProps,
|
|
875
894
|
ariaLabel,
|
|
876
895
|
dataTestId,
|
|
877
896
|
tooltipPlacement = "top",
|
|
897
|
+
tooltipProps,
|
|
898
|
+
snackbarProps,
|
|
878
899
|
...props
|
|
879
900
|
}, ref) => {
|
|
880
901
|
const [open, setOpen] = useState(false);
|
|
@@ -892,6 +913,7 @@ const _CopiableComponent = ({
|
|
|
892
913
|
setOpen(true);
|
|
893
914
|
}).catch(console.error);
|
|
894
915
|
};
|
|
916
|
+
const copyIcon = buttonIcon ?? /* @__PURE__ */ jsx(ContentCopyOutlined, {});
|
|
895
917
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
896
918
|
/* @__PURE__ */ jsx(
|
|
897
919
|
Tooltip,
|
|
@@ -899,6 +921,7 @@ const _CopiableComponent = ({
|
|
|
899
921
|
title: copyTooltipText,
|
|
900
922
|
leaveDelay: 0,
|
|
901
923
|
placement: tooltipPlacement,
|
|
924
|
+
...tooltipProps,
|
|
902
925
|
children: /* @__PURE__ */ jsxs(
|
|
903
926
|
Box,
|
|
904
927
|
{
|
|
@@ -914,7 +937,7 @@ const _CopiableComponent = ({
|
|
|
914
937
|
{
|
|
915
938
|
...buttonProps,
|
|
916
939
|
disabled,
|
|
917
|
-
icon:
|
|
940
|
+
icon: copyIcon,
|
|
918
941
|
"data-testid": dataTestId,
|
|
919
942
|
"aria-label": ariaLabel || buttonLabel || copyTooltipText || intlConfig.formatMessage({ id: "c4r.button.copy" }),
|
|
920
943
|
sx: {
|
|
@@ -930,10 +953,11 @@ const _CopiableComponent = ({
|
|
|
930
953
|
/* @__PURE__ */ jsx(
|
|
931
954
|
Snackbar,
|
|
932
955
|
{
|
|
933
|
-
open,
|
|
934
956
|
autoWidth: true,
|
|
935
957
|
closeable: false,
|
|
936
958
|
autoHideDuration: 4e3,
|
|
959
|
+
...snackbarProps,
|
|
960
|
+
open,
|
|
937
961
|
onClose: () => setOpen(false),
|
|
938
962
|
children: copySuccessMessage
|
|
939
963
|
}
|
|
@@ -1273,10 +1297,12 @@ function useCreatableAutocomplete({
|
|
|
1273
1297
|
newItemIcon,
|
|
1274
1298
|
multiple
|
|
1275
1299
|
}) {
|
|
1276
|
-
const intl = useIntl();
|
|
1277
|
-
const intlConfig = useImperativeIntl(intl);
|
|
1278
1300
|
const filter = createFilterOptions();
|
|
1279
1301
|
const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
|
|
1302
|
+
const addLabel = useTranslationWithFallback(
|
|
1303
|
+
"c4r.form.add",
|
|
1304
|
+
typeof newItemLabel === "string" ? newItemLabel : void 0
|
|
1305
|
+
);
|
|
1280
1306
|
const creatableFilterOptions = (options, params) => {
|
|
1281
1307
|
const filtered = filter(
|
|
1282
1308
|
options,
|
|
@@ -1290,10 +1316,8 @@ function useCreatableAutocomplete({
|
|
|
1290
1316
|
let newItemText;
|
|
1291
1317
|
if (typeof newItemLabel === "function") {
|
|
1292
1318
|
newItemText = newItemLabel(inputValue);
|
|
1293
|
-
} else if (newItemLabel) {
|
|
1294
|
-
newItemText = `${newItemLabel} "${inputValue}"`;
|
|
1295
1319
|
} else {
|
|
1296
|
-
newItemText = `${
|
|
1320
|
+
newItemText = `${addLabel} "${inputValue}"`;
|
|
1297
1321
|
}
|
|
1298
1322
|
filtered.push({
|
|
1299
1323
|
inputValue,
|
|
@@ -1338,14 +1362,18 @@ function useMultipleAutocomplete({
|
|
|
1338
1362
|
counterText,
|
|
1339
1363
|
allSelectedText
|
|
1340
1364
|
}) {
|
|
1341
|
-
const intl = useIntl();
|
|
1342
|
-
const intlConfig = useImperativeIntl(intl);
|
|
1343
|
-
const defaultCounterText = counterText || intlConfig.formatMessage({ id: "c4r.form.selected" });
|
|
1344
|
-
const defaultAllSelectedText = allSelectedText || intlConfig.formatMessage({ id: "c4r.form.allSelected" });
|
|
1345
1365
|
const [multipleValue, setMultipleValue] = useState(
|
|
1346
1366
|
Array.isArray(value) ? value : value ? [value] : []
|
|
1347
1367
|
);
|
|
1348
1368
|
const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
|
|
1369
|
+
const defaultCounterText = useTranslationWithFallback(
|
|
1370
|
+
"c4r.form.selected",
|
|
1371
|
+
counterText
|
|
1372
|
+
);
|
|
1373
|
+
const defaultAllSelectedText = useTranslationWithFallback(
|
|
1374
|
+
"c4r.form.allSelected",
|
|
1375
|
+
allSelectedText
|
|
1376
|
+
);
|
|
1349
1377
|
useEffect(() => {
|
|
1350
1378
|
const newValue = Array.isArray(value) ? value : value ? [value] : [];
|
|
1351
1379
|
setMultipleValue(newValue);
|
|
@@ -4852,6 +4880,9 @@ function _FilterDropdown({
|
|
|
4852
4880
|
responsive,
|
|
4853
4881
|
tooltipLabel,
|
|
4854
4882
|
tooltipPlacement,
|
|
4883
|
+
tooltipProps,
|
|
4884
|
+
buttonProps,
|
|
4885
|
+
iconButtonProps,
|
|
4855
4886
|
slotProps,
|
|
4856
4887
|
MenuListProps,
|
|
4857
4888
|
...props
|
|
@@ -4889,14 +4920,30 @@ function _FilterDropdown({
|
|
|
4889
4920
|
"data-color": buttonColor
|
|
4890
4921
|
};
|
|
4891
4922
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4892
|
-
/* @__PURE__ */ jsx(
|
|
4893
|
-
|
|
4923
|
+
/* @__PURE__ */ jsx(
|
|
4924
|
+
Tooltip,
|
|
4894
4925
|
{
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4926
|
+
title: tooltipLabel,
|
|
4927
|
+
placement: tooltipPlacement,
|
|
4928
|
+
...tooltipProps,
|
|
4929
|
+
children: /* @__PURE__ */ jsx(ButtonWrapper, { isOpen, buttonColor, ref, children: isIcon ? /* @__PURE__ */ jsx(
|
|
4930
|
+
IconButton,
|
|
4931
|
+
{
|
|
4932
|
+
...commonButtonProps,
|
|
4933
|
+
icon,
|
|
4934
|
+
...iconButtonProps
|
|
4935
|
+
}
|
|
4936
|
+
) : /* @__PURE__ */ jsx(
|
|
4937
|
+
Button,
|
|
4938
|
+
{
|
|
4939
|
+
...commonButtonProps,
|
|
4940
|
+
endIcon: isOpen ? /* @__PURE__ */ jsx(ArrowUp, {}) : /* @__PURE__ */ jsx(ArrowDown, {}),
|
|
4941
|
+
...buttonProps,
|
|
4942
|
+
children: menuLabel
|
|
4943
|
+
}
|
|
4944
|
+
) })
|
|
4898
4945
|
}
|
|
4899
|
-
)
|
|
4946
|
+
),
|
|
4900
4947
|
/* @__PURE__ */ jsxs(
|
|
4901
4948
|
Menu,
|
|
4902
4949
|
{
|
|
@@ -4946,6 +4993,240 @@ function _FilterDropdown({
|
|
|
4946
4993
|
const FilterDropdown = forwardRef(
|
|
4947
4994
|
_FilterDropdown
|
|
4948
4995
|
);
|
|
4996
|
+
const SearchIcon = styled(Search, {
|
|
4997
|
+
shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
|
|
4998
|
+
})(
|
|
4999
|
+
({ theme, minimized, disabled }) => ({
|
|
5000
|
+
cursor: !disabled && minimized ? "pointer" : "inherit",
|
|
5001
|
+
width: ICON_SIZE_MEDIUM,
|
|
5002
|
+
height: ICON_SIZE_MEDIUM,
|
|
5003
|
+
path: {
|
|
5004
|
+
fillOpacity: 1,
|
|
5005
|
+
fill: disabled ? theme.palette.text.disabled : theme.palette.text.secondary
|
|
5006
|
+
}
|
|
5007
|
+
})
|
|
5008
|
+
);
|
|
5009
|
+
const CancelSearchIcon = styled(Cancel)(({ theme }) => ({
|
|
5010
|
+
color: `${theme.palette.text.hint} !important`
|
|
5011
|
+
}));
|
|
5012
|
+
const LoadingSearchIcon = styled(CircularProgress)(({ theme }) => ({
|
|
5013
|
+
svg: {
|
|
5014
|
+
color: theme.palette.primary.main
|
|
5015
|
+
}
|
|
5016
|
+
}));
|
|
5017
|
+
const SearchInputAdornment = styled(InputAdornment, {
|
|
5018
|
+
shouldForwardProp: (prop) => prop !== "minimized" && prop !== "expanded"
|
|
5019
|
+
})(
|
|
5020
|
+
({ theme, minimized, expanded }) => ({
|
|
5021
|
+
"&.MuiInputAdornment-positionEnd": {
|
|
5022
|
+
minWidth: theme.spacing(4),
|
|
5023
|
+
"&.MuiInputAdornment-sizeSmall": {
|
|
5024
|
+
minWidth: theme.spacing(3)
|
|
5025
|
+
}
|
|
5026
|
+
},
|
|
5027
|
+
"&.MuiInputAdornment-positionStart": {
|
|
5028
|
+
marginLeft: minimized ? theme.spacing(1.5) : void 0
|
|
5029
|
+
},
|
|
5030
|
+
...expanded && !minimized && {
|
|
5031
|
+
"&.MuiInputAdornment-root": {
|
|
5032
|
+
minWidth: theme.spacing(8),
|
|
5033
|
+
"&.MuiInputAdornment-sizeSmall": {
|
|
5034
|
+
minWidth: theme.spacing(7)
|
|
5035
|
+
}
|
|
5036
|
+
}
|
|
5037
|
+
}
|
|
5038
|
+
})
|
|
5039
|
+
);
|
|
5040
|
+
const SearchFieldBase = styled(TextField, {
|
|
5041
|
+
shouldForwardProp: (prop) => prop !== "minimized" && prop !== "isInputFocused" && prop !== "emphasis"
|
|
5042
|
+
})(({ theme, emphasis = "filled", minimized, isInputFocused }) => ({
|
|
5043
|
+
"&.MuiTextField-root .MuiInputBase-root": {
|
|
5044
|
+
paddingRight: theme.spacing(1),
|
|
5045
|
+
transition: theme.transitions.create("width", {
|
|
5046
|
+
easing: theme.transitions.easing.easeInOut,
|
|
5047
|
+
duration: theme.transitions.duration.shortest
|
|
5048
|
+
}),
|
|
5049
|
+
"&.MuiInputBase-sizeSmall": {
|
|
5050
|
+
paddingRight: theme.spacing(0.5)
|
|
5051
|
+
},
|
|
5052
|
+
"&:before": {
|
|
5053
|
+
border: "none !important",
|
|
5054
|
+
"&:hover": {
|
|
5055
|
+
border: "none !important"
|
|
5056
|
+
}
|
|
5057
|
+
},
|
|
5058
|
+
// Input
|
|
5059
|
+
"& .MuiInputBase-input": {
|
|
5060
|
+
pointerEvents: isInputFocused ? "auto" : "none"
|
|
5061
|
+
// Fix Chrome scroll issue https://issues.chromium.org/issues/41245282
|
|
5062
|
+
},
|
|
5063
|
+
// Error state
|
|
5064
|
+
"&.Mui-error": {
|
|
5065
|
+
"&::after": {
|
|
5066
|
+
borderColor: "transparent !important"
|
|
5067
|
+
}
|
|
5068
|
+
},
|
|
5069
|
+
...minimized && {
|
|
5070
|
+
display: "flex",
|
|
5071
|
+
alignItems: "center",
|
|
5072
|
+
justifyContent: "center",
|
|
5073
|
+
padding: 0,
|
|
5074
|
+
width: theme.spacing(6),
|
|
5075
|
+
cursor: "pointer",
|
|
5076
|
+
"& .MuiInputBase-input": {
|
|
5077
|
+
display: "none"
|
|
5078
|
+
},
|
|
5079
|
+
"&.MuiInputBase-sizeSmall": {
|
|
5080
|
+
width: theme.spacing(4)
|
|
5081
|
+
}
|
|
5082
|
+
}
|
|
5083
|
+
},
|
|
5084
|
+
// Variants
|
|
5085
|
+
...emphasis === "filled" && {
|
|
5086
|
+
"& .MuiInputBase-root": {
|
|
5087
|
+
backgroundColor: minimized ? "inherit !important" : void 0,
|
|
5088
|
+
// not disabled
|
|
5089
|
+
"&:not(.Mui-disabled):hover": {
|
|
5090
|
+
backgroundColor: `${theme.palette.action.hover} !important`
|
|
5091
|
+
}
|
|
5092
|
+
}
|
|
5093
|
+
},
|
|
5094
|
+
...emphasis === "transparent" && {
|
|
5095
|
+
"& .MuiInputBase-root": {
|
|
5096
|
+
backgroundColor: "transparent !important",
|
|
5097
|
+
"&:hover": {
|
|
5098
|
+
backgroundColor: "transparent"
|
|
5099
|
+
},
|
|
5100
|
+
"&.Mui-disabled": {
|
|
5101
|
+
backgroundColor: "transparent"
|
|
5102
|
+
}
|
|
5103
|
+
}
|
|
5104
|
+
},
|
|
5105
|
+
...emphasis === "floating" && {
|
|
5106
|
+
"& .MuiInputBase-root": {
|
|
5107
|
+
backgroundColor: `${theme.palette.background.paper} !important`,
|
|
5108
|
+
boxShadow: theme.shadows[1],
|
|
5109
|
+
"&:hover": {
|
|
5110
|
+
backgroundColor: theme.palette.background.paper
|
|
5111
|
+
},
|
|
5112
|
+
"&.Mui-disabled": {
|
|
5113
|
+
backgroundColor: theme.palette.background.paper
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
}
|
|
5117
|
+
}));
|
|
5118
|
+
function _SearchField({
|
|
5119
|
+
value,
|
|
5120
|
+
defaultValue,
|
|
5121
|
+
placeholder,
|
|
5122
|
+
onChange,
|
|
5123
|
+
onClick,
|
|
5124
|
+
onResetSearch,
|
|
5125
|
+
disabled,
|
|
5126
|
+
minimized = false,
|
|
5127
|
+
loading = false,
|
|
5128
|
+
variant = "filled",
|
|
5129
|
+
size = "small",
|
|
5130
|
+
InputProps,
|
|
5131
|
+
inputProps,
|
|
5132
|
+
startAdornment,
|
|
5133
|
+
endAdornment,
|
|
5134
|
+
onFocus,
|
|
5135
|
+
onBlur,
|
|
5136
|
+
clearButtonLabel,
|
|
5137
|
+
...otherProps
|
|
5138
|
+
}, ref) {
|
|
5139
|
+
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
5140
|
+
const clearButtonLabelValue = useTranslationWithFallback(
|
|
5141
|
+
"c4r.button.clear",
|
|
5142
|
+
clearButtonLabel
|
|
5143
|
+
);
|
|
5144
|
+
const handleFocus = (event) => {
|
|
5145
|
+
setIsInputFocused(true);
|
|
5146
|
+
onFocus == null ? void 0 : onFocus(event);
|
|
5147
|
+
};
|
|
5148
|
+
const handleBlur = (event) => {
|
|
5149
|
+
setIsInputFocused(false);
|
|
5150
|
+
onBlur == null ? void 0 : onBlur(event);
|
|
5151
|
+
};
|
|
5152
|
+
const handleClearText = () => {
|
|
5153
|
+
onResetSearch == null ? void 0 : onResetSearch();
|
|
5154
|
+
onChange == null ? void 0 : onChange({ target: { value: "" } });
|
|
5155
|
+
};
|
|
5156
|
+
const getEndAdornment = () => {
|
|
5157
|
+
const showClearButton = !disabled && (value ?? defaultValue);
|
|
5158
|
+
if (minimized) {
|
|
5159
|
+
return void 0;
|
|
5160
|
+
}
|
|
5161
|
+
const clearButtonAriaLabel = typeof clearButtonLabelValue === "string" ? clearButtonLabelValue : String(clearButtonLabelValue);
|
|
5162
|
+
return /* @__PURE__ */ jsx(
|
|
5163
|
+
SearchInputAdornment,
|
|
5164
|
+
{
|
|
5165
|
+
position: "end",
|
|
5166
|
+
expanded: Boolean(endAdornment && showClearButton),
|
|
5167
|
+
children: /* @__PURE__ */ jsxs(
|
|
5168
|
+
Stack,
|
|
5169
|
+
{
|
|
5170
|
+
direction: "row",
|
|
5171
|
+
spacing: 1,
|
|
5172
|
+
sx: {
|
|
5173
|
+
alignItems: "center"
|
|
5174
|
+
},
|
|
5175
|
+
children: [
|
|
5176
|
+
loading ? /* @__PURE__ */ jsx(LoadingSearchIcon, { size: ICON_SIZE_MEDIUM }) : !disabled && showClearButton ? /* @__PURE__ */ jsx(
|
|
5177
|
+
IconButton,
|
|
5178
|
+
{
|
|
5179
|
+
icon: /* @__PURE__ */ jsx(CancelSearchIcon, {}),
|
|
5180
|
+
onClick: handleClearText,
|
|
5181
|
+
size,
|
|
5182
|
+
color: "default",
|
|
5183
|
+
disabled,
|
|
5184
|
+
tooltip: clearButtonLabelValue,
|
|
5185
|
+
"aria-label": clearButtonAriaLabel
|
|
5186
|
+
}
|
|
5187
|
+
) : void 0,
|
|
5188
|
+
endAdornment
|
|
5189
|
+
]
|
|
5190
|
+
}
|
|
5191
|
+
)
|
|
5192
|
+
}
|
|
5193
|
+
);
|
|
5194
|
+
};
|
|
5195
|
+
return /* @__PURE__ */ jsx(
|
|
5196
|
+
SearchFieldBase,
|
|
5197
|
+
{
|
|
5198
|
+
value: minimized ? "" : value,
|
|
5199
|
+
defaultValue,
|
|
5200
|
+
placeholder: minimized ? "" : placeholder,
|
|
5201
|
+
onChange,
|
|
5202
|
+
onClick,
|
|
5203
|
+
variant: "filled",
|
|
5204
|
+
emphasis: variant,
|
|
5205
|
+
size,
|
|
5206
|
+
focused: false,
|
|
5207
|
+
isInputFocused,
|
|
5208
|
+
disabled,
|
|
5209
|
+
minimized,
|
|
5210
|
+
InputProps: {
|
|
5211
|
+
onFocus: handleFocus,
|
|
5212
|
+
onBlur: handleBlur,
|
|
5213
|
+
startAdornment: /* @__PURE__ */ jsx(SearchInputAdornment, { position: "start", minimized, children: /* @__PURE__ */ jsx(Box, { sx: { display: "inline-flex", ml: minimized ? -0.75 : 0 }, children: loading && minimized ? /* @__PURE__ */ jsx(LoadingSearchIcon, { size: ICON_SIZE_MEDIUM }) : startAdornment || /* @__PURE__ */ jsx(SearchIcon, { disabled, minimized }) }) }),
|
|
5214
|
+
endAdornment: getEndAdornment(),
|
|
5215
|
+
...InputProps
|
|
5216
|
+
},
|
|
5217
|
+
inputProps: {
|
|
5218
|
+
role: "searchbox",
|
|
5219
|
+
...inputProps
|
|
5220
|
+
},
|
|
5221
|
+
role: "search",
|
|
5222
|
+
"data-variant": variant,
|
|
5223
|
+
"data-name": "search-field",
|
|
5224
|
+
ref,
|
|
5225
|
+
...otherProps
|
|
5226
|
+
}
|
|
5227
|
+
);
|
|
5228
|
+
}
|
|
5229
|
+
const SearchField = forwardRef(_SearchField);
|
|
4949
5230
|
const MAX_WIDTH = 480;
|
|
4950
5231
|
const SnackbarRoot = styled(Snackbar$1)(({ theme }) => ({
|
|
4951
5232
|
bottom: theme.spacing(2),
|
|
@@ -5768,6 +6049,7 @@ export {
|
|
|
5768
6049
|
MultipleSelectField,
|
|
5769
6050
|
PasswordField,
|
|
5770
6051
|
ScreenReaderOnly,
|
|
6052
|
+
SearchField,
|
|
5771
6053
|
SelectField,
|
|
5772
6054
|
Snackbar,
|
|
5773
6055
|
SplitButton,
|
|
@@ -818,6 +818,7 @@ const en = {
|
|
|
818
818
|
copy: "Copy",
|
|
819
819
|
save: "Save",
|
|
820
820
|
add: "Add",
|
|
821
|
+
clear: "Clear",
|
|
821
822
|
showOptions: "Show options",
|
|
822
823
|
hide: "Hide",
|
|
823
824
|
show: "Show",
|
|
@@ -967,6 +968,7 @@ const es = {
|
|
|
967
968
|
copy: "Copiar",
|
|
968
969
|
save: "Guardar",
|
|
969
970
|
add: "Añadir",
|
|
971
|
+
clear: "Borrar",
|
|
970
972
|
showOptions: "Mostrar opciones",
|
|
971
973
|
hide: "Ocultar",
|
|
972
974
|
show: "Mostrar",
|
|
@@ -1114,6 +1116,7 @@ const id = {
|
|
|
1114
1116
|
copy: "Salin",
|
|
1115
1117
|
save: "Simpan",
|
|
1116
1118
|
add: "Tambah",
|
|
1119
|
+
clear: "Bersihkan",
|
|
1117
1120
|
showOptions: "Tampilkan opsi",
|
|
1118
1121
|
hide: "Sembunyikan",
|
|
1119
1122
|
show: "Tampilkan",
|
|
@@ -817,6 +817,7 @@ const en = {
|
|
|
817
817
|
copy: "Copy",
|
|
818
818
|
save: "Save",
|
|
819
819
|
add: "Add",
|
|
820
|
+
clear: "Clear",
|
|
820
821
|
showOptions: "Show options",
|
|
821
822
|
hide: "Hide",
|
|
822
823
|
show: "Show",
|
|
@@ -966,6 +967,7 @@ const es = {
|
|
|
966
967
|
copy: "Copiar",
|
|
967
968
|
save: "Guardar",
|
|
968
969
|
add: "Añadir",
|
|
970
|
+
clear: "Borrar",
|
|
969
971
|
showOptions: "Mostrar opciones",
|
|
970
972
|
hide: "Ocultar",
|
|
971
973
|
show: "Mostrar",
|
|
@@ -1113,6 +1115,7 @@ const id = {
|
|
|
1113
1115
|
copy: "Salin",
|
|
1114
1116
|
save: "Simpan",
|
|
1115
1117
|
add: "Tambah",
|
|
1118
|
+
clear: "Bersihkan",
|
|
1116
1119
|
showOptions: "Tampilkan opsi",
|
|
1117
1120
|
hide: "Sembunyikan",
|
|
1118
1121
|
show: "Tampilkan",
|