@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
|
@@ -4,12 +4,12 @@ const jsxRuntime = require("react/jsx-runtime");
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const material = require("@mui/material");
|
|
6
6
|
const iconsMaterial = require("@mui/icons-material");
|
|
7
|
-
const Alert$1 = require("../Alert-
|
|
8
|
-
const cssUtils = require("../css-utils-
|
|
7
|
+
const Alert$1 = require("../Alert-CL9Y3l7D.cjs");
|
|
8
|
+
const cssUtils = require("../css-utils-CqIN_t7x.cjs");
|
|
9
9
|
const ArrowDown = require("../ArrowDown-DJ0vhbsw.cjs");
|
|
10
10
|
const OpenDiagonallyRight = require("../OpenDiagonallyRight-CpL4ROwg.cjs");
|
|
11
11
|
const reactIntl = require("react-intl");
|
|
12
|
-
const MenuItem = require("../MenuItem-
|
|
12
|
+
const MenuItem = require("../MenuItem-Bssr5qGq.cjs");
|
|
13
13
|
require("cartocolor");
|
|
14
14
|
const reactWindow = require("react-window");
|
|
15
15
|
const reactCodemirror2 = require("react-codemirror2");
|
|
@@ -41,6 +41,7 @@ const DatePicker$1 = require("@mui/x-date-pickers/DatePicker");
|
|
|
41
41
|
const xDatePickers = require("@mui/x-date-pickers");
|
|
42
42
|
const TimePicker$1 = require("@mui/x-date-pickers/TimePicker");
|
|
43
43
|
const DateTimePicker$1 = require("@mui/x-date-pickers/DateTimePicker");
|
|
44
|
+
const Search = require("../Search-CMWbM9nD.cjs");
|
|
44
45
|
const DOMPurify = require("dompurify");
|
|
45
46
|
const IndicatorIcon = material.styled(material.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 = Alert$1.
|
|
73
|
+
const screenReaderTextValue = Alert$1.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 = Alert$1.useTranslationWithFallback(
|
|
531
|
+
"c4r.form.selectAll",
|
|
532
|
+
selectAllText
|
|
533
|
+
);
|
|
530
534
|
return /* @__PURE__ */ jsxRuntime.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 = Alert$1.useTranslationWithFallback(
|
|
629
|
+
"c4r.form.allSelected",
|
|
630
|
+
allSelectedText
|
|
631
|
+
);
|
|
632
|
+
const noneSelectedLabel = Alert$1.useTranslationWithFallback(
|
|
633
|
+
"c4r.form.noneSelected",
|
|
634
|
+
noneSelectedText
|
|
635
|
+
);
|
|
636
|
+
const selectedLabel = Alert$1.useTranslationWithFallback(
|
|
637
|
+
"c4r.form.selected",
|
|
638
|
+
selectedText
|
|
639
|
+
);
|
|
640
|
+
const counterText = `${currentOptions.length} ${selectedLabel}`;
|
|
625
641
|
const renderValue = React.useMemo(() => {
|
|
626
642
|
if (areAllSelected) {
|
|
627
643
|
return /* @__PURE__ */ jsxRuntime.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] = React.useState(false);
|
|
@@ -892,6 +913,7 @@ const _CopiableComponent = ({
|
|
|
892
913
|
setOpen(true);
|
|
893
914
|
}).catch(console.error);
|
|
894
915
|
};
|
|
916
|
+
const copyIcon = buttonIcon ?? /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopyOutlined, {});
|
|
895
917
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
896
918
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
897
919
|
material.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__ */ jsxRuntime.jsxs(
|
|
903
926
|
material.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__ */ jsxRuntime.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 = reactIntl.useIntl();
|
|
1277
|
-
const intlConfig = cssUtils.useImperativeIntl(intl);
|
|
1278
1300
|
const filter = material.createFilterOptions();
|
|
1279
1301
|
const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
|
|
1302
|
+
const addLabel = Alert$1.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 = reactIntl.useIntl();
|
|
1342
|
-
const intlConfig = cssUtils.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] = React.useState(
|
|
1346
1366
|
Array.isArray(value) ? value : value ? [value] : []
|
|
1347
1367
|
);
|
|
1348
1368
|
const { renderOption: autocompleteRenderOption } = useAutocompleteRenderOption();
|
|
1369
|
+
const defaultCounterText = Alert$1.useTranslationWithFallback(
|
|
1370
|
+
"c4r.form.selected",
|
|
1371
|
+
counterText
|
|
1372
|
+
);
|
|
1373
|
+
const defaultAllSelectedText = Alert$1.useTranslationWithFallback(
|
|
1374
|
+
"c4r.form.allSelected",
|
|
1375
|
+
allSelectedText
|
|
1376
|
+
);
|
|
1349
1377
|
React.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__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4892
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4893
|
-
|
|
4923
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4924
|
+
material.Tooltip,
|
|
4894
4925
|
{
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4926
|
+
title: tooltipLabel,
|
|
4927
|
+
placement: tooltipPlacement,
|
|
4928
|
+
...tooltipProps,
|
|
4929
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ButtonWrapper, { isOpen, buttonColor, ref, children: isIcon ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4930
|
+
cssUtils.IconButton,
|
|
4931
|
+
{
|
|
4932
|
+
...commonButtonProps,
|
|
4933
|
+
icon,
|
|
4934
|
+
...iconButtonProps
|
|
4935
|
+
}
|
|
4936
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
4937
|
+
Button,
|
|
4938
|
+
{
|
|
4939
|
+
...commonButtonProps,
|
|
4940
|
+
endIcon: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(OpenDiagonallyRight.ArrowUp, {}) : /* @__PURE__ */ jsxRuntime.jsx(ArrowDown.ArrowDown, {}),
|
|
4941
|
+
...buttonProps,
|
|
4942
|
+
children: menuLabel
|
|
4943
|
+
}
|
|
4944
|
+
) })
|
|
4898
4945
|
}
|
|
4899
|
-
)
|
|
4946
|
+
),
|
|
4900
4947
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4901
4948
|
Menu,
|
|
4902
4949
|
{
|
|
@@ -4946,6 +4993,240 @@ function _FilterDropdown({
|
|
|
4946
4993
|
const FilterDropdown = React.forwardRef(
|
|
4947
4994
|
_FilterDropdown
|
|
4948
4995
|
);
|
|
4996
|
+
const SearchIcon = material.styled(Search.Search, {
|
|
4997
|
+
shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
|
|
4998
|
+
})(
|
|
4999
|
+
({ theme, minimized, disabled }) => ({
|
|
5000
|
+
cursor: !disabled && minimized ? "pointer" : "inherit",
|
|
5001
|
+
width: cssUtils.ICON_SIZE_MEDIUM,
|
|
5002
|
+
height: cssUtils.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 = material.styled(iconsMaterial.Cancel)(({ theme }) => ({
|
|
5010
|
+
color: `${theme.palette.text.hint} !important`
|
|
5011
|
+
}));
|
|
5012
|
+
const LoadingSearchIcon = material.styled(material.CircularProgress)(({ theme }) => ({
|
|
5013
|
+
svg: {
|
|
5014
|
+
color: theme.palette.primary.main
|
|
5015
|
+
}
|
|
5016
|
+
}));
|
|
5017
|
+
const SearchInputAdornment = material.styled(material.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 = material.styled(material.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] = React.useState(false);
|
|
5140
|
+
const clearButtonLabelValue = Alert$1.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__ */ jsxRuntime.jsx(
|
|
5163
|
+
SearchInputAdornment,
|
|
5164
|
+
{
|
|
5165
|
+
position: "end",
|
|
5166
|
+
expanded: Boolean(endAdornment && showClearButton),
|
|
5167
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5168
|
+
material.Stack,
|
|
5169
|
+
{
|
|
5170
|
+
direction: "row",
|
|
5171
|
+
spacing: 1,
|
|
5172
|
+
sx: {
|
|
5173
|
+
alignItems: "center"
|
|
5174
|
+
},
|
|
5175
|
+
children: [
|
|
5176
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSearchIcon, { size: cssUtils.ICON_SIZE_MEDIUM }) : !disabled && showClearButton ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5177
|
+
cssUtils.IconButton,
|
|
5178
|
+
{
|
|
5179
|
+
icon: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.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__ */ jsxRuntime.jsx(SearchInputAdornment, { position: "start", minimized, children: /* @__PURE__ */ jsxRuntime.jsx(material.Box, { sx: { display: "inline-flex", ml: minimized ? -0.75 : 0 }, children: loading && minimized ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSearchIcon, { size: cssUtils.ICON_SIZE_MEDIUM }) : startAdornment || /* @__PURE__ */ jsxRuntime.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 = React.forwardRef(_SearchField);
|
|
4949
5230
|
const MAX_WIDTH = 480;
|
|
4950
5231
|
const SnackbarRoot = material.styled(material.Snackbar)(({ theme }) => ({
|
|
4951
5232
|
bottom: theme.spacing(2),
|
|
@@ -5769,6 +6050,7 @@ exports.MenuList = MenuList;
|
|
|
5769
6050
|
exports.MultipleAutocomplete = MultipleAutocomplete;
|
|
5770
6051
|
exports.MultipleSelectField = MultipleSelectField;
|
|
5771
6052
|
exports.PasswordField = PasswordField;
|
|
6053
|
+
exports.SearchField = SearchField;
|
|
5772
6054
|
exports.SelectField = SelectField;
|
|
5773
6055
|
exports.Snackbar = Snackbar;
|
|
5774
6056
|
exports.SplitButton = SplitButton;
|