@mond-design-system/react 4.4.0 → 4.5.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.d.cts CHANGED
@@ -530,6 +530,11 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
530
530
  /** Any CSS length. Text defaults to full width, one line tall. */
531
531
  width?: string;
532
532
  height?: string;
533
+ /** How many lines of text to stand in for. Above one, the last is cut short
534
+ — a paragraph ends mid-line, and a block of full-width bars reads as a
535
+ table. Text only: a rect or a circle is one shape however many lines of
536
+ copy it replaces. */
537
+ lines?: number;
533
538
  ref?: Ref<HTMLSpanElement>;
534
539
  }
535
540
  /**
@@ -542,6 +547,7 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
542
547
  * <Stack gap="tight">
543
548
  * <Skeleton width="40%" />
544
549
  * <Skeleton />
550
+ * <Skeleton lines={3} />
545
551
  * <Skeleton variant="rect" height="8rem" />
546
552
  * </Stack>
547
553
  * ) : (
@@ -550,7 +556,7 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
550
556
  * </div>
551
557
  * ```
552
558
  */
553
- declare function Skeleton({ variant, width, height, className, style, ...rest }: SkeletonProps): ReactElement;
559
+ declare function Skeleton({ variant, width, height, lines, className, style, ...rest }: SkeletonProps): ReactElement;
554
560
 
555
561
  interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
556
562
  /** 0–100; clamped. Ignored when indeterminate. */
package/dist/index.d.ts CHANGED
@@ -530,6 +530,11 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
530
530
  /** Any CSS length. Text defaults to full width, one line tall. */
531
531
  width?: string;
532
532
  height?: string;
533
+ /** How many lines of text to stand in for. Above one, the last is cut short
534
+ — a paragraph ends mid-line, and a block of full-width bars reads as a
535
+ table. Text only: a rect or a circle is one shape however many lines of
536
+ copy it replaces. */
537
+ lines?: number;
533
538
  ref?: Ref<HTMLSpanElement>;
534
539
  }
535
540
  /**
@@ -542,6 +547,7 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
542
547
  * <Stack gap="tight">
543
548
  * <Skeleton width="40%" />
544
549
  * <Skeleton />
550
+ * <Skeleton lines={3} />
545
551
  * <Skeleton variant="rect" height="8rem" />
546
552
  * </Stack>
547
553
  * ) : (
@@ -550,7 +556,7 @@ interface SkeletonProps extends HTMLAttributes<HTMLSpanElement> {
550
556
  * </div>
551
557
  * ```
552
558
  */
553
- declare function Skeleton({ variant, width, height, className, style, ...rest }: SkeletonProps): ReactElement;
559
+ declare function Skeleton({ variant, width, height, lines, className, style, ...rest }: SkeletonProps): ReactElement;
554
560
 
555
561
  interface ProgressBarProps extends HTMLAttributes<HTMLDivElement> {
556
562
  /** 0–100; clamped. Ignored when indeterminate. */
package/dist/index.js CHANGED
@@ -1024,11 +1024,13 @@ function VisuallyHidden({ as = "span", className, ...rest }) {
1024
1024
  }
1025
1025
 
1026
1026
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/Skeleton/Skeleton.module.css?mds-scoped
1027
- var Skeleton_module_default = { "skeleton": "mds-Skeleton__skeleton", "pulse": "mds-Skeleton__pulse", "variant-text": "mds-Skeleton__variant-text", "variant-rect": "mds-Skeleton__variant-rect", "variant-circle": "mds-Skeleton__variant-circle" };
1027
+ var Skeleton_module_default = { "skeleton": "mds-Skeleton__skeleton", "pulse": "mds-Skeleton__pulse", "lines": "mds-Skeleton__lines", "variant-text": "mds-Skeleton__variant-text", "variant-rect": "mds-Skeleton__variant-rect", "variant-circle": "mds-Skeleton__variant-circle" };
1028
+ var LAST_LINE = "62%";
1028
1029
  function Skeleton({
1029
1030
  variant = "text",
1030
1031
  width,
1031
1032
  height,
1033
+ lines = 1,
1032
1034
  className,
1033
1035
  style,
1034
1036
  ...rest
@@ -1037,15 +1039,18 @@ function Skeleton({
1037
1039
  ...width ? { "--skeleton-w": width } : {},
1038
1040
  ...height ? { "--skeleton-h": height } : {}
1039
1041
  };
1040
- return /* @__PURE__ */ jsx(
1041
- "span",
1042
- {
1043
- "aria-hidden": "true",
1044
- className: cx(Skeleton_module_default.skeleton, Skeleton_module_default[`variant-${variant}`], className),
1045
- style: { ...vars, ...style },
1046
- ...rest
1047
- }
1048
- );
1042
+ const box = cx(Skeleton_module_default.skeleton, Skeleton_module_default[`variant-${variant}`], className);
1043
+ if (variant === "text" && lines > 1) {
1044
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: Skeleton_module_default.lines, style, ...rest, children: Array.from({ length: lines }, (_, line) => /* @__PURE__ */ jsx(
1045
+ "span",
1046
+ {
1047
+ className: box,
1048
+ style: line === lines - 1 ? { ...vars, "--skeleton-w": LAST_LINE } : vars
1049
+ },
1050
+ line
1051
+ )) });
1052
+ }
1053
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: box, style: { ...vars, ...style }, ...rest });
1049
1054
  }
1050
1055
 
1051
1056
  // mds-cssmod:/home/runner/work/mond-design-system/mond-design-system/packages/react/src/components/ProgressBar/ProgressBar.module.css?mds-scoped