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

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 +352 -3
  11. package/dist/components/index.js +355 -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 +10 -0
  19. package/dist/types/components/Loader/Loader.d.ts.map +1 -0
  20. package/dist/types/components/Loader/Loader.stories.d.ts +54 -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,64 @@ 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
+ fullHeight,
898
+ ...otherProps
899
+ }, ref) {
900
+ const labelText = cssUtils.useTranslationWithFallback("c4r.utils.loader.label", label);
901
+ const hasAnyLabel = labelText || secondLabel;
902
+ return /* @__PURE__ */ jsxRuntime.jsxs(
903
+ StyledGrid,
904
+ {
905
+ container: true,
906
+ fullHeight,
907
+ ...otherProps,
908
+ ref,
909
+ "aria-busy": true,
910
+ "data-name": "loader",
911
+ "data-full-height": fullHeight,
912
+ children: [
913
+ /* @__PURE__ */ jsxRuntime.jsx(
914
+ material.CircularProgress,
915
+ {
916
+ color,
917
+ "aria-labelledby": hasAnyLabel ? "loader-label" : void 0
918
+ }
919
+ ),
920
+ hasAnyLabel && /* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { direction: "column", alignItems: "center", children: [
921
+ labelText && /* @__PURE__ */ jsxRuntime.jsx(cssUtils.Typography, { variant: "body2", color: "textSecondary", id: "loader-label", children: labelText }),
922
+ secondLabel && /* @__PURE__ */ jsxRuntime.jsx(
923
+ cssUtils.Typography,
924
+ {
925
+ variant: "body2",
926
+ color: "textSecondary",
927
+ id: labelText ? void 0 : "loader-label",
928
+ children: secondLabel
929
+ }
930
+ )
931
+ ] })
932
+ ]
933
+ }
934
+ );
935
+ }
936
+ const Loader = React.forwardRef(_Loader);
878
937
  async function copyString(value) {
879
938
  return await navigator.clipboard.writeText(value);
880
939
  }
