@azmr/ui 0.0.1 → 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/LICENSE +1 -1
- package/README.md +244 -73
- package/dist/avatar.d.ts +58 -0
- package/dist/avatar.js +84 -0
- package/dist/breadcrumb.d.ts +47 -0
- package/dist/breadcrumb.js +120 -0
- package/dist/button-CYt2Zw3D.d.ts +64 -0
- package/dist/button.d.ts +54 -0
- package/dist/button.js +19 -0
- package/dist/chunk-2RIWL363.js +27 -0
- package/dist/chunk-2TQSHVXA.js +12 -0
- package/dist/chunk-7EOSDFS3.js +10 -0
- package/dist/chunk-C2HKIPLQ.js +118 -0
- package/dist/chunk-CAJLW6K2.js +16 -0
- package/dist/chunk-CZJZYN54.js +36 -0
- package/dist/chunk-EE4V6XMB.js +35 -0
- package/dist/chunk-EFHRRLAW.js +211 -0
- package/dist/chunk-GLB75NT3.js +21 -0
- package/dist/chunk-GX2YEJ43.js +36 -0
- package/dist/chunk-LTOLV67A.js +19 -0
- package/dist/chunk-LZMX27IZ.js +10 -0
- package/dist/chunk-NIIDYIZA.js +1 -0
- package/dist/chunk-Q4PPM2SU.js +97 -0
- package/dist/chunk-WVE2E37B.js +20 -0
- package/dist/chunk-XRZHP6BD.js +92 -0
- package/dist/disclosure.d.ts +72 -0
- package/dist/disclosure.js +221 -0
- package/dist/display.d.ts +111 -0
- package/dist/display.js +237 -0
- package/dist/floating.d.ts +81 -0
- package/dist/floating.js +231 -0
- package/dist/hooks.d.ts +33 -0
- package/dist/hooks.js +55 -0
- package/dist/icons/lucide.d.ts +77 -0
- package/dist/icons/lucide.js +135 -0
- package/dist/icons/mui-map.d.ts +1268 -0
- package/dist/icons/mui-map.js +352 -0
- package/dist/icons.d.ts +48 -0
- package/dist/icons.js +19 -0
- package/dist/index.d.ts +240 -5
- package/dist/index.js +242 -15
- package/dist/input.d.ts +14 -0
- package/dist/input.js +8 -0
- package/dist/layout/mui-map.d.ts +80 -0
- package/dist/layout/mui-map.js +104 -0
- package/dist/layout.d.ts +89 -0
- package/dist/layout.js +455 -0
- package/dist/lib.d.ts +11 -0
- package/dist/lib.js +6 -0
- package/dist/menu.d.ts +105 -0
- package/dist/menu.js +56 -0
- package/dist/modal.d.ts +105 -0
- package/dist/modal.js +273 -0
- package/dist/motion.css +295 -0
- package/dist/pagination.d.ts +82 -0
- package/dist/pagination.js +211 -0
- package/dist/presets.d.ts +97 -0
- package/dist/presets.js +94 -0
- package/dist/progress.d.ts +70 -0
- package/dist/progress.js +138 -0
- package/dist/react.d.ts +81 -0
- package/dist/react.js +281 -0
- package/dist/responsive-YJBnvsjt.d.ts +69 -0
- package/dist/scroll-area.d.ts +30 -0
- package/dist/scroll-area.js +80 -0
- package/dist/shared-Fkx-sjPt.d.ts +15 -0
- package/dist/spinner.d.ts +18 -0
- package/dist/spinner.js +39 -0
- package/dist/split-button.d.ts +32 -0
- package/dist/split-button.js +54 -0
- package/dist/stepper.d.ts +27 -0
- package/dist/stepper.js +104 -0
- package/dist/styles.css +24 -0
- package/dist/table.d.ts +52 -0
- package/dist/table.js +124 -0
- package/dist/theme.d.ts +111 -0
- package/dist/theme.js +414 -0
- package/dist/toast.d.ts +77 -0
- package/dist/toast.js +203 -0
- package/dist/toggle.d.ts +55 -0
- package/dist/toggle.js +88 -0
- package/dist/tokens.css +337 -0
- package/dist/transition.d.ts +51 -0
- package/dist/transition.js +79 -0
- package/dist/types-BBudf463.d.ts +39 -0
- package/dist/typography/mui-map.d.ts +91 -0
- package/dist/typography/mui-map.js +62 -0
- package/dist/typography.d.ts +90 -0
- package/dist/typography.js +193 -0
- package/dist/useSignal-C-3ZGURN.d.ts +21 -0
- package/dist/variants-De0c0ucO.d.ts +60 -0
- package/package.json +173 -18
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/** A gap step (Tailwind's 4px scale), or `density` to follow the `data-density` token. */
|
|
5
|
+
declare const GAP_CLASSES: {
|
|
6
|
+
readonly 0: "gap-0";
|
|
7
|
+
readonly 1: "gap-1";
|
|
8
|
+
readonly 2: "gap-2";
|
|
9
|
+
readonly 3: "gap-3";
|
|
10
|
+
readonly 4: "gap-4";
|
|
11
|
+
readonly 5: "gap-5";
|
|
12
|
+
readonly 6: "gap-6";
|
|
13
|
+
readonly 8: "gap-8";
|
|
14
|
+
readonly 10: "gap-10";
|
|
15
|
+
readonly 12: "gap-12";
|
|
16
|
+
readonly density: "gap-(--density-gap)";
|
|
17
|
+
};
|
|
18
|
+
type Gap = keyof typeof GAP_CLASSES;
|
|
19
|
+
declare const ALIGN_ITEMS_CLASSES: {
|
|
20
|
+
readonly start: "items-start";
|
|
21
|
+
readonly center: "items-center";
|
|
22
|
+
readonly end: "items-end";
|
|
23
|
+
readonly stretch: "items-stretch";
|
|
24
|
+
readonly baseline: "items-baseline";
|
|
25
|
+
};
|
|
26
|
+
type AlignItems = keyof typeof ALIGN_ITEMS_CLASSES;
|
|
27
|
+
declare const JUSTIFY_CONTENT_CLASSES: {
|
|
28
|
+
readonly start: "justify-start";
|
|
29
|
+
readonly center: "justify-center";
|
|
30
|
+
readonly end: "justify-end";
|
|
31
|
+
readonly between: "justify-between";
|
|
32
|
+
readonly around: "justify-around";
|
|
33
|
+
readonly evenly: "justify-evenly";
|
|
34
|
+
};
|
|
35
|
+
type JustifyContent = keyof typeof JUSTIFY_CONTENT_CLASSES;
|
|
36
|
+
declare const JUSTIFY_ITEMS_CLASSES: {
|
|
37
|
+
readonly start: "justify-items-start";
|
|
38
|
+
readonly center: "justify-items-center";
|
|
39
|
+
readonly end: "justify-items-end";
|
|
40
|
+
readonly stretch: "justify-items-stretch";
|
|
41
|
+
};
|
|
42
|
+
type JustifyItems = keyof typeof JUSTIFY_ITEMS_CLASSES;
|
|
43
|
+
/** Elements a layout box may render as. */
|
|
44
|
+
type LayoutElement = "div" | "section" | "article" | "aside" | "nav" | "header" | "footer" | "main" | "ul" | "ol" | "form" | "fieldset";
|
|
45
|
+
|
|
46
|
+
declare const CONTAINER_SIZE_CLASSES: {
|
|
47
|
+
readonly sm: "max-w-2xl";
|
|
48
|
+
readonly md: "max-w-4xl";
|
|
49
|
+
readonly lg: "max-w-6xl";
|
|
50
|
+
readonly xl: "max-w-7xl";
|
|
51
|
+
readonly "2xl": "max-w-[96rem]";
|
|
52
|
+
readonly full: "max-w-none";
|
|
53
|
+
};
|
|
54
|
+
type ContainerSize = keyof typeof CONTAINER_SIZE_CLASSES;
|
|
55
|
+
interface ContainerProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
56
|
+
/** The widest the content gets (42, 56, 72, 80, 96rem); `full` removes the limit. Default `lg`. */
|
|
57
|
+
size?: ContainerSize;
|
|
58
|
+
/** Horizontal padding that grows with the screen. Default true. */
|
|
59
|
+
gutters?: boolean;
|
|
60
|
+
as?: LayoutElement;
|
|
61
|
+
children?: ReactNode;
|
|
62
|
+
}
|
|
63
|
+
/** Centres content and limits its width. Server-safe. */
|
|
64
|
+
declare const Container: react.ForwardRefExoticComponent<ContainerProps & react.RefAttributes<HTMLElement>>;
|
|
65
|
+
|
|
66
|
+
declare const BREAKPOINTS: readonly ["base", "sm", "md", "lg", "xl", "2xl"];
|
|
67
|
+
type Breakpoint = (typeof BREAKPOINTS)[number];
|
|
68
|
+
|
|
69
|
+
export { type AlignItems as A, type Breakpoint as B, Container as C, type Gap as G, type JustifyItems as J, type LayoutElement as L, type JustifyContent as a, type ContainerProps as b, type ContainerSize as c };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, Ref, ReactNode, ComponentPropsWithoutRef, RefAttributes } from 'react';
|
|
2
|
+
import { ScrollArea as ScrollArea$1 } from '@base-ui/react/scroll-area';
|
|
3
|
+
|
|
4
|
+
interface ScrollAreaOwnProps {
|
|
5
|
+
/** Which scrollbars to show. Default `vertical`. */
|
|
6
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
7
|
+
/**
|
|
8
|
+
* `hover` (default) fades the scrollbar in on hover and while scrolling, like the desktop
|
|
9
|
+
* platforms; `always` keeps it visible.
|
|
10
|
+
*/
|
|
11
|
+
scrollbar?: "always" | "hover";
|
|
12
|
+
/** Keep the scrollbars in the DOM even when nothing overflows, so layout never jumps. */
|
|
13
|
+
keepMounted?: boolean;
|
|
14
|
+
/** Classes for the scrollable viewport (padding, for example); `className` styles the root. */
|
|
15
|
+
viewportClassName?: string;
|
|
16
|
+
/** A ref to the scrollable element, to read or set the scroll position. */
|
|
17
|
+
viewportRef?: Ref<HTMLDivElement>;
|
|
18
|
+
className?: string;
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/** A scrollable region is focusable, so it needs a name: a label or the id of a heading. */
|
|
22
|
+
type Named = {
|
|
23
|
+
"aria-label": string;
|
|
24
|
+
} | {
|
|
25
|
+
"aria-labelledby": string;
|
|
26
|
+
};
|
|
27
|
+
type ScrollAreaProps = ScrollAreaOwnProps & Named & Omit<ComponentPropsWithoutRef<typeof ScrollArea$1.Root>, keyof ScrollAreaOwnProps | "aria-label" | "aria-labelledby">;
|
|
28
|
+
declare const ScrollArea: ForwardRefExoticComponent<ScrollAreaProps & RefAttributes<HTMLDivElement>>;
|
|
29
|
+
|
|
30
|
+
export { ScrollArea, type ScrollAreaOwnProps, type ScrollAreaProps };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "./chunk-2TQSHVXA.js";
|
|
5
|
+
|
|
6
|
+
// src/components/scroll-area/scroll-area.tsx
|
|
7
|
+
import {
|
|
8
|
+
forwardRef
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
// src/primitives/scroll-area.ts
|
|
12
|
+
import { ScrollArea } from "@base-ui/react/scroll-area";
|
|
13
|
+
|
|
14
|
+
// src/components/scroll-area/scroll-area.tsx
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
function Scrollbar({
|
|
17
|
+
orientation,
|
|
18
|
+
always,
|
|
19
|
+
keepMounted
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
ScrollArea.Scrollbar,
|
|
23
|
+
{
|
|
24
|
+
orientation,
|
|
25
|
+
keepMounted,
|
|
26
|
+
className: cn(
|
|
27
|
+
"flex touch-none select-none p-px transition-opacity duration-(--motion-duration-fast) ease-standard",
|
|
28
|
+
orientation === "vertical" ? "h-full w-2.5" : "h-2.5 flex-col",
|
|
29
|
+
!always && "opacity-0 data-[hovering]:opacity-100 data-[scrolling]:opacity-100"
|
|
30
|
+
),
|
|
31
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Thumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
var ScrollAreaImpl = forwardRef(function ScrollArea2({
|
|
36
|
+
orientation = "vertical",
|
|
37
|
+
scrollbar = "hover",
|
|
38
|
+
keepMounted = false,
|
|
39
|
+
viewportClassName,
|
|
40
|
+
viewportRef,
|
|
41
|
+
className,
|
|
42
|
+
children,
|
|
43
|
+
"aria-label": ariaLabel,
|
|
44
|
+
"aria-labelledby": ariaLabelledBy,
|
|
45
|
+
...props
|
|
46
|
+
}, ref) {
|
|
47
|
+
const always = scrollbar === "always";
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
ScrollArea.Root,
|
|
50
|
+
{
|
|
51
|
+
ref,
|
|
52
|
+
className: cn("relative overflow-hidden rounded-md", className),
|
|
53
|
+
...props,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
ScrollArea.Viewport,
|
|
57
|
+
{
|
|
58
|
+
ref: viewportRef,
|
|
59
|
+
role: "region",
|
|
60
|
+
tabIndex: 0,
|
|
61
|
+
"aria-label": ariaLabel,
|
|
62
|
+
"aria-labelledby": ariaLabelledBy,
|
|
63
|
+
className: cn(
|
|
64
|
+
"size-full rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
|
|
65
|
+
viewportClassName
|
|
66
|
+
),
|
|
67
|
+
children: /* @__PURE__ */ jsx(ScrollArea.Content, { children })
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
orientation !== "horizontal" && /* @__PURE__ */ jsx(Scrollbar, { orientation: "vertical", always, keepMounted }),
|
|
71
|
+
orientation !== "vertical" && /* @__PURE__ */ jsx(Scrollbar, { orientation: "horizontal", always, keepMounted }),
|
|
72
|
+
orientation === "both" && /* @__PURE__ */ jsx(ScrollArea.Corner, {})
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
var ScrollArea3 = ScrollAreaImpl;
|
|
78
|
+
export {
|
|
79
|
+
ScrollArea3 as ScrollArea
|
|
80
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type Side = "top" | "right" | "bottom" | "left" | "inline-start" | "inline-end";
|
|
2
|
+
type Align = "start" | "center" | "end";
|
|
3
|
+
/** Where a floating surface sits relative to its trigger. */
|
|
4
|
+
interface PositionProps {
|
|
5
|
+
/** The side of the trigger to open on. It flips to the opposite side when there is no room. */
|
|
6
|
+
side?: Side;
|
|
7
|
+
/** Alignment along that side. */
|
|
8
|
+
align?: Align;
|
|
9
|
+
/** Gap between the trigger and the surface, in px. Default 6. */
|
|
10
|
+
sideOffset?: number;
|
|
11
|
+
/** Minimum distance kept from the viewport edge, in px. Default 8. */
|
|
12
|
+
collisionPadding?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { Align as A, PositionProps as P, Side as S };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { SVGProps } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SpinnerProps extends Omit<SVGProps<SVGSVGElement>, "ref"> {
|
|
5
|
+
/**
|
|
6
|
+
* Accessible name. When set the spinner is announced as a status ("Loading customers");
|
|
7
|
+
* when omitted it is decorative and hidden from assistive technology (use that when the
|
|
8
|
+
* surrounding control already says it is busy, as `Button loading` does).
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* An indeterminate progress indicator. It keeps spinning under `prefers-reduced-motion`
|
|
14
|
+
* (`data-motion="essential"`) because a frozen spinner reads as a hung page.
|
|
15
|
+
*/
|
|
16
|
+
declare const Spinner: react.ForwardRefExoticComponent<SpinnerProps & react.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
|
|
18
|
+
export { Spinner, type SpinnerProps };
|
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-7EOSDFS3.js";
|
|
4
|
+
|
|
5
|
+
// src/components/spinner/spinner.tsx
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var Spinner = forwardRef(function Spinner2({ label, className, ...props }, ref) {
|
|
9
|
+
return (
|
|
10
|
+
// biome-ignore lint/a11y/noSvgWithoutTitle: decorative (aria-hidden) by default, or role="status" with an aria-label when `label` is set; both paths are covered by axe tests
|
|
11
|
+
/* @__PURE__ */ jsxs(
|
|
12
|
+
"svg",
|
|
13
|
+
{
|
|
14
|
+
ref,
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
fill: "none",
|
|
17
|
+
"data-motion": "essential",
|
|
18
|
+
className: cn("size-4 animate-spin", className),
|
|
19
|
+
...label ? { role: "status", "aria-label": label } : { "aria-hidden": true },
|
|
20
|
+
...props,
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeOpacity: "0.25", strokeWidth: "3" }),
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"path",
|
|
25
|
+
{
|
|
26
|
+
d: "M22 12a10 10 0 0 0-10-10",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
strokeWidth: "3",
|
|
29
|
+
strokeLinecap: "round"
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
Spinner
|
|
39
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ButtonProps } from '@base-ui/react/button';
|
|
4
|
+
import { B as ButtonOwnProps } from './button-CYt2Zw3D.js';
|
|
5
|
+
import 'class-variance-authority';
|
|
6
|
+
import 'class-variance-authority/types';
|
|
7
|
+
|
|
8
|
+
interface SplitButtonProps extends Omit<ButtonProps, "className" | "children" | "type" | "render" | "nativeButton"> {
|
|
9
|
+
/** The primary action's label. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** The extra actions: `DropdownMenuItem`s (and groups, separators, and so on). */
|
|
12
|
+
menu: ReactNode;
|
|
13
|
+
/** Names the arrow button ("More save options"). Required: the arrow has no text. */
|
|
14
|
+
menuLabel: string;
|
|
15
|
+
variant?: ButtonOwnProps["variant"];
|
|
16
|
+
size?: "sm" | "md" | "lg";
|
|
17
|
+
/** Shows a spinner on the primary button and ignores it. The menu stays usable. */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
loadingText?: ReactNode;
|
|
20
|
+
startIcon?: ReactNode;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A primary action with a menu of related ones attached: "Save", and a menu with "Save as…".
|
|
25
|
+
*
|
|
26
|
+
* Keyboard: Tab visits the primary button, then the arrow button; Enter or Space on the primary
|
|
27
|
+
* runs it; ArrowDown, Enter or Space on the arrow opens the menu (see `DropdownMenu` for the keys
|
|
28
|
+
* inside it), and Escape closes it and returns focus to the arrow.
|
|
29
|
+
*/
|
|
30
|
+
declare const SplitButton: react.ForwardRefExoticComponent<Omit<SplitButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
|
|
32
|
+
export { SplitButton, type SplitButtonProps };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
DropdownMenu,
|
|
4
|
+
DropdownMenuContent,
|
|
5
|
+
DropdownMenuTrigger
|
|
6
|
+
} from "./chunk-EFHRRLAW.js";
|
|
7
|
+
import "./chunk-LZMX27IZ.js";
|
|
8
|
+
import {
|
|
9
|
+
Icon
|
|
10
|
+
} from "./chunk-XRZHP6BD.js";
|
|
11
|
+
import {
|
|
12
|
+
IconButton
|
|
13
|
+
} from "./chunk-CZJZYN54.js";
|
|
14
|
+
import {
|
|
15
|
+
Button
|
|
16
|
+
} from "./chunk-C2HKIPLQ.js";
|
|
17
|
+
import {
|
|
18
|
+
joinedClasses
|
|
19
|
+
} from "./chunk-EE4V6XMB.js";
|
|
20
|
+
import {
|
|
21
|
+
cn
|
|
22
|
+
} from "./chunk-2TQSHVXA.js";
|
|
23
|
+
|
|
24
|
+
// src/components/split-button/split-button.tsx
|
|
25
|
+
import { ChevronDown } from "lucide-react";
|
|
26
|
+
import { forwardRef } from "react";
|
|
27
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
var SplitButton = forwardRef(function SplitButton2({ children, menu, menuLabel, variant = "default", size = "md", disabled, className, ...props }, ref) {
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(joinedClasses("horizontal", true), className), children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Button, { ref, variant, size, disabled, ...props, children }),
|
|
31
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
DropdownMenuTrigger,
|
|
34
|
+
{
|
|
35
|
+
disabled,
|
|
36
|
+
render: /* @__PURE__ */ jsx(
|
|
37
|
+
IconButton,
|
|
38
|
+
{
|
|
39
|
+
icon: /* @__PURE__ */ jsx(Icon, { icon: ChevronDown }),
|
|
40
|
+
label: menuLabel,
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
className: cn(variant !== "outline" && "border-l border-l-background/30")
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: menu })
|
|
49
|
+
] })
|
|
50
|
+
] });
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
SplitButton
|
|
54
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { OlHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type StepStatus = "complete" | "current" | "upcoming" | "error";
|
|
5
|
+
interface StepperStep {
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** Mark this step as failed. Otherwise the status follows `current`. */
|
|
9
|
+
status?: "error";
|
|
10
|
+
}
|
|
11
|
+
interface StepperProps extends Omit<OlHTMLAttributes<HTMLOListElement>, "children"> {
|
|
12
|
+
steps: readonly StepperStep[];
|
|
13
|
+
/** The index (0-based) of the step in progress. Below 0 nothing has started; past the end everything is done. */
|
|
14
|
+
current: number;
|
|
15
|
+
orientation?: "horizontal" | "vertical";
|
|
16
|
+
/** The list's name. Default "Progress". */
|
|
17
|
+
label?: string;
|
|
18
|
+
/** The words spoken for each state, for translation. */
|
|
19
|
+
statusLabels?: Partial<Record<StepStatus, string>>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Where someone is in a fixed sequence of steps. It is a status display, not navigation: steps are not
|
|
23
|
+
* links. Each state is also said in text (screen-reader only), never by colour alone. Server-safe.
|
|
24
|
+
*/
|
|
25
|
+
declare const Stepper: react.ForwardRefExoticComponent<StepperProps & react.RefAttributes<HTMLOListElement>>;
|
|
26
|
+
|
|
27
|
+
export { type StepStatus, Stepper, type StepperProps, type StepperStep };
|
package/dist/stepper.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon
|
|
3
|
+
} from "./chunk-Q4PPM2SU.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-7EOSDFS3.js";
|
|
7
|
+
|
|
8
|
+
// src/components/stepper/stepper.tsx
|
|
9
|
+
import { Check, X } from "lucide-react";
|
|
10
|
+
import { forwardRef } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var STATUS_LABELS = {
|
|
13
|
+
complete: "Completed",
|
|
14
|
+
current: "Current step",
|
|
15
|
+
upcoming: "Not started",
|
|
16
|
+
error: "Error"
|
|
17
|
+
};
|
|
18
|
+
var INDICATOR = {
|
|
19
|
+
complete: "border-primary bg-primary text-primary-foreground",
|
|
20
|
+
current: "border-primary bg-background text-primary",
|
|
21
|
+
upcoming: "border-border bg-background text-muted-foreground",
|
|
22
|
+
error: "border-destructive bg-background text-destructive"
|
|
23
|
+
};
|
|
24
|
+
var Stepper = forwardRef(function Stepper2({
|
|
25
|
+
steps,
|
|
26
|
+
current,
|
|
27
|
+
orientation = "horizontal",
|
|
28
|
+
label = "Progress",
|
|
29
|
+
statusLabels,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}, ref) {
|
|
33
|
+
const words = { ...STATUS_LABELS, ...statusLabels };
|
|
34
|
+
const horizontal = orientation === "horizontal";
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
"ol",
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
"aria-label": label,
|
|
40
|
+
"data-orientation": orientation,
|
|
41
|
+
className: cn(horizontal ? "flex flex-row items-start" : "flex flex-col", className),
|
|
42
|
+
...props,
|
|
43
|
+
children: steps.map((step, index) => {
|
|
44
|
+
const status = step.status === "error" ? "error" : index < current ? "complete" : index === current ? "current" : "upcoming";
|
|
45
|
+
const last = index === steps.length - 1;
|
|
46
|
+
return /* @__PURE__ */ jsxs(
|
|
47
|
+
"li",
|
|
48
|
+
{
|
|
49
|
+
"data-status": status,
|
|
50
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
51
|
+
className: cn(
|
|
52
|
+
"flex",
|
|
53
|
+
horizontal ? "flex-1 flex-row items-center last:flex-none" : "flex-col"
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
"data-azmr-step-indicator": "",
|
|
61
|
+
className: cn(
|
|
62
|
+
"flex size-8 shrink-0 items-center justify-center rounded-full border-2 text-sm font-medium",
|
|
63
|
+
INDICATOR[status]
|
|
64
|
+
),
|
|
65
|
+
children: status === "complete" ? /* @__PURE__ */ jsx(Icon, { icon: Check }) : status === "error" ? /* @__PURE__ */ jsx(Icon, { icon: X }) : index + 1
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsxs("span", { className: "grid text-left", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: words[status] }),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
className: cn(
|
|
74
|
+
"text-sm font-medium",
|
|
75
|
+
status === "upcoming" && "text-muted-foreground"
|
|
76
|
+
),
|
|
77
|
+
children: step.label
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
step.description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: step.description })
|
|
81
|
+
] })
|
|
82
|
+
] }),
|
|
83
|
+
!last && /* @__PURE__ */ jsx(
|
|
84
|
+
"span",
|
|
85
|
+
{
|
|
86
|
+
"data-azmr-step-connector": "",
|
|
87
|
+
"aria-hidden": "true",
|
|
88
|
+
className: cn(
|
|
89
|
+
index < current ? "bg-primary" : "bg-border",
|
|
90
|
+
horizontal ? "mx-3 h-px min-w-6 flex-1" : "my-2 ml-4 min-h-6 w-px"
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
index
|
|
97
|
+
);
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
export {
|
|
103
|
+
Stepper
|
|
104
|
+
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @azmr/ui stylesheet: the design tokens plus the global base rules.
|
|
3
|
+
*
|
|
4
|
+
* @import "tailwindcss";
|
|
5
|
+
* @import "@azmr/ui/styles.css";
|
|
6
|
+
*
|
|
7
|
+
* Importing this changes the page itself: the body gets our background and text colours, and every
|
|
8
|
+
* element's default border and outline colour become our tokens. For an app that already has global
|
|
9
|
+
* styles (another UI library mid-migration, a docs site), import "@azmr/ui/tokens.css" instead:
|
|
10
|
+
* the same tokens, themes, density and utilities, without these global rules.
|
|
11
|
+
*/
|
|
12
|
+
@import "./tokens.css";
|
|
13
|
+
|
|
14
|
+
@layer base {
|
|
15
|
+
* {
|
|
16
|
+
border-color: var(--border);
|
|
17
|
+
outline-color: var(--ring);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
background-color: var(--background);
|
|
22
|
+
color: var(--foreground);
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { TableHTMLAttributes, HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type Align = "left" | "center" | "right";
|
|
5
|
+
interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
6
|
+
/**
|
|
7
|
+
* Names the scrolling container. When set it becomes a labelled, focusable region, so a keyboard
|
|
8
|
+
* user can scroll a table that is wider than its space. Give a wide table a label.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Classes for the scrolling container, such as a `max-h-96` so the table scrolls vertically. */
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
/** Keep the header row in view while the body scrolls. Give the container a height. */
|
|
14
|
+
stickyHeader?: boolean;
|
|
15
|
+
/** Tint every other body row. */
|
|
16
|
+
striped?: boolean;
|
|
17
|
+
/** Tint the row under the pointer. */
|
|
18
|
+
hoverable?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A semantic, non-interactive table. It is a native `<table>`, so it already has the table, row and
|
|
22
|
+
* cell roles; name it with a `TableCaption`. Server-safe.
|
|
23
|
+
*/
|
|
24
|
+
declare const Table: react.ForwardRefExoticComponent<TableProps & react.RefAttributes<HTMLTableElement>>;
|
|
25
|
+
declare const TableHeader: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
|
|
26
|
+
declare const TableBody: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
|
|
27
|
+
declare const TableFooter: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTableSectionElement> & react.RefAttributes<HTMLTableSectionElement>>;
|
|
28
|
+
interface TableRowProps extends HTMLAttributes<HTMLTableRowElement> {
|
|
29
|
+
/** Marks the row as selected (`data-selected`) and tints it. */
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
}
|
|
32
|
+
declare const TableRow: react.ForwardRefExoticComponent<TableRowProps & react.RefAttributes<HTMLTableRowElement>>;
|
|
33
|
+
interface TableHeadProps extends ThHTMLAttributes<HTMLTableCellElement> {
|
|
34
|
+
/** Horizontal alignment. Default `left`. */
|
|
35
|
+
align?: Align;
|
|
36
|
+
}
|
|
37
|
+
/** A header cell. `scope="col"` by default; use `scope="row"` for the first cell of a row. */
|
|
38
|
+
declare const TableHead: react.ForwardRefExoticComponent<TableHeadProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
39
|
+
interface TableCellProps extends TdHTMLAttributes<HTMLTableCellElement> {
|
|
40
|
+
align?: Align;
|
|
41
|
+
/** Right-aligns and uses tabular figures, so a column of numbers lines up. */
|
|
42
|
+
numeric?: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare const TableCell: react.ForwardRefExoticComponent<TableCellProps & react.RefAttributes<HTMLTableCellElement>>;
|
|
45
|
+
interface TableCaptionProps extends HTMLAttributes<HTMLTableCaptionElement> {
|
|
46
|
+
/** Hide the caption visually but keep it as the table's name. */
|
|
47
|
+
srOnly?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** The table's name. Prefer a visible caption; `srOnly` keeps it for assistive technology only. */
|
|
50
|
+
declare const TableCaption: react.ForwardRefExoticComponent<TableCaptionProps & react.RefAttributes<HTMLTableCaptionElement>>;
|
|
51
|
+
|
|
52
|
+
export { Table, TableBody, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, TableFooter, TableHead, type TableHeadProps, TableHeader, type TableProps, TableRow, type TableRowProps };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-7EOSDFS3.js";
|
|
4
|
+
|
|
5
|
+
// src/components/table/table.tsx
|
|
6
|
+
import {
|
|
7
|
+
forwardRef
|
|
8
|
+
} from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
var ALIGN = { left: "text-left", center: "text-center", right: "text-right" };
|
|
11
|
+
var Table = forwardRef(function Table2({ label, containerClassName, stickyHeader, striped, hoverable, className, ...props }, ref) {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
...label ? { role: "region", "aria-label": label, tabIndex: 0 } : {},
|
|
16
|
+
className: cn(
|
|
17
|
+
"relative w-full overflow-x-auto",
|
|
18
|
+
label && "rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
19
|
+
stickyHeader && "overflow-y-auto",
|
|
20
|
+
containerClassName
|
|
21
|
+
),
|
|
22
|
+
children: /* @__PURE__ */ jsx(
|
|
23
|
+
"table",
|
|
24
|
+
{
|
|
25
|
+
ref,
|
|
26
|
+
className: cn(
|
|
27
|
+
"w-full caption-bottom border-collapse text-sm",
|
|
28
|
+
stickyHeader && "[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-10 [&_thead_th]:bg-background [&_thead_th]:shadow-[inset_0_-1px_0_0_var(--color-border)]",
|
|
29
|
+
striped && "[&_tbody_tr:nth-child(even)]:bg-muted/50",
|
|
30
|
+
hoverable && "[&_tbody_tr:hover]:bg-muted/50",
|
|
31
|
+
className
|
|
32
|
+
),
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
var TableHeader = forwardRef(function TableHeader2({ className, ...props }, ref) {
|
|
40
|
+
return /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props });
|
|
41
|
+
});
|
|
42
|
+
var TableBody = forwardRef(function TableBody2({ className, ...props }, ref) {
|
|
43
|
+
return /* @__PURE__ */ jsx("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props });
|
|
44
|
+
});
|
|
45
|
+
var TableFooter = forwardRef(function TableFooter2({ className, ...props }, ref) {
|
|
46
|
+
return /* @__PURE__ */ jsx(
|
|
47
|
+
"tfoot",
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className),
|
|
51
|
+
...props
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
var TableRow = forwardRef(function TableRow2({ selected, className, ...props }, ref) {
|
|
56
|
+
return /* @__PURE__ */ jsx(
|
|
57
|
+
"tr",
|
|
58
|
+
{
|
|
59
|
+
ref,
|
|
60
|
+
"data-selected": selected ? "" : void 0,
|
|
61
|
+
className: cn(
|
|
62
|
+
"h-(--density-row-height) border-b border-border transition-colors data-[selected]:bg-muted",
|
|
63
|
+
className
|
|
64
|
+
),
|
|
65
|
+
...props
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
var TableHead = forwardRef(function TableHead2({ scope = "col", align = "left", className, ...props }, ref) {
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"th",
|
|
72
|
+
{
|
|
73
|
+
ref,
|
|
74
|
+
scope,
|
|
75
|
+
className: cn(
|
|
76
|
+
"px-3 text-left align-middle font-medium text-muted-foreground",
|
|
77
|
+
ALIGN[align],
|
|
78
|
+
className
|
|
79
|
+
),
|
|
80
|
+
...props
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
var TableCell = forwardRef(function TableCell2({ align, numeric, className, ...props }, ref) {
|
|
85
|
+
return /* @__PURE__ */ jsx(
|
|
86
|
+
"td",
|
|
87
|
+
{
|
|
88
|
+
ref,
|
|
89
|
+
className: cn(
|
|
90
|
+
"px-3 py-2 align-middle",
|
|
91
|
+
numeric && "text-right tabular-nums",
|
|
92
|
+
align && ALIGN[align],
|
|
93
|
+
className
|
|
94
|
+
),
|
|
95
|
+
...props
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
var TableCaption = forwardRef(
|
|
100
|
+
function TableCaption2({ srOnly, className, ...props }, ref) {
|
|
101
|
+
return /* @__PURE__ */ jsx(
|
|
102
|
+
"caption",
|
|
103
|
+
{
|
|
104
|
+
ref,
|
|
105
|
+
className: cn(
|
|
106
|
+
"mt-4 caption-bottom text-sm text-muted-foreground",
|
|
107
|
+
srOnly && "sr-only",
|
|
108
|
+
className
|
|
109
|
+
),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
export {
|
|
116
|
+
Table,
|
|
117
|
+
TableBody,
|
|
118
|
+
TableCaption,
|
|
119
|
+
TableCell,
|
|
120
|
+
TableFooter,
|
|
121
|
+
TableHead,
|
|
122
|
+
TableHeader,
|
|
123
|
+
TableRow
|
|
124
|
+
};
|