@flipdish/ui-library 0.8.1 → 0.9.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.
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var cx = require('@flipdish/ui-library/utilities/cx');
5
+
6
+ const RADIUS = {
7
+ none: 'rounded-none',
8
+ sm: 'rounded-sm',
9
+ md: 'rounded-md',
10
+ lg: 'rounded-lg',
11
+ full: 'rounded-full',
12
+ };
13
+ /**
14
+ * Coerce a numeric size to a `px` string; pass any CSS length string through
15
+ * unchanged. Invalid numbers (`NaN`, `Infinity`, negative) are dropped so we
16
+ * never emit broken declarations like `NaNpx` or `-1px` — the dimension is simply
17
+ * omitted and the element falls back to its natural/CSS size.
18
+ */
19
+ const toSize = (value) => {
20
+ if (typeof value !== 'number')
21
+ return value;
22
+ return Number.isFinite(value) && value >= 0 ? `${value}px` : undefined;
23
+ };
24
+ /**
25
+ * A muted, pulsing placeholder that reserves layout space while content loads,
26
+ * reducing layout shift and signalling progress. It fills with the semantic
27
+ * `bg-quaternary` token (so it adapts to light/dark) and pauses its pulse under
28
+ * `prefers-reduced-motion`. Compose several — or use `SkeletonText` /
29
+ * `SkeletonCircle` — to mirror the shape of the content being loaded.
30
+ *
31
+ * @summary pulsing placeholder for loading content
32
+ */
33
+ const Skeleton = ({ width = '100%', height = '1rem', radius = 'md', className, style, ...props }) => (jsxRuntime.jsx("div", { className: cx.cx('animate-pulse bg-quaternary motion-reduce:animate-none', RADIUS[radius], className), style: { width: toSize(width), height: toSize(height), ...style }, ...props }));
34
+ /** Upper bound on rendered lines, guarding against a malformed `lines` prop. */
35
+ const MAX_SKELETON_TEXT_LINES = 100;
36
+ /**
37
+ * A multi-line placeholder for blocks of text. The last line is rendered shorter
38
+ * so the group reads as a paragraph rather than a solid block.
39
+ *
40
+ * @summary multi-line placeholder for loading text
41
+ */
42
+ const SkeletonText = ({ lines = 3, lineHeight = '0.75rem', lastLineWidth = '60%', className, ...props }) => {
43
+ // Clamp `lines` to a finite integer within a sane bound, so a malformed prop
44
+ // can't allocate a huge (or invalid) array and lock up rendering.
45
+ const lineCount = Number.isFinite(lines) ? Math.min(Math.max(Math.trunc(lines), 0), MAX_SKELETON_TEXT_LINES) : 0;
46
+ return (jsxRuntime.jsx("div", { className: cx.cx('flex w-full flex-col gap-2', className), ...props, children: Array.from({ length: lineCount }, (_, index) => {
47
+ const isLastOfMany = lineCount > 1 && index === lineCount - 1;
48
+ return (
49
+ // biome-ignore lint/suspicious/noArrayIndexKey: lines are identical placeholders with no stable identity
50
+ jsxRuntime.jsx(Skeleton, { height: lineHeight, width: isLastOfMany ? lastLineWidth : '100%', radius: "sm" }, index));
51
+ }) }));
52
+ };
53
+ /**
54
+ * A circular placeholder for avatars, icons, or any round element.
55
+ *
56
+ * @summary circular placeholder for loading avatars
57
+ */
58
+ const SkeletonCircle = ({ size = 40, className, ...props }) => (jsxRuntime.jsx(Skeleton, { width: size, height: size, radius: "full", className: cx.cx('shrink-0', className), ...props }));
59
+
60
+ exports.Skeleton = Skeleton;
61
+ exports.SkeletonCircle = SkeletonCircle;
62
+ exports.SkeletonText = SkeletonText;
63
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Skeleton/index.tsx"],"sourcesContent":[null],"names":["_jsx","cx"],"mappings":";;;;;AAKA,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,IAAI,EAAE,cAAc;CACZ;AAEV;;;;;AAKG;AACH,MAAM,MAAM,GAAG,CAAC,KAAuB,KAAI;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;AAAE,QAAA,OAAO,KAAK;IAC3C,OAAO,MAAM,CAAC,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CAAC,IAAI,KAAK,KAAK,SAAS,GAAG,CAAC;YAC7D;;YAEED,cAAA,CAAC,QAAQ,EAAA,EAAa,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,EAAE,MAAM,EAAC,IAAI,EAAA,EAApF,KAAK,CAAkF;QAE1G,CAAC,CAAC,EAAA,CACE;AAEV;AAOA;;;;AAIG;MACU,cAAc,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAuB,MACpFA,cAAA,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,EAAC,SAAS,EAAEC,KAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,CAAI;;;;;;"}
@@ -0,0 +1,53 @@
1
+ import type { ComponentPropsWithoutRef } from 'react';
2
+ declare const RADIUS: {
3
+ readonly none: "rounded-none";
4
+ readonly sm: "rounded-sm";
5
+ readonly md: "rounded-md";
6
+ readonly lg: "rounded-lg";
7
+ readonly full: "rounded-full";
8
+ };
9
+ export interface SkeletonProps extends ComponentPropsWithoutRef<'div'> {
10
+ /** Width — a number (px) or any CSS length. @default '100%' */
11
+ width?: number | string;
12
+ /** Height — a number (px) or any CSS length. @default '1rem' */
13
+ height?: number | string;
14
+ /** Corner radius preset. @default 'md' */
15
+ radius?: keyof typeof RADIUS;
16
+ }
17
+ /**
18
+ * A muted, pulsing placeholder that reserves layout space while content loads,
19
+ * reducing layout shift and signalling progress. It fills with the semantic
20
+ * `bg-quaternary` token (so it adapts to light/dark) and pauses its pulse under
21
+ * `prefers-reduced-motion`. Compose several — or use `SkeletonText` /
22
+ * `SkeletonCircle` — to mirror the shape of the content being loaded.
23
+ *
24
+ * @summary pulsing placeholder for loading content
25
+ */
26
+ export declare const Skeleton: ({ width, height, radius, className, style, ...props }: SkeletonProps) => import("react").JSX.Element;
27
+ export interface SkeletonTextProps extends ComponentPropsWithoutRef<'div'> {
28
+ /** Number of text lines to render. @default 3 */
29
+ lines?: number;
30
+ /** Height of each line. @default '0.75rem' */
31
+ lineHeight?: number | string;
32
+ /** Width of the final line, kept shorter for a natural paragraph shape. @default '60%' */
33
+ lastLineWidth?: number | string;
34
+ }
35
+ /**
36
+ * A multi-line placeholder for blocks of text. The last line is rendered shorter
37
+ * so the group reads as a paragraph rather than a solid block.
38
+ *
39
+ * @summary multi-line placeholder for loading text
40
+ */
41
+ export declare const SkeletonText: ({ lines, lineHeight, lastLineWidth, className, ...props }: SkeletonTextProps) => import("react").JSX.Element;
42
+ export interface SkeletonCircleProps extends Omit<SkeletonProps, 'width' | 'height' | 'radius'> {
43
+ /** Diameter — a number (px) or any CSS length. @default 40 */
44
+ size?: number | string;
45
+ }
46
+ /**
47
+ * A circular placeholder for avatars, icons, or any round element.
48
+ *
49
+ * @summary circular placeholder for loading avatars
50
+ */
51
+ export declare const SkeletonCircle: ({ size, className, ...props }: SkeletonCircleProps) => import("react").JSX.Element;
52
+ export {};
53
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Skeleton/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAEtD,QAAA,MAAM,MAAM;;;;;;CAMF,CAAC;AAaX,MAAM,WAAW,aAAc,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACpE,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,OAAO,MAAM,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,QAAQ,GAAI,uDAAgF,aAAa,gCAMrH,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,wBAAwB,CAAC,KAAK,CAAC;IACxE,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAKD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,2DAAmF,iBAAiB,gCAgBhI,CAAC;AAEF,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC7F,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,+BAAoC,mBAAmB,gCAErF,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { cx } from '@flipdish/ui-library/utilities/cx';
3
+
4
+ const RADIUS = {
5
+ none: 'rounded-none',
6
+ sm: 'rounded-sm',
7
+ md: 'rounded-md',
8
+ lg: 'rounded-lg',
9
+ full: 'rounded-full',
10
+ };
11
+ /**
12
+ * Coerce a numeric size to a `px` string; pass any CSS length string through
13
+ * unchanged. Invalid numbers (`NaN`, `Infinity`, negative) are dropped so we
14
+ * never emit broken declarations like `NaNpx` or `-1px` — the dimension is simply
15
+ * omitted and the element falls back to its natural/CSS size.
16
+ */
17
+ const toSize = (value) => {
18
+ if (typeof value !== 'number')
19
+ return value;
20
+ return Number.isFinite(value) && value >= 0 ? `${value}px` : undefined;
21
+ };
22
+ /**
23
+ * A muted, pulsing placeholder that reserves layout space while content loads,
24
+ * reducing layout shift and signalling progress. It fills with the semantic
25
+ * `bg-quaternary` token (so it adapts to light/dark) and pauses its pulse under
26
+ * `prefers-reduced-motion`. Compose several — or use `SkeletonText` /
27
+ * `SkeletonCircle` — to mirror the shape of the content being loaded.
28
+ *
29
+ * @summary pulsing placeholder for loading content
30
+ */
31
+ const Skeleton = ({ width = '100%', height = '1rem', radius = 'md', className, style, ...props }) => (jsx("div", { className: cx('animate-pulse bg-quaternary motion-reduce:animate-none', RADIUS[radius], className), style: { width: toSize(width), height: toSize(height), ...style }, ...props }));
32
+ /** Upper bound on rendered lines, guarding against a malformed `lines` prop. */
33
+ const MAX_SKELETON_TEXT_LINES = 100;
34
+ /**
35
+ * A multi-line placeholder for blocks of text. The last line is rendered shorter
36
+ * so the group reads as a paragraph rather than a solid block.
37
+ *
38
+ * @summary multi-line placeholder for loading text
39
+ */
40
+ const SkeletonText = ({ lines = 3, lineHeight = '0.75rem', lastLineWidth = '60%', className, ...props }) => {
41
+ // Clamp `lines` to a finite integer within a sane bound, so a malformed prop
42
+ // can't allocate a huge (or invalid) array and lock up rendering.
43
+ const lineCount = Number.isFinite(lines) ? Math.min(Math.max(Math.trunc(lines), 0), MAX_SKELETON_TEXT_LINES) : 0;
44
+ return (jsx("div", { className: cx('flex w-full flex-col gap-2', className), ...props, children: Array.from({ length: lineCount }, (_, index) => {
45
+ const isLastOfMany = lineCount > 1 && index === lineCount - 1;
46
+ return (
47
+ // biome-ignore lint/suspicious/noArrayIndexKey: lines are identical placeholders with no stable identity
48
+ jsx(Skeleton, { height: lineHeight, width: isLastOfMany ? lastLineWidth : '100%', radius: "sm" }, index));
49
+ }) }));
50
+ };
51
+ /**
52
+ * A circular placeholder for avatars, icons, or any round element.
53
+ *
54
+ * @summary circular placeholder for loading avatars
55
+ */
56
+ const SkeletonCircle = ({ size = 40, className, ...props }) => (jsx(Skeleton, { width: size, height: size, radius: "full", className: cx('shrink-0', className), ...props }));
57
+
58
+ export { Skeleton, SkeletonCircle, SkeletonText };
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Skeleton/index.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":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,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,uBAAuB,CAAC,GAAG,CAAC;AAEhH,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,QAAA,EACnE,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,KAAI;YAC9C,MAAM,YAAY,GAAG,SAAS,GAAG,CAAC,IAAI,KAAK,KAAK,SAAS,GAAG,CAAC;YAC7D;;YAEEA,GAAA,CAAC,QAAQ,EAAA,EAAa,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,GAAG,aAAa,GAAG,MAAM,EAAE,MAAM,EAAC,IAAI,EAAA,EAApF,KAAK,CAAkF;QAE1G,CAAC,CAAC,EAAA,CACE;AAEV;AAOA;;;;AAIG;MACU,cAAc,GAAG,CAAC,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,KAAK,EAAuB,MACpFA,GAAA,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,EAAC,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,EAAA,GAAM,KAAK,EAAA,CAAI;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flipdish/ui-library",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Flipdish Design System — atomic-design component library (Tailwind v4 + UntitledUI + React Aria).",
5
5
  "type": "module",
6
6
  "sideEffects": [