@@ -5039,6 +5098,294 @@ function _FilterDropdown({
5039
5098
  const FilterDropdown = React.forwardRef(
5040
5099
  _FilterDropdown
5041
5100
  );
5101
+ const SearchIcon = material.styled(Search.Search, {
5102
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "disabled"
5103
+ })(
5104
+ ({ theme, minimized, disabled }) => ({
5105
+ cursor: !disabled && minimized ? "pointer" : "inherit",
5106
+ width: cssUtils.ICON_SIZE_MEDIUM,
5107
+ height: cssUtils.ICON_SIZE_MEDIUM,
5108
+ path: {
5109
+ fillOpacity: 1,
5110
+ fill: disabled ? theme.palette.text.disabled : theme.palette.text.secondary
5111
+ }
5112
+ })
5113
+ );
5114
+ const ClearSearchIcon = material.styled(iconsMaterial.Cancel)(({ theme }) => ({
5115
+ color: `${theme.palette.text.hint} !important`
5116
+ }));
5117
+ const LoadingSearchIcon = material.styled(material.CircularProgress)(({ theme }) => ({
5118
+ svg: {
5119
+ color: `${theme.palette.primary.main} !important`
5120
+ }
5121
+ }));
5122
+ const SearchInputAdornment = material.styled(material.InputAdornment, {
5123
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "expanded"
5124
+ })(
5125
+ ({ theme, minimized, expanded }) => ({
5126
+ // Start adornment
5127
+ transition: theme.transitions.create(["width", "margin"], {
5128
+ easing: theme.transitions.easing.easeInOut,
5129
+ duration: theme.transitions.duration.short
5130
+ }),
5131
+ "&.MuiInputAdornment-positionStart": {
5132
+ marginLeft: minimized ? theme.spacing(2) : void 0,
5133
+ "&.MuiInputAdornment-sizeSmall": {
5134
+ marginLeft: minimized ? theme.spacing(1) : void 0
5135
+ }
5136
+ },
5137
+ // End adornment
5138
+ "&.MuiInputAdornment-positionEnd": {
5139
+ minWidth: theme.spacing(4),
5140
+ "&.MuiInputAdornment-sizeSmall": {
5141
+ minWidth: theme.spacing(3)
5142
+ }
5143
+ },
5144
+ ...expanded && !minimized && {
5145
+ "&.MuiInputAdornment-root": {
5146
+ minWidth: theme.spacing(9),
5147
+ "&.MuiInputAdornment-sizeSmall": {
5148
+ minWidth: theme.spacing(7)
5149
+ }
5150
+ }
5151
+ }
5152
+ })
5153
+ );
5154
+ const SearchFieldBase = material.styled(material.TextField, {
5155
+ shouldForwardProp: (prop) => prop !== "minimized" && prop !== "isInputFocused" && prop !== "emphasis"
5156
+ })(({ theme, emphasis = "filled", minimized, isInputFocused }) => ({
5157
+ "&.MuiTextField-root .MuiInputBase-root": {
5158
+ paddingRight: theme.spacing(1),
5159
+ transition: theme.transitions.create(["width", "padding"], {
5160
+ easing: theme.transitions.easing.easeInOut,
5161
+ duration: theme.transitions.duration.standard
5162
+ }),
5163
+ "&.MuiInputBase-sizeSmall": {
5164
+ paddingRight: theme.spacing(0.5)
5165
+ },
5166
+ "&:before": {
5167
+ border: "none !important",
5168
+ "&:hover": {
5169
+ border: "none !important"
5170
+ }
5171
+ },
5172
+ // Input
5173
+ "& .MuiInputBase-input": {
5174
+ pointerEvents: isInputFocused ? "auto" : "none",
5175
+ // Fix Chrome scroll issue https://issues.chromium.org/issues/41245282
5176
+ transition: theme.transitions.create("width", {
5177
+ easing: theme.transitions.easing.easeInOut,
5178
+ duration: theme.transitions.duration.standard
5179
+ })
5180
+ },
5181
+ // Error state
5182
+ "&.Mui-error": {
5183
+ "&::after": {
5184
+ borderColor: "transparent !important"
5185
+ }
5186
+ },
5187
+ ...minimized && {
5188
+ display: "flex",
5189
+ alignItems: "center",
5190
+ padding: 0,
5191
+ width: theme.spacing(6),
5192
+ cursor: "pointer",
5193
+ "& .MuiInputBase-input": {
5194
+ width: 0
5195
+ },
5196
+ "&.MuiInputBase-sizeSmall": {
5197
+ padding: 0,
5198
+ width: theme.spacing(4)
5199
+ }
5200
+ }
5201
+ },
5202
+ // Variants
5203
+ ...emphasis === "filled" && {
5204
+ "& .MuiInputBase-root": {
5205
+ backgroundColor: minimized ? "transparent !important" : void 0,
5206
+ "&:hover": {
5207
+ backgroundColor: `${theme.palette.action.hover} !important`
5208
+ },
5209
+ // not disabled
5210
+ "&:not(.Mui-disabled):hover": {
5211
+ backgroundColor: `${theme.palette.action.hover} !important`
5212
+ }
5213
+ }
5214
+ },
5215
+ ...emphasis === "transparent" && {
5216
+ "& .MuiInputBase-root": {
5217
+ backgroundColor: "transparent !important",
5218
+ "&:hover": {
5219
+ backgroundColor: minimized ? `${theme.palette.action.hover} !important` : "transparent !important"
5220
+ },
5221
+ "&.Mui-disabled": {
5222
+ backgroundColor: "transparent !important"
5223
+ }
5224
+ }
5225
+ },
5226
+ ...emphasis === "floating" && {
5227
+ "& .MuiInputBase-root": {
5228
+ backgroundColor: `${theme.palette.background.paper} !important`,
5229
+ boxShadow: theme.shadows[1],
5230
+ "&:hover": {
5231
+ backgroundColor: minimized ? `${theme.palette.action.hover} !important` : `${theme.palette.background.paper} !important`
5232
+ },
5233
+ "&.Mui-disabled": {
5234
+ backgroundColor: `${theme.palette.background.paper} !important`
5235
+ }
5236
+ }
5237
+ }
5238
+ }));
5239
+ const SearchFieldEndAdornment = ({
5240
+ disabled,
5241
+ showClearButton = true,
5242
+ loading,
5243
+ size,
5244
+ endAdornment,
5245
+ clearButton,
5246
+ clearButtonLabel,
5247
+ onClear
5248
+ }) => {
5249
+ if (!showClearButton && !endAdornment && !loading) {
5250
+ return null;
5251
+ }
5252
+ return /* @__PURE__ */ jsxRuntime.jsx(
5253
+ SearchInputAdornment,
5254
+ {
5255
+ position: "end",
5256
+ expanded: Boolean(endAdornment && showClearButton),
5257
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
5258
+ material.Stack,
5259
+ {
5260
+ direction: "row",
5261
+ spacing: 1,
5262
+ sx: {
5263
+ alignItems: "center"
5264
+ },
5265
+ children: [
5266
+ loading ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSearchIcon, { size: cssUtils.ICON_SIZE_MEDIUM }) : showClearButton ? clearButton ?? /* @__PURE__ */ jsxRuntime.jsx(
5267
+ cssUtils.IconButton,
5268
+ {
5269
+ onClick: onClear,
5270
+ size,
5271
+ color: "default",
5272
+ disabled,
5273
+ tooltip: clearButtonLabel,
5274
+ "aria-label": clearButtonLabel,
5275
+ icon: /* @__PURE__ */ jsxRuntime.jsx(ClearSearchIcon, {})
5276
+ }
5277
+ ) : null,
5278
+ endAdornment
5279
+ ]
5280
+ }
5281
+ )
5282
+ }
5283
+ );
5284
+ };
5285
+ const SearchFieldStartAdornment = ({
5286
+ minimized,
5287
+ loading,
5288
+ startAdornment,
5289
+ disabled
5290
+ }) => {
5291
+ 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 }) });
5292
+ };
5293
+ function _SearchField({
5294
+ value,
5295
+ defaultValue,
5296
+ placeholder,
5297
+ disabled,
5298
+ minimized = false,
5299
+ loading = false,
5300
+ variant = "filled",
5301
+ size = "small",
5302
+ InputProps,
5303
+ inputProps,
5304
+ startAdornment,
5305
+ endAdornment,
5306
+ onFocus,
5307
+ onBlur,
5308
+ onChange,
5309
+ onClick,
5310
+ onResetSearch,
5311
+ showClearButton = true,
5312
+ clearButtonLabel,
5313
+ clearButton,
5314
+ ...otherProps
5315
+ }, ref) {
5316
+ const [isInputFocused, setIsInputFocused] = React.useState(false);
5317
+ const clearButtonVisibility = !disabled && Boolean(value ?? defaultValue) && showClearButton;
5318
+ const clearButtonLabelValue = cssUtils.useTranslationWithFallback(
5319
+ "c4r.button.clear",
5320
+ clearButtonLabel
5321
+ );
5322
+ const handleFocus = (event) => {
5323
+ setIsInputFocused(true);
5324
+ onFocus == null ? void 0 : onFocus(event);
5325
+ };
5326
+ const handleBlur = (event) => {
5327
+ setIsInputFocused(false);
5328
+ onBlur == null ? void 0 : onBlur(event);
5329
+ };
5330
+ const handleClear = () => {
5331
+ onResetSearch == null ? void 0 : onResetSearch();
5332
+ onChange == null ? void 0 : onChange({ target: { value: "" } });
5333
+ };
5334
+ return /* @__PURE__ */ jsxRuntime.jsx(
5335
+ SearchFieldBase,
5336
+ {
5337
+ defaultValue,
5338
+ value: minimized ? "" : value,
5339
+ placeholder: minimized ? "" : placeholder,
5340
+ onChange,
5341
+ onClick,
5342
+ variant: "filled",
5343
+ emphasis: variant,
5344
+ size,
5345
+ focused: false,
5346
+ isInputFocused,
5347
+ disabled,
5348
+ minimized,
5349
+ InputProps: {
5350
+ onFocus: handleFocus,
5351
+ onBlur: handleBlur,
5352
+ startAdornment: /* @__PURE__ */ jsxRuntime.jsx(
5353
+ SearchFieldStartAdornment,
5354
+ {
5355
+ minimized,
5356
+ loading,
5357
+ disabled,
5358
+ startAdornment
5359
+ }
5360
+ ),
5361
+ endAdornment: !minimized && /* @__PURE__ */ jsxRuntime.jsx(
5362
+ SearchFieldEndAdornment,
5363
+ {
5364
+ disabled,
5365
+ loading,
5366
+ showClearButton: clearButtonVisibility,
5367
+ clearButton,
5368
+ clearButtonLabel: clearButtonLabelValue,
5369
+ onClear: handleClear,
5370
+ size,
5371
+ endAdornment
5372
+ }
5373
+ ),
5374
+ ...InputProps
5375
+ },
5376
+ inputProps: {
5377
+ role: "searchbox",
5378
+ ...inputProps
5379
+ },
5380
+ role: "search",
5381
+ "data-variant": variant,
5382
+ "data-name": "search-field",
5383
+ ref,
5384
+ ...otherProps
5385
+ }
5386
+ );
5387
+ }
5388
+ const SearchField = React.forwardRef(_SearchField);
5042
5389
  const MAX_WIDTH = 480;
5043
5390
  const SnackbarRoot = material.styled(material.Snackbar)(({ theme }) => ({
5044
5391
  bottom: theme.spacing(2),
@@ -5857,12 +6204,14 @@ exports.EllipsisWithTooltip = EllipsisWithTooltip;
5857
6204
  exports.FilterDropdown = FilterDropdown;
5858
6205
  exports.FilterDropdownMenuItem = FilterDropdownMenuItem;
5859
6206
  exports.LabelWithIndicator = LabelWithIndicator;
6207
+ exports.Loader = Loader;
5860
6208
  exports.Menu = Menu;
5861
6209
  exports.MenuItemFilter = MenuItemFilter;
5862
6210
  exports.MenuList = MenuList;
5863
6211
  exports.MultipleAutocomplete = MultipleAutocomplete;
5864
6212
  exports.MultipleSelectField = MultipleSelectField;
5865
6213
  exports.PasswordField = PasswordField;
6214
+ exports.SearchField = SearchField;
5866
6215
  exports.SelectField = SelectField;
5867
6216
  exports.Snackbar = Snackbar;
5868
6217
  exports.SplitButton = SplitButton;