@mond-design-system/react 4.0.0 → 4.2.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/dist/index.cjs +69 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +33 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +69 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1229,7 +1229,7 @@ function Switch({
|
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
1231
|
// mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/SegmentedControl/SegmentedControl.module.css?mds-scoped
|
|
1232
|
-
var SegmentedControl_module_default = { "group": "mds-SegmentedControl__group", "
|
|
1232
|
+
var SegmentedControl_module_default = { "group": "mds-SegmentedControl__group", "size-md": "mds-SegmentedControl__size-md", "face": "mds-SegmentedControl__face", "size-sm": "mds-SegmentedControl__size-sm", "bare": "mds-SegmentedControl__bare", "segment": "mds-SegmentedControl__segment", "fullWidth": "mds-SegmentedControl__fullWidth", "input": "mds-SegmentedControl__input" };
|
|
1233
1233
|
function SegmentedControl({
|
|
1234
1234
|
label,
|
|
1235
1235
|
options,
|
|
@@ -1237,24 +1237,42 @@ function SegmentedControl({
|
|
|
1237
1237
|
onChange,
|
|
1238
1238
|
disabled = false,
|
|
1239
1239
|
fullWidth = false,
|
|
1240
|
+
size = "md",
|
|
1241
|
+
bare = false,
|
|
1242
|
+
repick = false,
|
|
1240
1243
|
className
|
|
1241
1244
|
}) {
|
|
1242
1245
|
const name = react.useId();
|
|
1243
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
className
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1246
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1247
|
+
"div",
|
|
1248
|
+
{
|
|
1249
|
+
role: "radiogroup",
|
|
1250
|
+
"aria-label": label,
|
|
1251
|
+
className: cx(
|
|
1252
|
+
SegmentedControl_module_default.group,
|
|
1253
|
+
SegmentedControl_module_default[`size-${size}`],
|
|
1254
|
+
fullWidth && SegmentedControl_module_default.fullWidth,
|
|
1255
|
+
bare && SegmentedControl_module_default.bare,
|
|
1256
|
+
className
|
|
1257
|
+
),
|
|
1258
|
+
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: SegmentedControl_module_default.segment, children: [
|
|
1259
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1260
|
+
"input",
|
|
1261
|
+
{
|
|
1262
|
+
type: "radio",
|
|
1263
|
+
name,
|
|
1264
|
+
value: option.value,
|
|
1265
|
+
checked: option.value === value,
|
|
1266
|
+
onChange: () => onChange(option.value),
|
|
1267
|
+
onClick: repick && option.value === value ? () => onChange(option.value) : void 0,
|
|
1268
|
+
disabled,
|
|
1269
|
+
className: SegmentedControl_module_default.input
|
|
1270
|
+
}
|
|
1271
|
+
),
|
|
1272
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: SegmentedControl_module_default.face, children: option.label })
|
|
1273
|
+
] }, option.value))
|
|
1274
|
+
}
|
|
1275
|
+
);
|
|
1258
1276
|
}
|
|
1259
1277
|
|
|
1260
1278
|
// mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/SearchField/SearchField.module.css?mds-scoped
|
|
@@ -1469,7 +1487,7 @@ function TabPanel({ value, className, children, ...rest }) {
|
|
|
1469
1487
|
}
|
|
1470
1488
|
|
|
1471
1489
|
// mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Toast/Toast.module.css?mds-scoped
|
|
1472
|
-
var Toast_module_default = { "viewport": "mds-Toast__viewport", "toast": "mds-Toast__toast", "tone-success": "mds-Toast__tone-success", "tone-danger": "mds-Toast__tone-danger", "body": "mds-Toast__body", "title": "mds-Toast__title", "description": "mds-Toast__description", "close": "mds-Toast__close mds-hit-area__hitArea", "closeGlyph": "mds-Toast__closeGlyph" };
|
|
1490
|
+
var Toast_module_default = { "viewport": "mds-Toast__viewport", "toast": "mds-Toast__toast", "tone-success": "mds-Toast__tone-success", "tone-danger": "mds-Toast__tone-danger", "body": "mds-Toast__body", "title": "mds-Toast__title", "description": "mds-Toast__description", "close": "mds-Toast__close mds-hit-area__hitArea", "closeGlyph": "mds-Toast__closeGlyph", "action": "mds-Toast__action mds-hit-area__hitArea" };
|
|
1473
1491
|
var ToastContext = react.createContext(null);
|
|
1474
1492
|
function useToast() {
|
|
1475
1493
|
const context = react.useContext(ToastContext);
|
|
@@ -1483,13 +1501,20 @@ function ToastProvider({
|
|
|
1483
1501
|
}) {
|
|
1484
1502
|
const [toasts, setToasts] = react.useState([]);
|
|
1485
1503
|
const nextId = react.useRef(1);
|
|
1504
|
+
const leaving = react.useRef(/* @__PURE__ */ new Map());
|
|
1486
1505
|
const dismiss = react.useCallback((id) => {
|
|
1487
1506
|
setToasts((current) => current.filter((entry) => entry.id !== id));
|
|
1507
|
+
const said = leaving.current.get(id);
|
|
1508
|
+
if (said !== void 0) {
|
|
1509
|
+
leaving.current.delete(id);
|
|
1510
|
+
said();
|
|
1511
|
+
}
|
|
1488
1512
|
}, []);
|
|
1489
1513
|
const toast = react.useCallback(
|
|
1490
|
-
({ title, description, tone = "neutral", duration = 5e3 }) => {
|
|
1514
|
+
({ title, description, tone = "neutral", duration = 5e3, action, onDismiss }) => {
|
|
1491
1515
|
const id = nextId.current++;
|
|
1492
|
-
|
|
1516
|
+
if (onDismiss !== void 0) leaving.current.set(id, onDismiss);
|
|
1517
|
+
setToasts((current) => [...current, { id, title, description, tone, action }]);
|
|
1493
1518
|
if (duration > 0) setTimeout(() => dismiss(id), duration);
|
|
1494
1519
|
return id;
|
|
1495
1520
|
},
|
|
@@ -1503,6 +1528,18 @@ function ToastProvider({
|
|
|
1503
1528
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: Toast_module_default.title, children: entry.title }),
|
|
1504
1529
|
entry.description !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: Toast_module_default.description, children: entry.description })
|
|
1505
1530
|
] }),
|
|
1531
|
+
entry.action !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1532
|
+
"button",
|
|
1533
|
+
{
|
|
1534
|
+
type: "button",
|
|
1535
|
+
className: Toast_module_default.action,
|
|
1536
|
+
onClick: () => {
|
|
1537
|
+
entry.action?.onClick();
|
|
1538
|
+
dismiss(entry.id);
|
|
1539
|
+
},
|
|
1540
|
+
children: entry.action.label
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1506
1543
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1507
1544
|
"button",
|
|
1508
1545
|
{
|
|
@@ -1720,9 +1757,9 @@ function ScreenContent({ children, flush = false, className, ref, ...rest }) {
|
|
|
1720
1757
|
|
|
1721
1758
|
// mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/AppBar/AppBar.module.css?mds-scoped
|
|
1722
1759
|
var AppBar_module_default = { "bar": "mds-AppBar__bar", "title": "mds-AppBar__title", "text": "mds-AppBar__text", "subtitle": "mds-AppBar__subtitle", "slot": "mds-AppBar__slot", "trailing": "mds-AppBar__trailing" };
|
|
1723
|
-
function AppBar({ title, subtitle, leading, trailing }) {
|
|
1760
|
+
function AppBar({ title, subtitle, leading, trailing, className, ref, ...rest }) {
|
|
1724
1761
|
const heading = title ? /* @__PURE__ */ jsxRuntime.jsx("h1", { className: AppBar_module_default.title, children: title }) : null;
|
|
1725
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("header", { className: AppBar_module_default.bar, children: [
|
|
1762
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("header", { ref, className: cx(AppBar_module_default.bar, className), ...rest, children: [
|
|
1726
1763
|
leading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: AppBar_module_default.slot, children: leading }) : null,
|
|
1727
1764
|
subtitle != null ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: AppBar_module_default.text, children: [
|
|
1728
1765
|
heading,
|
|
@@ -1737,14 +1774,23 @@ var TabBar_module_default = { "bar": "mds-TabBar__bar", "item": "mds-TabBar__ite
|
|
|
1737
1774
|
function TabBar({ label, children }) {
|
|
1738
1775
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": label, className: TabBar_module_default.bar, children });
|
|
1739
1776
|
}
|
|
1740
|
-
function TabBarItem({
|
|
1777
|
+
function TabBarItem({
|
|
1778
|
+
label,
|
|
1779
|
+
icon,
|
|
1780
|
+
href,
|
|
1781
|
+
onClick,
|
|
1782
|
+
active = false,
|
|
1783
|
+
badge = false,
|
|
1784
|
+
as,
|
|
1785
|
+
hideLabel = false
|
|
1786
|
+
}) {
|
|
1741
1787
|
const className = cx(TabBar_module_default.item, active && TabBar_module_default.active);
|
|
1742
1788
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1743
1789
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: TabBar_module_default.icon, "aria-hidden": "true", children: [
|
|
1744
1790
|
icon,
|
|
1745
1791
|
badge ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: TabBar_module_default.badge, "data-testid": "mds-tabbar-badge" }) : null
|
|
1746
1792
|
] }),
|
|
1747
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: TabBar_module_default.label, children: label })
|
|
1793
|
+
hideLabel ? /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden, { children: label }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: TabBar_module_default.label, children: label })
|
|
1748
1794
|
] });
|
|
1749
1795
|
if (href !== void 0) {
|
|
1750
1796
|
const Element = as ?? "a";
|