@carto/meridian-ds 5.2.2 → 5.2.3-alpha.0ed71db.42792631259
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 +3 -0
- package/dist/components/index.cjs +132 -6
- package/dist/components/index.js +133 -7
- package/dist/conventions.md +3 -0
- package/dist/metadata.json +2 -2
- package/dist/theme/index.cjs +5 -1
- package/dist/theme/index.js +5 -1
- package/dist/types/components/ChipGroup/ChipGroup.d.ts.map +1 -1
- package/dist/types/components/ChipGroup/ChipGroup.stories.d.ts +11 -0
- package/dist/types/components/ChipGroup/ChipGroup.stories.d.ts.map +1 -1
- package/dist/types/components/ChipGroup/types.d.ts +6 -1
- package/dist/types/components/ChipGroup/types.d.ts.map +1 -1
- package/dist/types/components/ChipGroup/useRowFitCount.d.ts +24 -0
- package/dist/types/components/ChipGroup/useRowFitCount.d.ts.map +1 -0
- package/dist/types/components/IconWrapper/IconWrapper.d.ts.map +1 -1
- package/dist/types/theme/components/data-display.d.ts.map +1 -1
- package/dist/types/theme/components/stories/Chip.stories.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- feat(chip): support IconWrapper in the avatar slot (prototype create-builder-map-extended-settings) [#589](https://github.com/CartoDB/meridian-ds/pull/589)
|
|
6
|
+
- docs(icons): document per-path MUI icon imports [#593](https://github.com/CartoDB/meridian-ds/pull/593)
|
|
7
|
+
|
|
5
8
|
## 5.0
|
|
6
9
|
|
|
7
10
|
### 5.2.2
|
|
@@ -5630,6 +5630,12 @@ function colorStyles({
|
|
|
5630
5630
|
const isExplicitColor = color !== "inherit" && color !== "default";
|
|
5631
5631
|
return {
|
|
5632
5632
|
color: iconColor,
|
|
5633
|
+
// In a Chip's avatar slot, MUI's colored-chip avatar rule (`avatarColorPrimary`…, 0,2,0) would repaint the
|
|
5634
|
+
// wrapper; the extra specificity keeps the wrapper's own colors there.
|
|
5635
|
+
".MuiChip-root &&": {
|
|
5636
|
+
color: iconColor,
|
|
5637
|
+
...!!background && backgroundColor && { backgroundColor }
|
|
5638
|
+
},
|
|
5633
5639
|
...!!background && backgroundColor && {
|
|
5634
5640
|
backgroundColor,
|
|
5635
5641
|
// A disabled ancestor dims the frame too — the extra class/attribute
|
|
@@ -8011,6 +8017,98 @@ function _ChipGroupItem({
|
|
|
8011
8017
|
}
|
|
8012
8018
|
const ChipGroupItem = React.forwardRef(_ChipGroupItem);
|
|
8013
8019
|
ChipGroupItem.displayName = "ChipGroupItem";
|
|
8020
|
+
function countRows({ widths, containerWidth, gap }) {
|
|
8021
|
+
let rows = 0;
|
|
8022
|
+
let rowWidth = 0;
|
|
8023
|
+
for (const width of widths) {
|
|
8024
|
+
if (rows === 0) {
|
|
8025
|
+
rows = 1;
|
|
8026
|
+
rowWidth = width;
|
|
8027
|
+
} else if (rowWidth + gap + width <= containerWidth) {
|
|
8028
|
+
rowWidth += gap + width;
|
|
8029
|
+
} else {
|
|
8030
|
+
rows += 1;
|
|
8031
|
+
rowWidth = width;
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
return rows;
|
|
8035
|
+
}
|
|
8036
|
+
function getRowFitCount({
|
|
8037
|
+
chipWidths,
|
|
8038
|
+
indicatorWidth,
|
|
8039
|
+
containerWidth,
|
|
8040
|
+
gap,
|
|
8041
|
+
maxRows,
|
|
8042
|
+
countLimit
|
|
8043
|
+
}) {
|
|
8044
|
+
const total = chipWidths.length;
|
|
8045
|
+
const upperBound = Math.min(total, countLimit);
|
|
8046
|
+
if (containerWidth <= 0) return upperBound;
|
|
8047
|
+
for (let count = upperBound; count > 0; count--) {
|
|
8048
|
+
const widths = chipWidths.slice(0, count);
|
|
8049
|
+
if (count < total) widths.push(indicatorWidth);
|
|
8050
|
+
if (countRows({ widths, containerWidth, gap }) <= maxRows) return count;
|
|
8051
|
+
}
|
|
8052
|
+
return 0;
|
|
8053
|
+
}
|
|
8054
|
+
function useRowFitCount({
|
|
8055
|
+
rootRef,
|
|
8056
|
+
maxRows,
|
|
8057
|
+
countLimit,
|
|
8058
|
+
chipsKey
|
|
8059
|
+
}) {
|
|
8060
|
+
const [fitCount, setFitCount] = React.useState(null);
|
|
8061
|
+
const [containerWidth, setContainerWidth] = React.useState(0);
|
|
8062
|
+
const measured = React.useRef(null);
|
|
8063
|
+
React.useLayoutEffect(() => {
|
|
8064
|
+
measured.current = null;
|
|
8065
|
+
setFitCount(null);
|
|
8066
|
+
}, [chipsKey, maxRows]);
|
|
8067
|
+
React.useLayoutEffect(() => {
|
|
8068
|
+
const root = rootRef.current;
|
|
8069
|
+
if (maxRows === void 0 || fitCount !== null || !root) return;
|
|
8070
|
+
const items = Array.from(root.children);
|
|
8071
|
+
const indicator = items.pop();
|
|
8072
|
+
const gap = parseFloat(getComputedStyle(root).columnGap) || 0;
|
|
8073
|
+
measured.current = {
|
|
8074
|
+
chipWidths: items.map((item) => item.offsetWidth),
|
|
8075
|
+
indicatorWidth: (indicator == null ? void 0 : indicator.offsetWidth) ?? 0,
|
|
8076
|
+
gap
|
|
8077
|
+
};
|
|
8078
|
+
const width = root.clientWidth;
|
|
8079
|
+
setContainerWidth(width);
|
|
8080
|
+
setFitCount(
|
|
8081
|
+
getRowFitCount({
|
|
8082
|
+
...measured.current,
|
|
8083
|
+
containerWidth: width,
|
|
8084
|
+
maxRows,
|
|
8085
|
+
countLimit
|
|
8086
|
+
})
|
|
8087
|
+
);
|
|
8088
|
+
}, [rootRef, maxRows, fitCount, countLimit]);
|
|
8089
|
+
React.useEffect(() => {
|
|
8090
|
+
const root = rootRef.current;
|
|
8091
|
+
if (maxRows === void 0 || !root || typeof ResizeObserver === "undefined")
|
|
8092
|
+
return;
|
|
8093
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
8094
|
+
if (entry) setContainerWidth(entry.contentRect.width);
|
|
8095
|
+
});
|
|
8096
|
+
observer.observe(root);
|
|
8097
|
+
return () => observer.disconnect();
|
|
8098
|
+
}, [rootRef, maxRows]);
|
|
8099
|
+
React.useEffect(() => {
|
|
8100
|
+
if (maxRows === void 0 || !measured.current) return;
|
|
8101
|
+
setFitCount(
|
|
8102
|
+
getRowFitCount({
|
|
8103
|
+
...measured.current,
|
|
8104
|
+
containerWidth,
|
|
8105
|
+
maxRows,
|
|
8106
|
+
countLimit
|
|
8107
|
+
})
|
|
8108
|
+
);
|
|
8109
|
+
}, [containerWidth, maxRows, countLimit]);
|
|
8110
|
+
return fitCount;
|
|
8111
|
+
}
|
|
8014
8112
|
const PopoverMenu = material.styled(material.Popover)(({ theme }) => ({
|
|
8015
8113
|
".MuiPaper-root": {
|
|
8016
8114
|
pointerEvents: "all",
|
|
@@ -8022,7 +8120,8 @@ const PopoverMenu = material.styled(material.Popover)(({ theme }) => ({
|
|
|
8022
8120
|
function _ChipGroup({
|
|
8023
8121
|
chips,
|
|
8024
8122
|
disabled,
|
|
8025
|
-
maxVisibleChips
|
|
8123
|
+
maxVisibleChips,
|
|
8124
|
+
maxRows,
|
|
8026
8125
|
maxLengthChip = 30,
|
|
8027
8126
|
onClickAllChips,
|
|
8028
8127
|
onDeleteAllChips,
|
|
@@ -8030,6 +8129,15 @@ function _ChipGroup({
|
|
|
8030
8129
|
}, ref) {
|
|
8031
8130
|
const [openedRef, setOpen] = React.useState(null);
|
|
8032
8131
|
const localRef = React.useRef(null);
|
|
8132
|
+
const rootRef = React.useRef(null);
|
|
8133
|
+
const setRootRef = React.useCallback(
|
|
8134
|
+
(node) => {
|
|
8135
|
+
rootRef.current = node;
|
|
8136
|
+
if (typeof ref === "function") ref(node);
|
|
8137
|
+
else if (ref) ref.current = node;
|
|
8138
|
+
},
|
|
8139
|
+
[ref]
|
|
8140
|
+
);
|
|
8033
8141
|
const hasChips = Boolean(chips == null ? void 0 : chips.length);
|
|
8034
8142
|
const normalizedChips = (chips == null ? void 0 : chips.map((chip) => {
|
|
8035
8143
|
if (typeof chip === "string") {
|
|
@@ -8037,9 +8145,19 @@ function _ChipGroup({
|
|
|
8037
8145
|
}
|
|
8038
8146
|
return chip;
|
|
8039
8147
|
})) || [];
|
|
8040
|
-
const
|
|
8041
|
-
const
|
|
8042
|
-
const
|
|
8148
|
+
const isRowLimited = maxRows !== void 0;
|
|
8149
|
+
const countLimit = maxVisibleChips ?? (isRowLimited ? Infinity : 3);
|
|
8150
|
+
const rowFitCount = useRowFitCount({
|
|
8151
|
+
rootRef,
|
|
8152
|
+
maxRows,
|
|
8153
|
+
countLimit,
|
|
8154
|
+
chipsKey: normalizedChips.map((chip) => chip.id ?? chip.label).join("\0")
|
|
8155
|
+
});
|
|
8156
|
+
const isMeasuring = isRowLimited && rowFitCount === null;
|
|
8157
|
+
const visibleCount = isMeasuring ? normalizedChips.length : rowFitCount ?? countLimit;
|
|
8158
|
+
const chipsToShow = normalizedChips.slice(0, visibleCount);
|
|
8159
|
+
const additionalChips = isMeasuring ? normalizedChips.length : Math.max(0, normalizedChips.length - visibleCount);
|
|
8160
|
+
const hiddenChips = normalizedChips.slice(visibleCount);
|
|
8043
8161
|
const firstChip = normalizedChips[0];
|
|
8044
8162
|
const indicatorVariant = (firstChip == null ? void 0 : firstChip.variant) ?? "outlined";
|
|
8045
8163
|
const indicatorColor = (firstChip == null ? void 0 : firstChip.color) ?? "default";
|
|
@@ -8070,8 +8188,16 @@ function _ChipGroup({
|
|
|
8070
8188
|
{
|
|
8071
8189
|
direction: "row",
|
|
8072
8190
|
spacing: 0.5,
|
|
8191
|
+
...isRowLimited && {
|
|
8192
|
+
useFlexGap: true,
|
|
8193
|
+
sx: {
|
|
8194
|
+
flexWrap: "wrap",
|
|
8195
|
+
width: "100%",
|
|
8196
|
+
visibility: isMeasuring ? "hidden" : void 0
|
|
8197
|
+
}
|
|
8198
|
+
},
|
|
8073
8199
|
...rootProps,
|
|
8074
|
-
ref,
|
|
8200
|
+
ref: setRootRef,
|
|
8075
8201
|
"data-name": "chip-group",
|
|
8076
8202
|
children: [
|
|
8077
8203
|
chipsToShow.map((chipData, index) => {
|
|
@@ -8128,7 +8254,7 @@ function _ChipGroup({
|
|
|
8128
8254
|
}
|
|
8129
8255
|
},
|
|
8130
8256
|
children: /* @__PURE__ */ jsxRuntime.jsx(material.Stack, { direction: "column", spacing: 1, children: hiddenChips.map((chipData, index) => {
|
|
8131
|
-
const chipIndex = index +
|
|
8257
|
+
const chipIndex = index + visibleCount;
|
|
8132
8258
|
const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
|
|
8133
8259
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8134
8260
|
ChipGroupItem,
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, createContext, useContext, useImperativeHandle } from "react";
|
|
2
|
+
import React, { forwardRef, useState, useRef, useEffect, useMemo, createElement, Fragment as Fragment$1, useCallback, createContext, useContext, useImperativeHandle, useLayoutEffect } from "react";
|
|
3
3
|
import { styled, Button as Button$1, Tooltip, CircularProgress as CircularProgress$1, Popper, Grow, Paper, ClickAwayListener, MenuList as MenuList$1, MenuItem, ButtonGroup as ButtonGroup$1, Box, TextField, InputAdornment, FormControl, InputLabel, FormHelperText, Select, Checkbox, Link as Link$1, ListItemText as ListItemText$1, IconButton as IconButton$1, ToggleButtonGroup as ToggleButtonGroup$1, Stack, Autocomplete as Autocomplete$1, Divider, ListItemIcon as ListItemIcon$1, createFilterOptions, alpha, useTheme, Toolbar as Toolbar$1, AppBar as AppBar$1, Dialog as Dialog$1, Chip as Chip$1, DialogTitle as DialogTitle$1, DialogContent as DialogContent$1, Fade, AlertTitle, Alert as Alert$2, DialogActions as DialogActions$1, Slide, Accordion, AccordionSummary, AccordionDetails, Avatar as Avatar$1, Menu as Menu$2, useMediaQuery, Portal, Snackbar as Snackbar$1, List as List$2, ListItemButton as ListItemButton$1, ListItem as ListItem$1, ListSubheader as ListSubheader$1, Popover } from "@mui/material";
|
|
4
4
|
import { ListItemAvatar, ListItemSecondaryAction } from "@mui/material";
|
|
5
5
|
import { T as Typography, I as ICON_SIZE_SMALL, m as mergeSx, a as ICON_SIZE_MEDIUM, i as isPalettePath, M as MENU_ITEM_SIZE_EXTENDED, b as MENU_ITEM_SIZE_DEFAULT, c as MENU_LIST_MAX_SIZE, d as MENU_ITEM_SIZE_DENSE, A as APPBAR_SIZE, e as ICON_SIZE_LARGE, N as NOTIFICATION_DURATION_IN_MS, L as LIST_MAX_SIZE, f as LIST_ITEM_SIZE_DENSE, g as LIST_ITEM_SIZE_DEFAULT, h as LIST_OVERSCAN_ITEMS_COUNT, F as FontWeight, r as resolvePalettePath } from "../palette-utils-BmPPGzZt.js";
|
|
@@ -5613,6 +5613,12 @@ function colorStyles({
|
|
|
5613
5613
|
const isExplicitColor = color !== "inherit" && color !== "default";
|
|
5614
5614
|
return {
|
|
5615
5615
|
color: iconColor,
|
|
5616
|
+
// In a Chip's avatar slot, MUI's colored-chip avatar rule (`avatarColorPrimary`…, 0,2,0) would repaint the
|
|
5617
|
+
// wrapper; the extra specificity keeps the wrapper's own colors there.
|
|
5618
|
+
".MuiChip-root &&": {
|
|
5619
|
+
color: iconColor,
|
|
5620
|
+
...!!background && backgroundColor && { backgroundColor }
|
|
5621
|
+
},
|
|
5616
5622
|
...!!background && backgroundColor && {
|
|
5617
5623
|
backgroundColor,
|
|
5618
5624
|
// A disabled ancestor dims the frame too — the extra class/attribute
|
|
@@ -7994,6 +8000,98 @@ function _ChipGroupItem({
|
|
|
7994
8000
|
}
|
|
7995
8001
|
const ChipGroupItem = forwardRef(_ChipGroupItem);
|
|
7996
8002
|
ChipGroupItem.displayName = "ChipGroupItem";
|
|
8003
|
+
function countRows({ widths, containerWidth, gap }) {
|
|
8004
|
+
let rows = 0;
|
|
8005
|
+
let rowWidth = 0;
|
|
8006
|
+
for (const width of widths) {
|
|
8007
|
+
if (rows === 0) {
|
|
8008
|
+
rows = 1;
|
|
8009
|
+
rowWidth = width;
|
|
8010
|
+
} else if (rowWidth + gap + width <= containerWidth) {
|
|
8011
|
+
rowWidth += gap + width;
|
|
8012
|
+
} else {
|
|
8013
|
+
rows += 1;
|
|
8014
|
+
rowWidth = width;
|
|
8015
|
+
}
|
|
8016
|
+
}
|
|
8017
|
+
return rows;
|
|
8018
|
+
}
|
|
8019
|
+
function getRowFitCount({
|
|
8020
|
+
chipWidths,
|
|
8021
|
+
indicatorWidth,
|
|
8022
|
+
containerWidth,
|
|
8023
|
+
gap,
|
|
8024
|
+
maxRows,
|
|
8025
|
+
countLimit
|
|
8026
|
+
}) {
|
|
8027
|
+
const total = chipWidths.length;
|
|
8028
|
+
const upperBound = Math.min(total, countLimit);
|
|
8029
|
+
if (containerWidth <= 0) return upperBound;
|
|
8030
|
+
for (let count = upperBound; count > 0; count--) {
|
|
8031
|
+
const widths = chipWidths.slice(0, count);
|
|
8032
|
+
if (count < total) widths.push(indicatorWidth);
|
|
8033
|
+
if (countRows({ widths, containerWidth, gap }) <= maxRows) return count;
|
|
8034
|
+
}
|
|
8035
|
+
return 0;
|
|
8036
|
+
}
|
|
8037
|
+
function useRowFitCount({
|
|
8038
|
+
rootRef,
|
|
8039
|
+
maxRows,
|
|
8040
|
+
countLimit,
|
|
8041
|
+
chipsKey
|
|
8042
|
+
}) {
|
|
8043
|
+
const [fitCount, setFitCount] = useState(null);
|
|
8044
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
8045
|
+
const measured = useRef(null);
|
|
8046
|
+
useLayoutEffect(() => {
|
|
8047
|
+
measured.current = null;
|
|
8048
|
+
setFitCount(null);
|
|
8049
|
+
}, [chipsKey, maxRows]);
|
|
8050
|
+
useLayoutEffect(() => {
|
|
8051
|
+
const root = rootRef.current;
|
|
8052
|
+
if (maxRows === void 0 || fitCount !== null || !root) return;
|
|
8053
|
+
const items = Array.from(root.children);
|
|
8054
|
+
const indicator = items.pop();
|
|
8055
|
+
const gap = parseFloat(getComputedStyle(root).columnGap) || 0;
|
|
8056
|
+
measured.current = {
|
|
8057
|
+
chipWidths: items.map((item) => item.offsetWidth),
|
|
8058
|
+
indicatorWidth: (indicator == null ? void 0 : indicator.offsetWidth) ?? 0,
|
|
8059
|
+
gap
|
|
8060
|
+
};
|
|
8061
|
+
const width = root.clientWidth;
|
|
8062
|
+
setContainerWidth(width);
|
|
8063
|
+
setFitCount(
|
|
8064
|
+
getRowFitCount({
|
|
8065
|
+
...measured.current,
|
|
8066
|
+
containerWidth: width,
|
|
8067
|
+
maxRows,
|
|
8068
|
+
countLimit
|
|
8069
|
+
})
|
|
8070
|
+
);
|
|
8071
|
+
}, [rootRef, maxRows, fitCount, countLimit]);
|
|
8072
|
+
useEffect(() => {
|
|
8073
|
+
const root = rootRef.current;
|
|
8074
|
+
if (maxRows === void 0 || !root || typeof ResizeObserver === "undefined")
|
|
8075
|
+
return;
|
|
8076
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
8077
|
+
if (entry) setContainerWidth(entry.contentRect.width);
|
|
8078
|
+
});
|
|
8079
|
+
observer.observe(root);
|
|
8080
|
+
return () => observer.disconnect();
|
|
8081
|
+
}, [rootRef, maxRows]);
|
|
8082
|
+
useEffect(() => {
|
|
8083
|
+
if (maxRows === void 0 || !measured.current) return;
|
|
8084
|
+
setFitCount(
|
|
8085
|
+
getRowFitCount({
|
|
8086
|
+
...measured.current,
|
|
8087
|
+
containerWidth,
|
|
8088
|
+
maxRows,
|
|
8089
|
+
countLimit
|
|
8090
|
+
})
|
|
8091
|
+
);
|
|
8092
|
+
}, [containerWidth, maxRows, countLimit]);
|
|
8093
|
+
return fitCount;
|
|
8094
|
+
}
|
|
7997
8095
|
const PopoverMenu = styled(Popover)(({ theme }) => ({
|
|
7998
8096
|
".MuiPaper-root": {
|
|
7999
8097
|
pointerEvents: "all",
|
|
@@ -8005,7 +8103,8 @@ const PopoverMenu = styled(Popover)(({ theme }) => ({
|
|
|
8005
8103
|
function _ChipGroup({
|
|
8006
8104
|
chips,
|
|
8007
8105
|
disabled,
|
|
8008
|
-
maxVisibleChips
|
|
8106
|
+
maxVisibleChips,
|
|
8107
|
+
maxRows,
|
|
8009
8108
|
maxLengthChip = 30,
|
|
8010
8109
|
onClickAllChips,
|
|
8011
8110
|
onDeleteAllChips,
|
|
@@ -8013,6 +8112,15 @@ function _ChipGroup({
|
|
|
8013
8112
|
}, ref) {
|
|
8014
8113
|
const [openedRef, setOpen] = useState(null);
|
|
8015
8114
|
const localRef = useRef(null);
|
|
8115
|
+
const rootRef = useRef(null);
|
|
8116
|
+
const setRootRef = useCallback(
|
|
8117
|
+
(node) => {
|
|
8118
|
+
rootRef.current = node;
|
|
8119
|
+
if (typeof ref === "function") ref(node);
|
|
8120
|
+
else if (ref) ref.current = node;
|
|
8121
|
+
},
|
|
8122
|
+
[ref]
|
|
8123
|
+
);
|
|
8016
8124
|
const hasChips = Boolean(chips == null ? void 0 : chips.length);
|
|
8017
8125
|
const normalizedChips = (chips == null ? void 0 : chips.map((chip) => {
|
|
8018
8126
|
if (typeof chip === "string") {
|
|
@@ -8020,9 +8128,19 @@ function _ChipGroup({
|
|
|
8020
8128
|
}
|
|
8021
8129
|
return chip;
|
|
8022
8130
|
})) || [];
|
|
8023
|
-
const
|
|
8024
|
-
const
|
|
8025
|
-
const
|
|
8131
|
+
const isRowLimited = maxRows !== void 0;
|
|
8132
|
+
const countLimit = maxVisibleChips ?? (isRowLimited ? Infinity : 3);
|
|
8133
|
+
const rowFitCount = useRowFitCount({
|
|
8134
|
+
rootRef,
|
|
8135
|
+
maxRows,
|
|
8136
|
+
countLimit,
|
|
8137
|
+
chipsKey: normalizedChips.map((chip) => chip.id ?? chip.label).join("\0")
|
|
8138
|
+
});
|
|
8139
|
+
const isMeasuring = isRowLimited && rowFitCount === null;
|
|
8140
|
+
const visibleCount = isMeasuring ? normalizedChips.length : rowFitCount ?? countLimit;
|
|
8141
|
+
const chipsToShow = normalizedChips.slice(0, visibleCount);
|
|
8142
|
+
const additionalChips = isMeasuring ? normalizedChips.length : Math.max(0, normalizedChips.length - visibleCount);
|
|
8143
|
+
const hiddenChips = normalizedChips.slice(visibleCount);
|
|
8026
8144
|
const firstChip = normalizedChips[0];
|
|
8027
8145
|
const indicatorVariant = (firstChip == null ? void 0 : firstChip.variant) ?? "outlined";
|
|
8028
8146
|
const indicatorColor = (firstChip == null ? void 0 : firstChip.color) ?? "default";
|
|
@@ -8053,8 +8171,16 @@ function _ChipGroup({
|
|
|
8053
8171
|
{
|
|
8054
8172
|
direction: "row",
|
|
8055
8173
|
spacing: 0.5,
|
|
8174
|
+
...isRowLimited && {
|
|
8175
|
+
useFlexGap: true,
|
|
8176
|
+
sx: {
|
|
8177
|
+
flexWrap: "wrap",
|
|
8178
|
+
width: "100%",
|
|
8179
|
+
visibility: isMeasuring ? "hidden" : void 0
|
|
8180
|
+
}
|
|
8181
|
+
},
|
|
8056
8182
|
...rootProps,
|
|
8057
|
-
ref,
|
|
8183
|
+
ref: setRootRef,
|
|
8058
8184
|
"data-name": "chip-group",
|
|
8059
8185
|
children: [
|
|
8060
8186
|
chipsToShow.map((chipData, index) => {
|
|
@@ -8111,7 +8237,7 @@ function _ChipGroup({
|
|
|
8111
8237
|
}
|
|
8112
8238
|
},
|
|
8113
8239
|
children: /* @__PURE__ */ jsx(Stack, { direction: "column", spacing: 1, children: hiddenChips.map((chipData, index) => {
|
|
8114
|
-
const chipIndex = index +
|
|
8240
|
+
const chipIndex = index + visibleCount;
|
|
8115
8241
|
const { displayLabel, showTooltip } = getChipDisplayProps(chipData);
|
|
8116
8242
|
return /* @__PURE__ */ jsx(
|
|
8117
8243
|
ChipGroupItem,
|
package/dist/conventions.md
CHANGED
|
@@ -33,6 +33,9 @@ Meridian is the source of truth: when an existing codebase pattern contradicts M
|
|
|
33
33
|
- Source icons from Meridian's custom-icons first, then `@mui/icons-material`;
|
|
34
34
|
add a local SVG only when neither has an equivalent. Don't duplicate an icon
|
|
35
35
|
the design system already ships.
|
|
36
|
+
- Import each MUI icon by path (`import AddOutlined from '@mui/icons-material/AddOutlined'`),
|
|
37
|
+
never from the `@mui/icons-material` barrel: the barrel pulls in every icon
|
|
38
|
+
module and slows tests and dev builds.
|
|
36
39
|
- 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`).
|
|
37
40
|
- 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.
|
|
38
41
|
- Use the standard icon sizes — small 12px, medium (default) 18px, large 24px;
|
package/dist/metadata.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.2.
|
|
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- Common hand-rolled patterns and their Meridian replacement:\n - `<a target=\"_blank\">` → `Link external`\n - modal built from `Box` → `Dialog` + `DialogHeader`/`DialogContent`/`DialogFooter`\n - pill/badge `Box` → `Tag`\n - custom select/dropdown → `SelectField`, or `FilterDropdown` for filters\n - label + required/optional mark → `LabelWithIndicator`\n - read-only input with a copy button → `CopiableInputText`\n - custom input → `TextField` (themed by Meridian; pick its `variant`) or `SearchField`\n - manual ellipsis + tooltip → `EllipsisWithTooltip`\n - status/feedback `Box` → `Alert`\n - form label/help text → `InputLabel`/`FormHelperText` (themed by Meridian)\n- Compose before customizing: a cluster of `styled()` wrappers that mirrors a composite is a smell (e.g. a hand-built row instead of `ListItem` + `ListItemIcon iconProps` + `ListItemText` + `ListItemRightContent`). Don't trust a code comment claiming the design system can't do something — check the component's props first.\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- `IconWrapper`'s `size` is the outer footprint (steps 12/18/24/32/40/48), not the glyph size — the glyph inside is sized for you.\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 — pass the reason as `tooltip` on `Button`/`IconButton`/`SplitButton` (it shows while disabled), or link it with `aria-describedby`.\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- Interactive elements are real controls (`Button`, `IconButton`, `Link`, …) — never a `div`/`Box` with `onClick`.\n- Every input has a visible or accessible label, not just a placeholder; every image has `alt`.\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- Prefer the prop over an override (`Typography noWrap`/`weight`, `fullWidth`, `Alert isSticky`, …). Don't restyle one component to imitate another or to fake a state — pick the component/variant that already looks that way (e.g. `TextField variant=\"standard\"`, or plain `Typography` for a read-only value). Avoid brittle descendant selectors into a component's internals.\n- Don't restate or cancel built-in styling: no wrapper re-applying a component's own border/radius/background, no `disablePadding` on a parent only to re-add padding on its children.\n- `!important` on a Meridian or themed component is an override smell — a design-system gap to raise upstream.\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 scale (`theme.spacing(n)`, or `sx` numeric spacing like `px: 2` / `mt: 1.5`) — no raw hex/rgb or px. Margin, padding and gap use steps `0.25, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 12, 15` (2–120px); `width`/`height` and positional offsets may use any step (`spacing-step` in `@carto/meridian-ds/eslint-rules` lints it). Get the exact values — palette keys, spacing base, type ramp, `shape.borderRadius`, breakpoints, shadows — from `meridian_get_tokens`.\n- Token details:\n - `sx` spacing keys (`m*`/`p*`/`gap`) resolve to the scale, but `top`/`right`/`bottom`/`left` don't (`top: 2` is 2px) — use `theme.spacing()` there.\n - In `styled()`, always use `theme.spacing()`. `style={}` isn't theme-aware — use `sx`.\n - Borders use `divider`; radius comes from `shape.borderRadius`; elevation from `theme.shadows[n]`.\n - Translucent black/white use `palette.black[N]`/`palette.white[N]` (N = 90, 60, 40, 25, 12, 8, 4), not `alpha()`.\n - Motion uses `theme.transitions` and respects `prefers-reduced-motion`; responsive rules use `theme.breakpoints`.\n- Text uses `<Typography variant=…>` (with the `weight` prop for emphasis), never hardcoded `fontSize`/`fontWeight`/`lineHeight`/`fontFamily`. Text that can overflow gets `EllipsisWithTooltip` (or `noWrap` when the full text isn't needed).\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- A reusable component doesn't bake in its placement: no absolute positioning, outer margin, or fixed outer size — accept `sx` and let the caller place it.\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",
|
|
2
|
+
"version": "5.2.3-alpha.0ed71db.42792631259",
|
|
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- Common hand-rolled patterns and their Meridian replacement:\n - `<a target=\"_blank\">` → `Link external`\n - modal built from `Box` → `Dialog` + `DialogHeader`/`DialogContent`/`DialogFooter`\n - pill/badge `Box` → `Tag`\n - custom select/dropdown → `SelectField`, or `FilterDropdown` for filters\n - label + required/optional mark → `LabelWithIndicator`\n - read-only input with a copy button → `CopiableInputText`\n - custom input → `TextField` (themed by Meridian; pick its `variant`) or `SearchField`\n - manual ellipsis + tooltip → `EllipsisWithTooltip`\n - status/feedback `Box` → `Alert`\n - form label/help text → `InputLabel`/`FormHelperText` (themed by Meridian)\n- Compose before customizing: a cluster of `styled()` wrappers that mirrors a composite is a smell (e.g. a hand-built row instead of `ListItem` + `ListItemIcon iconProps` + `ListItemText` + `ListItemRightContent`). Don't trust a code comment claiming the design system can't do something — check the component's props first.\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- Import each MUI icon by path (`import AddOutlined from '@mui/icons-material/AddOutlined'`),\n never from the `@mui/icons-material` barrel: the barrel pulls in every icon\n module and slows tests and dev builds.\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- `IconWrapper`'s `size` is the outer footprint (steps 12/18/24/32/40/48), not the glyph size — the glyph inside is sized for you.\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 — pass the reason as `tooltip` on `Button`/`IconButton`/`SplitButton` (it shows while disabled), or link it with `aria-describedby`.\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- Interactive elements are real controls (`Button`, `IconButton`, `Link`, …) — never a `div`/`Box` with `onClick`.\n- Every input has a visible or accessible label, not just a placeholder; every image has `alt`.\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- Prefer the prop over an override (`Typography noWrap`/`weight`, `fullWidth`, `Alert isSticky`, …). Don't restyle one component to imitate another or to fake a state — pick the component/variant that already looks that way (e.g. `TextField variant=\"standard\"`, or plain `Typography` for a read-only value). Avoid brittle descendant selectors into a component's internals.\n- Don't restate or cancel built-in styling: no wrapper re-applying a component's own border/radius/background, no `disablePadding` on a parent only to re-add padding on its children.\n- `!important` on a Meridian or themed component is an override smell — a design-system gap to raise upstream.\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 scale (`theme.spacing(n)`, or `sx` numeric spacing like `px: 2` / `mt: 1.5`) — no raw hex/rgb or px. Margin, padding and gap use steps `0.25, 0.5, 0.75, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8, 9, 12, 15` (2–120px); `width`/`height` and positional offsets may use any step (`spacing-step` in `@carto/meridian-ds/eslint-rules` lints it). Get the exact values — palette keys, spacing base, type ramp, `shape.borderRadius`, breakpoints, shadows — from `meridian_get_tokens`.\n- Token details:\n - `sx` spacing keys (`m*`/`p*`/`gap`) resolve to the scale, but `top`/`right`/`bottom`/`left` don't (`top: 2` is 2px) — use `theme.spacing()` there.\n - In `styled()`, always use `theme.spacing()`. `style={}` isn't theme-aware — use `sx`.\n - Borders use `divider`; radius comes from `shape.borderRadius`; elevation from `theme.shadows[n]`.\n - Translucent black/white use `palette.black[N]`/`palette.white[N]` (N = 90, 60, 40, 25, 12, 8, 4), not `alpha()`.\n - Motion uses `theme.transitions` and respects `prefers-reduced-motion`; responsive rules use `theme.breakpoints`.\n- Text uses `<Typography variant=…>` (with the `weight` prop for emphasis), never hardcoded `fontSize`/`fontWeight`/`lineHeight`/`fontFamily`. Text that can overflow gets `EllipsisWithTooltip` (or `noWrap` when the full text isn't needed).\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- A reusable component doesn't bake in its placement: no absolute positioning, outer margin, or fixed outer size — accept `sx` and let the caller place it.\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
|
{
|
|
6
6
|
"name": "AccordionGroup",
|
package/dist/theme/index.cjs
CHANGED
|
@@ -529,6 +529,10 @@ const dataDisplayOverrides = {
|
|
|
529
529
|
color: theme2.palette.secondary.contrastText,
|
|
530
530
|
backgroundColor: theme2.palette.background.paper
|
|
531
531
|
},
|
|
532
|
+
// An IconWrapper in the avatar slot keeps its own size and colors and only drops MUI's avatar margins, like Avatar
|
|
533
|
+
'& .MuiChip-avatar[data-name="icon-wrapper"]': {
|
|
534
|
+
margin: 0
|
|
535
|
+
},
|
|
532
536
|
"& .MuiChip-icon": {
|
|
533
537
|
margin: 0,
|
|
534
538
|
marginLeft: theme2.spacing(0.5),
|
|
@@ -546,7 +550,7 @@ const dataDisplayOverrides = {
|
|
|
546
550
|
"& .MuiChip-deleteIcon, & .MuiChip-icon": {
|
|
547
551
|
color: theme2.palette.action.disabled
|
|
548
552
|
},
|
|
549
|
-
|
|
553
|
+
'& .MuiAvatar-root, & .MuiChip-avatar[data-name="icon-wrapper"]': {
|
|
550
554
|
opacity: 0.6
|
|
551
555
|
}
|
|
552
556
|
},
|
package/dist/theme/index.js
CHANGED
|
@@ -528,6 +528,10 @@ const dataDisplayOverrides = {
|
|
|
528
528
|
color: theme2.palette.secondary.contrastText,
|
|
529
529
|
backgroundColor: theme2.palette.background.paper
|
|
530
530
|
},
|
|
531
|
+
// An IconWrapper in the avatar slot keeps its own size and colors and only drops MUI's avatar margins, like Avatar
|
|
532
|
+
'& .MuiChip-avatar[data-name="icon-wrapper"]': {
|
|
533
|
+
margin: 0
|
|
534
|
+
},
|
|
531
535
|
"& .MuiChip-icon": {
|
|
532
536
|
margin: 0,
|
|
533
537
|
marginLeft: theme2.spacing(0.5),
|
|
@@ -545,7 +549,7 @@ const dataDisplayOverrides = {
|
|
|
545
549
|
"& .MuiChip-deleteIcon, & .MuiChip-icon": {
|
|
546
550
|
color: theme2.palette.action.disabled
|
|
547
551
|
},
|
|
548
|
-
|
|
552
|
+
'& .MuiAvatar-root, & .MuiChip-avatar[data-name="icon-wrapper"]': {
|
|
549
553
|
opacity: 0.6
|
|
550
554
|
}
|
|
551
555
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/ChipGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"ChipGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/ChipGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAsB,cAAc,EAAE,MAAM,SAAS,CAAA;AAoM5D,6ZAA6Z;AAC7Z,QAAA,MAAM,SAAS,2GAAyB,CAAA;AAGxC,eAAe,SAAS,CAAA"}
|
|
@@ -192,6 +192,17 @@ export declare const InteractionMaxVisibleChips: {
|
|
|
192
192
|
canvasElement: HTMLElement;
|
|
193
193
|
}) => Promise<void>;
|
|
194
194
|
};
|
|
195
|
+
export declare const InteractionMaxRows: {
|
|
196
|
+
render: (args: PlaygroundStoryProps) => import("react/jsx-runtime").JSX.Element;
|
|
197
|
+
tags: string[];
|
|
198
|
+
args: {
|
|
199
|
+
maxVisibleChips: undefined;
|
|
200
|
+
maxRows: number;
|
|
201
|
+
};
|
|
202
|
+
play: ({ canvasElement }: {
|
|
203
|
+
canvasElement: HTMLElement;
|
|
204
|
+
}) => Promise<void>;
|
|
205
|
+
};
|
|
195
206
|
/** @summary Overflow + per-chip behavior — truncation to maxVisibleChips with a +N hover popover, plus individual clickable/removable/disabled/filled chips. */
|
|
196
207
|
export declare const Behavior: {
|
|
197
208
|
render: ({ ...rest }: ChipGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChipGroup.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/ChipGroup.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAQ,MAAM,eAAe,CAAA;AAU3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxC;;GAEG;AACH,UAAU,oBAAqB,SAAQ,cAAc;IACnD,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9B,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC1B,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CACzB;AA6CD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCqB,CAAA;AAClC,eAAe,OAAO,CAAA;AA0PtB,eAAO,MAAM,UAAU;uDAlPpB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6PtB,CAAA;AAED,eAAO,MAAM,WAAW;uDA/PrB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAwQW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAgB/D,CAAA;AAED,eAAO,MAAM,OAAO;iCAtQyB,cAAc;CAwQ1D,CAAA;AAED,eAAO,MAAM,KAAK;iCA5OyB,cAAc;CA8OxD,CAAA;AAED,eAAO,MAAM,IAAI;iCApMyB,cAAc;CAsMvD,CAAA;AAED,eAAO,MAAM,QAAQ;uDAtSlB,oBAAoB;;;;CA2StB,CAAA;AAED,eAAO,MAAM,wBAAwB;uDA7SlC,oBAAoB;;;;;8BAmTW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAW/D,CAAA;AAED,eAAO,MAAM,0BAA0B;uDAhUpC,oBAAoB;;;;;8BAsUW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAe/D,CAAA;AAED,gKAAgK;AAChK,eAAO,MAAM,QAAQ;
|
|
1
|
+
{"version":3,"file":"ChipGroup.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/ChipGroup.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAQ,MAAM,eAAe,CAAA;AAU3D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxC;;GAEG;AACH,UAAU,oBAAqB,SAAQ,cAAc;IACnD,wDAAwD;IACxD,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9B,sDAAsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAA;IAC1B,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAA;CACzB;AA6CD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCqB,CAAA;AAClC,eAAe,OAAO,CAAA;AA0PtB,eAAO,MAAM,UAAU;uDAlPpB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6PtB,CAAA;AAED,eAAO,MAAM,WAAW;uDA/PrB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAwQW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAgB/D,CAAA;AAED,eAAO,MAAM,OAAO;iCAtQyB,cAAc;CAwQ1D,CAAA;AAED,eAAO,MAAM,KAAK;iCA5OyB,cAAc;CA8OxD,CAAA;AAED,eAAO,MAAM,IAAI;iCApMyB,cAAc;CAsMvD,CAAA;AAED,eAAO,MAAM,QAAQ;uDAtSlB,oBAAoB;;;;CA2StB,CAAA;AAED,eAAO,MAAM,wBAAwB;uDA7SlC,oBAAoB;;;;;8BAmTW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAW/D,CAAA;AAED,eAAO,MAAM,0BAA0B;uDAhUpC,oBAAoB;;;;;8BAsUW;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAe/D,CAAA;AAED,eAAO,MAAM,kBAAkB;mBACd,oBAAoB;;;;;;8BAUH;QAAE,aAAa,EAAE,WAAW,CAAA;KAAE;CAiB/D,CAAA;AAED,gKAAgK;AAChK,eAAO,MAAM,QAAQ;0BA1PkB,cAAc;CA4PpD,CAAA;AAED,eAAO,MAAM,KAAK;;;CAejB,CAAA"}
|
|
@@ -28,9 +28,14 @@ export interface ChipGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
28
|
* Hidden chips appear in a vertical popover on hover. Set this close to the
|
|
29
29
|
* typical chip count so the overflow indicator actually kicks in — a value well
|
|
30
30
|
* above your usual count defeats the truncation.
|
|
31
|
-
* @default 3
|
|
31
|
+
* @default 3, or no limit when `maxRows` is set
|
|
32
32
|
*/
|
|
33
33
|
maxVisibleChips?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Wraps the chips and shows as many as fit in this many rows, with the "+N" indicator
|
|
36
|
+
* at the end of the last row. Combined with `maxVisibleChips`, the stricter limit wins.
|
|
37
|
+
*/
|
|
38
|
+
maxRows?: number;
|
|
34
39
|
/**
|
|
35
40
|
* Maximum length of chip labels before truncating with "..." indicator.
|
|
36
41
|
* Labels longer than this value will be truncated and show a tooltip with the full text.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IAEb,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,4GAA4G;IAC5G,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAA;IAEtC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAE7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAE9E;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IAEb,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,4GAA4G;IAC5G,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC1E;;;OAGG;IACH,KAAK,EAAE,CAAC,MAAM,GAAG,kBAAkB,CAAC,EAAE,CAAA;IAEtC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAE7E;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAA;IAE9E;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
interface GetRowFitCountArgs {
|
|
3
|
+
chipWidths: number[];
|
|
4
|
+
indicatorWidth: number;
|
|
5
|
+
containerWidth: number;
|
|
6
|
+
gap: number;
|
|
7
|
+
maxRows: number;
|
|
8
|
+
countLimit: number;
|
|
9
|
+
}
|
|
10
|
+
/** Largest number of leading chips that, followed by the `+N` indicator when some are left out, wraps into at most `maxRows` rows. */
|
|
11
|
+
export declare function getRowFitCount({ chipWidths, indicatorWidth, containerWidth, gap, maxRows, countLimit, }: GetRowFitCountArgs): number;
|
|
12
|
+
interface UseRowFitCountArgs {
|
|
13
|
+
rootRef: RefObject<HTMLDivElement | null>;
|
|
14
|
+
maxRows: number | undefined;
|
|
15
|
+
countLimit: number;
|
|
16
|
+
chipsKey: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Measures the chips once (all rendered, `+N` last) and returns how many fit in `maxRows` rows,
|
|
20
|
+
* recomputing from the cached widths when the container resizes. `null` while measuring.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useRowFitCount({ rootRef, maxRows, countLimit, chipsKey, }: UseRowFitCountArgs): number | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=useRowFitCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRowFitCount.d.ts","sourceRoot":"","sources":["../../../../src/components/ChipGroup/useRowFitCount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAgD,MAAM,OAAO,CAAA;AAyB/E,UAAU,kBAAkB;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,sIAAsI;AACtI,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,EACd,cAAc,EACd,GAAG,EACH,OAAO,EACP,UAAU,GACX,EAAE,kBAAkB,UAUpB;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACzC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,OAAO,EACP,UAAU,EACV,QAAQ,GACT,EAAE,kBAAkB,iBA6DpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/IconWrapper/IconWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EACd,cAAc,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAIL,OAAO,EACP,KAAK,EAEL,YAAY,EACb,MAAM,eAAe,CAAA;AAOtB,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,sEAAsE;IACtE,QAAQ,EAAE,SAAS,CAAA;IACnB,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,qCAAqC;IACrC,IAAI,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IAC7C,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC3C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACvE;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACpC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,UAAU,CAAC,CAAA;CACxD,CAAA;
|
|
1
|
+
{"version":3,"file":"IconWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/IconWrapper/IconWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,cAAc,EACd,cAAc,EACf,MAAM,OAAO,CAAA;AACd,OAAO,EAIL,OAAO,EACP,KAAK,EAEL,YAAY,EACb,MAAM,eAAe,CAAA;AAOtB,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG;IAC9C,sEAAsE;IACtE,QAAQ,EAAE,SAAS,CAAA;IACnB,0CAA0C;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,qCAAqC;IACrC,IAAI,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;IAC7C,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gEAAgE;IAChE,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAA;IAC3C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACvE;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;IACpC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,UAAU,CAAC,CAAA;CACxD,CAAA;AAiQD,gPAAgP;AAChP,QAAA,MAAM,WAAW;IA1Uf,sEAAsE;cAC5D,SAAS;IACnB,0CAA0C;SACrC,MAAM;IACX,qCAAqC;WAC9B,cAAc,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC;IAC7C,qCAAqC;eAC1B,MAAM;IACjB,kEAAkE;oBAClD,MAAM;IACtB,gEAAgE;SAC3D,OAAO,CAAC,KAAK,CAAC;IACnB;;;;;OAKG;WACI,MAAM;IACb;;;OAGG;cACO,SAAS,GAAG,QAAQ,GAAG,UAAU;IAC3C;;;;;;OAMG;YACK,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IACvE;;;OAGG;iBACU,OAAO;IACpB;;;;;OAKG;iBACU,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IACpC;;;;OAIG;sBACe,MAAM;IACxB;;;;OAIG;qBACc,OAAO;IACxB;;;OAGG;eACQ,OAAO;IAClB;;;;OAIG;cACO,YAAY,CAAC,OAAO,CAAC;IAC/B;;;OAGG;mBACY,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,UAAU,CAAC;kDAmQb,CAAA;AAE5C,eAAe,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-display.d.ts","sourceRoot":"","sources":["../../../../src/theme/components/data-display.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAQ,KAAK,EAAE,MAAM,eAAe,CAAA;AAqB9D,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"data-display.d.ts","sourceRoot":"","sources":["../../../../src/theme/components/data-display.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAQ,KAAK,EAAE,MAAM,eAAe,CAAA;AAqB9D,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAouB3D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/theme/components/stories/Chip.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Chip.stories.d.ts","sourceRoot":"","sources":["../../../../../src/theme/components/stories/Chip.stories.tsx"],"names":[],"mappings":"AAyBA,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EG,CAAA;AAChB,eAAe,OAAO,CAAA;AA6mCtB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;CAMtB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIlB,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIlB,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIrB,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIlB,CAAA;AAED,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKvB,CAAA"}
|