@fastyshop/ui 0.1.0 → 0.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/CHANGELOG.md +9 -0
- package/README.md +142 -3
- package/dist/generated/components.d.ts +19 -0
- package/dist/generated/components.d.ts.map +1 -0
- package/dist/generated/components.js +12 -0
- package/dist/generated/components.js.map +1 -0
- package/dist/hooks/useCopyToClipboard/useCopyToClipboard.d.ts +23 -0
- package/dist/hooks/useCopyToClipboard/useCopyToClipboard.d.ts.map +1 -0
- package/dist/hooks/useCopyToClipboard/useCopyToClipboard.js +78 -0
- package/dist/hooks/useCopyToClipboard/useCopyToClipboard.js.map +1 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts +27 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.d.ts.map +1 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.js +114 -0
- package/dist/hooks/useMediaQuery/useMediaQuery.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/primitives/Button/Button.d.ts +11 -0
- package/dist/primitives/Button/Button.d.ts.map +1 -0
- package/dist/{button.js → primitives/Button/Button.js} +14 -22
- package/dist/primitives/Button/Button.js.map +1 -0
- package/dist/primitives/Button/types/button.types.d.ts +34 -0
- package/dist/primitives/Button/types/button.types.d.ts.map +1 -0
- package/dist/primitives/Button/types/button.types.js +2 -0
- package/dist/primitives/Button/types/button.types.js.map +1 -0
- package/dist/primitives/Button/utils/hasVisibleLabel.d.ts +3 -0
- package/dist/primitives/Button/utils/hasVisibleLabel.d.ts.map +1 -0
- package/dist/primitives/Button/utils/hasVisibleLabel.js +17 -0
- package/dist/primitives/Button/utils/hasVisibleLabel.js.map +1 -0
- package/dist/primitives/Separator/Separator.d.ts +25 -0
- package/dist/primitives/Separator/Separator.d.ts.map +1 -0
- package/dist/primitives/Separator/Separator.js +24 -0
- package/dist/primitives/Separator/Separator.js.map +1 -0
- package/dist/primitives/Skeleton/Skeleton.d.ts +14 -0
- package/dist/primitives/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/primitives/Skeleton/Skeleton.js +32 -0
- package/dist/primitives/Skeleton/Skeleton.js.map +1 -0
- package/dist/primitives/Spinner/Spinner.d.ts +23 -0
- package/dist/primitives/Spinner/Spinner.d.ts.map +1 -0
- package/dist/primitives/Spinner/Spinner.js +27 -0
- package/dist/primitives/Spinner/Spinner.js.map +1 -0
- package/dist/primitives/Typography/Typography.d.ts +30 -0
- package/dist/primitives/Typography/Typography.d.ts.map +1 -0
- package/dist/primitives/Typography/Typography.js +48 -0
- package/dist/primitives/Typography/Typography.js.map +1 -0
- package/dist/primitives/Typography/types/typography.types.d.ts +31 -0
- package/dist/primitives/Typography/types/typography.types.d.ts.map +1 -0
- package/dist/primitives/Typography/types/typography.types.js +2 -0
- package/dist/primitives/Typography/types/typography.types.js.map +1 -0
- package/dist/runtime/clipboard/clipboard.d.ts +4 -0
- package/dist/runtime/clipboard/clipboard.d.ts.map +1 -0
- package/dist/runtime/clipboard/clipboard.js +22 -0
- package/dist/runtime/clipboard/clipboard.js.map +1 -0
- package/dist/styles.css +216 -15
- package/dist/tailwind-theme.css +5 -1
- package/package.json +5 -4
- package/dist/button.d.ts +0 -44
- package/dist/button.d.ts.map +0 -1
- package/dist/button.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ComponentType, ReactNode, SVGProps } from "react";
|
|
2
|
+
/** @inline */
|
|
3
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "destructive";
|
|
4
|
+
/** @inline */
|
|
5
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
6
|
+
/** @inline */
|
|
7
|
+
export type ButtonIcon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
8
|
+
/** @inline */
|
|
9
|
+
export type ButtonOwnProps = {
|
|
10
|
+
/** Visual and semantic emphasis of the action. */
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
/** Visible face size. Medium resolves to 44px on mobile and 40px at tablet widths. */
|
|
13
|
+
size?: ButtonSize;
|
|
14
|
+
/** Controlled pending state. It preserves the label and blocks native activation. */
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
/** Consumer-provided Lucide-compatible SVG component. */
|
|
17
|
+
icon?: ButtonIcon;
|
|
18
|
+
/** Placement of a decorative icon next to a visible label. */
|
|
19
|
+
iconPosition?: "start" | "end";
|
|
20
|
+
};
|
|
21
|
+
/** @inline */
|
|
22
|
+
export type NativeButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof ButtonOwnProps | "children">;
|
|
23
|
+
/** @inline */
|
|
24
|
+
export type TextButtonProps = ButtonOwnProps & NativeButtonProps & {
|
|
25
|
+
children: Exclude<ReactNode, boolean | null | undefined>;
|
|
26
|
+
};
|
|
27
|
+
/** @inline */
|
|
28
|
+
export type IconOnlyButtonProps = Omit<ButtonOwnProps, "iconPosition"> & NativeButtonProps & {
|
|
29
|
+
"aria-label": string;
|
|
30
|
+
children?: never;
|
|
31
|
+
icon: ButtonIcon;
|
|
32
|
+
iconPosition?: never;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=button.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.types.d.ts","sourceRoot":"","sources":["../../../../src/primitives/Button/types/button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtF,cAAc;AACd,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAAC;AAC9E,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC5C,cAAc;AACd,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEhE,cAAc;AACd,MAAM,MAAM,cAAc,GAAG;IAC3B,kDAAkD;IAClD,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,sFAAsF;IACtF,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yDAAyD;IACzD,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAChC,CAAC;AAEF,cAAc;AACd,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,MAAM,cAAc,GAAG,UAAU,CAClC,CAAC;AAEF,cAAc;AACd,MAAM,MAAM,eAAe,GAAG,cAAc,GAC1C,iBAAiB,GAAG;IAClB,QAAQ,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CAC1D,CAAC;AAEJ,cAAc;AACd,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GACpE,iBAAiB,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,YAAY,CAAC,EAAE,KAAK,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.types.js","sourceRoot":"","sources":["../../../../src/primitives/Button/types/button.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasVisibleLabel.d.ts","sourceRoot":"","sources":["../../../../src/primitives/Button/utils/hasVisibleLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE3E,eAAO,MAAM,eAAe,GAAI,UAAU,SAAS,KAAG,OAelD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Children, Fragment, isValidElement } from "react";
|
|
2
|
+
export const hasVisibleLabel = (children) => Children.toArray(children).some((child) => {
|
|
3
|
+
if (typeof child === "string") {
|
|
4
|
+
return child.trim().length > 0;
|
|
5
|
+
}
|
|
6
|
+
if (typeof child === "number" || typeof child === "bigint") {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (!isValidElement(child)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
if (child.type === Fragment || typeof child.type === "string") {
|
|
13
|
+
return hasVisibleLabel(child.props.children);
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
//# sourceMappingURL=hasVisibleLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasVisibleLabel.js","sourceRoot":"","sources":["../../../../src/primitives/Button/utils/hasVisibleLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAkB,MAAM,OAAO,CAAC;AAE3E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAmB,EAAW,EAAE,CAC9D,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,cAAc,CAA2B,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9D,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type SeparatorOrientation = "horizontal" | "vertical";
|
|
2
|
+
/** Public props for the FastyShop content-group divider. */
|
|
3
|
+
export type SeparatorProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
decorative?: boolean;
|
|
6
|
+
id?: string;
|
|
7
|
+
orientation?: SeparatorOrientation;
|
|
8
|
+
} & {
|
|
9
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Static visual or structural boundary with consumer-owned layout and grouping.
|
|
13
|
+
*
|
|
14
|
+
* The default decorative mode stays outside the accessibility tree. Use
|
|
15
|
+
* structural mode only when the divider itself conveys a meaningful boundary.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Separator: import("react").ForwardRefExoticComponent<{
|
|
18
|
+
className?: string;
|
|
19
|
+
decorative?: boolean;
|
|
20
|
+
id?: string;
|
|
21
|
+
orientation?: SeparatorOrientation;
|
|
22
|
+
} & {
|
|
23
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
24
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
//# sourceMappingURL=Separator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/primitives/Separator/Separator.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7D,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,oBAAoB,CAAC;CACpC,GAAG;IACF,CAAC,aAAa,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1E,CAAC;AAIF;;;;;GAKG;AACH,eAAO,MAAM,SAAS;gBAhBR,MAAM;iBACL,OAAO;SACf,MAAM;kBACG,oBAAoB;;;kDA8ClC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const separatorOrientations = new Set(["horizontal", "vertical"]);
|
|
5
|
+
/**
|
|
6
|
+
* Static visual or structural boundary with consumer-owned layout and grouping.
|
|
7
|
+
*
|
|
8
|
+
* The default decorative mode stays outside the accessibility tree. Use
|
|
9
|
+
* structural mode only when the divider itself conveys a meaningful boundary.
|
|
10
|
+
*/
|
|
11
|
+
export const Separator = forwardRef(function Separator({ className, decorative = true, id, orientation = "horizontal", ...consumerProps }, ref) {
|
|
12
|
+
if (!separatorOrientations.has(orientation)) {
|
|
13
|
+
throw new Error("FastyShop Separator orientation must be horizontal or vertical.");
|
|
14
|
+
}
|
|
15
|
+
const dataAttributes = Object.fromEntries(Object.entries(consumerProps).filter(([property, value]) => property.startsWith("data-") &&
|
|
16
|
+
property !== "data-orientation" &&
|
|
17
|
+
(value === undefined ||
|
|
18
|
+
typeof value === "string" ||
|
|
19
|
+
typeof value === "number" ||
|
|
20
|
+
typeof value === "boolean")));
|
|
21
|
+
const classes = clsx("fs-separator", className);
|
|
22
|
+
return (_jsx("div", { ...dataAttributes, "aria-hidden": decorative ? "true" : undefined, "aria-orientation": decorative ? undefined : orientation, className: classes, "data-orientation": orientation, id: id, ref: ref, role: decorative ? undefined : "separator" }));
|
|
23
|
+
});
|
|
24
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Separator.js","sourceRoot":"","sources":["../../../src/primitives/Separator/Separator.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAcnC,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAuB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC;AAExF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CACpF,EAAE,SAAS,EAAE,UAAU,GAAG,IAAI,EAAE,EAAE,EAAE,WAAW,GAAG,YAAY,EAAE,GAAG,aAAa,EAAE,EAClF,GAAG;IAEH,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,CAClC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,EAAE,CACpB,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC;QAC5B,QAAQ,KAAK,kBAAkB;QAC/B,CAAC,KAAK,KAAK,SAAS;YAClB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS,CAAC,CAChC,CACF,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAEhD,OAAO,CACL,iBACM,cAAc,iBACL,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,sBAC1B,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EACtD,SAAS,EAAE,OAAO,sBACA,WAAW,EAC7B,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,GAC1C,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ForwardRefExoticComponent, type RefAttributes } from "react";
|
|
2
|
+
/** Public props for the decorative FastyShop loading placeholder. */
|
|
3
|
+
export type SkeletonProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Decorative loading placeholder with consumer-owned geometry.
|
|
10
|
+
*
|
|
11
|
+
* The changing region owns loading semantics and any localized status copy.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Skeleton: ForwardRefExoticComponent<SkeletonProps & RefAttributes<HTMLDivElement>>;
|
|
14
|
+
//# sourceMappingURL=Skeleton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.d.ts","sourceRoot":"","sources":["../../../src/primitives/Skeleton/Skeleton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,yBAAyB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvF,qEAAqE;AACrE,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,aAAa,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CAC1E,CAAC;AA8BF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,yBAAyB,CAAC,aAAa,GAAG,aAAa,CAAC,cAAc,CAAC,CAQ1F,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
function allowedDataAttributes(props) {
|
|
5
|
+
const attributes = {};
|
|
6
|
+
for (const key of Object.keys(props)) {
|
|
7
|
+
const normalizedKey = key.toLowerCase();
|
|
8
|
+
if (!key.startsWith("data-") || normalizedKey.startsWith("data-fs-")) {
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const dataAttribute = key;
|
|
12
|
+
const value = props[dataAttribute];
|
|
13
|
+
if (value === undefined ||
|
|
14
|
+
typeof value === "string" ||
|
|
15
|
+
typeof value === "number" ||
|
|
16
|
+
typeof value === "boolean") {
|
|
17
|
+
attributes[dataAttribute] = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return attributes;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Decorative loading placeholder with consumer-owned geometry.
|
|
24
|
+
*
|
|
25
|
+
* The changing region owns loading semantics and any localized status copy.
|
|
26
|
+
*/
|
|
27
|
+
export const Skeleton = forwardRef(function Skeleton(props, ref) {
|
|
28
|
+
const classes = clsx("fs-skeleton", props.className);
|
|
29
|
+
const dataAttributes = allowedDataAttributes(props);
|
|
30
|
+
return (_jsx("div", { ...dataAttributes, "aria-hidden": "true", className: classes, id: props.id, ref: ref }));
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../src/primitives/Skeleton/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAsD,MAAM,OAAO,CAAC;AAavF,SAAS,qBAAqB,CAAC,KAAoB;IACjD,MAAM,UAAU,GAA2B,EAAE,CAAC;IAE9C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,MAAM,aAAa,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QACxC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACrE,SAAS;QACX,CAAC;QAED,MAAM,aAAa,GAAG,GAAuB,CAAC;QAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;QACnC,IACE,KAAK,KAAK,SAAS;YACnB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS,EAC1B,CAAC;YACD,UAAU,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC;QACpC,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GACnB,UAAU,CAAgC,SAAS,QAAQ,CAAC,KAAK,EAAE,GAAG;IACpE,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAEpD,OAAO,CACL,iBAAS,cAAc,iBAAc,MAAM,EAAC,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,GAAI,CAC3F,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type SpinnerSize = "sm" | "md" | "lg";
|
|
2
|
+
/** Public props for the FastyShop indeterminate progress indicator. */
|
|
3
|
+
export type SpinnerProps = {
|
|
4
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
5
|
+
className?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
size?: SpinnerSize;
|
|
8
|
+
} & ({
|
|
9
|
+
decorative?: true;
|
|
10
|
+
label?: never;
|
|
11
|
+
} | {
|
|
12
|
+
decorative: false;
|
|
13
|
+
label: string;
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Indeterminate progress presentation with caller-owned lifecycle and copy.
|
|
17
|
+
*
|
|
18
|
+
* The default decorative mode stays out of the accessibility tree. Use the
|
|
19
|
+
* announced mode only when no surrounding control or live region owns the
|
|
20
|
+
* loading status.
|
|
21
|
+
*/
|
|
22
|
+
export declare const Spinner: import("react").ForwardRefExoticComponent<SpinnerProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
23
|
+
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/primitives/Spinner/Spinner.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE7C,uEAAuE;AACvE,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,aAAa,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,GAAG,CAAC;IAAE,UAAU,CAAC,EAAE,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAIlF;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,wGAuClB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
const spinnerSizes = new Set(["sm", "md", "lg"]);
|
|
5
|
+
/**
|
|
6
|
+
* Indeterminate progress presentation with caller-owned lifecycle and copy.
|
|
7
|
+
*
|
|
8
|
+
* The default decorative mode stays out of the accessibility tree. Use the
|
|
9
|
+
* announced mode only when no surrounding control or live region owns the
|
|
10
|
+
* loading status.
|
|
11
|
+
*/
|
|
12
|
+
export const Spinner = forwardRef(function Spinner({ className, decorative = true, id, label, size = "md", ...consumerProps }, ref) {
|
|
13
|
+
if (!spinnerSizes.has(size)) {
|
|
14
|
+
throw new Error("FastyShop Spinner size must be sm, md or lg.");
|
|
15
|
+
}
|
|
16
|
+
if (decorative && label !== undefined) {
|
|
17
|
+
throw new Error("FastyShop decorative Spinner does not accept a label.");
|
|
18
|
+
}
|
|
19
|
+
const announcedLabel = decorative ? undefined : label?.trim();
|
|
20
|
+
if (!decorative && !announcedLabel) {
|
|
21
|
+
throw new Error("FastyShop announced Spinner requires a non-empty label.");
|
|
22
|
+
}
|
|
23
|
+
const dataAttributes = Object.fromEntries(Object.entries(consumerProps).filter(([property]) => property.startsWith("data-")));
|
|
24
|
+
const classes = clsx("fs-spinner", className);
|
|
25
|
+
return (_jsx("svg", { ...dataAttributes, "aria-hidden": decorative ? "true" : undefined, "aria-label": announcedLabel, className: classes, "data-fs-size": size, fill: "none", focusable: "false", id: id, ref: ref, role: decorative ? undefined : "status", viewBox: "0 0 24 24", children: _jsx("path", { d: "M21 12a9 9 0 1 1-6.22-8.56" }) }));
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=Spinner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.js","sourceRoot":"","sources":["../../../src/primitives/Spinner/Spinner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAYnC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAA8B,SAAS,OAAO,CAC7E,EAAE,SAAS,EAAE,UAAU,GAAG,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,aAAa,EAAE,EAC1E,GAAG;IAEH,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,UAAU,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,cAAc,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9D,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CACvC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CACnF,CAAC;IACF,MAAM,OAAO,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAE9C,OAAO,CACL,iBACM,cAAc,iBACL,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,gBAChC,cAAc,EAC1B,SAAS,EAAE,OAAO,kBACJ,IAAI,EAClB,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,OAAO,EACjB,EAAE,EAAE,EAAE,EACN,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EACvC,OAAO,EAAC,WAAW,YAEnB,eAAM,CAAC,EAAC,4BAA4B,GAAG,GACnC,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactElement, type Ref } from "react";
|
|
2
|
+
import type { TypographyElementContract, TypographyPropsContract, TypographyVariantContract } from "./types/typography.types.js";
|
|
3
|
+
/** The eleven canonical FastyShop typography roles. */
|
|
4
|
+
export type TypographyVariant = TypographyVariantContract;
|
|
5
|
+
/** Native roots supported by the Typography primitive. */
|
|
6
|
+
export type TypographyElement = TypographyElementContract;
|
|
7
|
+
/** Root-aware public props for Typography. */
|
|
8
|
+
export type TypographyProps<Element extends TypographyElement = "span"> = TypographyPropsContract<Element>;
|
|
9
|
+
type TypographyNode<Element extends TypographyElement> = HTMLElementTagNameMap[Element];
|
|
10
|
+
type ExactTypographyNode<Element extends TypographyElement, RefElement extends HTMLElement> = [
|
|
11
|
+
RefElement
|
|
12
|
+
] extends [TypographyNode<Element>] ? [TypographyNode<Element>] extends [RefElement] ? unknown : never : never;
|
|
13
|
+
type TypographyPropsWithExactRef<Element extends TypographyElement, RefElement extends HTMLElement> = TypographyProps<Element> & {
|
|
14
|
+
as?: Element;
|
|
15
|
+
ref?: Ref<RefElement> & ExactTypographyNode<Element, RefElement>;
|
|
16
|
+
};
|
|
17
|
+
/** @inline */
|
|
18
|
+
type TypographyComponent = {
|
|
19
|
+
<Element extends TypographyElement = "span", RefElement extends HTMLElement = TypographyNode<Element>>(props: TypographyPropsWithExactRef<Element, RefElement>): ReactElement | null;
|
|
20
|
+
displayName?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Token-backed standalone visible text with independently selected HTML semantics.
|
|
24
|
+
*
|
|
25
|
+
* Component-owned labels, titles, and descriptions keep their owning component's
|
|
26
|
+
* DOM rather than adding a nested Typography wrapper.
|
|
27
|
+
*/
|
|
28
|
+
export declare const Typography: TypographyComponent;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=Typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typography.d.ts","sourceRoot":"","sources":["../../../src/primitives/Typography/Typography.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAEjB,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACV,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAC;AAErC,uDAAuD;AACvD,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAE1D,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAE1D,8CAA8C;AAC9C,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,iBAAiB,GAAG,MAAM,IACpE,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAEnC,KAAK,cAAc,CAAC,OAAO,SAAS,iBAAiB,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAExF,KAAK,mBAAmB,CAAC,OAAO,SAAS,iBAAiB,EAAE,UAAU,SAAS,WAAW,IAAI;IAC5F,UAAU;CACX,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GAC/B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,GAC5C,OAAO,GACP,KAAK,GACP,KAAK,CAAC;AAEV,KAAK,2BAA2B,CAC9B,OAAO,SAAS,iBAAiB,EACjC,UAAU,SAAS,WAAW,IAC5B,eAAe,CAAC,OAAO,CAAC,GAAG;IAC7B,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,GAAG,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;CAClE,CAAC;AA8BF,cAAc;AACd,KAAK,mBAAmB,GAAG;IACzB,CACE,OAAO,SAAS,iBAAiB,GAAG,MAAM,EAC1C,UAAU,SAAS,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,EAExD,KAAK,EAAE,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,GACtD,YAAY,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAMF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAmBjB,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { forwardRef, } from "react";
|
|
4
|
+
const typographyVariants = new Set([
|
|
5
|
+
"display-lg",
|
|
6
|
+
"display-md",
|
|
7
|
+
"heading-lg",
|
|
8
|
+
"heading-md",
|
|
9
|
+
"heading-sm",
|
|
10
|
+
"body-lg",
|
|
11
|
+
"body-md",
|
|
12
|
+
"body-sm",
|
|
13
|
+
"label-md",
|
|
14
|
+
"label-sm",
|
|
15
|
+
"caption",
|
|
16
|
+
]);
|
|
17
|
+
const typographyElements = new Set([
|
|
18
|
+
"span",
|
|
19
|
+
"p",
|
|
20
|
+
"div",
|
|
21
|
+
"h1",
|
|
22
|
+
"h2",
|
|
23
|
+
"h3",
|
|
24
|
+
"h4",
|
|
25
|
+
"h5",
|
|
26
|
+
"h6",
|
|
27
|
+
"blockquote",
|
|
28
|
+
"figcaption",
|
|
29
|
+
]);
|
|
30
|
+
/**
|
|
31
|
+
* Token-backed standalone visible text with independently selected HTML semantics.
|
|
32
|
+
*
|
|
33
|
+
* Component-owned labels, titles, and descriptions keep their owning component's
|
|
34
|
+
* DOM rather than adding a nested Typography wrapper.
|
|
35
|
+
*/
|
|
36
|
+
export const Typography = forwardRef(function Typography({ as = "span", children, className, variant, ...nativeProps }, ref) {
|
|
37
|
+
if (!typographyElements.has(as)) {
|
|
38
|
+
throw new Error("FastyShop Typography received an unsupported HTML root.");
|
|
39
|
+
}
|
|
40
|
+
if (!typographyVariants.has(variant)) {
|
|
41
|
+
throw new Error("FastyShop Typography received an unsupported typography variant.");
|
|
42
|
+
}
|
|
43
|
+
const Root = as;
|
|
44
|
+
const classes = clsx("fs-typography", className);
|
|
45
|
+
return (_jsx(Root, { ...nativeProps, className: classes, "data-fs-variant": variant, ref: ref, children: children }));
|
|
46
|
+
});
|
|
47
|
+
Typography.displayName = "Typography";
|
|
48
|
+
//# sourceMappingURL=Typography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Typography.js","sourceRoot":"","sources":["../../../src/primitives/Typography/Typography.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EACL,UAAU,GAMX,MAAM,OAAO,CAAC;AAoCf,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAoB;IACpD,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,UAAU;IACV,UAAU;IACV,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAoB;IACpD,MAAM;IACN,GAAG;IACH,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,YAAY;IACZ,YAAY;CACb,CAAC,CAAC;AAiBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAqC,SAAS,UAAU,CAC1F,EAAE,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,EAC7D,GAA8B;IAE9B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,IAAI,GAAG,EAAiB,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAEjD,OAAO,CACL,KAAC,IAAI,OAAK,WAAW,EAAE,SAAS,EAAE,OAAO,qBAAmB,OAAO,EAAE,GAAG,EAAE,GAAG,YAC1E,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC,CAAwB,CAAC;AAE1B,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, DOMAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
/** @inline */
|
|
3
|
+
export type TypographyVariantContract = "display-lg" | "display-md" | "heading-lg" | "heading-md" | "heading-sm" | "body-lg" | "body-md" | "body-sm" | "label-md" | "label-sm" | "caption";
|
|
4
|
+
/** @inline */
|
|
5
|
+
export type TypographyElementContract = "span" | "p" | "div" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "blockquote" | "figcaption";
|
|
6
|
+
type EventHandlerProp = Extract<{
|
|
7
|
+
[Property in keyof DOMAttributes<HTMLElement>]: Property extends `on${string}` ? Property : never;
|
|
8
|
+
}[keyof DOMAttributes<HTMLElement>], string>;
|
|
9
|
+
type UnsupportedTypographyProp = EventHandlerProp | "align" | "color" | "contentEditable" | "dangerouslySetInnerHTML" | "style" | "tabIndex";
|
|
10
|
+
type TypographyOwnProps = {
|
|
11
|
+
/** Caller-owned visible or composed inline content. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
/** Layout, inherited color, and overflow composition hook. */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Required semantic visual role backed by the public typography tokens. */
|
|
16
|
+
variant: TypographyVariantContract;
|
|
17
|
+
};
|
|
18
|
+
/** @inline */
|
|
19
|
+
type TypographyPropsForElement<Element extends TypographyElementContract> = TypographyOwnProps & Omit<ComponentPropsWithoutRef<Element>, keyof TypographyOwnProps | "as" | UnsupportedTypographyProp> & {
|
|
20
|
+
ref?: Ref<HTMLElementTagNameMap[Element]>;
|
|
21
|
+
};
|
|
22
|
+
/** @inline */
|
|
23
|
+
export type TypographyPropsContract<Element extends TypographyElementContract = "span"> = [
|
|
24
|
+
Element
|
|
25
|
+
] extends ["span"] ? {
|
|
26
|
+
as?: "span";
|
|
27
|
+
} & TypographyPropsForElement<"span"> : Element extends TypographyElementContract ? {
|
|
28
|
+
as: Element;
|
|
29
|
+
} & TypographyPropsForElement<Element> : never;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=typography.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.types.d.ts","sourceRoot":"","sources":["../../../../src/primitives/Typography/types/typography.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,aAAa,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAErF,cAAc;AACd,MAAM,MAAM,yBAAyB,GACjC,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,cAAc;AACd,MAAM,MAAM,yBAAyB,GACnC,MAAM,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,YAAY,CAAC;AAE/F,KAAK,gBAAgB,GAAG,OAAO,CAC7B;KACG,QAAQ,IAAI,MAAM,aAAa,CAAC,WAAW,CAAC,GAAG,QAAQ,SAAS,KAAK,MAAM,EAAE,GAC1E,QAAQ,GACR,KAAK;CACV,CAAC,MAAM,aAAa,CAAC,WAAW,CAAC,CAAC,EACnC,MAAM,CACP,CAAC;AAEF,KAAK,yBAAyB,GAC1B,gBAAgB,GAChB,OAAO,GACP,OAAO,GACP,iBAAiB,GACjB,yBAAyB,GACzB,OAAO,GACP,UAAU,CAAC;AAEf,KAAK,kBAAkB,GAAG;IACxB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,cAAc;AACd,KAAK,yBAAyB,CAAC,OAAO,SAAS,yBAAyB,IAAI,kBAAkB,GAC5F,IAAI,CACF,wBAAwB,CAAC,OAAO,CAAC,EACjC,MAAM,kBAAkB,GAAG,IAAI,GAAG,yBAAyB,CAC5D,GAAG;IACF,GAAG,CAAC,EAAE,GAAG,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC;CAC3C,CAAC;AAEJ,cAAc;AACd,MAAM,MAAM,uBAAuB,CAAC,OAAO,SAAS,yBAAyB,GAAG,MAAM,IAAI;IACxF,OAAO;CACR,SAAS,CAAC,MAAM,CAAC,GACd;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,yBAAyB,CAAC,MAAM,CAAC,GACnD,OAAO,SAAS,yBAAyB,GACvC;IAAE,EAAE,EAAE,OAAO,CAAA;CAAE,GAAG,yBAAyB,CAAC,OAAO,CAAC,GACpD,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.types.js","sourceRoot":"","sources":["../../../../src/primitives/Typography/types/typography.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../src/runtime/clipboard/clipboard.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAC;AAW3E,eAAO,MAAM,oBAAoB,GAAU,OAAO,MAAM,KAAG,OAAO,CAAC,oBAAoB,CAqBtF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const hasWriteText = (clipboard) => typeof clipboard?.writeText === "function";
|
|
2
|
+
export const writeTextToClipboard = async (value) => {
|
|
3
|
+
if (value.length === 0) {
|
|
4
|
+
return "empty";
|
|
5
|
+
}
|
|
6
|
+
if (typeof navigator === "undefined") {
|
|
7
|
+
return "unsupported";
|
|
8
|
+
}
|
|
9
|
+
const browserNavigator = navigator;
|
|
10
|
+
const clipboard = browserNavigator.clipboard;
|
|
11
|
+
if (!hasWriteText(clipboard)) {
|
|
12
|
+
return "unsupported";
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
await clipboard.writeText(value);
|
|
16
|
+
return "success";
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return "failed";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=clipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../../../src/runtime/clipboard/clipboard.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG,CACnB,SAA0C,EACoB,EAAE,CAChE,OAAO,SAAS,EAAE,SAAS,KAAK,UAAU,CAAC;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,KAAa,EAAiC,EAAE;IACzF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,MAAM,gBAAgB,GAAwC,SAAS,CAAC;IACxE,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC;IAC7C,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjC,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC,CAAC"}
|