@carto/meridian-ds 2.6.2-alpha.0 → 2.7.0-alpha-loader.2

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +8 -3
  2. package/dist/{Alert-1A6BG2aO.js → Alert-BZPM5zpX.js} +1 -1
  3. package/dist/{Alert-eVzJvC47.cjs → Alert-C4W0H_uN.cjs} +1 -1
  4. package/dist/{MenuItem-6ZIV5V7a.cjs → MenuItem-CgF4QdGi.cjs} +12 -3
  5. package/dist/{MenuItem-DgHhHW-j.js → MenuItem-DRUK149i.js} +12 -3
  6. package/dist/{SwatchSquare-CaaLsjAC.js → Search-C7wkXu3f.js} +4 -23
  7. package/dist/{SwatchSquare-B8PIY3Rd.cjs → Search-CMWbM9nD.cjs} +3 -22
  8. package/dist/SwatchSquare-B6KYVoqV.js +24 -0
  9. package/dist/SwatchSquare-DuXPIL7t.cjs +23 -0
  10. package/dist/components/index.cjs +366 -3
  11. package/dist/components/index.js +369 -6
  12. package/dist/{css-utils-BNXxLCyb.cjs → css-utils-CH7es90t.cjs} +18 -0
  13. package/dist/{css-utils-lmkjeCdF.js → css-utils-CjUBRJVK.js} +18 -0
  14. package/dist/custom-icons/index.cjs +3 -2
  15. package/dist/custom-icons/index.js +3 -2
  16. package/dist/theme/index.cjs +16 -4
  17. package/dist/theme/index.js +17 -5
  18. package/dist/types/components/Loader/Loader.d.ts +43 -0
  19. package/dist/types/components/Loader/Loader.d.ts.map +1 -0
  20. package/dist/types/components/Loader/Loader.stories.d.ts +79 -0
  21. package/dist/types/components/Loader/Loader.stories.d.ts.map +1 -0
  22. package/dist/types/components/Loader/Loader.test.d.ts +2 -0
  23. package/dist/types/components/Loader/Loader.test.d.ts.map +1 -0
  24. package/dist/types/components/Loader/index.d.ts +3 -0
  25. package/dist/types/components/Loader/index.d.ts.map +1 -0
  26. package/dist/types/components/Menu/Menu/Menu.stories.d.ts +16 -7
  27. package/dist/types/components/Menu/Menu/Menu.stories.d.ts.map +1 -1
  28. package/dist/types/components/Menu/MenuItem/MenuItem.d.ts.map +1 -1
  29. package/dist/types/components/SearchField/SearchField.d.ts +4 -0
  30. package/dist/types/components/SearchField/SearchField.d.ts.map +1 -0
  31. package/dist/types/components/SearchField/SearchField.stories.d.ts +111 -0
  32. package/dist/types/components/SearchField/SearchField.stories.d.ts.map +1 -0
  33. package/dist/types/components/SearchField/SearchField.styled.d.ts +23 -0
  34. package/dist/types/components/SearchField/SearchField.styled.d.ts.map +1 -0
  35. package/dist/types/components/SearchField/SearchField.test.d.ts +2 -0
  36. package/dist/types/components/SearchField/SearchField.test.d.ts.map +1 -0
  37. package/dist/types/components/SearchField/components/SearchFieldEndAdornment.d.ts +19 -0
  38. package/dist/types/components/SearchField/components/SearchFieldEndAdornment.d.ts.map +1 -0
  39. package/dist/types/components/SearchField/components/SearchFieldStartAdornment.d.ts +14 -0
  40. package/dist/types/components/SearchField/components/SearchFieldStartAdornment.d.ts.map +1 -0
  41. package/dist/types/components/SearchField/index.d.ts +3 -0
  42. package/dist/types/components/SearchField/index.d.ts.map +1 -0
  43. package/dist/types/components/SearchField/types.d.ts +72 -0
  44. package/dist/types/components/SearchField/types.d.ts.map +1 -0
  45. package/dist/types/components/index.d.ts +4 -0
  46. package/dist/types/components/index.d.ts.map +1 -1
  47. package/dist/types/localization/en.d.ts +6 -0
  48. package/dist/types/localization/en.d.ts.map +1 -1
  49. package/dist/types/localization/es.d.ts +6 -0
  50. package/dist/types/localization/es.d.ts.map +1 -1
  51. package/dist/types/localization/id.d.ts +6 -0
  52. package/dist/types/localization/id.d.ts.map +1 -1
  53. package/dist/types/localization/index.d.ts +18 -0
  54. package/dist/types/localization/index.d.ts.map +1 -1
  55. package/dist/types/theme/carto-theme.d.ts.map +1 -1
  56. package/dist/types/theme/components/layout.d.ts +3 -0
  57. package/dist/types/theme/components/layout.d.ts.map +1 -0
  58. package/dist/types/theme/components/navigation.d.ts.map +1 -1
  59. package/dist/types/widgets/CategoryWidgetUI/CategoryWidgetUI.styled.d.ts +5 -5
  60. package/dist/widgets/index.cjs +8 -7
  61. package/dist/widgets/index.js +4 -3
  62. package/package.json +2 -3
