@stll/ui 0.49.2 → 0.49.4
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { useRender } from "@base-ui/react/use-render";
|
|
3
3
|
import { VariantProps } from "class-variance-authority";
|
|
4
4
|
//#region src/components/button.d.ts
|
|
@@ -20,8 +20,9 @@ type ButtonProps = {
|
|
|
20
20
|
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
21
21
|
size?: VariantProps<typeof buttonVariants>["size"];
|
|
22
22
|
loading?: boolean;
|
|
23
|
-
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
tooltip?: ReactNode;
|
|
24
25
|
} & useRender.ComponentProps<"button">;
|
|
25
|
-
declare function Button({ className, variant, size, render, loading, children, disabled, tooltip, ...props }: ButtonProps):
|
|
26
|
+
declare function Button({ className, variant, size, render, loading, icon, children, disabled, tooltip, ...props }: ButtonProps): import("react").JSX.Element;
|
|
26
27
|
//#endregion
|
|
27
28
|
export { Button, buttonAccessibleDisabledClass, buttonVariants };
|
|
@@ -62,7 +62,7 @@ const buttonVariants = cva("focus-visible:ring-ring focus-visible:ring-offset-ba
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
function Button({ className, variant, size, render, loading, children, disabled, tooltip, ...props }) {
|
|
65
|
+
function Button({ className, variant, size, render, loading, icon, children, disabled, tooltip, ...props }) {
|
|
66
66
|
const typeValue = render ? void 0 : "button";
|
|
67
67
|
const tooltipContent = tooltip ?? props["aria-label"] ?? props.title;
|
|
68
68
|
const disposition = resolveButtonDisposition({
|
|
@@ -72,17 +72,18 @@ function Button({ className, variant, size, render, loading, children, disabled,
|
|
|
72
72
|
});
|
|
73
73
|
const isAccessibleDisabled = disposition === BUTTON_DISPOSITION.accessibleDisabled;
|
|
74
74
|
const defaultProps = {
|
|
75
|
-
children:
|
|
75
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [loading ? /* @__PURE__ */ jsx(Loader, {
|
|
76
|
+
animation: "none",
|
|
76
77
|
className: "[transition:opacity_150ms_ease-out,scale_320ms_var(--ease-spring)] motion-reduce:transition-none starting:scale-50 starting:opacity-0",
|
|
77
78
|
"data-slot": "button-loader",
|
|
78
79
|
size: "sm",
|
|
79
80
|
variant: "decorative"
|
|
80
|
-
}), children] })
|
|
81
|
+
}) : icon, children] }),
|
|
81
82
|
className: cn(disposition === BUTTON_DISPOSITION.enabled && size !== "row" && variant !== "link" && buttonPressClass, buttonVariants({
|
|
82
83
|
className,
|
|
83
84
|
size,
|
|
84
85
|
variant
|
|
85
|
-
}),
|
|
86
|
+
}), isAccessibleDisabled && "cursor-not-allowed opacity-64"),
|
|
86
87
|
"data-slot": "button",
|
|
87
88
|
"aria-busy": loading || void 0,
|
|
88
89
|
...isAccessibleDisabled ? {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
2
|
//#region src/components/loader.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
5
|
-
* (`sm`) next to a control that is busy, `md` in a row
|
|
6
|
-
*
|
|
4
|
+
* The indeterminate loading indicator for a control or a row: a plain
|
|
5
|
+
* spinner. Inline (`sm`) next to a control that is busy, `md` in a row or a
|
|
6
|
+
* small panel. A whole region with no content yet is `LoaderState` (the only
|
|
7
|
+
* place the Stella mark breathes). Content with a known shape gets a
|
|
8
|
+
* `Skeleton` instead, never a loader.
|
|
7
9
|
*/
|
|
8
|
-
declare const Loader: ({ label, variant, size, className, ...props }: LoaderProps) => import("react").JSX.Element;
|
|
10
|
+
declare const Loader: ({ label, variant, size, animation, className, ...props }: LoaderProps) => import("react").JSX.Element;
|
|
9
11
|
/**
|
|
10
|
-
* A region whose content has no shape yet (
|
|
11
|
-
*
|
|
12
|
+
* A region whose content has no shape yet (an empty screen while a job runs or
|
|
13
|
+
* a first fetch lands): the Stella mark breathing, one line saying what is
|
|
14
|
+
* happening, and at most one line of detail.
|
|
12
15
|
* Progress is stated in the detail text, never drawn as a bar that guesses.
|
|
13
16
|
*/
|
|
14
17
|
declare const LoaderState: ({ label, detail, hint, className }: LoaderStateProps) => import("react").JSX.Element;
|
|
@@ -20,6 +23,7 @@ declare const LOADER_SIZE: {
|
|
|
20
23
|
type LoaderSize = keyof typeof LOADER_SIZE;
|
|
21
24
|
type LoaderProps = Omit<ComponentProps<"span">, "children" | "role" | "aria-label" | "aria-hidden" | "aria-busy"> & {
|
|
22
25
|
size?: LoaderSize;
|
|
26
|
+
animation?: "none" | "spin";
|
|
23
27
|
} & ({
|
|
24
28
|
variant?: "status";
|
|
25
29
|
/** What is pending, for assistive technology ("Loading matters"). */
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { LoaderCircleIcon } from "../icons.js";
|
|
1
2
|
import { cn } from "../lib/utils.js";
|
|
2
3
|
import { StellaMark } from "./stella-mark.js";
|
|
3
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/loader.tsx
|
|
5
6
|
/**
|
|
6
|
-
* The
|
|
7
|
-
* (`sm`) next to a control that is busy, `md` in a row
|
|
8
|
-
*
|
|
7
|
+
* The indeterminate loading indicator for a control or a row: a plain
|
|
8
|
+
* spinner. Inline (`sm`) next to a control that is busy, `md` in a row or a
|
|
9
|
+
* small panel. A whole region with no content yet is `LoaderState` (the only
|
|
10
|
+
* place the Stella mark breathes). Content with a known shape gets a
|
|
11
|
+
* `Skeleton` instead, never a loader.
|
|
9
12
|
*/
|
|
10
|
-
const Loader = ({ label, variant = "status", size = "md", className, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
13
|
+
const Loader = ({ label, variant = "status", size = "md", animation = "spin", className, ...props }) => /* @__PURE__ */ jsx("span", {
|
|
11
14
|
className: cn("inline-flex shrink-0 items-center justify-center", LOADER_SIZE[size], className),
|
|
12
15
|
"data-slot": "loader",
|
|
13
16
|
...props,
|
|
@@ -15,11 +18,12 @@ const Loader = ({ label, variant = "status", size = "md", className, ...props })
|
|
|
15
18
|
"aria-hidden": variant === "decorative" ? true : void 0,
|
|
16
19
|
"aria-label": label,
|
|
17
20
|
role: variant === "status" ? "status" : void 0,
|
|
18
|
-
children: /* @__PURE__ */ jsx(
|
|
21
|
+
children: /* @__PURE__ */ jsx(LoaderCircleIcon, { className: cn("text-muted-foreground size-full", animation === "spin" && "animate-spin motion-reduce:animate-none") })
|
|
19
22
|
});
|
|
20
23
|
/**
|
|
21
|
-
* A region whose content has no shape yet (
|
|
22
|
-
*
|
|
24
|
+
* A region whose content has no shape yet (an empty screen while a job runs or
|
|
25
|
+
* a first fetch lands): the Stella mark breathing, one line saying what is
|
|
26
|
+
* happening, and at most one line of detail.
|
|
23
27
|
* Progress is stated in the detail text, never drawn as a bar that guesses.
|
|
24
28
|
*/
|
|
25
29
|
const LoaderState = ({ label, detail, hint, className }) => /* @__PURE__ */ jsxs("div", {
|
|
@@ -13,7 +13,7 @@ const ScrollArea = ({ axis = "both", className, children, scrollFade = false, sc
|
|
|
13
13
|
children: [
|
|
14
14
|
/* @__PURE__ */ jsx(ScrollArea$1.Viewport, {
|
|
15
15
|
ref: viewportRef,
|
|
16
|
-
className: cn("focus-visible:ring-ring focus-visible:ring-offset-background h-full overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-offset-1 data-has-overflow-x:overscroll-x-contain", scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]", scrollbarGutter && "data-has-overflow-x:pb-2.5 data-has-overflow-y:pe-2.5", AXIS_VIEWPORT_CLASS[axis]),
|
|
16
|
+
className: cn("focus-visible:ring-ring focus-visible:ring-offset-background h-full max-h-[inherit] overscroll-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-offset-1 data-has-overflow-x:overscroll-x-contain", scrollFade && "mask-t-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-start)))] mask-r-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-end)))] mask-b-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-y-end)))] mask-l-from-[calc(100%-min(var(--fade-size),var(--scroll-area-overflow-x-start)))] [--fade-size:1.5rem]", scrollbarGutter && "data-has-overflow-x:pb-2.5 data-has-overflow-y:pe-2.5", AXIS_VIEWPORT_CLASS[axis]),
|
|
17
17
|
"data-slot": "scroll-area-viewport",
|
|
18
18
|
children
|
|
19
19
|
}),
|
package/package.json
CHANGED