@carto/meridian-ds 2.7.0-alpha-loader.6 → 2.8.0-alpha-empty-state.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.
- package/CHANGELOG.md +9 -2
- package/dist/{Alert-CHyETxuP.js → Alert-BZPM5zpX.js} +1 -1
- package/dist/{Alert-DyUCYGVG.cjs → Alert-C4W0H_uN.cjs} +1 -1
- package/dist/{MenuItem-BLZz_nSA.cjs → MenuItem-CgF4QdGi.cjs} +1 -1
- package/dist/{MenuItem-CM00TU3e.js → MenuItem-DRUK149i.js} +1 -1
- package/dist/components/index.cjs +159 -92
- package/dist/components/index.js +161 -94
- package/dist/{css-utils-B9V_AMcv.cjs → css-utils-CH7es90t.cjs} +1 -212
- package/dist/{css-utils-Cr7ZvmiF.js → css-utils-CjUBRJVK.js} +5 -216
- package/dist/custom-icons/index.cjs +296 -226
- package/dist/custom-icons/index.js +296 -226
- package/dist/palette-utils-B9ybmwiI.cjs +304 -0
- package/dist/palette-utils-BHqJlHm9.js +288 -0
- package/dist/theme/index.cjs +83 -14
- package/dist/theme/index.js +76 -6
- package/dist/types/components/CircularProgress/CircularProgress.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts +1 -1
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts +13 -0
- package/dist/types/components/Dialog/DialogConfirmation/DialogConfirmation.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts +1 -1
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.stories.d.ts +31 -0
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/types.d.ts +7 -1
- package/dist/types/components/Dialog/types.d.ts.map +1 -1
- package/dist/types/components/EmptyState/EmptyState.d.ts +4 -0
- package/dist/types/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/dist/types/components/EmptyState/EmptyState.stories.d.ts +158 -0
- package/dist/types/components/EmptyState/EmptyState.stories.d.ts.map +1 -0
- package/dist/types/components/EmptyState/EmptyState.styled.d.ts +40 -0
- package/dist/types/components/EmptyState/EmptyState.styled.d.ts.map +1 -0
- package/dist/types/components/EmptyState/EmptyState.test.d.ts +2 -0
- package/dist/types/components/EmptyState/EmptyState.test.d.ts.map +1 -0
- package/dist/types/components/EmptyState/index.d.ts +3 -0
- package/dist/types/components/EmptyState/index.d.ts.map +1 -0
- package/dist/types/components/EmptyState/types.d.ts +71 -0
- package/dist/types/components/EmptyState/types.d.ts.map +1 -0
- package/dist/types/components/Loader/Loader.d.ts +1 -39
- package/dist/types/components/Loader/Loader.d.ts.map +1 -1
- package/dist/types/components/Loader/Loader.stories.d.ts +1 -1
- package/dist/types/components/Loader/Loader.stories.d.ts.map +1 -1
- package/dist/types/components/Loader/index.d.ts +1 -1
- package/dist/types/components/Loader/index.d.ts.map +1 -1
- package/dist/types/components/Loader/types.d.ts +40 -0
- package/dist/types/components/Loader/types.d.ts.map +1 -0
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.d.ts +1 -4
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.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/CreateFolder.d.ts +4 -0
- package/dist/types/custom-icons/CreateFolder.d.ts.map +1 -0
- package/dist/types/custom-icons/FolderEmpty.d.ts +4 -0
- package/dist/types/custom-icons/FolderEmpty.d.ts.map +1 -0
- package/dist/types/custom-icons/SelectFeature.d.ts.map +1 -1
- package/dist/types/custom-icons/index.d.ts +2 -0
- package/dist/types/custom-icons/index.d.ts.map +1 -1
- package/dist/types/theme/components/buttons.d.ts.map +1 -1
- package/dist/types/theme/components/stories/LinearProgress.stories.d.ts.map +1 -1
- package/dist/types/theme/types.d.ts +6 -0
- package/dist/types/theme/types.d.ts.map +1 -1
- package/dist/widgets/index.cjs +5 -5
- package/dist/widgets/index.js +3 -3
- package/package.json +1 -1
- package/dist/palette-utils-C5CHlLXB.cjs +0 -93
- package/dist/palette-utils-D99Ib0kC.js +0 -77
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const material = require("@mui/material");
|
|
3
|
+
const cartoColors = require("cartocolor");
|
|
4
|
+
function _interopNamespaceDefault(e) {
|
|
5
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
|
+
if (e) {
|
|
7
|
+
for (const k in e) {
|
|
8
|
+
if (k !== "default") {
|
|
9
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: () => e[k]
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
n.default = e;
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
const cartoColors__namespace = /* @__PURE__ */ _interopNamespaceDefault(cartoColors);
|
|
21
|
+
const COLOR_BLACK = "#2C3032";
|
|
22
|
+
const COLOR_WHITE = "#FFFFFF";
|
|
23
|
+
const COLOR_UNUSED = "#e91e63";
|
|
24
|
+
const baseColors = {
|
|
25
|
+
common: {
|
|
26
|
+
black: COLOR_BLACK,
|
|
27
|
+
white: COLOR_WHITE
|
|
28
|
+
},
|
|
29
|
+
neutral: {
|
|
30
|
+
50: "#f8f9f9",
|
|
31
|
+
100: "#e1e3e4",
|
|
32
|
+
200: "#cbcdcf",
|
|
33
|
+
300: "#b4b8ba",
|
|
34
|
+
400: "#9da2a6",
|
|
35
|
+
500: "#868d91",
|
|
36
|
+
600: "#6f777c",
|
|
37
|
+
700: "#595f63",
|
|
38
|
+
800: "#43474a",
|
|
39
|
+
900: COLOR_BLACK,
|
|
40
|
+
A100: "#ddddde",
|
|
41
|
+
A200: "#b9babb",
|
|
42
|
+
A400: "#7c7e7f",
|
|
43
|
+
A700: "#16191A"
|
|
44
|
+
},
|
|
45
|
+
blue: {
|
|
46
|
+
100: "#B9DAF9",
|
|
47
|
+
200: "#5DB2F6",
|
|
48
|
+
300: "#358BE7",
|
|
49
|
+
400: "#036FE2",
|
|
50
|
+
500: "#024D9E"
|
|
51
|
+
},
|
|
52
|
+
green: {
|
|
53
|
+
300: "#6BE2AD",
|
|
54
|
+
400: "#47DB99",
|
|
55
|
+
500: "#31996B"
|
|
56
|
+
},
|
|
57
|
+
lightGreen: {
|
|
58
|
+
300: "#8CB24A",
|
|
59
|
+
400: "#709F1D",
|
|
60
|
+
500: "#435F11"
|
|
61
|
+
},
|
|
62
|
+
indigo: {
|
|
63
|
+
300: "#34689F",
|
|
64
|
+
400: "#024388",
|
|
65
|
+
500: "#012C5A"
|
|
66
|
+
},
|
|
67
|
+
orange: {
|
|
68
|
+
300: "#F4B134",
|
|
69
|
+
400: "#F29E02",
|
|
70
|
+
500: "#A96E01"
|
|
71
|
+
},
|
|
72
|
+
red: {
|
|
73
|
+
300: "#CD593B",
|
|
74
|
+
400: "#C1300B",
|
|
75
|
+
500: "#872107"
|
|
76
|
+
},
|
|
77
|
+
qualitative: {
|
|
78
|
+
// CARTO colors
|
|
79
|
+
// TODO: Related discussion https://app.shortcut.com/cartoteam/story/264834/
|
|
80
|
+
bold: {
|
|
81
|
+
0: "#7F3C8D",
|
|
82
|
+
1: "#11A579",
|
|
83
|
+
2: "#3969AC",
|
|
84
|
+
3: "#F2B701",
|
|
85
|
+
4: "#E73F74",
|
|
86
|
+
5: "#80BA5A",
|
|
87
|
+
6: "#E68310",
|
|
88
|
+
7: "#008695",
|
|
89
|
+
8: "#CF1C90",
|
|
90
|
+
9: "#f97b72",
|
|
91
|
+
10: "#4b4b8f",
|
|
92
|
+
11: "#A5AA99"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
shades: {
|
|
96
|
+
dark: {
|
|
97
|
+
90: material.alpha(COLOR_BLACK, 0.9),
|
|
98
|
+
60: material.alpha(COLOR_BLACK, 0.6),
|
|
99
|
+
40: material.alpha(COLOR_BLACK, 0.4),
|
|
100
|
+
25: material.alpha(COLOR_BLACK, 0.25),
|
|
101
|
+
12: material.alpha(COLOR_BLACK, 0.12),
|
|
102
|
+
8: material.alpha(COLOR_BLACK, 0.08),
|
|
103
|
+
4: material.alpha(COLOR_BLACK, 0.04)
|
|
104
|
+
},
|
|
105
|
+
light: {
|
|
106
|
+
90: material.alpha(COLOR_WHITE, 0.9),
|
|
107
|
+
60: material.alpha(COLOR_WHITE, 0.6),
|
|
108
|
+
40: material.alpha(COLOR_WHITE, 0.4),
|
|
109
|
+
25: material.alpha(COLOR_WHITE, 0.25),
|
|
110
|
+
12: material.alpha(COLOR_WHITE, 0.12),
|
|
111
|
+
8: material.alpha(COLOR_WHITE, 0.08),
|
|
112
|
+
4: material.alpha(COLOR_WHITE, 0.04)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const commonPalette = {
|
|
117
|
+
mode: "light",
|
|
118
|
+
contrastThreshold: 3,
|
|
119
|
+
tonalOffset: 0.2,
|
|
120
|
+
common: { ...baseColors.common },
|
|
121
|
+
primary: {
|
|
122
|
+
main: baseColors.blue[400],
|
|
123
|
+
dark: baseColors.blue[500],
|
|
124
|
+
light: baseColors.blue[300],
|
|
125
|
+
contrastText: baseColors.common.white,
|
|
126
|
+
background: material.alpha(baseColors.blue[400], 0.08),
|
|
127
|
+
relatedLight: "#EAF2FC",
|
|
128
|
+
relatedDark: COLOR_UNUSED
|
|
129
|
+
},
|
|
130
|
+
secondary: {
|
|
131
|
+
main: baseColors.green[400],
|
|
132
|
+
dark: baseColors.green[500],
|
|
133
|
+
light: baseColors.green[300],
|
|
134
|
+
contrastText: baseColors.common.black,
|
|
135
|
+
background: material.alpha(baseColors.green[400], 0.08),
|
|
136
|
+
relatedLight: "#EFFCF5",
|
|
137
|
+
relatedDark: COLOR_UNUSED
|
|
138
|
+
},
|
|
139
|
+
text: {
|
|
140
|
+
primary: baseColors.common.black,
|
|
141
|
+
secondary: baseColors.shades.dark[60],
|
|
142
|
+
disabled: baseColors.shades.dark[25],
|
|
143
|
+
hint: baseColors.shades.dark[40]
|
|
144
|
+
},
|
|
145
|
+
background: {
|
|
146
|
+
paper: baseColors.common.white,
|
|
147
|
+
default: baseColors.neutral[50]
|
|
148
|
+
},
|
|
149
|
+
action: {
|
|
150
|
+
active: baseColors.shades.dark[40],
|
|
151
|
+
hover: baseColors.shades.dark[8],
|
|
152
|
+
disabledBackground: baseColors.neutral[100],
|
|
153
|
+
disabled: baseColors.shades.dark[25],
|
|
154
|
+
selected: baseColors.shades.dark[12],
|
|
155
|
+
focus: baseColors.shades.dark[12],
|
|
156
|
+
activatedOpacity: 0.12,
|
|
157
|
+
hoverOpacity: 0.04,
|
|
158
|
+
selectedOpacity: 0.08,
|
|
159
|
+
disabledOpacity: 0.38,
|
|
160
|
+
focusOpacity: 0.12
|
|
161
|
+
},
|
|
162
|
+
info: {
|
|
163
|
+
main: baseColors.indigo[400],
|
|
164
|
+
dark: baseColors.indigo[500],
|
|
165
|
+
light: baseColors.indigo[300],
|
|
166
|
+
contrastText: baseColors.common.white,
|
|
167
|
+
relatedDark: "#0D2B4A",
|
|
168
|
+
relatedLight: "#E9EEF4",
|
|
169
|
+
background: COLOR_UNUSED
|
|
170
|
+
},
|
|
171
|
+
success: {
|
|
172
|
+
main: baseColors.lightGreen[400],
|
|
173
|
+
dark: baseColors.lightGreen[500],
|
|
174
|
+
light: baseColors.lightGreen[300],
|
|
175
|
+
contrastText: baseColors.common.white,
|
|
176
|
+
relatedDark: "#3D541A",
|
|
177
|
+
relatedLight: "#F2F5EB",
|
|
178
|
+
background: COLOR_UNUSED
|
|
179
|
+
},
|
|
180
|
+
warning: {
|
|
181
|
+
main: baseColors.orange[400],
|
|
182
|
+
dark: baseColors.orange[500],
|
|
183
|
+
light: baseColors.orange[300],
|
|
184
|
+
contrastText: baseColors.common.black,
|
|
185
|
+
relatedDark: "#78540F",
|
|
186
|
+
relatedLight: "#FEF6EA",
|
|
187
|
+
background: COLOR_UNUSED
|
|
188
|
+
},
|
|
189
|
+
error: {
|
|
190
|
+
main: baseColors.red[400],
|
|
191
|
+
light: baseColors.red[300],
|
|
192
|
+
dark: baseColors.red[500],
|
|
193
|
+
contrastText: baseColors.common.white,
|
|
194
|
+
relatedDark: "#622215",
|
|
195
|
+
relatedLight: "#F9EDEA",
|
|
196
|
+
background: COLOR_UNUSED
|
|
197
|
+
},
|
|
198
|
+
grey: {
|
|
199
|
+
...baseColors.neutral
|
|
200
|
+
},
|
|
201
|
+
divider: baseColors.shades.dark[12],
|
|
202
|
+
// Custom common colors
|
|
203
|
+
default: {
|
|
204
|
+
main: baseColors.neutral[100],
|
|
205
|
+
dark: baseColors.neutral[200],
|
|
206
|
+
light: baseColors.neutral[50],
|
|
207
|
+
outlinedBorder: baseColors.shades.dark[25],
|
|
208
|
+
background: baseColors.shades.dark[4],
|
|
209
|
+
relatedLight: COLOR_UNUSED,
|
|
210
|
+
relatedDark: COLOR_UNUSED,
|
|
211
|
+
contrastText: COLOR_UNUSED
|
|
212
|
+
},
|
|
213
|
+
brand: {
|
|
214
|
+
navyBlue: "#162945",
|
|
215
|
+
locationRed: "#EB1510",
|
|
216
|
+
predictionBlue: "#1785FB",
|
|
217
|
+
softBlue: "#F2F6F9",
|
|
218
|
+
appBarMain: "#162945",
|
|
219
|
+
appBarContrastText: baseColors.common.white
|
|
220
|
+
},
|
|
221
|
+
white: {
|
|
222
|
+
...baseColors.shades.light
|
|
223
|
+
},
|
|
224
|
+
black: {
|
|
225
|
+
...baseColors.shades.dark
|
|
226
|
+
},
|
|
227
|
+
qualitative: {
|
|
228
|
+
...baseColors.qualitative
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function getPaletteFromCartoColors(name, domainSize) {
|
|
232
|
+
var _a;
|
|
233
|
+
const palette = cartoColors__namespace[name];
|
|
234
|
+
let paletteIndex = domainSize;
|
|
235
|
+
if (!palette) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`Palette "${name}" not found. Expected a CARTOColors string`
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
const palettesColorVariants = Object.keys(palette).filter((p) => p !== "tags").map(Number);
|
|
241
|
+
const longestPaletteIndex = Math.max(...palettesColorVariants);
|
|
242
|
+
const smallestPaletteIndex = Math.min(...palettesColorVariants);
|
|
243
|
+
if (!Number.isInteger(domainSize) || domainSize > longestPaletteIndex) {
|
|
244
|
+
paletteIndex = longestPaletteIndex;
|
|
245
|
+
} else if (domainSize < smallestPaletteIndex) {
|
|
246
|
+
paletteIndex = smallestPaletteIndex;
|
|
247
|
+
}
|
|
248
|
+
let colors = palette[paletteIndex];
|
|
249
|
+
if ((_a = palette.tags) == null ? void 0 : _a.includes("qualitative")) {
|
|
250
|
+
colors = colors == null ? void 0 : colors.slice(0, -1);
|
|
251
|
+
}
|
|
252
|
+
return colors;
|
|
253
|
+
}
|
|
254
|
+
function getPalette(colors, domainSize) {
|
|
255
|
+
if (typeof colors === "string") {
|
|
256
|
+
return getPaletteFromCartoColors(colors, domainSize);
|
|
257
|
+
} else {
|
|
258
|
+
return colors.map((c) => {
|
|
259
|
+
if (Array.isArray(c)) {
|
|
260
|
+
const [r, g, b] = c;
|
|
261
|
+
return rgbToHex(r, g, b);
|
|
262
|
+
} else {
|
|
263
|
+
return c;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
function rgbToHex(r, g, b) {
|
|
269
|
+
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
270
|
+
}
|
|
271
|
+
function getCartoColorStylePropsForItem(theme, index) {
|
|
272
|
+
var _a;
|
|
273
|
+
const palette = (_a = commonPalette == null ? void 0 : commonPalette.qualitative) == null ? void 0 : _a.bold;
|
|
274
|
+
const colors = Object.values(palette ?? {});
|
|
275
|
+
const chosenIndex = index % colors.length;
|
|
276
|
+
return {
|
|
277
|
+
backgroundColor: colors[chosenIndex],
|
|
278
|
+
color: theme.palette.getContrastText(colors[chosenIndex])
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function getColorByCategory(category, {
|
|
282
|
+
palette,
|
|
283
|
+
fallbackColor,
|
|
284
|
+
colorMapping
|
|
285
|
+
}) {
|
|
286
|
+
const assignedColor = colorMapping[category];
|
|
287
|
+
if (assignedColor) {
|
|
288
|
+
return colorMapping[category];
|
|
289
|
+
}
|
|
290
|
+
if (!palette || palette.length === 0) {
|
|
291
|
+
return fallbackColor;
|
|
292
|
+
}
|
|
293
|
+
const nextFreeColorIndex = Math.min(
|
|
294
|
+
Object.keys(colorMapping).length,
|
|
295
|
+
palette.length - 1
|
|
296
|
+
);
|
|
297
|
+
const newColor = palette[nextFreeColorIndex];
|
|
298
|
+
colorMapping[category] = newColor;
|
|
299
|
+
return newColor;
|
|
300
|
+
}
|
|
301
|
+
exports.commonPalette = commonPalette;
|
|
302
|
+
exports.getCartoColorStylePropsForItem = getCartoColorStylePropsForItem;
|
|
303
|
+
exports.getColorByCategory = getColorByCategory;
|
|
304
|
+
exports.getPalette = getPalette;
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { alpha } from "@mui/material";
|
|
2
|
+
import * as cartoColors from "cartocolor";
|
|
3
|
+
const COLOR_BLACK = "#2C3032";
|
|
4
|
+
const COLOR_WHITE = "#FFFFFF";
|
|
5
|
+
const COLOR_UNUSED = "#e91e63";
|
|
6
|
+
const baseColors = {
|
|
7
|
+
common: {
|
|
8
|
+
black: COLOR_BLACK,
|
|
9
|
+
white: COLOR_WHITE
|
|
10
|
+
},
|
|
11
|
+
neutral: {
|
|
12
|
+
50: "#f8f9f9",
|
|
13
|
+
100: "#e1e3e4",
|
|
14
|
+
200: "#cbcdcf",
|
|
15
|
+
300: "#b4b8ba",
|
|
16
|
+
400: "#9da2a6",
|
|
17
|
+
500: "#868d91",
|
|
18
|
+
600: "#6f777c",
|
|
19
|
+
700: "#595f63",
|
|
20
|
+
800: "#43474a",
|
|
21
|
+
900: COLOR_BLACK,
|
|
22
|
+
A100: "#ddddde",
|
|
23
|
+
A200: "#b9babb",
|
|
24
|
+
A400: "#7c7e7f",
|
|
25
|
+
A700: "#16191A"
|
|
26
|
+
},
|
|
27
|
+
blue: {
|
|
28
|
+
100: "#B9DAF9",
|
|
29
|
+
200: "#5DB2F6",
|
|
30
|
+
300: "#358BE7",
|
|
31
|
+
400: "#036FE2",
|
|
32
|
+
500: "#024D9E"
|
|
33
|
+
},
|
|
34
|
+
green: {
|
|
35
|
+
300: "#6BE2AD",
|
|
36
|
+
400: "#47DB99",
|
|
37
|
+
500: "#31996B"
|
|
38
|
+
},
|
|
39
|
+
lightGreen: {
|
|
40
|
+
300: "#8CB24A",
|
|
41
|
+
400: "#709F1D",
|
|
42
|
+
500: "#435F11"
|
|
43
|
+
},
|
|
44
|
+
indigo: {
|
|
45
|
+
300: "#34689F",
|
|
46
|
+
400: "#024388",
|
|
47
|
+
500: "#012C5A"
|
|
48
|
+
},
|
|
49
|
+
orange: {
|
|
50
|
+
300: "#F4B134",
|
|
51
|
+
400: "#F29E02",
|
|
52
|
+
500: "#A96E01"
|
|
53
|
+
},
|
|
54
|
+
red: {
|
|
55
|
+
300: "#CD593B",
|
|
56
|
+
400: "#C1300B",
|
|
57
|
+
500: "#872107"
|
|
58
|
+
},
|
|
59
|
+
qualitative: {
|
|
60
|
+
// CARTO colors
|
|
61
|
+
// TODO: Related discussion https://app.shortcut.com/cartoteam/story/264834/
|
|
62
|
+
bold: {
|
|
63
|
+
0: "#7F3C8D",
|
|
64
|
+
1: "#11A579",
|
|
65
|
+
2: "#3969AC",
|
|
66
|
+
3: "#F2B701",
|
|
67
|
+
4: "#E73F74",
|
|
68
|
+
5: "#80BA5A",
|
|
69
|
+
6: "#E68310",
|
|
70
|
+
7: "#008695",
|
|
71
|
+
8: "#CF1C90",
|
|
72
|
+
9: "#f97b72",
|
|
73
|
+
10: "#4b4b8f",
|
|
74
|
+
11: "#A5AA99"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
shades: {
|
|
78
|
+
dark: {
|
|
79
|
+
90: alpha(COLOR_BLACK, 0.9),
|
|
80
|
+
60: alpha(COLOR_BLACK, 0.6),
|
|
81
|
+
40: alpha(COLOR_BLACK, 0.4),
|
|
82
|
+
25: alpha(COLOR_BLACK, 0.25),
|
|
83
|
+
12: alpha(COLOR_BLACK, 0.12),
|
|
84
|
+
8: alpha(COLOR_BLACK, 0.08),
|
|
85
|
+
4: alpha(COLOR_BLACK, 0.04)
|
|
86
|
+
},
|
|
87
|
+
light: {
|
|
88
|
+
90: alpha(COLOR_WHITE, 0.9),
|
|
89
|
+
60: alpha(COLOR_WHITE, 0.6),
|
|
90
|
+
40: alpha(COLOR_WHITE, 0.4),
|
|
91
|
+
25: alpha(COLOR_WHITE, 0.25),
|
|
92
|
+
12: alpha(COLOR_WHITE, 0.12),
|
|
93
|
+
8: alpha(COLOR_WHITE, 0.08),
|
|
94
|
+
4: alpha(COLOR_WHITE, 0.04)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
const commonPalette = {
|
|
99
|
+
mode: "light",
|
|
100
|
+
contrastThreshold: 3,
|
|
101
|
+
tonalOffset: 0.2,
|
|
102
|
+
common: { ...baseColors.common },
|
|
103
|
+
primary: {
|
|
104
|
+
main: baseColors.blue[400],
|
|
105
|
+
dark: baseColors.blue[500],
|
|
106
|
+
light: baseColors.blue[300],
|
|
107
|
+
contrastText: baseColors.common.white,
|
|
108
|
+
background: alpha(baseColors.blue[400], 0.08),
|
|
109
|
+
relatedLight: "#EAF2FC",
|
|
110
|
+
relatedDark: COLOR_UNUSED
|
|
111
|
+
},
|
|
112
|
+
secondary: {
|
|
113
|
+
main: baseColors.green[400],
|
|
114
|
+
dark: baseColors.green[500],
|
|
115
|
+
light: baseColors.green[300],
|
|
116
|
+
contrastText: baseColors.common.black,
|
|
117
|
+
background: alpha(baseColors.green[400], 0.08),
|
|
118
|
+
relatedLight: "#EFFCF5",
|
|
119
|
+
relatedDark: COLOR_UNUSED
|
|
120
|
+
},
|
|
121
|
+
text: {
|
|
122
|
+
primary: baseColors.common.black,
|
|
123
|
+
secondary: baseColors.shades.dark[60],
|
|
124
|
+
disabled: baseColors.shades.dark[25],
|
|
125
|
+
hint: baseColors.shades.dark[40]
|
|
126
|
+
},
|
|
127
|
+
background: {
|
|
128
|
+
paper: baseColors.common.white,
|
|
129
|
+
default: baseColors.neutral[50]
|
|
130
|
+
},
|
|
131
|
+
action: {
|
|
132
|
+
active: baseColors.shades.dark[40],
|
|
133
|
+
hover: baseColors.shades.dark[8],
|
|
134
|
+
disabledBackground: baseColors.neutral[100],
|
|
135
|
+
disabled: baseColors.shades.dark[25],
|
|
136
|
+
selected: baseColors.shades.dark[12],
|
|
137
|
+
focus: baseColors.shades.dark[12],
|
|
138
|
+
activatedOpacity: 0.12,
|
|
139
|
+
hoverOpacity: 0.04,
|
|
140
|
+
selectedOpacity: 0.08,
|
|
141
|
+
disabledOpacity: 0.38,
|
|
142
|
+
focusOpacity: 0.12
|
|
143
|
+
},
|
|
144
|
+
info: {
|
|
145
|
+
main: baseColors.indigo[400],
|
|
146
|
+
dark: baseColors.indigo[500],
|
|
147
|
+
light: baseColors.indigo[300],
|
|
148
|
+
contrastText: baseColors.common.white,
|
|
149
|
+
relatedDark: "#0D2B4A",
|
|
150
|
+
relatedLight: "#E9EEF4",
|
|
151
|
+
background: COLOR_UNUSED
|
|
152
|
+
},
|
|
153
|
+
success: {
|
|
154
|
+
main: baseColors.lightGreen[400],
|
|
155
|
+
dark: baseColors.lightGreen[500],
|
|
156
|
+
light: baseColors.lightGreen[300],
|
|
157
|
+
contrastText: baseColors.common.white,
|
|
158
|
+
relatedDark: "#3D541A",
|
|
159
|
+
relatedLight: "#F2F5EB",
|
|
160
|
+
background: COLOR_UNUSED
|
|
161
|
+
},
|
|
162
|
+
warning: {
|
|
163
|
+
main: baseColors.orange[400],
|
|
164
|
+
dark: baseColors.orange[500],
|
|
165
|
+
light: baseColors.orange[300],
|
|
166
|
+
contrastText: baseColors.common.black,
|
|
167
|
+
relatedDark: "#78540F",
|
|
168
|
+
relatedLight: "#FEF6EA",
|
|
169
|
+
background: COLOR_UNUSED
|
|
170
|
+
},
|
|
171
|
+
error: {
|
|
172
|
+
main: baseColors.red[400],
|
|
173
|
+
light: baseColors.red[300],
|
|
174
|
+
dark: baseColors.red[500],
|
|
175
|
+
contrastText: baseColors.common.white,
|
|
176
|
+
relatedDark: "#622215",
|
|
177
|
+
relatedLight: "#F9EDEA",
|
|
178
|
+
background: COLOR_UNUSED
|
|
179
|
+
},
|
|
180
|
+
grey: {
|
|
181
|
+
...baseColors.neutral
|
|
182
|
+
},
|
|
183
|
+
divider: baseColors.shades.dark[12],
|
|
184
|
+
// Custom common colors
|
|
185
|
+
default: {
|
|
186
|
+
main: baseColors.neutral[100],
|
|
187
|
+
dark: baseColors.neutral[200],
|
|
188
|
+
light: baseColors.neutral[50],
|
|
189
|
+
outlinedBorder: baseColors.shades.dark[25],
|
|
190
|
+
background: baseColors.shades.dark[4],
|
|
191
|
+
relatedLight: COLOR_UNUSED,
|
|
192
|
+
relatedDark: COLOR_UNUSED,
|
|
193
|
+
contrastText: COLOR_UNUSED
|
|
194
|
+
},
|
|
195
|
+
brand: {
|
|
196
|
+
navyBlue: "#162945",
|
|
197
|
+
locationRed: "#EB1510",
|
|
198
|
+
predictionBlue: "#1785FB",
|
|
199
|
+
softBlue: "#F2F6F9",
|
|
200
|
+
appBarMain: "#162945",
|
|
201
|
+
appBarContrastText: baseColors.common.white
|
|
202
|
+
},
|
|
203
|
+
white: {
|
|
204
|
+
...baseColors.shades.light
|
|
205
|
+
},
|
|
206
|
+
black: {
|
|
207
|
+
...baseColors.shades.dark
|
|
208
|
+
},
|
|
209
|
+
qualitative: {
|
|
210
|
+
...baseColors.qualitative
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
function getPaletteFromCartoColors(name, domainSize) {
|
|
214
|
+
var _a;
|
|
215
|
+
const palette = cartoColors[name];
|
|
216
|
+
let paletteIndex = domainSize;
|
|
217
|
+
if (!palette) {
|
|
218
|
+
throw new Error(
|
|
219
|
+
`Palette "${name}" not found. Expected a CARTOColors string`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
const palettesColorVariants = Object.keys(palette).filter((p) => p !== "tags").map(Number);
|
|
223
|
+
const longestPaletteIndex = Math.max(...palettesColorVariants);
|
|
224
|
+
const smallestPaletteIndex = Math.min(...palettesColorVariants);
|
|
225
|
+
if (!Number.isInteger(domainSize) || domainSize > longestPaletteIndex) {
|
|
226
|
+
paletteIndex = longestPaletteIndex;
|
|
227
|
+
} else if (domainSize < smallestPaletteIndex) {
|
|
228
|
+
paletteIndex = smallestPaletteIndex;
|
|
229
|
+
}
|
|
230
|
+
let colors = palette[paletteIndex];
|
|
231
|
+
if ((_a = palette.tags) == null ? void 0 : _a.includes("qualitative")) {
|
|
232
|
+
colors = colors == null ? void 0 : colors.slice(0, -1);
|
|
233
|
+
}
|
|
234
|
+
return colors;
|
|
235
|
+
}
|
|
236
|
+
function getPalette(colors, domainSize) {
|
|
237
|
+
if (typeof colors === "string") {
|
|
238
|
+
return getPaletteFromCartoColors(colors, domainSize);
|
|
239
|
+
} else {
|
|
240
|
+
return colors.map((c) => {
|
|
241
|
+
if (Array.isArray(c)) {
|
|
242
|
+
const [r, g, b] = c;
|
|
243
|
+
return rgbToHex(r, g, b);
|
|
244
|
+
} else {
|
|
245
|
+
return c;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function rgbToHex(r, g, b) {
|
|
251
|
+
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
|
|
252
|
+
}
|
|
253
|
+
function getCartoColorStylePropsForItem(theme, index) {
|
|
254
|
+
var _a;
|
|
255
|
+
const palette = (_a = commonPalette == null ? void 0 : commonPalette.qualitative) == null ? void 0 : _a.bold;
|
|
256
|
+
const colors = Object.values(palette ?? {});
|
|
257
|
+
const chosenIndex = index % colors.length;
|
|
258
|
+
return {
|
|
259
|
+
backgroundColor: colors[chosenIndex],
|
|
260
|
+
color: theme.palette.getContrastText(colors[chosenIndex])
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function getColorByCategory(category, {
|
|
264
|
+
palette,
|
|
265
|
+
fallbackColor,
|
|
266
|
+
colorMapping
|
|
267
|
+
}) {
|
|
268
|
+
const assignedColor = colorMapping[category];
|
|
269
|
+
if (assignedColor) {
|
|
270
|
+
return colorMapping[category];
|
|
271
|
+
}
|
|
272
|
+
if (!palette || palette.length === 0) {
|
|
273
|
+
return fallbackColor;
|
|
274
|
+
}
|
|
275
|
+
const nextFreeColorIndex = Math.min(
|
|
276
|
+
Object.keys(colorMapping).length,
|
|
277
|
+
palette.length - 1
|
|
278
|
+
);
|
|
279
|
+
const newColor = palette[nextFreeColorIndex];
|
|
280
|
+
colorMapping[category] = newColor;
|
|
281
|
+
return newColor;
|
|
282
|
+
}
|
|
283
|
+
export {
|
|
284
|
+
getColorByCategory as a,
|
|
285
|
+
getPalette as b,
|
|
286
|
+
commonPalette as c,
|
|
287
|
+
getCartoColorStylePropsForItem as g
|
|
288
|
+
};
|