@@ -4,11 +4,11 @@ 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 cssUtils = require("../css-utils-BNXxLCyb.cjs");
8
- const Alert$1 = require("../Alert-eVzJvC47.cjs");
7
+ const cssUtils = require("../css-utils-CH7es90t.cjs");
8
+ const Alert$1 = require("../Alert-C4W0H_uN.cjs");
9
9
  const ArrowDown = require("../ArrowDown-DJ0vhbsw.cjs");
10
10
  const OpenDiagonallyRight = require("../OpenDiagonallyRight-CpL4ROwg.cjs");
11
- const MenuItem = require("../MenuItem-6ZIV5V7a.cjs");
11
+ const MenuItem = require("../MenuItem-CgF4QdGi.cjs");
12
12
  require("cartocolor");
13
13
  const reactWindow = require("react-window");
14
14
  const reactCodemirror2 = require("react-codemirror2");
@@ -41,6 +41,7 @@ const reactIntl = require("react-intl");
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",
@@ -875,6 +876,78 @@ function _ToggleButtonGroup({
875
876
  );
876
877
  }
877
878
  const ToggleButtonGroup = React.forwardRef(_ToggleButtonGroup);
879
+ const StyledGrid = material.styled(material.Grid, {
880
+ shouldForwardProp: (prop) => prop !== "fullHeight" && prop !== "height"
881
+ })(({ fullHeight, theme }) => ({
882
+ display: "flex",
883
+ flexDirection: "column",
884
+ alignItems: "center",
885
+ justifyContent: "center",
886
+ gap: theme.spacing(1.5),
887
+ ...fullHeight && {
888
+ flex: 1,
889
+ height: "100%",
890
+ width: "100%"
891
+ }
892
+ }));
893
+ function _Loader({
894
+ label,
895
+ secondLabel,
896
+ color = "primary",
897
+ size = 40,
898
+ fullHeight,
899
+ labelTypographyProps,
900
+ secondLabelTypographyProps,
901
+ ...otherProps
902
+ }, ref) {
903
+ const labelText = cssUtils.useTranslationWithFallback("c4r.utils.loader.label", label);
904
+ const hasAnyLabel = labelText || secondLabel;
905
+ return /* @__PURE__ */ jsxRuntime.jsxs(
906
+ StyledGrid,
907
+ {
908
+ container: true,
909
+ fullHeight,
910
+ ...otherProps,
911
+ ref,
912
+ "aria-busy": true,
913
+ "data-name": "loader",
914
+ "data-full-height": fullHeight,
915
+ children: [
916
+ /* @__PURE__ */ jsxRuntime.jsx(
917
+ material.CircularProgress,
918
+ {
919
+ color,
920
+ size,
921
+ "aria-labelledby": hasAnyLabel ? "loader-label" : void 0
922
+ }
923
+ ),
924
+ hasAnyLabel && /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "column", alignItems: "center", children: [
925
+ labelText && /* @__PURE__ */ jsxRuntime.jsx(
926
+ cssUtils.Typography,
927
+ {
928
+ variant: "body2",
929
+ color: "textSecondary",
930
+ ...labelTypographyProps,
931
+ id: "loader-label",
932
+ children: labelText
933
+ }
934
+ ),
935
+ secondLabel && /* @__PURE__ */ jsxRuntime.jsx(
936
+ cssUtils.Typography,
937
+ {
938
+ variant: "body2",
939
+ color: "textSecondary",
940
+ ...secondLabelTypographyProps,
941
+ id: labelText ? void 0 : "loader-label",
942
+ children: secondLabel
943
+ }
944
+ )
945
+ ] })
946
+ ]
947
+ }
948
+ );
949
+ }
950
+ const Loader = React.forwardRef(_Loader);
878
951
  async function copyString(value) {
879
952
  return await navigator.clipboard.writeText(value);
880
953
  }
