@carto/meridian-ds 5.0.1-alpha.ce0f0f7.332 → 5.1.0
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 +15 -0
- package/dist/components/index.cjs +29 -3
- package/dist/components/index.js +30 -4
- package/dist/metadata.json +26 -6
- package/dist/theme/index.cjs +163 -47
- package/dist/theme/index.js +163 -47
- package/dist/types/components/ChipGroup/ChipGroup.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/Dialog/Dialog.stories.d.ts +5 -0
- package/dist/types/components/Dialog/Dialog/Dialog.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.stories.d.ts +10 -0
- package/dist/types/components/Dialog/DialogHeader/DialogHeader.stories.d.ts.map +1 -1
- package/dist/types/components/Dialog/DialogPaper/DialogPaper.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.figma.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdown.stories.d.ts +23 -0
- package/dist/types/components/FilterDropdown/FilterDropdown.stories.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdownMenuItem/FilterDropdownMenuItem.d.ts +1 -1
- package/dist/types/components/FilterDropdown/FilterDropdownMenuItem/FilterDropdownMenuItem.d.ts.map +1 -1
- package/dist/types/components/FilterDropdown/types.d.ts +4 -0
- package/dist/types/components/FilterDropdown/types.d.ts.map +1 -1
- package/dist/types/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/types/components/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/types/components/Menu/Menu/Menu.stories.d.ts +9 -0
- package/dist/types/components/Menu/Menu/Menu.stories.d.ts.map +1 -1
- package/dist/types/components/Menu/MenuItem/MenuItem.d.ts.map +1 -1
- package/dist/types/components/Menu/types.d.ts +2 -0
- package/dist/types/components/Menu/types.d.ts.map +1 -1
- package/dist/types/components/MessageField/MessageField.d.ts.map +1 -1
- package/dist/types/components/MessageField/MessageField.stories.d.ts.map +1 -1
- package/dist/types/components/MessageField/components/MessageFieldFooter.d.ts +1 -1
- package/dist/types/components/MessageField/components/MessageFieldFooter.d.ts.map +1 -1
- package/dist/types/components/MessageField/types.d.ts +4 -0
- package/dist/types/components/MessageField/types.d.ts.map +1 -1
- package/dist/types/components/SplitButton/SplitButton.stories.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.d.ts +1 -1
- package/dist/types/components/Tag/Tag.d.ts.map +1 -1
- package/dist/types/components/Tag/Tag.stories.d.ts.map +1 -1
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.metadata.d.ts.map +1 -1
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.stories.d.ts +15 -0
- package/dist/types/components/ToggleButtonGroup/ToggleButtonGroup.stories.d.ts.map +1 -1
- package/dist/types/theme/components/buttons.d.ts.map +1 -1
- package/dist/types/theme/components/data-display.d.ts.map +1 -1
- package/dist/types/theme/components/navigation.d.ts.map +1 -1
- package/dist/types/theme/components/stories/Chip.stories.d.ts.map +1 -1
- package/dist/types/theme/components/stories/ToggleButton.stories.d.ts +14 -0
- package/dist/types/theme/components/stories/ToggleButton.stories.d.ts.map +1 -1
- package/dist/types/theme/types.d.ts +24 -0
- package/dist/types/theme/types.d.ts.map +1 -1
- package/dist/{utils-BiLDYqDS.cjs → utils-B2bWHJl-.cjs} +31 -27
- package/dist/{utils-BfI3xeuX.js → utils-DeuEpVVh.js} +32 -28
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
## 5.0
|
|
6
6
|
|
|
7
|
+
### 5.1.0
|
|
8
|
+
|
|
9
|
+
- feat(theme): support `color='tertiary'` — CARTO's purple accent — on Button, IconButton, ButtonGroup, SplitButton, Fab, ToggleButton, ToggleButtonGroup, Chip and Tag, plus a new `selectedColor` on MenuItem / FilterDropdown and `buttonColor` on MessageField [sc-567740] [#535](https://github.com/CartoDB/meridian-ds/pull/535)
|
|
10
|
+
- fix(ToggleButton): `color` now drives the selected state on ToggleButton and ToggleButtonGroup — the theme previously pinned it to primary whatever the value; the default is unchanged [#535](https://github.com/CartoDB/meridian-ds/pull/535)
|
|
11
|
+
- chore(deps): bump @figma/code-connect from 1.4.5 to 2.0.0 [#535](https://github.com/CartoDB/meridian-ds/pull/535)
|
|
12
|
+
- chore(deps-dev): bump the storybook group to 10.6.0 — including `@storybook/addon-mcp` from 0.7 and `@chromatic-com/storybook` to 5.3.1 [#535](https://github.com/CartoDB/meridian-ds/pull/535)
|
|
13
|
+
- chore(deps): bump js-yaml from 4.3.1 to 4.3.2 [#545](https://github.com/CartoDB/meridian-ds/pull/545)
|
|
14
|
+
- chore(deps): bump js-yaml from 4.3.1 to 4.3.2 in /scripts/import-figma-icons [#543](https://github.com/CartoDB/meridian-ds/pull/543)
|
|
15
|
+
- chore(deps): bump svgo from 3.3.4 to 3.3.5 in /scripts/import-figma-icons [#542](https://github.com/CartoDB/meridian-ds/pull/542)
|
|
16
|
+
- chore(deps): bump fflate from 0.8.2 to 0.8.3 [#534](https://github.com/CartoDB/meridian-ds/pull/534)
|
|
17
|
+
- chore(deps): bump fast-uri from 3.1.5 to 3.1.7 [#529](https://github.com/CartoDB/meridian-ds/pull/529)
|
|
18
|
+
- chore(deps): bump qs from 6.15.3 to 6.16.0 [#530](https://github.com/CartoDB/meridian-ds/pull/530)
|
|
19
|
+
- chore(deps): bump browserslist from 4.24.2 to 4.28.9 [#532](https://github.com/CartoDB/meridian-ds/pull/532)
|
|
20
|
+
- chore(deps): bump browserslist from 4.24.2 to 4.28.8 in /scripts/import-figma-icons [#531](https://github.com/CartoDB/meridian-ds/pull/531)
|
|
21
|
+
|
|
7
22
|
### 5.0.0
|
|
8
23
|
|
|
9
24
|
- chore(deps): upgrade MUI core + MUI X from v5 to v9 [sc-557186] [#485](https://github.com/CartoDB/meridian-ds/pull/485), in three phases — v6 [#484](https://github.com/CartoDB/meridian-ds/pull/484), v7 [#505](https://github.com/CartoDB/meridian-ds/pull/505), v9 [#524](https://github.com/CartoDB/meridian-ds/pull/524).
|
|
@@ -7,7 +7,7 @@ const paletteUtils = require("../palette-utils-NhMBL9rx.cjs");
|
|
|
7
7
|
const iconsMaterial = require("@mui/icons-material");
|
|
8
8
|
const ArrowDown = require("../ArrowDown-84Oc8r9k.cjs");
|
|
9
9
|
const ReactWindow = require("react-window");
|
|
10
|
-
const utils = require("../utils-
|
|
10
|
+
const utils = require("../utils-B2bWHJl-.cjs");
|
|
11
11
|
const Search = require("../Search-BsaXrSzs.cjs");
|
|
12
12
|
require("cartocolor");
|
|
13
13
|
const reactCodemirror2 = require("react-codemirror2");
|
|
@@ -3371,6 +3371,12 @@ const DialogPaper = material.styled(material.Paper, {
|
|
|
3371
3371
|
// unreachable.
|
|
3372
3372
|
overflowY: "auto",
|
|
3373
3373
|
outline: 0,
|
|
3374
|
+
// The focus trap focuses the paper when nothing inside autofocuses, and
|
|
3375
|
+
// Chromium treats that as `:focus-visible` — the global ring would frame
|
|
3376
|
+
// the whole dialog. It's a container, not a control.
|
|
3377
|
+
"&:focus-visible": {
|
|
3378
|
+
outline: "none !important"
|
|
3379
|
+
},
|
|
3374
3380
|
"@media print": {
|
|
3375
3381
|
overflowY: "visible",
|
|
3376
3382
|
boxShadow: "none"
|
|
@@ -5788,6 +5794,7 @@ const FilterDropdownMenuItem = ({
|
|
|
5788
5794
|
selectedValue,
|
|
5789
5795
|
dense,
|
|
5790
5796
|
extended,
|
|
5797
|
+
selectedColor,
|
|
5791
5798
|
onItemChange
|
|
5792
5799
|
}) => {
|
|
5793
5800
|
const {
|
|
@@ -5824,6 +5831,7 @@ const FilterDropdownMenuItem = ({
|
|
|
5824
5831
|
divider,
|
|
5825
5832
|
fixed,
|
|
5826
5833
|
iconColor,
|
|
5834
|
+
selectedColor: item.selectedColor ?? selectedColor,
|
|
5827
5835
|
"aria-label": ariaLabel,
|
|
5828
5836
|
"aria-labelledby": menuItemId,
|
|
5829
5837
|
"aria-selected": isSelected,
|
|
@@ -5885,6 +5893,7 @@ function _FilterDropdown({
|
|
|
5885
5893
|
buttonColor = "primary",
|
|
5886
5894
|
dense = false,
|
|
5887
5895
|
extended = false,
|
|
5896
|
+
selectedColor,
|
|
5888
5897
|
"aria-label": ariaLabel,
|
|
5889
5898
|
responsive,
|
|
5890
5899
|
tooltipLabel,
|
|
@@ -5991,6 +6000,7 @@ function _FilterDropdown({
|
|
|
5991
6000
|
selectedValue: selected,
|
|
5992
6001
|
dense,
|
|
5993
6002
|
extended,
|
|
6003
|
+
selectedColor,
|
|
5994
6004
|
onItemChange: handleChange
|
|
5995
6005
|
},
|
|
5996
6006
|
index
|
|
@@ -6104,6 +6114,7 @@ const MessageFieldFooter = ({
|
|
|
6104
6114
|
stopLabel,
|
|
6105
6115
|
iconButton,
|
|
6106
6116
|
labelButton,
|
|
6117
|
+
buttonColor = "primary",
|
|
6107
6118
|
onClick,
|
|
6108
6119
|
buttonIsDisabled,
|
|
6109
6120
|
disabled,
|
|
@@ -6132,7 +6143,7 @@ const MessageFieldFooter = ({
|
|
|
6132
6143
|
{
|
|
6133
6144
|
onClick,
|
|
6134
6145
|
disabled: buttonIsDisabled,
|
|
6135
|
-
color:
|
|
6146
|
+
color: buttonColor,
|
|
6136
6147
|
variant: "contained",
|
|
6137
6148
|
size,
|
|
6138
6149
|
icon: iconButton,
|
|
@@ -6156,7 +6167,7 @@ const MessageFieldFooter = ({
|
|
|
6156
6167
|
{
|
|
6157
6168
|
onClick,
|
|
6158
6169
|
variant: "contained",
|
|
6159
|
-
color:
|
|
6170
|
+
color: buttonColor,
|
|
6160
6171
|
disabled: buttonIsDisabled,
|
|
6161
6172
|
size,
|
|
6162
6173
|
children: labelButton
|
|
@@ -6182,6 +6193,7 @@ function _MessageField({
|
|
|
6182
6193
|
analyzing,
|
|
6183
6194
|
iconButton = /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpwardOutlined, {}),
|
|
6184
6195
|
labelButton,
|
|
6196
|
+
buttonColor,
|
|
6185
6197
|
disabledButton,
|
|
6186
6198
|
helperText,
|
|
6187
6199
|
helperTextAlign = "center",
|
|
@@ -6296,6 +6308,7 @@ function _MessageField({
|
|
|
6296
6308
|
stopLabel,
|
|
6297
6309
|
iconButton,
|
|
6298
6310
|
labelButton,
|
|
6311
|
+
buttonColor,
|
|
6299
6312
|
onClick,
|
|
6300
6313
|
buttonIsDisabled,
|
|
6301
6314
|
disabled,
|
|
@@ -6834,6 +6847,19 @@ function colorProps(color, variant, theme, disabled) {
|
|
|
6834
6847
|
backgroundColor: theme.palette.secondary.main,
|
|
6835
6848
|
borderColor: "transparent"
|
|
6836
6849
|
};
|
|
6850
|
+
case "tertiary":
|
|
6851
|
+
if (variant === "outlined") {
|
|
6852
|
+
return {
|
|
6853
|
+
color: theme.palette.tertiary.main,
|
|
6854
|
+
backgroundColor: theme.palette.tertiary.relatedLight,
|
|
6855
|
+
borderColor: theme.palette.tertiary.main
|
|
6856
|
+
};
|
|
6857
|
+
}
|
|
6858
|
+
return {
|
|
6859
|
+
color: theme.palette.tertiary.contrastText,
|
|
6860
|
+
backgroundColor: theme.palette.tertiary.main,
|
|
6861
|
+
borderColor: "transparent"
|
|
6862
|
+
};
|
|
6837
6863
|
case "success":
|
|
6838
6864
|
if (variant === "outlined") {
|
|
6839
6865
|
return {
|
package/dist/components/index.js
CHANGED
|
@@ -6,8 +6,8 @@ import { T as Typography, I as ICON_SIZE_SMALL, m as mergeSx, a as ICON_SIZE_MED
|
|
|
6
6
|
import { OpenInNewOutlined, VisibilityOffOutlined, VisibilityOutlined, Cancel, ContentCopyOutlined, AddCircleOutlineOutlined, MenuOutlined, MoreVertOutlined, HelpOutlineOutlined, ErrorOutlineOutlined, ArrowBackOutlined, CloseOutlined, Check, TodayOutlined, StopCircleOutlined, ArrowUpwardOutlined } from "@mui/icons-material";
|
|
7
7
|
import { F as ForwardedComponent$1 } from "../ArrowDown-Bho9Ssnw.js";
|
|
8
8
|
import * as ReactWindow from "react-window";
|
|
9
|
-
import { u as useTranslationWithFallback, I as IconButton, M as MenuItem$1, g as getThemeColor, e as ellipsisStyles, S as SVG_SELECTOR } from "../utils-
|
|
10
|
-
import { T } from "../utils-
|
|
9
|
+
import { u as useTranslationWithFallback, I as IconButton, M as MenuItem$1, g as getThemeColor, e as ellipsisStyles, S as SVG_SELECTOR } from "../utils-DeuEpVVh.js";
|
|
10
|
+
import { T } from "../utils-DeuEpVVh.js";
|
|
11
11
|
import { F as ForwardedComponent, a as ForwardedComponent$2, b as ForwardedComponent$3, c as ForwardedComponent$4 } from "../Search-DXfTNnxj.js";
|
|
12
12
|
import "cartocolor";
|
|
13
13
|
import { Controlled, UnControlled } from "react-codemirror2";
|
|
@@ -3354,6 +3354,12 @@ const DialogPaper = styled(Paper, {
|
|
|
3354
3354
|
// unreachable.
|
|
3355
3355
|
overflowY: "auto",
|
|
3356
3356
|
outline: 0,
|
|
3357
|
+
// The focus trap focuses the paper when nothing inside autofocuses, and
|
|
3358
|
+
// Chromium treats that as `:focus-visible` — the global ring would frame
|
|
3359
|
+
// the whole dialog. It's a container, not a control.
|
|
3360
|
+
"&:focus-visible": {
|
|
3361
|
+
outline: "none !important"
|
|
3362
|
+
},
|
|
3357
3363
|
"@media print": {
|
|
3358
3364
|
overflowY: "visible",
|
|
3359
3365
|
boxShadow: "none"
|
|
@@ -5771,6 +5777,7 @@ const FilterDropdownMenuItem = ({
|
|
|
5771
5777
|
selectedValue,
|
|
5772
5778
|
dense,
|
|
5773
5779
|
extended,
|
|
5780
|
+
selectedColor,
|
|
5774
5781
|
onItemChange
|
|
5775
5782
|
}) => {
|
|
5776
5783
|
const {
|
|
@@ -5807,6 +5814,7 @@ const FilterDropdownMenuItem = ({
|
|
|
5807
5814
|
divider,
|
|
5808
5815
|
fixed,
|
|
5809
5816
|
iconColor,
|
|
5817
|
+
selectedColor: item.selectedColor ?? selectedColor,
|
|
5810
5818
|
"aria-label": ariaLabel,
|
|
5811
5819
|
"aria-labelledby": menuItemId,
|
|
5812
5820
|
"aria-selected": isSelected,
|
|
@@ -5868,6 +5876,7 @@ function _FilterDropdown({
|
|
|
5868
5876
|
buttonColor = "primary",
|
|
5869
5877
|
dense = false,
|
|
5870
5878
|
extended = false,
|
|
5879
|
+
selectedColor,
|
|
5871
5880
|
"aria-label": ariaLabel,
|
|
5872
5881
|
responsive,
|
|
5873
5882
|
tooltipLabel,
|
|
@@ -5974,6 +5983,7 @@ function _FilterDropdown({
|
|
|
5974
5983
|
selectedValue: selected,
|
|
5975
5984
|
dense,
|
|
5976
5985
|
extended,
|
|
5986
|
+
selectedColor,
|
|
5977
5987
|
onItemChange: handleChange
|
|
5978
5988
|
},
|
|
5979
5989
|
index
|
|
@@ -6087,6 +6097,7 @@ const MessageFieldFooter = ({
|
|
|
6087
6097
|
stopLabel,
|
|
6088
6098
|
iconButton,
|
|
6089
6099
|
labelButton,
|
|
6100
|
+
buttonColor = "primary",
|
|
6090
6101
|
onClick,
|
|
6091
6102
|
buttonIsDisabled,
|
|
6092
6103
|
disabled,
|
|
@@ -6115,7 +6126,7 @@ const MessageFieldFooter = ({
|
|
|
6115
6126
|
{
|
|
6116
6127
|
onClick,
|
|
6117
6128
|
disabled: buttonIsDisabled,
|
|
6118
|
-
color:
|
|
6129
|
+
color: buttonColor,
|
|
6119
6130
|
variant: "contained",
|
|
6120
6131
|
size,
|
|
6121
6132
|
icon: iconButton,
|
|
@@ -6139,7 +6150,7 @@ const MessageFieldFooter = ({
|
|
|
6139
6150
|
{
|
|
6140
6151
|
onClick,
|
|
6141
6152
|
variant: "contained",
|
|
6142
|
-
color:
|
|
6153
|
+
color: buttonColor,
|
|
6143
6154
|
disabled: buttonIsDisabled,
|
|
6144
6155
|
size,
|
|
6145
6156
|
children: labelButton
|
|
@@ -6165,6 +6176,7 @@ function _MessageField({
|
|
|
6165
6176
|
analyzing,
|
|
6166
6177
|
iconButton = /* @__PURE__ */ jsx(ArrowUpwardOutlined, {}),
|
|
6167
6178
|
labelButton,
|
|
6179
|
+
buttonColor,
|
|
6168
6180
|
disabledButton,
|
|
6169
6181
|
helperText,
|
|
6170
6182
|
helperTextAlign = "center",
|
|
@@ -6279,6 +6291,7 @@ function _MessageField({
|
|
|
6279
6291
|
stopLabel,
|
|
6280
6292
|
iconButton,
|
|
6281
6293
|
labelButton,
|
|
6294
|
+
buttonColor,
|
|
6282
6295
|
onClick,
|
|
6283
6296
|
buttonIsDisabled,
|
|
6284
6297
|
disabled,
|
|
@@ -6817,6 +6830,19 @@ function colorProps(color, variant, theme, disabled) {
|
|
|
6817
6830
|
backgroundColor: theme.palette.secondary.main,
|
|
6818
6831
|
borderColor: "transparent"
|
|
6819
6832
|
};
|
|
6833
|
+
case "tertiary":
|
|
6834
|
+
if (variant === "outlined") {
|
|
6835
|
+
return {
|
|
6836
|
+
color: theme.palette.tertiary.main,
|
|
6837
|
+
backgroundColor: theme.palette.tertiary.relatedLight,
|
|
6838
|
+
borderColor: theme.palette.tertiary.main
|
|
6839
|
+
};
|
|
6840
|
+
}
|
|
6841
|
+
return {
|
|
6842
|
+
color: theme.palette.tertiary.contrastText,
|
|
6843
|
+
backgroundColor: theme.palette.tertiary.main,
|
|
6844
|
+
borderColor: "transparent"
|
|
6845
|
+
};
|
|
6820
6846
|
case "success":
|
|
6821
6847
|
if (variant === "outlined") {
|
|
6822
6848
|
return {
|
package/dist/metadata.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.1.0",
|
|
3
3
|
"conventions": "# Meridian usage conventions (for code-generating agents)\n\nSystem-level rules an agent should apply across all components.\n\nMeridian is the source of truth: when an existing codebase pattern contradicts Meridian, follow Meridian — don't replicate the contradicting local pattern.\n\n## Choosing a component\n\n- Don't hand-roll what the design system already provides. Before writing a\n custom component, a styled wrapper, or a block of primitives (a modal,\n chip/tag, card, empty state, dropdown, tooltip, copy-to-clipboard input,\n etc.), confirm no Meridian component covers it — reuse or extend the existing one instead of rebuilding it.\n- Prefer a Meridian component over a bare MUI one whenever a Meridian wrapper\n exists — the wrappers carry CARTO theming, a11y defaults, and narrowed APIs. MUI is correct for layout primitives (`Box`/`Grid`/`Stack`/`Container`) and for gaps Meridian doesn't fill (e.g. date pickers); \"prefer Meridian\" is not \"never MUI\".\n- Resolve \"which component\" by reading each one's `description` + `keywords`,\n then confirm with its `decisionTree` (the conditions that point elsewhere) and `limitations` (what it lacks — check before you downgrade to it).\n Don't infer selection from prop lists.\n\n## Icons\n\n- Source icons from Meridian's custom-icons first, then `@mui/icons-material`;\n add a local SVG only when neither has an equivalent. Don't duplicate an icon\n the design system already ships.\n- Find the right custom icon with `meridian_list_icons` — match by name or keyword (e.g. \"warehouse\" → `Bigquery`), import it from `@carto/meridian-ds/custom-icons`, and render `<Name />`. Every icon shares one prop type, `CustomIconProps` (MUI `SvgIconProps` — `color`/`fontSize`/`sx` — plus `width`/`height`).\n- To confirm a shortlisted icon by sight (or match an icon in a design you're implementing), call `meridian_get_screenshot` with `name: 'icons'` and Read the returned image path — a labeled grid of every icon.\n- Use the standard icon sizes — small 12px, medium (default) 18px, large 24px;\n a value off this scale (e.g. 16, 20) needs design sign-off. Prefer the\n outlined variants.\n- A new SVG must inherit, not bake in: set `fill='currentColor'` so it takes\n the parent's color, and use the standard size — don't hardcode\n color/opacity/dimensions.\n- For an icon color outside the palette `color` set, pass a theme token via\n `htmlColor` (e.g. `htmlColor={theme.palette.text.secondary}`) — never a\n hardcoded hex.\n\n## Accessibility\n\n- Any icon-only control needs an accessible name: `tooltip` or `aria-label`.\n- Don't disable a control without telling the user why — pair a disabled action with a tooltip explaining the requirement.\n- An `aria-label` must be human-readable text describing the control, not a test id in disguise — use a separate test hook for that.\n- User-facing strings (labels, `aria-label`, placeholders, messages) go through the app's i18n layer, not hardcoded literals.\n\n## Props\n\n- Two sources, both pinned to the installed `@carto/meridian-ds`: **exact props / types / JSDoc** come from the package's **type declarations** — read the `<Name>.d.ts` directly — while the **`meridian-design-system` MCP** (`meridian_*` tools) covers what types can't: which component, when, gotchas, and real examples.\n- A component's curation lists the high-value inherited MUI props worth knowing (`curation.mui`, e.g. `color`/`variant`/`size`); the rest of MUI's surface is available but rarely needed.\n- Don't use `sx`/inline styles to override a Meridian component's visual design (colors, typography, borders, sizing) — use its documented props and the theme tokens. (`sx` for layout/spacing on primitives is fine — see Styling.)\n- If no prop covers the visual change you need, treat it as a design-system gap: request the variant/behavior upstream in Meridian rather than permanently overriding the component locally — a local `styled()` of a Meridian component is a smell, not a fix.\n\n## Styling\n\n- Use theme tokens, never hardcoded values: colors from the palette (`text.*`, `background.*`, `divider`, semantic `*.main`) and spacing from the theme spacing scale — no raw hex/rgb or pixel literals for color or spacing. Use integer steps on the spacing scale (`theme.spacing(n)`, or `sx` numeric spacing like `px: 2` / `mt: 3` which resolve to it) — not fractional steps or raw px. Get the exact values — palette keys, spacing base, type ramp, `shape.borderRadius`, breakpoints, shadows — from `meridian_get_tokens`.\n- Text uses `<Typography variant=…>` (with the `weight` prop for emphasis), never hardcoded `fontSize`/`fontWeight`/`lineHeight`/`fontFamily`.\n- Meridian's type scale is custom and does not match MUI defaults (e.g. `body2`/`caption` differ from MUI's sizes, and there are Meridian-only variants like `code1`/`code2`/`code3` and `overlineDelicate`). Pick the variant by role from Typography's variant list (`meridian_get_examples('Typography')`) — don't assume a px size or map px → variant yourself.\n- `sx` is the right tool for one-off layout/spacing on primitives (`Box`/`Grid`/`Stack`), not the deprecated MUI system props\n (`<Box px={2}>` → `<Box sx={{ px: 2 }}>`). This is layout, distinct from restyling a Meridian component (see Props).\n\n## Examples\n\n- Never invent example code when a story exists — use the component's real story source (`meridian_get_examples`). The lead Usage story is the copy-paste starting point; the later stories are illustrative (variants, edge cases) and may carry story-arg shells, so don't copy one wholesale as your baseline.\n",
|
|
4
4
|
"components": [
|
|
5
5
|
{
|
|
@@ -574,7 +574,7 @@
|
|
|
574
574
|
{
|
|
575
575
|
"name": "Color",
|
|
576
576
|
"id": "components-chipgroup--color",
|
|
577
|
-
"code": "import { ChipGroup, ChipGroupProps } from '@carto/meridian-ds/components'\nimport { Box, Stack } from '@mui/material'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const Label: any\n\nconst Color = ({ chips, ...rest }: ChipGroupProps) => {\n const colors = [\n 'default',\n 'primary',\n 'secondary',\n 'error',\n 'info',\n 'success',\n 'warning',\n ] as const\n\n const createColoredChips = (\n color: (typeof colors)[number],\n variant?: 'filled' | 'outlined',\n ) =>\n chips.map((chip) =>\n typeof chip === 'string'\n ? { label: chip, color, variant }\n : { ...chip, color, variant },\n )\n\n return (\n <Stack spacing={4}>\n {colors.map((color) => (\n <Box key={color}>\n <Container>\n <Label variant='body2' sx={{ textTransform: 'capitalize' }}>\n {color}\n </Label>\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>\n <ChipGroup {...rest} chips={createColoredChips(color)} />\n <ChipGroup\n {...rest}\n chips={createColoredChips(color, 'filled')}\n />\n </Box>\n </Container>\n </Box>\n ))}\n </Stack>\n )\n}"
|
|
577
|
+
"code": "import { ChipGroup, ChipGroupProps } from '@carto/meridian-ds/components'\nimport { Box, Stack } from '@mui/material'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const Label: any\n\nconst Color = ({ chips, ...rest }: ChipGroupProps) => {\n const colors = [\n 'default',\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'info',\n 'success',\n 'warning',\n ] as const\n\n const createColoredChips = (\n color: (typeof colors)[number],\n variant?: 'filled' | 'outlined',\n ) =>\n chips.map((chip) =>\n typeof chip === 'string'\n ? { label: chip, color, variant }\n : { ...chip, color, variant },\n )\n\n return (\n <Stack spacing={4}>\n {colors.map((color) => (\n <Box key={color}>\n <Container>\n <Label variant='body2' sx={{ textTransform: 'capitalize' }}>\n {color}\n </Label>\n <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>\n <ChipGroup {...rest} chips={createColoredChips(color)} />\n <ChipGroup\n {...rest}\n chips={createColoredChips(color, 'filled')}\n />\n </Box>\n </Container>\n </Box>\n ))}\n </Stack>\n )\n}"
|
|
578
578
|
},
|
|
579
579
|
{
|
|
580
580
|
"name": "Size",
|
|
@@ -2022,6 +2022,11 @@
|
|
|
2022
2022
|
"id": "components-filterdropdown--sizes",
|
|
2023
2023
|
"code": "import { FilterDropdown, FilterDropdownProps } from '@carto/meridian-ds/components'\nimport { Box } from '@mui/material'\nimport { useEffect, useRef } from 'react'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const LabeledConfig: any\ndeclare const LabeledConfigGrid: any\n\nconst OpenOnMount = ({ disabled, ...rest }: FilterDropdownProps) => {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (disabled) return\n ref.current?.querySelector<HTMLButtonElement>('button')?.click()\n }, [disabled])\n return (\n <Box\n ref={ref}\n sx={{\n display: 'flex',\n }}\n >\n <FilterDropdown {...rest} disabled={disabled} />\n </Box>\n )\n}\n\nconst sizeConfigs: any<FilterDropdownProps>[] = [\n { label: 'Default', args: {} },\n { label: 'Dense', args: { dense: true } },\n { label: 'Extended', args: { extended: true } },\n]\n\nconst Sizes = (args: FilterDropdownProps) => (\n <LabeledConfigGrid\n configs={sizeConfigs}\n minColumnWidth={240}\n minItemHeight={280}\n renderItem={(configArgs) => <OpenOnMount {...args} {...configArgs} />}\n />\n)"
|
|
2024
2024
|
},
|
|
2025
|
+
{
|
|
2026
|
+
"name": "SelectedColor",
|
|
2027
|
+
"id": "components-filterdropdown--selected-color",
|
|
2028
|
+
"code": "import { FilterDropdown, FilterDropdownProps } from '@carto/meridian-ds/components'\nimport { Box } from '@mui/material'\nimport { useEffect, useRef } from 'react'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const LabeledConfig: any\ndeclare const LabeledConfigGrid: any\n\nconst OpenOnMount = ({ disabled, ...rest }: FilterDropdownProps) => {\n const ref = useRef<HTMLDivElement>(null)\n useEffect(() => {\n if (disabled) return\n ref.current?.querySelector<HTMLButtonElement>('button')?.click()\n }, [disabled])\n return (\n <Box\n ref={ref}\n sx={{\n display: 'flex',\n }}\n >\n <FilterDropdown {...rest} disabled={disabled} />\n </Box>\n )\n}\n\nconst selectedColorConfigs: any<FilterDropdownProps>[] = [\n { label: 'Primary (default)', args: { selectedColor: 'primary' } },\n { label: 'Secondary', args: { selectedColor: 'secondary' } },\n { label: 'Tertiary', args: { selectedColor: 'tertiary' } },\n]\n\nconst SelectedColor = (args: FilterDropdownProps) => (\n <LabeledConfigGrid\n configs={selectedColorConfigs}\n minColumnWidth={240}\n minItemHeight={280}\n renderItem={(configArgs) => <OpenOnMount {...args} {...configArgs} />}\n />\n)"
|
|
2029
|
+
},
|
|
2025
2030
|
{
|
|
2026
2031
|
"name": "SecondaryButtonColor",
|
|
2027
2032
|
"id": "components-filterdropdown--secondary-button-color",
|
|
@@ -2098,7 +2103,7 @@
|
|
|
2098
2103
|
{
|
|
2099
2104
|
"name": "Colors",
|
|
2100
2105
|
"id": "components-buttons-iconbutton--colors",
|
|
2101
|
-
"code": "import { IconButton, IconButtonProps, Typography } from '@carto/meridian-ds/components'\nimport { CheckCircleOutlined } from '@mui/icons-material'\nimport { Box, Grid, Stack } from '@mui/material'\n\nconst SizeTemplate = (rest: IconButtonProps) => {\n return (\n <Grid container spacing={2}>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Icon\n </Typography>\n <IconButton {...rest} variant='icon' icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Contained\n </Typography>\n <IconButton\n {...rest}\n variant='contained'\n icon={<CheckCircleOutlined />}\n />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Outlined\n </Typography>\n <IconButton\n {...rest}\n variant='outlined'\n icon={<CheckCircleOutlined />}\n />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Disabled\n </Typography>\n <IconButton {...rest} disabled icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Loading\n </Typography>\n <IconButton {...rest} loading icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n </Grid>\n )\n}\n\nconst colors = ['default'
|
|
2106
|
+
"code": "import { IconButton, IconButtonProps, Typography } from '@carto/meridian-ds/components'\nimport { CheckCircleOutlined } from '@mui/icons-material'\nimport { Box, Grid, Stack } from '@mui/material'\n\nconst SizeTemplate = (rest: IconButtonProps) => {\n return (\n <Grid container spacing={2}>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Icon\n </Typography>\n <IconButton {...rest} variant='icon' icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Contained\n </Typography>\n <IconButton\n {...rest}\n variant='contained'\n icon={<CheckCircleOutlined />}\n />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Outlined\n </Typography>\n <IconButton\n {...rest}\n variant='outlined'\n icon={<CheckCircleOutlined />}\n />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Disabled\n </Typography>\n <IconButton {...rest} disabled icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n <Grid size={2}>\n <Stack spacing={2} sx={{ alignItems: 'center' }}>\n <Typography variant='body2' sx={{ mb: 2 }}>\n Loading\n </Typography>\n <IconButton {...rest} loading icon={<CheckCircleOutlined />} />\n </Stack>\n </Grid>\n </Grid>\n )\n}\n\nconst colors = [\n 'default',\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n 'warning',\n] as const\n\nconst Colors = (rest: IconButtonProps) => (\n <>\n {colors.map((color) => (\n <Box\n key={color}\n sx={{\n mb: 6,\n }}\n >\n <Typography variant='h6' sx={{ mb: 4, textTransform: 'capitalize' }}>\n {color}\n </Typography>\n <SizeTemplate {...rest} color={color} />\n </Box>\n ))}\n </>\n)"
|
|
2102
2107
|
},
|
|
2103
2108
|
{
|
|
2104
2109
|
"name": "IconButtonGroup",
|
|
@@ -2775,6 +2780,12 @@
|
|
|
2775
2780
|
"summary": "`iconColor`: 'primary' recolors the icon to the theme text color; 'default' keeps the icon's own color",
|
|
2776
2781
|
"code": "import { MenuItem, MenuItemProps, MenuList } from '@carto/meridian-ds/components'\nimport { Box, ListItemIcon, ListItemText, Stack } from '@mui/material'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const DocContainer: any\ndeclare const Label: any\n\nconst icon = (\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='13.504'\n height='13.5'\n viewBox='0 0 13.504 13.5'\n >\n <path\n fill='#8a2be2'\n fillRule='evenodd'\n d='M6.078 0a6.075 6.075 0 0 1 4.92 9.637l.034.028 2.39 2.39a.283.283 0 0 1 0 .4l-.966.965a.283.283 0 0 1-.4 0l-2.39-2.39a.283.283 0 0 1-.029-.033 6.075 6.075 0 1 1-3.561-11Zm0 1.573a4.509 4.509 0 1 0 4.511 4.506 4.508 4.508 0 0 0-4.511-4.506Zm.675 2.754V9.45a5.4 5.4 0 0 1-.674 0 5.379 5.379 0 0 1-.75-.041V4.327Zm-2.4 1.633v2.95a3.314 3.314 0 0 1-1.027-.973l-.127-.2V5.96Zm4.657.695v.995a3.374 3.374 0 0 1-1.147 1.229v-2.22H9.01Z'\n />\n </svg>\n)\n\nconst IconColor = ({\n label,\n ...args\n}: MenuItemProps & { label: string }) => {\n return (\n <>\n <DocContainer severity='info'>\n Default keeps the color of the icon as is, Primary changes the color of\n the icon to theme.palette.text.primary.\n </DocContainer>\n <Stack spacing={6}>\n <Box>\n <Container>\n <Label variant='body2'>{'Primary'}</Label>\n <MenuList disablePadding>\n <MenuItem {...args} iconColor='primary'>\n <ListItemIcon>{icon}</ListItemIcon>\n <ListItemText>{label}</ListItemText>\n </MenuItem>\n </MenuList>\n </Container>\n </Box>\n <Box>\n <Container>\n <Label variant='body2'>{'Default'}</Label>\n <MenuList disablePadding>\n <MenuItem {...args} iconColor='default'>\n <ListItemIcon>{icon}</ListItemIcon>\n <ListItemText>{label}</ListItemText>\n </MenuItem>\n </MenuList>\n </Container>\n </Box>\n </Stack>\n </>\n )\n}"
|
|
2777
2782
|
},
|
|
2783
|
+
{
|
|
2784
|
+
"name": "SelectedColor",
|
|
2785
|
+
"id": "components-menu--selected-color",
|
|
2786
|
+
"summary": "`selectedColor`: tint of the selected row — 'primary' (default), 'secondary' or 'tertiary'",
|
|
2787
|
+
"code": "import { MenuItem, MenuItemProps, MenuList } from '@carto/meridian-ds/components'\nimport { Box, ListItemIcon, ListItemText, Stack } from '@mui/material'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const DocContainer: any\ndeclare const Label: any\n\nconst icon = (\n <svg\n xmlns='http://www.w3.org/2000/svg'\n width='13.504'\n height='13.5'\n viewBox='0 0 13.504 13.5'\n >\n <path\n fill='#8a2be2'\n fillRule='evenodd'\n d='M6.078 0a6.075 6.075 0 0 1 4.92 9.637l.034.028 2.39 2.39a.283.283 0 0 1 0 .4l-.966.965a.283.283 0 0 1-.4 0l-2.39-2.39a.283.283 0 0 1-.029-.033 6.075 6.075 0 1 1-3.561-11Zm0 1.573a4.509 4.509 0 1 0 4.511 4.506 4.508 4.508 0 0 0-4.511-4.506Zm.675 2.754V9.45a5.4 5.4 0 0 1-.674 0 5.379 5.379 0 0 1-.75-.041V4.327Zm-2.4 1.633v2.95a3.314 3.314 0 0 1-1.027-.973l-.127-.2V5.96Zm4.657.695v.995a3.374 3.374 0 0 1-1.147 1.229v-2.22H9.01Z'\n />\n </svg>\n)\n\nconst SelectedColor = ({\n label,\n ...args\n}: MenuItemProps & { label: string }) => (\n <>\n <DocContainer severity='info'>\n {`selectedColor tints the selected row. Tertiary is CARTO's purple accent.`}\n </DocContainer>\n <Stack spacing={6}>\n {(['primary', 'secondary', 'tertiary'] as const).map((selectedColor) => (\n <Box key={selectedColor}>\n <Container>\n <Label variant='body2' sx={{ textTransform: 'capitalize' }}>\n {selectedColor}\n </Label>\n <MenuList disablePadding>\n <MenuItem {...args} selected selectedColor={selectedColor}>\n <ListItemIcon>{icon}</ListItemIcon>\n <ListItemText>{label}</ListItemText>\n </MenuItem>\n </MenuList>\n </Container>\n </Box>\n ))}\n </Stack>\n </>\n)"
|
|
2788
|
+
},
|
|
2778
2789
|
{
|
|
2779
2790
|
"name": "Destructive",
|
|
2780
2791
|
"id": "components-menu--destructive",
|
|
@@ -2887,7 +2898,7 @@
|
|
|
2887
2898
|
{
|
|
2888
2899
|
"name": "Action",
|
|
2889
2900
|
"id": "components-messagefield--action",
|
|
2890
|
-
"code": "import { MessageField, MessageFieldProps } from '@carto/meridian-ds/components'\nimport { SendOutlined } from '@mui/icons-material'\nimport { Box, Stack } from '@mui/material'\nimport { useState } from 'react'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const Label: any\n\nconst
|
|
2901
|
+
"code": "import { MessageField, MessageFieldProps } from '@carto/meridian-ds/components'\nimport { SendOutlined } from '@mui/icons-material'\nimport { Box, Stack } from '@mui/material'\nimport { useState } from 'react'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const Container: any\ndeclare const Label: any\n\nconst actionConfigs: { caption: string; props: Partial<MessageFieldProps> }[] =\n [\n { caption: 'Default (IconButton)', props: {} },\n { caption: 'Custom IconButton', props: { iconButton: <SendOutlined /> } },\n { caption: 'Text Button', props: { labelButton: 'Send' } },\n {\n caption: 'Tertiary Button',\n props: { labelButton: 'Send', buttonColor: 'tertiary' },\n },\n ]\n\nconst ActionRow = ({\n initialValue = '',\n ...rest\n}: MessageFieldProps & { initialValue?: string }) => {\n const [value, setValue] = useState(initialValue)\n\n return (\n <MessageField\n {...rest}\n onChange={(e) => setValue(e.target.value)}\n value={value}\n />\n )\n}\n\nconst Action = (args: MessageFieldProps) => {\n const { label, placeholder, ...rest } = args\n\n return (\n <Stack spacing={6}>\n {actionConfigs.map(({ caption, props }) => (\n <Box key={caption}>\n <Container>\n <Label variant='body2'>{caption}</Label>\n <ActionRow\n {...rest}\n {...props}\n label={label}\n placeholder={placeholder}\n />\n </Container>\n </Box>\n ))}\n {actionConfigs.map(({ caption, props }) => (\n <Box key={`${caption} filled`}>\n <Container>\n <Label variant='body2'>{`${caption} — filled`}</Label>\n <ActionRow\n {...rest}\n {...props}\n label={label}\n placeholder={placeholder}\n initialValue='Message typed'\n />\n </Container>\n </Box>\n ))}\n </Stack>\n )\n}"
|
|
2891
2902
|
},
|
|
2892
2903
|
{
|
|
2893
2904
|
"name": "Toolbar",
|
|
@@ -3547,7 +3558,7 @@
|
|
|
3547
3558
|
{
|
|
3548
3559
|
"name": "Colors",
|
|
3549
3560
|
"id": "components-buttons-splitbutton--colors",
|
|
3550
|
-
"code": "import { SplitButton, SplitButtonProps, Typography } from '@carto/meridian-ds/components'\nimport { Grid } from '@mui/material'\n\nconst SPLIT_BUTTON_COLORS = [\n 'default',\n 'primary',\n 'secondary',\n 'error',\n] as const\n\nconst DEFAULT_OPTIONS = [\n { label: 'Item 1', disabled: false },\n { label: 'Item 2', disabled: false },\n { label: 'Item 3', disabled: true },\n]\n\nconst ColorTemplate = ({ color, ...rest }: SplitButtonProps) => {\n return (\n <div style={{ minHeight: 200 }}>\n <SplitButton\n {...rest}\n color={color}\n defaultOpen\n options={DEFAULT_OPTIONS}\n />\n </div>\n )\n}\n\nconst Colors = (props: SplitButtonProps) => (\n <Grid container direction='row' spacing={4}>\n {SPLIT_BUTTON_COLORS.map((color) => (\n <Grid key={color}>\n <Typography\n variant='subtitle2'\n sx={{ mb: 1, textTransform: 'capitalize' }}\n >\n {color}\n </Typography>\n <ColorTemplate {...props} color={color} />\n </Grid>\n ))}\n </Grid>\n)"
|
|
3561
|
+
"code": "import { SplitButton, SplitButtonProps, Typography } from '@carto/meridian-ds/components'\nimport { Grid } from '@mui/material'\n\nconst SPLIT_BUTTON_COLORS = [\n 'default',\n 'primary',\n 'secondary',\n 'tertiary',\n 'error',\n] as const\n\nconst DEFAULT_OPTIONS = [\n { label: 'Item 1', disabled: false },\n { label: 'Item 2', disabled: false },\n { label: 'Item 3', disabled: true },\n]\n\nconst ColorTemplate = ({ color, ...rest }: SplitButtonProps) => {\n return (\n <div style={{ minHeight: 200 }}>\n <SplitButton\n {...rest}\n color={color}\n defaultOpen\n options={DEFAULT_OPTIONS}\n />\n </div>\n )\n}\n\nconst Colors = (props: SplitButtonProps) => (\n <Grid container direction='row' spacing={4}>\n {SPLIT_BUTTON_COLORS.map((color) => (\n <Grid key={color}>\n <Typography\n variant='subtitle2'\n sx={{ mb: 1, textTransform: 'capitalize' }}\n >\n {color}\n </Typography>\n <ColorTemplate {...props} color={color} />\n </Grid>\n ))}\n </Grid>\n)"
|
|
3551
3562
|
}
|
|
3552
3563
|
]
|
|
3553
3564
|
},
|
|
@@ -3646,7 +3657,7 @@
|
|
|
3646
3657
|
{
|
|
3647
3658
|
"name": "Colors",
|
|
3648
3659
|
"id": "components-tag--colors",
|
|
3649
|
-
"code": "import { Tag, TagProps } from '@carto/meridian-ds/components'\nimport { Box, Grid, Stack } from '@mui/material'\nimport React from 'react'\n\nconst colorsOptions = [\n { color: 'default' },\n { color: 'neutral' },\n { color: 'primary' },\n { color: 'secondary' },\n { color: 'success' },\n { color: 'warning' },\n { color: 'error' },\n] as const\n\nconst Colors = ({ ...args }: TagProps) => {\n return (\n <Grid container spacing={2}>\n <Grid size={6}>\n <Stack spacing={2}>\n {colorsOptions.map((colorOption, index) => (\n <React.Fragment key={index}>\n <Box>\n <Tag\n {...args}\n {...colorOption}\n variant='filled'\n label={`${colorOption.color} - filled`}\n />\n </Box>\n <Grid\n sx={{\n mb: 3,\n }}\n >\n <Tag\n {...args}\n {...colorOption}\n variant='filled'\n label={`${colorOption.color} - filled disabled`}\n disabled\n />\n </Grid>\n </React.Fragment>\n ))}\n </Stack>\n </Grid>\n <Grid size={6}>\n <Stack spacing={2}>\n {colorsOptions.map((colorOption, index) => (\n <React.Fragment key={index}>\n <Box>\n <Tag\n {...args}\n {...colorOption}\n variant='outlined'\n label={`${colorOption.color} - outlined`}\n />\n </Box>\n <Grid\n sx={{\n mb: 3,\n }}\n >\n <Tag\n {...args}\n {...colorOption}\n variant='outlined'\n label={`${colorOption.color} - outlined disabled`}\n disabled\n />\n </Grid>\n </React.Fragment>\n ))}\n </Stack>\n </Grid>\n </Grid>\n )\n}"
|
|
3660
|
+
"code": "import { Tag, TagProps } from '@carto/meridian-ds/components'\nimport { Box, Grid, Stack } from '@mui/material'\nimport React from 'react'\n\nconst colorsOptions = [\n { color: 'default' },\n { color: 'neutral' },\n { color: 'primary' },\n { color: 'secondary' },\n { color: 'tertiary' },\n { color: 'success' },\n { color: 'warning' },\n { color: 'error' },\n] as const\n\nconst Colors = ({ ...args }: TagProps) => {\n return (\n <Grid container spacing={2}>\n <Grid size={6}>\n <Stack spacing={2}>\n {colorsOptions.map((colorOption, index) => (\n <React.Fragment key={index}>\n <Box>\n <Tag\n {...args}\n {...colorOption}\n variant='filled'\n label={`${colorOption.color} - filled`}\n />\n </Box>\n <Grid\n sx={{\n mb: 3,\n }}\n >\n <Tag\n {...args}\n {...colorOption}\n variant='filled'\n label={`${colorOption.color} - filled disabled`}\n disabled\n />\n </Grid>\n </React.Fragment>\n ))}\n </Stack>\n </Grid>\n <Grid size={6}>\n <Stack spacing={2}>\n {colorsOptions.map((colorOption, index) => (\n <React.Fragment key={index}>\n <Box>\n <Tag\n {...args}\n {...colorOption}\n variant='outlined'\n label={`${colorOption.color} - outlined`}\n />\n </Box>\n <Grid\n sx={{\n mb: 3,\n }}\n >\n <Tag\n {...args}\n {...colorOption}\n variant='outlined'\n label={`${colorOption.color} - outlined disabled`}\n disabled\n />\n </Grid>\n </React.Fragment>\n ))}\n </Stack>\n </Grid>\n </Grid>\n )\n}"
|
|
3650
3661
|
},
|
|
3651
3662
|
{
|
|
3652
3663
|
"name": "WithIcons",
|
|
@@ -3790,6 +3801,10 @@
|
|
|
3790
3801
|
{
|
|
3791
3802
|
"name": "backgroundColor",
|
|
3792
3803
|
"aiHint": "Group surface — 'primary' / 'secondary' / 'transparent' (defaults to 'primary', or 'transparent' for the unbounded variant)."
|
|
3804
|
+
},
|
|
3805
|
+
{
|
|
3806
|
+
"name": "color",
|
|
3807
|
+
"aiHint": "Tint of the selected buttons, applied to every ToggleButton in the group — 'primary' (default), 'secondary' or 'tertiary'. MUI's status colors carry no designed tint here."
|
|
3793
3808
|
}
|
|
3794
3809
|
],
|
|
3795
3810
|
"decisionTree": [
|
|
@@ -3835,6 +3850,11 @@
|
|
|
3835
3850
|
"id": "components-buttons-toggle-button-group--variant",
|
|
3836
3851
|
"code": "import { ToggleButtonGroup, ToggleButtonGroupProps, Typography } from '@carto/meridian-ds/components'\nimport { FormatAlignCenter, FormatAlignJustify, FormatAlignLeft, FormatAlignRight } from '@mui/icons-material'\nimport { Grid, Stack, ToggleButton } from '@mui/material'\nimport { useState } from 'react'\n\nconst TOGGLE_BUTTON_GROUP_VARIANTS = [\n 'floating',\n 'contained',\n 'unbounded',\n] as const\n\nconst LabeledToggleButtonGroup = ({\n label,\n title,\n exclusive,\n ...args\n}: ToggleButtonGroupProps & { label: string; title: string }) => {\n const [selected, setSelected] = useState(() => ['AlignLeft'])\n const handleChange = (_: React.MouseEvent, newAlignment: string[]) => {\n setSelected(newAlignment)\n }\n\n return (\n <Grid>\n <Typography\n variant='subtitle2'\n sx={{ mb: 1, textTransform: 'capitalize' }}\n >\n {title}\n </Typography>\n <ToggleButtonGroup\n {...args}\n value={!exclusive && !Array.isArray(selected) ? [selected] : selected}\n onChange={handleChange}\n exclusive={exclusive}\n aria-label='Text alignment'\n >\n <ToggleButton value='AlignLeft' aria-label='AlignLeft'>\n {label ? label : <FormatAlignLeft />}\n </ToggleButton>\n <ToggleButton value='AlignCenter' aria-label='AlignCenter'>\n {label ? label : <FormatAlignCenter />}\n </ToggleButton>\n <ToggleButton value='AlignRight' aria-label='AlignRight'>\n {label ? label : <FormatAlignRight />}\n </ToggleButton>\n <ToggleButton value='AlignJustify' aria-label='AlignJustify' disabled>\n {label ? label : <FormatAlignJustify />}\n </ToggleButton>\n </ToggleButtonGroup>\n </Grid>\n )\n}\n\nconst Variant = (\n props: ToggleButtonGroupProps & { label: string; divider: boolean },\n) => (\n <Stack spacing={4}>\n {TOGGLE_BUTTON_GROUP_VARIANTS.map((variant) => (\n <LabeledToggleButtonGroup\n key={variant}\n {...props}\n title={variant}\n variant={variant}\n />\n ))}\n </Stack>\n)"
|
|
3837
3852
|
},
|
|
3853
|
+
{
|
|
3854
|
+
"name": "Colors",
|
|
3855
|
+
"id": "components-buttons-toggle-button-group--colors",
|
|
3856
|
+
"code": "import { ToggleButtonGroup, ToggleButtonGroupProps, Typography } from '@carto/meridian-ds/components'\nimport { FormatAlignCenter, FormatAlignJustify, FormatAlignLeft, FormatAlignRight } from '@mui/icons-material'\nimport { Box, Stack, ToggleButton } from '@mui/material'\nimport { useState } from 'react'\n\n// Story-only helpers, not exported by the package (stubbed so this compiles):\ndeclare const toggleButtonColors: any\n\nconst GroupTemplate = ({\n label,\n exclusive,\n ...args\n}: ToggleButtonGroupProps & { label: string; divider: boolean }) => {\n const [selectedMedium, setSelectedMedium] = useState(() => ['AlignLeft'])\n const [selectedSmall, setSelectedSmall] = useState(() => ['AlignLeft'])\n\n const handleMediumChange = (\n event: React.MouseEvent,\n newAlignment: string[],\n ) => {\n setSelectedMedium(newAlignment)\n }\n const handleSmallChange = (\n event: React.MouseEvent,\n newAlignment: string[],\n ) => {\n setSelectedSmall(newAlignment)\n }\n\n return (\n <Stack spacing={4}>\n <Box>\n <ToggleButtonGroup\n {...args}\n size='medium'\n value={\n !exclusive && !Array.isArray(selectedMedium)\n ? [selectedMedium]\n : selectedMedium\n }\n onChange={handleMediumChange}\n exclusive={exclusive}\n aria-label='Text alignment'\n >\n <ToggleButton value='AlignLeft' aria-label='AlignLeft'>\n {label ? label : <FormatAlignLeft />}\n </ToggleButton>\n <ToggleButton value='AlignCenter' aria-label='AlignCenter'>\n {label ? label : <FormatAlignCenter />}\n </ToggleButton>\n <ToggleButton value='AlignRight' aria-label='AlignRight'>\n {label ? label : <FormatAlignRight />}\n </ToggleButton>\n <ToggleButton value='AlignJustify' aria-label='AlignJustify' disabled>\n {label ? label : <FormatAlignJustify />}\n </ToggleButton>\n </ToggleButtonGroup>\n </Box>\n <Box>\n <ToggleButtonGroup\n {...args}\n size='small'\n value={\n !exclusive && !Array.isArray(selectedSmall)\n ? [selectedSmall]\n : selectedSmall\n }\n onChange={handleSmallChange}\n exclusive={exclusive}\n aria-label='Text alignment'\n >\n <ToggleButton value='AlignLeft' aria-label='AlignLeft'>\n {label ? label : <FormatAlignLeft />}\n </ToggleButton>\n <ToggleButton value='AlignCenter' aria-label='AlignCenter'>\n {label ? label : <FormatAlignCenter />}\n </ToggleButton>\n <ToggleButton value='AlignRight' aria-label='AlignRight'>\n {label ? label : <FormatAlignRight />}\n </ToggleButton>\n <ToggleButton value='AlignJustify' aria-label='AlignJustify' disabled>\n {label ? label : <FormatAlignJustify />}\n </ToggleButton>\n </ToggleButtonGroup>\n </Box>\n </Stack>\n )\n}\n\nconst Colors = (\n props: ToggleButtonGroupProps & { label: string; divider: boolean },\n) => (\n <Stack spacing={4}>\n {toggleButtonColors.map((color) => (\n <Box key={color}>\n <Typography variant='subtitle2' sx={{ mb: 1 }}>\n {color}\n </Typography>\n <GroupTemplate\n {...props}\n color={color as ToggleButtonGroupProps['color']}\n />\n </Box>\n ))}\n </Stack>\n)"
|
|
3857
|
+
},
|
|
3838
3858
|
{
|
|
3839
3859
|
"name": "BackgroundColor",
|
|
3840
3860
|
"id": "components-buttons-toggle-button-group--background-color",
|