@mond-design-system/react 4.9.0 → 4.10.2

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 CHANGED
@@ -150,6 +150,8 @@ function Button({
150
150
  children,
151
151
  ...rest
152
152
  }) {
153
+ const glyph = iconOnly && children != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children }) : children;
154
+ const body = loading && iconOnly ? null : glyph;
153
155
  const Element = as ?? (href !== void 0 ? "a" : "button");
154
156
  const isButton = Element === "button";
155
157
  const own = isButton ? { type, disabled: disabled || loading } : { href };
@@ -171,7 +173,7 @@ function Button({
171
173
  ...rest,
172
174
  children: [
173
175
  loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: ICON_PX[size], label: "", "aria-hidden": "true" }) }) : iconLeft ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: iconLeft }) : null,
174
- children,
176
+ body,
175
177
  !loading && iconRight ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: Button_module_default.slot, children: iconRight }) : null
176
178
  ]
177
179
  }
@@ -385,10 +387,10 @@ function CountButton({
385
387
  );
386
388
  }
387
389
  function CloseGlyph({ className }) {
388
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) });
390
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 4l8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" }) });
389
391
  }
390
392
  function ChevronLeftGlyph({ className }) {
391
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
393
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
392
394
  "path",
393
395
  {
394
396
  d: "M10 3l-5 5 5 5",
@@ -401,7 +403,7 @@ function ChevronLeftGlyph({ className }) {
401
403
  ) });
402
404
  }
403
405
  function ChevronRightGlyph({ className }) {
404
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
406
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
405
407
  "path",
406
408
  {
407
409
  d: "M6 3l5 5-5 5",
@@ -414,7 +416,7 @@ function ChevronRightGlyph({ className }) {
414
416
  ) });
415
417
  }
416
418
  function Magnifier({ className, children }) {
417
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", children: [
419
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round", children: [
418
420
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "4.25" }),
419
421
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.2 10.2L14 14" }),
420
422
  children
@@ -427,35 +429,35 @@ function ZoomOutGlyph({ className }) {
427
429
  return /* @__PURE__ */ jsxRuntime.jsx(Magnifier, { className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.75 7h4.5" }) });
428
430
  }
429
431
  function PlayGlyph({ className }) {
430
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 3.2l7.5 4.8L5 12.8z", fill: "currentColor" }) });
432
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 3.2l7.5 4.8L5 12.8z", fill: "currentColor" }) });
431
433
  }
432
434
  function PauseGlyph({ className }) {
433
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 3h2.25v10H4.5zM9.25 3h2.25v10H9.25z", fill: "currentColor" }) });
435
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4.5 3h2.25v10H4.5zM9.25 3h2.25v10H9.25z", fill: "currentColor" }) });
434
436
  }
435
437
  function Speaker() {
436
438
  return /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2.5 6.25h2.25L8 3.4v9.2L4.75 9.75H2.5z", fill: "currentColor", stroke: "none" });
437
439
  }
438
440
  function VolumeGlyph({ className }) {
439
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
441
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
440
442
  /* @__PURE__ */ jsxRuntime.jsx(Speaker, {}),
441
443
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.5 5.75a3.25 3.25 0 010 4.5" }),
442
444
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.5 3.9a5.75 5.75 0 010 8.2" })
443
445
  ] }) });
444
446
  }
445
447
  function VolumeOffGlyph({ className }) {
446
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
448
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
447
449
  /* @__PURE__ */ jsxRuntime.jsx(Speaker, {}),
448
450
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.75 6.25l3.5 3.5M14.25 6.25l-3.5 3.5" })
449
451
  ] }) });
450
452
  }
451
453
  function CaptionsGlyph({ className }) {
452
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
454
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
453
455
  /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "1.75", y: "3.25", width: "12.5", height: "9.5", rx: "2" }),
454
456
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.25 6.75a2 2 0 100 2.5M11.25 6.75a2 2 0 100 2.5" })
455
457
  ] }) });
456
458
  }