@@ -5039,6 +5112,294 @@ function _FilterDropdown({
5039
5112
  const FilterDropdown = React.forwardRef(
5040
5113
  _FilterDropdown
5041
5114
  );
5115
+ const SearchIcon = material.styled(Search.Search, {
5116
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
5117
+ })(
5118
+ ({ theme, minimized, disabled }) => ({
5119
+ cursor: !disabled && minimized ? "pointer" : "inherit",
5120
+ width: cssUtils.ICON_SIZE_MEDIUM,
5121
+ height: cssUtils.ICON_SIZE_MEDIUM,
5122
+ path: {
5123
+ fillOpacity: 1,
5124
+ fill: disabled ? theme.palette.text.disabled : theme.palette.text.secondary
5125
+ }
5126
+ })
5127
+ );
5128
+ const ClearSearchIcon = material.styled(iconsMaterial.Cancel)(({ theme }) => ({
5129
+ color: `${theme.palette.text.hint} !important`
5130
+ }));
5131
+ const LoadingSearchIcon = material.styled(material.CircularProgress)(({ theme }) => ({
5132
+ svg: {
5133
+ color: `${theme.palette.primary.main} !important`
5134
+ }
5135
+ }));
5136
+ const SearchInputAdornment = material.styled(material.InputAdornment, {
5137
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "expanded"
5138
+ })(
5139
+ ({ theme, minimized, expanded }) => ({
5140
+ // Start adornment
5141
+ transition: theme.transitions.create(["width", "margin"], {
5142
+ easing: theme.transitions.easing.easeInOut,
5143
+ duration: theme.transitions.duration.short
5144
+ }),
5145
+ "&.MuiInputAdornment-positionStart": {
5146
+ marginLeft: minimized ? theme.spacing(2) : void 0,
5147
+ "&.MuiInputAdornment-sizeSmall": {
5148
+ marginLeft: minimized ? theme.spacing(1) : void 0
5149
+ }
5150
+ },
5151
+ // End adornment
5152
+ "&.MuiInputAdornment-positionEnd": {
5153
+ minWidth: theme.spacing(4),
5154
+ "&.MuiInputAdornment-sizeSmall": {
5155
+ minWidth: theme.spacing(3)
5156
+ }
5157
+ },
5158
+ ...expanded && !minimized && {
5159
+ "&.MuiInputAdornment-root": {
5160
+ minWidth: theme.spacing(9),
5161
+ "&.MuiInputAdornment-sizeSmall": {
5162
+ minWidth: theme.spacing(7)
5163
+ }
5164
+ }
5165
+ }
5166
+ })
5167
+ );
5168
+ const SearchFieldBase = material.styled(material.TextField, {
5169
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "isInputFocused" && prop !== "emphasis"
5170
+ })(({ theme, emphasis = "filled", minimized, isInputFocused }) => ({
5171
+ "&.MuiTextField-root .MuiInputBase-root": {
5172
+ paddingRight: theme.spacing(1),
5173
+ transition: theme.transitions.create(["width", "padding"], {
5174
+ easing: theme.transitions.easing.easeInOut,
5175
+ duration: theme.transitions.duration.standard
5176
+ }),
5177
+ "&.MuiInputBase-sizeSmall": {
5178
+ paddingRight: theme.spacing(0.5)
5179
+ },
5180
+ "&:before": {
5181
+ border: "none !important",
5182
+ "&:hover": {
5183
+ border: "none !important"
5184
+ }
5185
+ },
5186
+ // Input
5187
+ "& .MuiInputBase-input": {
5188
+ pointerEvents: isInputFocused ? "auto" : "none",
5189
+ // Fix Chrome scroll issue https://issues.chromium.org/issues/41245282
5190
+ transition: theme.transitions.create("width", {
5191
+ easing: theme.transitions.easing.easeInOut,
5192
+ duration: theme.transitions.duration.standard
5193
+ })
5194
+ },
5195
+ // Error state
5196
+ "&.Mui-error": {
5197
+ "&::after": {
5198
+ borderColor: "transparent !important"
5199
+ }
5200
+ },
5201
+ ...minimized && {
5202
+ display: "flex",
5203
+ alignItems: "center",
5204
+ padding: 0,
5205
+ width: theme.spacing(6),
5206
+ cursor: "pointer",
5207
+ "& .MuiInputBase-input": {
5208
+ width: 0
5209
+ },
5210
+ "&.MuiInputBase-sizeSmall": {
5211
+ padding: 0,
5212
+ width: theme.spacing(4)
5213
+ }
5214
+ }
5215
+ },
5216
+ // Variants
5217
+ ...emphasis === "filled" && {
5218
+ "& .MuiInputBase-root": {
5219
+ backgroundColor: minimized ? "transparent !important" : void 0,
5220
+ "&:hover": {
5221
+ backgroundColor: `${theme.palette.action.hover} !important`
5222
+ },
5223
+ // not disabled
5224
+ "&:not(.Mui-disabled):hover": {
5225
+ backgroundColor: `${theme.palette.action.hover} !important`
5226
+ }
5227
+ }
5228
+ },
5229
+ ...emphasis === "transparent" && {
5230
+ "& .MuiInputBase-root": {
5231
+ backgroundColor: "transparent !important",
5232
+ "&:hover": {
5233
+ backgroundColor: minimized ? `${theme.palette.action.hover} !important` : "transparent !important"
5234
+ },
5235
+ "&.Mui-disabled": {
5236
+ backgroundColor: "transparent !important"
5237
+ }
5238
+ }
5239
+ },
5240
+ ...emphasis === "floating" && {
5241
+ "& .MuiInputBase-root": {
5242
+ backgroundColor: `${theme.palette.background.paper} !important`,
5243
+ boxShadow: theme.shadows[1],
5244
+ "&:hover": {
5245
+ backgroundColor: minimized ? `${theme.palette.action.hover} !important` : `${theme.palette.background.paper} !important`
5246
+ },
5247
+ "&.Mui-disabled": {
5248
+ backgroundColor: `${theme.palette.background.paper} !important`
5249
+ }
5250
+ }
5251
+ }
5252
+ }));
5253
+ const SearchFieldEndAdornment = ({
5254
+ disabled,
5255
+ showClearButton = true,
5256
+ loading,
5257
+ size,
5258
+ endAdornment,
5259
+ clearButton,
5260
+ clearButtonLabel,
5261
+ onClear
5262
+ }) => {
5263
+ if (!showClearButton && !endAdornment && !loading) {
5264
+ return null;
5265
+ }
5266
+ return /* @__PURE__ */ jsxRuntime.jsx(
5267
+ SearchInputAdornment,
5268
+ {
5269
+ position: "end",
5270
+ expanded: Boolean(endAdornment && showClearButton),
5271
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
5272
+ material.Stack,
5273
+ {
5274
+ direction: "row",
5275
+ spacing: 1,
5276
+ sx: {
5277
+ alignItems: "center"
5278
+ },
5279
+ children: [
5280
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSearchIcon, { size: cssUtils.ICON_SIZE_MEDIUM }) : showClearButton ? clearButton ?? /* @__PURE__ */ jsxRuntime.jsx(
5281
+ cssUtils.IconButton,
5282
+ {
5283
+ onClick: onClear,
5284
+ size,
5285
+ color: "default",
5286
+ disabled,
5287
+ tooltip: clearButtonLabel,
5288
+ "aria-label": clearButtonLabel,
5289
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ClearSearchIcon, {})
5290
+ }
5291
+ ) : null,
5292
+ endAdornment
5293
+ ]
5294
+ }
5295
+ )
5296
+ }
5297
+ );
5298
+ };
5299
+ const SearchFieldStartAdornment = ({
5300
+ minimized,
5301
+ loading,
5302
+ startAdornment,
5303
+ disabled
5304
+ }) => {
5305
+ return /* @__PURE__ */ jsxRuntime.jsx(SearchInputAdornment, { position: "start", minimized, children: loading && minimized ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSearchIcon, { size: cssUtils.ICON_SIZE_MEDIUM }) : startAdornment || /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, { disabled, minimized }) });
5306
+ };
5307
+ function _SearchField({
5308
+ value,
5309
+ defaultValue,
5310
+ placeholder,
5311
+ disabled,
5312
+ minimized = false,
5313
+ loading = false,
5314
+ variant = "filled",
5315
+ size = "small",
5316
+ InputProps,
5317
+ inputProps,
5318
+ startAdornment,
5319
+ endAdornment,
5320
+ onFocus,
5321
+ onBlur,
5322
+ onChange,
5323
+ onClick,
5324
+ onResetSearch,
5325
+ showClearButton = true,
5326
+ clearButtonLabel,
5327
+ clearButton,
5328
+ ...otherProps
5329
+ }, ref) {
5330
+ const [isInputFocused, setIsInputFocused] = React.useState(false);
5331
+ const clearButtonVisibility = !disabled && Boolean(value ?? defaultValue) && showClearButton;
5332
+ const clearButtonLabelValue = cssUtils.useTranslationWithFallback(
5333
+ "c4r.button.clear",
5334
+ clearButtonLabel
5335
+ );
5336
+ const handleFocus = (event) => {
5337
+ setIsInputFocused(true);
5338
+ onFocus == null ? void 0 : onFocus(event);
5339
+ };
5340
+ const handleBlur = (event) => {
5341
+ setIsInputFocused(false);
5342
+ onBlur == null ? void 0 : onBlur(event);
5343
+ };
5344
+ const handleClear = () => {
5345
+ onResetSearch == null ? void 0 : onResetSearch();
5346
+ onChange == null ? void 0 : onChange({ target: { value: "" } });
5347
+ };
5348
+ return /* @__PURE__ */ jsxRuntime.jsx(
5349
+ SearchFieldBase,
5350
+ {
5351
+ defaultValue,
5352
+ value: minimized ? "" : value,
5353
+ placeholder: minimized ? "" : placeholder,
5354
+ onChange,
5355
+ onClick,
5356
+ variant: "filled",
5357
+ emphasis: variant,
5358
+ size,
5359
+ focused: false,
5360
+ isInputFocused,
5361
+ disabled,
5362
+ minimized,
5363
+ InputProps: {
5364
+ onFocus: handleFocus,
5365
+ onBlur: handleBlur,
5366
+ startAdornment: /* @__PURE__ */ jsxRuntime.jsx(
5367
+ SearchFieldStartAdornment,
5368
+ {
5369
+ minimized,
5370
+ loading,
5371
+ disabled,
5372
+ startAdornment
5373
+ }
5374
+ ),
5375
+ endAdornment: !minimized && /* @__PURE__ */ jsxRuntime.jsx(
5376
+ SearchFieldEndAdornment,
5377
+ {
5378
+ disabled,
5379
+ loading,
5380
+ showClearButton: clearButtonVisibility,
5381
+ clearButton,
5382
+ clearButtonLabel: clearButtonLabelValue,
5383
+ onClear: handleClear,
5384
+ size,
5385
+ endAdornment
5386
+ }
5387
+ ),
5388
+ ...InputProps
5389
+ },
5390
+ inputProps: {
5391
+ role: "searchbox",
5392
+ ...inputProps
5393
+ },
5394
+ role: "search",
5395
+ "data-variant": variant,
5396
+ "data-name": "search-field",
5397
+ ref,
5398
+ ...otherProps
5399
+ }
5400
+ );
5401
+ }
5402
+ const SearchField = React.forwardRef(_SearchField);
5042
5403
  const MAX_WIDTH = 480;
5043
5404
  const SnackbarRoot = material.styled(material.Snackbar)(({ theme }) => ({
5044
5405
  bottom: theme.spacing(2),
@@ -5857,12 +6218,14 @@ exports.EllipsisWithTooltip = EllipsisWithTooltip;
5857
6218
  exports.FilterDropdown = FilterDropdown;
5858
6219
  exports.FilterDropdownMenuItem = FilterDropdownMenuItem;
5859
6220
  exports.LabelWithIndicator = LabelWithIndicator;
6221
+ exports.Loader = Loader;
5860
6222
  exports.Menu = Menu;
5861
6223
  exports.MenuItemFilter = MenuItemFilter;
5862
6224
  exports.MenuList = MenuList;
5863
6225
  exports.MultipleAutocomplete = MultipleAutocomplete;
5864
6226
  exports.MultipleSelectField = MultipleSelectField;
5865
6227
  exports.PasswordField = PasswordField;
6228
+ exports.SearchField = SearchField;
5866
6229
  exports.SelectField = SelectField;
5867
6230
  exports.Snackbar = Snackbar;
5868
6231
  exports.SplitButton = SplitButton;