457
459
  function FullscreenGlyph({ className }) {
458
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
460
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
459
461
  "path",
460
462
  {
461
463
  d: "M6 2.5H2.5V6M10 2.5h3.5V6M6 13.5H2.5V10M10 13.5h3.5V10",
@@ -468,7 +470,7 @@ function FullscreenGlyph({ className }) {
468
470
  ) });
469
471
  }
470
472
  function FullscreenExitGlyph({ className }) {
471
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
473
+ return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 16 16", width: "1em", height: "1em", "aria-hidden": "true", className, children: /* @__PURE__ */ jsxRuntime.jsx(
472
474
  "path",
473
475
  {
474
476
  d: "M2.5 6H6V2.5M13.5 6H10V2.5M2.5 10H6v3.5M13.5 10H10v3.5",
@@ -503,7 +505,15 @@ function Field({ label, children, hint, error, required = false, className }) {
503
505
  children
504
506
  }
505
507
  ),
506
- message && /* @__PURE__ */ jsxRuntime.jsx("span", { id: messageId, className: cx(Field_module_default.message, error !== void 0 && Field_module_default.error), children: message })
508
+ message && /* @__PURE__ */ jsxRuntime.jsx(
509
+ "span",
510
+ {
511
+ id: messageId,
512
+ role: error !== void 0 ? "alert" : void 0,
513
+ className: cx(Field_module_default.message, error !== void 0 && Field_module_default.error),
514
+ children: message
515
+ }
516
+ )
507
517
  ] });
508
518
  }
509
519
 
@@ -1353,6 +1363,85 @@ function SearchField({
1353
1363
  ] });
1354
1364
  }
1355
1365
 
1366
+ // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Scroller/Scroller.module.css?mds-scoped
1367
+ var Scroller_module_default = { "scroller": "mds-Scroller__scroller", "header": "mds-Scroller__header", "trailing": "mds-Scroller__trailing", "track": "mds-Scroller__track", "arrows": "mds-Scroller__arrows" };
1368
+ var STEP = 0.8;
1369
+ function Scroller({
1370
+ title,
1371
+ labels,
1372
+ level = 2,
1373
+ action,
1374
+ children,
1375
+ className,
1376
+ ...rest
1377
+ }) {
1378
+ const track = react.useRef(null);
1379
+ const titleId = react.useId();
1380
+ const [atStart, setAtStart] = react.useState(true);
1381
+ const [atEnd, setAtEnd] = react.useState(true);
1382
+ const measure = react.useCallback(() => {
1383
+ const row = track.current;
1384
+ if (row === null) return;
1385
+ setAtStart(row.scrollLeft <= 0);
1386
+ setAtEnd(row.scrollLeft + row.clientWidth >= row.scrollWidth - 1);
1387
+ }, []);
1388
+ react.useEffect(measure);
1389
+ react.useEffect(() => {
1390
+ window.addEventListener("resize", measure);
1391
+ return () => window.removeEventListener("resize", measure);
1392
+ }, [measure]);
1393
+ const step = (direction) => {
1394
+ const row = track.current;
1395
+ if (row === null) return;
1396
+ row.scrollBy({ left: direction * Math.round(row.clientWidth * STEP) });
1397
+ };
1398
+ return /* @__PURE__ */ jsxRuntime.jsxs("section", { className: cx(Scroller_module_default.scroller, className), ...rest, children: [
1399
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Scroller_module_default.header, children: [
1400
+ /* @__PURE__ */ jsxRuntime.jsx(Heading, { level, variant: "label", id: titleId, children: title }),
1401
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Scroller_module_default.trailing, children: [
1402
+ action,
1403
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Scroller_module_default.arrows, children: [
1404
+ /* @__PURE__ */ jsxRuntime.jsx(
1405
+ Button,
1406
+ {
1407
+ variant: "ghost",
1408
+ size: "sm",
1409
+ iconOnly: true,
1410
+ "aria-label": labels.previous,
1411
+ disabled: atStart,
1412
+ onClick: () => step(-1),
1413
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftGlyph, {})
1414
+ }
1415
+ ),
1416
+ /* @__PURE__ */ jsxRuntime.jsx(
1417
+ Button,
1418
+ {
1419
+ variant: "ghost",
1420
+ size: "sm",
1421
+ iconOnly: true,
1422
+ "aria-label": labels.next,
1423
+ disabled: atEnd,
1424
+ onClick: () => step(1),
1425
+ children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightGlyph, {})
1426
+ }
1427
+ )
1428
+ ] })
1429
+ ] })
1430
+ ] }),
1431
+ /* @__PURE__ */ jsxRuntime.jsx(
1432
+ "div",
1433
+ {
1434
+ className: Scroller_module_default.track,
1435
+ ref: track,
1436
+ role: "group",
1437
+ "aria-labelledby": titleId,
1438
+ onScroll: measure,
1439
+ children
1440
+ }
1441
+ )
1442
+ ] });
1443
+ }
1444
+
1356
1445
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/List/List.module.css?mds-scoped
1357
1446
  var List_module_default = { "group": "mds-List__group", "labelledGroup": "mds-List__labelledGroup", "label": "mds-List__label", "item": "mds-List__item", "surface-card": "mds-List__surface-card", "surface-sunken": "mds-List__surface-sunken", "surface-accent": "mds-List__surface-accent", "surface-plain": "mds-List__surface-plain", "row": "mds-List__row", "interactive": "mds-List__interactive", "withActions": "mds-List__withActions", "actions": "mds-List__actions", "leading": "mds-List__leading", "trailing": "mds-List__trailing", "text": "mds-List__text", "title": "mds-List__title", "description": "mds-List__description" };
1358
1447
  var ListGroupContext = react.createContext(false);
@@ -1411,7 +1500,7 @@ function ListItem({
1411
1500
  ref,
1412
1501
  ...rest,
1413
1502
  children: [
1414
- href !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(LinkElement, { className: cx(List_module_default.row, List_module_default.interactive), href, children: content }) : onClick !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1503
+ href !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(LinkElement, { className: cx(List_module_default.row, List_module_default.interactive), href, onClick, children: content }) : onClick !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
1415
1504
  "button",
1416
1505
  {
1417
1506
  type: "button",
@@ -2349,7 +2438,7 @@ function FileDrop({
2349
2438
  var Lightbox_module_default = { "panel": "mds-Lightbox__panel", "bar": "mds-Lightbox__bar", "surface": "mds-Lightbox__surface", "image": "mds-Lightbox__image", "caption": "mds-Lightbox__caption" };
2350
2439
  var MIN_SCALE = 1;
2351
2440
  var MAX_SCALE = 4;
2352
- var STEP = 1;
2441
+ var STEP2 = 1;
2353
2442
  var DOUBLE = 2.5;
2354
2443
  var WHEEL = 0.01;
2355
2444
  var ORIGIN = { x: 0, y: 0 };
@@ -2462,7 +2551,7 @@ function Lightbox({ open, onClose, src, alt = "", caption, labels }) {
2462
2551
  variant: "ghost",
2463
2552
  onMedia: true,
2464
2553
  disabled: scale <= MIN_SCALE,
2465
- onClick: () => zoom(scale - STEP),
2554
+ onClick: () => zoom(scale - STEP2),
2466
2555
  children: /* @__PURE__ */ jsxRuntime.jsx(ZoomOutGlyph, {})
2467
2556
  }
2468
2557
  ),
@@ -2474,7 +2563,7 @@ function Lightbox({ open, onClose, src, alt = "", caption, labels }) {
2474
2563
  variant: "ghost",
2475
2564
  onMedia: true,
2476
2565
  disabled: scale >= MAX_SCALE,
2477
- onClick: () => zoom(scale + STEP),
2566
+ onClick: () => zoom(scale + STEP2),
2478
2567
  children: /* @__PURE__ */ jsxRuntime.jsx(ZoomInGlyph, {})
2479
2568
  }
2480
2569
  ),
@@ -2781,6 +2870,7 @@ exports.ProgressBar = ProgressBar;
2781
2870
  exports.Radio = Radio;
2782
2871
  exports.Screen = Screen;
2783
2872
  exports.ScreenContent = ScreenContent;
2873
+ exports.Scroller = Scroller;
2784
2874
  exports.SearchField = SearchField;
2785
2875
  exports.SegmentedControl = SegmentedControl;
2786
2876
  exports.Select = Select;