@askrjs/themes 0.0.25 → 0.0.27
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/components/_internal/style.js +2 -1
- package/dist/components/_internal/style.js.map +1 -1
- package/dist/components/alert/alert.d.ts +5 -0
- package/dist/components/alert/alert.js +5 -0
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.types.d.ts +3 -0
- package/dist/components/aside/aside.d.ts +1 -0
- package/dist/components/aside/aside.js +1 -0
- package/dist/components/aside/aside.js.map +1 -1
- package/dist/components/aside/aside.types.d.ts +1 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +5 -0
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +3 -0
- package/dist/components/badge/badge.d.ts +1 -0
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/badge/badge.types.d.ts +4 -0
- package/dist/components/block/block.d.ts +6 -0
- package/dist/components/block/block.js.map +1 -1
- package/dist/components/block/block.types.d.ts +8 -0
- package/dist/components/brand/brand.d.ts +3 -0
- package/dist/components/brand/brand.js +3 -0
- package/dist/components/brand/brand.js.map +1 -1
- package/dist/components/brand/brand.types.d.ts +6 -0
- package/dist/components/button-group/button-group.d.ts +1 -0
- package/dist/components/button-group/button-group.js +1 -0
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/button-group/button-group.types.d.ts +2 -0
- package/dist/components/card/card.d.ts +7 -0
- package/dist/components/card/card.js +7 -0
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/card/card.types.d.ts +9 -0
- package/dist/components/catalog.d.ts +122 -0
- package/dist/components/catalog.js +118 -0
- package/dist/components/catalog.js.map +1 -1
- package/dist/components/close/close.d.ts +1 -0
- package/dist/components/close/close.js.map +1 -1
- package/dist/components/close/close.types.d.ts +2 -0
- package/dist/components/command-palette/command-palette.d.ts +14 -0
- package/dist/components/command-palette/command-palette.js +13 -0
- package/dist/components/command-palette/command-palette.js.map +1 -1
- package/dist/components/command-palette/command-palette.types.d.ts +6 -0
- package/dist/components/container/container.d.ts +1 -0
- package/dist/components/container/container.js +1 -0
- package/dist/components/container/container.js.map +1 -1
- package/dist/components/container/container.types.d.ts +1 -0
- package/dist/components/empty-state/empty-state.d.ts +1 -0
- package/dist/components/empty-state/empty-state.js +1 -0
- package/dist/components/empty-state/empty-state.js.map +1 -1
- package/dist/components/empty-state/empty-state.types.d.ts +2 -0
- package/dist/components/field/field.d.ts +3 -0
- package/dist/components/field/field.js +3 -0
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/field/field.types.d.ts +3 -0
- package/dist/components/footer/footer.d.ts +7 -0
- package/dist/components/footer/footer.js +7 -0
- package/dist/components/footer/footer.js.map +1 -1
- package/dist/components/footer/footer.types.d.ts +7 -0
- package/dist/components/grid/grid.d.ts +1 -0
- package/dist/components/grid/grid.js +1 -0
- package/dist/components/grid/grid.js.map +1 -1
- package/dist/components/grid/grid.types.d.ts +4 -0
- package/dist/components/header/header.d.ts +1 -0
- package/dist/components/header/header.js +1 -0
- package/dist/components/header/header.js.map +1 -1
- package/dist/components/header/header.types.d.ts +1 -0
- package/dist/components/input-group/input-group.d.ts +2 -0
- package/dist/components/input-group/input-group.js +1 -0
- package/dist/components/input-group/input-group.js.map +1 -1
- package/dist/components/input-group/input-group.types.d.ts +4 -0
- package/dist/components/main/main.d.ts +1 -0
- package/dist/components/main/main.js +1 -0
- package/dist/components/main/main.js.map +1 -1
- package/dist/components/main/main.types.d.ts +1 -0
- package/dist/components/nav/nav.d.ts +6 -0
- package/dist/components/nav/nav.js +3 -0
- package/dist/components/nav/nav.js.map +1 -1
- package/dist/components/nav/nav.types.d.ts +14 -0
- package/dist/components/navbar/navbar.d.ts +8 -0
- package/dist/components/navbar/navbar.js +8 -0
- package/dist/components/navbar/navbar.js.map +1 -1
- package/dist/components/navbar/navbar.types.d.ts +5 -0
- package/dist/components/overlays/dropdown-content.d.ts +5 -0
- package/dist/components/overlays/dropdown-content.js.map +1 -1
- package/dist/components/page/page.d.ts +1 -0
- package/dist/components/page/page.js +1 -0
- package/dist/components/page/page.js.map +1 -1
- package/dist/components/page/page.types.d.ts +1 -0
- package/dist/components/page-header/page-header.d.ts +1 -0
- package/dist/components/page-header/page-header.js +1 -0
- package/dist/components/page-header/page-header.js.map +1 -1
- package/dist/components/page-header/page-header.types.d.ts +1 -0
- package/dist/components/section/section.d.ts +1 -0
- package/dist/components/section/section.js +1 -0
- package/dist/components/section/section.js.map +1 -1
- package/dist/components/section/section.types.d.ts +1 -0
- package/dist/components/separator/separator.d.ts +5 -0
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/separator/separator.types.d.ts +4 -0
- package/dist/components/sidebar/sidebar.d.ts +16 -0
- package/dist/components/sidebar/sidebar.js +16 -0
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/sidebar/sidebar.types.d.ts +8 -0
- package/dist/components/skeleton/skeleton.d.ts +1 -0
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +3 -0
- package/dist/components/spinner/spinner.d.ts +1 -0
- package/dist/components/spinner/spinner.js +1 -0
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/spinner/spinner.types.d.ts +3 -0
- package/dist/components/stat/stat.d.ts +4 -0
- package/dist/components/stat/stat.js +4 -0
- package/dist/components/stat/stat.js.map +1 -1
- package/dist/components/stat/stat.types.d.ts +4 -0
- package/dist/components/text/text.d.ts +1 -0
- package/dist/components/text/text.js +1 -0
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text/text.types.d.ts +8 -0
- package/dist/components/theme/theme.d.ts +25 -0
- package/dist/components/theme/theme.js +17 -0
- package/dist/components/theme/theme.js.map +1 -1
- package/dist/components/toolbar/toolbar.d.ts +1 -0
- package/dist/components/toolbar/toolbar.js +1 -0
- package/dist/components/toolbar/toolbar.js.map +1 -1
- package/dist/components/toolbar/toolbar.types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/_internal/style.ts +8 -1
- package/src/components/alert/alert.tsx +5 -0
- package/src/components/alert/alert.types.ts +3 -0
- package/src/components/aside/aside.tsx +1 -0
- package/src/components/aside/aside.types.ts +1 -0
- package/src/components/aspect-ratio/aspect-ratio.tsx +5 -0
- package/src/components/aspect-ratio/aspect-ratio.types.ts +3 -0
- package/src/components/badge/badge.tsx +1 -0
- package/src/components/badge/badge.types.ts +4 -0
- package/src/components/block/block.tsx +6 -0
- package/src/components/block/block.types.ts +8 -0
- package/src/components/brand/brand.tsx +3 -0
- package/src/components/brand/brand.types.ts +6 -0
- package/src/components/button-group/button-group.tsx +1 -0
- package/src/components/button-group/button-group.types.ts +2 -0
- package/src/components/card/card.tsx +7 -0
- package/src/components/card/card.types.ts +9 -0
- package/src/components/catalog.tsx +122 -0
- package/src/components/close/close.tsx +1 -0
- package/src/components/close/close.types.ts +2 -0
- package/src/components/command-palette/command-palette.tsx +14 -0
- package/src/components/command-palette/command-palette.types.ts +6 -0
- package/src/components/container/container.tsx +1 -0
- package/src/components/container/container.types.ts +1 -0
- package/src/components/empty-state/empty-state.tsx +1 -0
- package/src/components/empty-state/empty-state.types.ts +2 -0
- package/src/components/field/field.tsx +3 -0
- package/src/components/field/field.types.ts +3 -0
- package/src/components/footer/footer.tsx +7 -0
- package/src/components/footer/footer.types.ts +7 -0
- package/src/components/grid/grid.tsx +1 -0
- package/src/components/grid/grid.types.ts +4 -0
- package/src/components/header/header.tsx +1 -0
- package/src/components/header/header.types.ts +1 -0
- package/src/components/input-group/input-group.tsx +2 -0
- package/src/components/input-group/input-group.types.ts +4 -0
- package/src/components/main/main.tsx +1 -0
- package/src/components/main/main.types.ts +1 -0
- package/src/components/nav/nav.tsx +6 -0
- package/src/components/nav/nav.types.ts +14 -0
- package/src/components/navbar/navbar.tsx +8 -0
- package/src/components/navbar/navbar.types.ts +5 -0
- package/src/components/overlays/dropdown-content.tsx +5 -0
- package/src/components/page/page.tsx +1 -0
- package/src/components/page/page.types.ts +1 -0
- package/src/components/page-header/page-header.tsx +1 -0
- package/src/components/page-header/page-header.types.ts +1 -0
- package/src/components/section/section.tsx +1 -0
- package/src/components/section/section.types.ts +1 -0
- package/src/components/separator/separator.tsx +5 -0
- package/src/components/separator/separator.types.ts +4 -0
- package/src/components/sidebar/sidebar.tsx +16 -0
- package/src/components/sidebar/sidebar.types.ts +8 -0
- package/src/components/skeleton/skeleton.tsx +1 -0
- package/src/components/skeleton/skeleton.types.ts +3 -0
- package/src/components/spinner/spinner.tsx +1 -0
- package/src/components/spinner/spinner.types.ts +3 -0
- package/src/components/stat/stat.tsx +4 -0
- package/src/components/stat/stat.types.ts +4 -0
- package/src/components/text/text.tsx +1 -0
- package/src/components/text/text.types.ts +8 -0
- package/src/components/theme/theme.tsx +25 -0
- package/src/components/toolbar/toolbar.tsx +1 -0
- package/src/components/toolbar/toolbar.types.ts +1 -0
|
@@ -2,22 +2,26 @@ import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
|
2
2
|
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
3
3
|
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
4
4
|
|
|
5
|
+
/** Props shared by both {@link Separator} call signatures. */
|
|
5
6
|
export type SeparatorOwnProps = {
|
|
6
7
|
decorative?: boolean;
|
|
7
8
|
orientation?: "horizontal" | "vertical";
|
|
8
9
|
children?: unknown;
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
/** Props for {@link Separator} rendered as its default `<div>` element. */
|
|
11
13
|
export type SeparatorNativeProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
12
14
|
SeparatorOwnProps & {
|
|
13
15
|
asChild?: false;
|
|
14
16
|
ref?: Ref<HTMLDivElement>;
|
|
15
17
|
};
|
|
16
18
|
|
|
19
|
+
/** Props for {@link Separator} rendered with `asChild`, merging its attributes onto a single child element. */
|
|
17
20
|
export type SeparatorAsChildProps = SeparatorOwnProps & {
|
|
18
21
|
asChild: true;
|
|
19
22
|
children: JSXElement;
|
|
20
23
|
ref?: Ref<unknown>;
|
|
21
24
|
};
|
|
22
25
|
|
|
26
|
+
/** Union of all prop shapes accepted by {@link Separator}. */
|
|
23
27
|
export type SeparatorProps = SeparatorNativeProps | SeparatorAsChildProps;
|
|
@@ -39,6 +39,7 @@ function sidebarPart(
|
|
|
39
39
|
return intrinsicElement(String(as ?? element), finalProps, children);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** Root `<aside>` sidebar layout with configurable width, side, collapse behavior, and visual variant, exposed as data attributes for CSS. */
|
|
42
43
|
export function Sidebar(props: SidebarProps): JSX.Element {
|
|
43
44
|
const {
|
|
44
45
|
children,
|
|
@@ -70,46 +71,57 @@ export function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
70
71
|
);
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
/** Scoping wrapper that establishes the sidebar's CSS/context boundary. */
|
|
73
75
|
export function SidebarScope(props: SidebarPartProps): JSX.Element {
|
|
74
76
|
return sidebarPart(props, "sidebar-scope");
|
|
75
77
|
}
|
|
76
78
|
|
|
79
|
+
/** Renders the `<main>` content area beside the {@link Sidebar}. */
|
|
77
80
|
export function SidebarInset(props: SidebarPartProps): JSX.Element {
|
|
78
81
|
return sidebarPart(props, "sidebar-inset", "main");
|
|
79
82
|
}
|
|
80
83
|
|
|
84
|
+
/** Renders the scrollable content region of a {@link Sidebar}. */
|
|
81
85
|
export function SidebarContent(props: SidebarPartProps): JSX.Element {
|
|
82
86
|
return sidebarPart(props, "sidebar-content");
|
|
83
87
|
}
|
|
84
88
|
|
|
89
|
+
/** Renders the header region of a {@link Sidebar}. */
|
|
85
90
|
export function SidebarHeader(props: SidebarPartProps): JSX.Element {
|
|
86
91
|
return sidebarPart(props, "sidebar-header");
|
|
87
92
|
}
|
|
88
93
|
|
|
94
|
+
/** Renders the footer region of a {@link Sidebar}. */
|
|
89
95
|
export function SidebarFooter(props: SidebarPartProps): JSX.Element {
|
|
90
96
|
return sidebarPart(props, "sidebar-footer");
|
|
91
97
|
}
|
|
92
98
|
|
|
99
|
+
/** Groups related {@link SidebarMenu} items together. */
|
|
93
100
|
export function SidebarGroup(props: SidebarPartProps): JSX.Element {
|
|
94
101
|
return sidebarPart(props, "sidebar-group");
|
|
95
102
|
}
|
|
96
103
|
|
|
104
|
+
/** Renders the label for a {@link SidebarGroup}. */
|
|
97
105
|
export function SidebarGroupLabel(props: SidebarPartProps): JSX.Element {
|
|
98
106
|
return sidebarPart(props, "sidebar-group-label");
|
|
99
107
|
}
|
|
100
108
|
|
|
109
|
+
/** Renders the content region of a {@link SidebarGroup}. */
|
|
101
110
|
export function SidebarGroupContent(props: SidebarPartProps): JSX.Element {
|
|
102
111
|
return sidebarPart(props, "sidebar-group-content");
|
|
103
112
|
}
|
|
104
113
|
|
|
114
|
+
/** Renders a `<ul>` list of {@link SidebarMenuItem}s. */
|
|
105
115
|
export function SidebarMenu(props: SidebarPartProps): JSX.Element {
|
|
106
116
|
return sidebarPart(props, "sidebar-menu", "ul");
|
|
107
117
|
}
|
|
108
118
|
|
|
119
|
+
/** Renders a single `<li>` entry within a {@link SidebarMenu}. */
|
|
109
120
|
export function SidebarMenuItem(props: SidebarPartProps): JSX.Element {
|
|
110
121
|
return sidebarPart(props, "sidebar-menu-item", "li");
|
|
111
122
|
}
|
|
112
123
|
|
|
124
|
+
/** Clickable menu button within a {@link SidebarMenuItem}; supports `active`/`size`/`variant` state and an optional tooltip. */
|
|
113
125
|
export function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {
|
|
114
126
|
const {
|
|
115
127
|
active,
|
|
@@ -143,6 +155,7 @@ export function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {
|
|
|
143
155
|
);
|
|
144
156
|
}
|
|
145
157
|
|
|
158
|
+
/** Renders a secondary action button attached to a {@link SidebarMenuItem}, with an optional tooltip. */
|
|
146
159
|
export function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {
|
|
147
160
|
const {
|
|
148
161
|
asChild,
|
|
@@ -166,10 +179,12 @@ export function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {
|
|
|
166
179
|
);
|
|
167
180
|
}
|
|
168
181
|
|
|
182
|
+
/** Renders a status badge attached to a {@link SidebarMenuItem}. */
|
|
169
183
|
export function SidebarMenuBadge(props: SidebarPartProps): JSX.Element {
|
|
170
184
|
return sidebarPart(props, "sidebar-menu-badge", "span");
|
|
171
185
|
}
|
|
172
186
|
|
|
187
|
+
/** Renders a draggable/clickable rail along the sidebar's edge for resizing or toggling it. */
|
|
173
188
|
export function SidebarRail(props: SidebarButtonProps): JSX.Element {
|
|
174
189
|
const { asChild, children, class: className, type = "button", ...rest } = props;
|
|
175
190
|
const finalProps = mergeProps(normalizeAriaProps(rest), {
|
|
@@ -184,6 +199,7 @@ export function SidebarRail(props: SidebarButtonProps): JSX.Element {
|
|
|
184
199
|
);
|
|
185
200
|
}
|
|
186
201
|
|
|
202
|
+
/** Icon button that toggles the {@link Sidebar}'s open/collapsed state, with an optional tooltip. */
|
|
187
203
|
export function SidebarTrigger(props: SidebarButtonProps): JSX.Element {
|
|
188
204
|
const {
|
|
189
205
|
asChild,
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
2
2
|
import type { BlockElementProps } from "../block";
|
|
3
3
|
|
|
4
|
+
/** How a {@link Sidebar} collapses: fully off-canvas, down to icons only, or not at all. */
|
|
4
5
|
export type SidebarCollapsible = "offcanvas" | "icon" | "none";
|
|
6
|
+
/** Which edge of the viewport a {@link Sidebar} is docked to. */
|
|
5
7
|
export type SidebarSide = "left" | "right";
|
|
8
|
+
/** Side a sidebar button's tooltip is positioned on. */
|
|
6
9
|
export type SidebarTooltipSide = "top" | "bottom" | "left" | "right";
|
|
10
|
+
/** Visual style of a {@link Sidebar}. */
|
|
7
11
|
export type SidebarVariant = "sidebar" | "floating" | "inset";
|
|
8
12
|
|
|
13
|
+
/** Props for the {@link Sidebar} component. */
|
|
9
14
|
export type SidebarProps = Omit<BlockElementProps<"aside">, "as" | "width" | "shrink"> & {
|
|
10
15
|
collapsible?: SidebarCollapsible;
|
|
11
16
|
side?: SidebarSide;
|
|
@@ -14,11 +19,13 @@ export type SidebarProps = Omit<BlockElementProps<"aside">, "as" | "width" | "sh
|
|
|
14
19
|
shrink?: BlockElementProps<"aside">["shrink"];
|
|
15
20
|
};
|
|
16
21
|
|
|
22
|
+
/** Props shared by the generic {@link Sidebar} structural parts (content, header, footer, group, etc.). */
|
|
17
23
|
export type SidebarPartProps = JSX.IntrinsicElements["div"] & {
|
|
18
24
|
as?: keyof JSX.IntrinsicElements;
|
|
19
25
|
asChild?: boolean;
|
|
20
26
|
};
|
|
21
27
|
|
|
28
|
+
/** Props shared by the interactive {@link Sidebar} button parts (menu button, action, trigger). */
|
|
22
29
|
export type SidebarButtonProps = JSX.IntrinsicElements["button"] & {
|
|
23
30
|
active?: boolean;
|
|
24
31
|
asChild?: boolean;
|
|
@@ -28,4 +35,5 @@ export type SidebarButtonProps = JSX.IntrinsicElements["button"] & {
|
|
|
28
35
|
variant?: "default" | "outline";
|
|
29
36
|
};
|
|
30
37
|
|
|
38
|
+
/** Props for the {@link SidebarRail} component. */
|
|
31
39
|
export type SidebarRailProps = SidebarButtonProps;
|
|
@@ -12,6 +12,7 @@ function resolveSkeletonDimension(value: string | number | undefined): string |
|
|
|
12
12
|
return value;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
/** Loading placeholder block with configurable `width`/`height`, hidden from assistive tech via `aria-hidden`, rendered as a `<div>` or merged onto a child via `asChild`. */
|
|
15
16
|
export function Skeleton(props: SkeletonProps): JSX.Element;
|
|
16
17
|
export function Skeleton(props: SkeletonAsChildProps): JSX.Element;
|
|
17
18
|
export function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {
|
|
@@ -2,18 +2,21 @@ import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
|
2
2
|
import type { JSXElement } from "@askrjs/askr/foundations";
|
|
3
3
|
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
4
4
|
|
|
5
|
+
/** Props shared by both {@link Skeleton} call signatures. */
|
|
5
6
|
export type SkeletonOwnProps = {
|
|
6
7
|
children?: unknown;
|
|
7
8
|
height?: string | number;
|
|
8
9
|
width?: string | number;
|
|
9
10
|
};
|
|
10
11
|
|
|
12
|
+
/** Props for {@link Skeleton} rendered as its default `<div>` element. */
|
|
11
13
|
export type SkeletonProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref"> &
|
|
12
14
|
SkeletonOwnProps & {
|
|
13
15
|
asChild?: false;
|
|
14
16
|
ref?: Ref<HTMLDivElement>;
|
|
15
17
|
};
|
|
16
18
|
|
|
19
|
+
/** Props for {@link Skeleton} rendered with `asChild`, merging its attributes onto a single child element. */
|
|
17
20
|
export type SkeletonAsChildProps = SkeletonOwnProps & {
|
|
18
21
|
asChild: true;
|
|
19
22
|
children: JSXElement;
|
|
@@ -2,6 +2,7 @@ import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
|
2
2
|
import { ProgressCircle, ProgressCircleIndicator } from "@askrjs/ui";
|
|
3
3
|
import type { SpinnerProps } from "./spinner.types";
|
|
4
4
|
|
|
5
|
+
/** Indeterminate loading spinner built on `ProgressCircle`, with an accessible label (defaults to `"Loading"`) and a `size` modifier. */
|
|
5
6
|
export function Spinner(props: SpinnerProps): JSX.Element {
|
|
6
7
|
const {
|
|
7
8
|
label,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ProgressCircleProps } from "@askrjs/ui";
|
|
2
2
|
|
|
3
|
+
/** Size modifier for {@link Spinner}. */
|
|
3
4
|
export type SpinnerSize = "sm" | "md" | "lg";
|
|
4
5
|
|
|
6
|
+
/** Props specific to {@link Spinner}, layered on top of `ProgressCircleProps`. */
|
|
5
7
|
export type SpinnerOwnProps = Omit<ProgressCircleProps, "value" | "getValueLabel"> & {
|
|
6
8
|
label?: string;
|
|
7
9
|
size?: SpinnerSize;
|
|
8
10
|
};
|
|
9
11
|
|
|
12
|
+
/** Props for the {@link Spinner} component. */
|
|
10
13
|
export type SpinnerProps = SpinnerOwnProps;
|
|
@@ -3,6 +3,7 @@ import { classes } from "../_internal/classes";
|
|
|
3
3
|
import { mergeProps } from "../_internal/merge-props";
|
|
4
4
|
import type { StatDescriptionProps, StatLabelProps, StatProps, StatValueProps } from "./stat.types";
|
|
5
5
|
|
|
6
|
+
/** Container for a labeled statistic (label, value, description). */
|
|
6
7
|
export function Stat(props: StatProps): JSX.Element {
|
|
7
8
|
const { children, class: className, ref, ...rest } = props;
|
|
8
9
|
const finalProps = mergeProps(rest, {
|
|
@@ -14,6 +15,7 @@ export function Stat(props: StatProps): JSX.Element {
|
|
|
14
15
|
return <div {...finalProps}>{children}</div>;
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
/** Renders the label of a {@link Stat}. */
|
|
17
19
|
export function StatLabel(props: StatLabelProps): JSX.Element {
|
|
18
20
|
const { children, class: className, ref, ...rest } = props;
|
|
19
21
|
const finalProps = mergeProps(rest, {
|
|
@@ -25,6 +27,7 @@ export function StatLabel(props: StatLabelProps): JSX.Element {
|
|
|
25
27
|
return <p {...finalProps}>{children}</p>;
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
/** Renders the primary value of a {@link Stat}. */
|
|
28
31
|
export function StatValue(props: StatValueProps): JSX.Element {
|
|
29
32
|
const { children, class: className, ref, ...rest } = props;
|
|
30
33
|
const finalProps = mergeProps(rest, {
|
|
@@ -36,6 +39,7 @@ export function StatValue(props: StatValueProps): JSX.Element {
|
|
|
36
39
|
return <p {...finalProps}>{children}</p>;
|
|
37
40
|
}
|
|
38
41
|
|
|
42
|
+
/** Renders supporting description text for a {@link Stat}. */
|
|
39
43
|
export function StatDescription(props: StatDescriptionProps): JSX.Element {
|
|
40
44
|
const { children, class: className, ref, ...rest } = props;
|
|
41
45
|
const finalProps = mergeProps(rest, {
|
|
@@ -4,21 +4,25 @@ import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
|
4
4
|
type DivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref">;
|
|
5
5
|
type ParagraphProps = Omit<JSX.IntrinsicElements["p"], "children" | "ref">;
|
|
6
6
|
|
|
7
|
+
/** Props for the {@link Stat} component. */
|
|
7
8
|
export type StatProps = DivProps & {
|
|
8
9
|
children?: unknown;
|
|
9
10
|
ref?: Ref<HTMLDivElement>;
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
/** Props for the {@link StatLabel} component. */
|
|
12
14
|
export type StatLabelProps = ParagraphProps & {
|
|
13
15
|
children?: unknown;
|
|
14
16
|
ref?: Ref<HTMLParagraphElement>;
|
|
15
17
|
};
|
|
16
18
|
|
|
19
|
+
/** Props for the {@link StatValue} component. */
|
|
17
20
|
export type StatValueProps = ParagraphProps & {
|
|
18
21
|
children?: unknown;
|
|
19
22
|
ref?: Ref<HTMLParagraphElement>;
|
|
20
23
|
};
|
|
21
24
|
|
|
25
|
+
/** Props for the {@link StatDescription} component. */
|
|
22
26
|
export type StatDescriptionProps = ParagraphProps & {
|
|
23
27
|
children?: unknown;
|
|
24
28
|
ref?: Ref<HTMLParagraphElement>;
|
|
@@ -6,6 +6,7 @@ import type { TextElement, TextProps } from "./text.types";
|
|
|
6
6
|
|
|
7
7
|
const DEFAULT_ELEMENT = "p";
|
|
8
8
|
|
|
9
|
+
/** Typography primitive: renders any {@link TextElement} (default `<p>`) and turns `size`/`tone`/`weight`/`font`/`numeric`/`wrap`/`truncate` into data attributes for CSS styling. */
|
|
9
10
|
export function Text<TElement extends TextElement = "p">(props: TextProps<TElement>): JSX.Element {
|
|
10
11
|
const {
|
|
11
12
|
as,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
2
2
|
import type { Ref } from "@askrjs/askr/foundations/utilities";
|
|
3
3
|
|
|
4
|
+
/** Element tags {@link Text} can render as via its `as` prop. */
|
|
4
5
|
export type TextElement = "p" | "span" | "div" | "strong";
|
|
6
|
+
/** Font size modifier for {@link Text}. */
|
|
5
7
|
export type TextSize = "sm" | "md" | "lg";
|
|
8
|
+
/** Color tone modifier for {@link Text}. */
|
|
6
9
|
export type TextTone =
|
|
7
10
|
| "default"
|
|
8
11
|
| "muted"
|
|
@@ -12,9 +15,13 @@ export type TextTone =
|
|
|
12
15
|
| "warning"
|
|
13
16
|
| "danger"
|
|
14
17
|
| "info";
|
|
18
|
+
/** Font weight modifier for {@link Text}. */
|
|
15
19
|
export type TextWeight = "normal" | "medium" | "semibold" | "bold";
|
|
20
|
+
/** Font family modifier for {@link Text}. */
|
|
16
21
|
export type TextFont = "body" | "mono";
|
|
22
|
+
/** Numeric glyph variant (e.g. tabular figures) for {@link Text}. */
|
|
17
23
|
export type TextNumeric = "normal" | "tabular";
|
|
24
|
+
/** White-space wrapping behavior for {@link Text}. */
|
|
18
25
|
export type TextWrap = "normal" | "nowrap" | "anywhere";
|
|
19
26
|
|
|
20
27
|
type TextIntrinsicProps<TElement extends TextElement> = Omit<
|
|
@@ -22,6 +29,7 @@ type TextIntrinsicProps<TElement extends TextElement> = Omit<
|
|
|
22
29
|
"children" | "ref"
|
|
23
30
|
>;
|
|
24
31
|
|
|
32
|
+
/** Props for the {@link Text} component, specialized for a given {@link TextElement} `TElement`. */
|
|
25
33
|
export type TextProps<TElement extends TextElement = "p"> = TextIntrinsicProps<TElement> & {
|
|
26
34
|
as?: TElement;
|
|
27
35
|
size?: TextSize;
|
|
@@ -4,16 +4,21 @@ import { cloneElement, isElement, type JSXElement } from "@askrjs/askr/foundatio
|
|
|
4
4
|
import { Button } from "@askrjs/ui";
|
|
5
5
|
import type { ButtonNativeProps, PressEvent } from "@askrjs/ui";
|
|
6
6
|
|
|
7
|
+
/** Names of the built-in "cat" theme presets. */
|
|
7
8
|
export const CAT_THEME_NAMES = ["tabby", "ginger", "tuxedo", "calico", "torty"] as const;
|
|
8
9
|
|
|
10
|
+
/** A built-in "cat" theme name, one of {@link CAT_THEME_NAMES}. */
|
|
9
11
|
export type CatThemeName = (typeof CAT_THEME_NAMES)[number];
|
|
12
|
+
/** Any theme identifier accepted by {@link ThemeScope}: `"light"`, `"dark"`, `"system"`, a {@link CatThemeName}, or a custom string. */
|
|
10
13
|
export type ThemeName = "light" | "dark" | "system" | CatThemeName | (string & {});
|
|
11
14
|
|
|
15
|
+
/** A theme choice offered by {@link ThemePicker}/{@link ThemeToggle}: a `value` paired with a display `label`. */
|
|
12
16
|
export type ThemeOption = {
|
|
13
17
|
value: ThemeName;
|
|
14
18
|
label: string;
|
|
15
19
|
};
|
|
16
20
|
|
|
21
|
+
/** Value read from {@link theme}: the active theme, its resolved system value, a setter, and the available theme options. */
|
|
17
22
|
export type ThemeScopeValue = {
|
|
18
23
|
theme: () => ThemeName;
|
|
19
24
|
resolvedSystemTheme: () => "light" | "dark";
|
|
@@ -22,6 +27,7 @@ export type ThemeScopeValue = {
|
|
|
22
27
|
storageKey: string;
|
|
23
28
|
};
|
|
24
29
|
|
|
30
|
+
/** Props for the {@link ThemeScope} component. */
|
|
25
31
|
export type ThemeScopeProps = {
|
|
26
32
|
children?: unknown;
|
|
27
33
|
defaultTheme?: ThemeName;
|
|
@@ -29,6 +35,7 @@ export type ThemeScopeProps = {
|
|
|
29
35
|
storageKey?: string;
|
|
30
36
|
};
|
|
31
37
|
|
|
38
|
+
/** Props for the {@link ThemePicker} component. */
|
|
32
39
|
export type ThemePickerProps = Omit<
|
|
33
40
|
JSX.IntrinsicElements["select"],
|
|
34
41
|
"children" | "value" | "defaultValue" | "onChange"
|
|
@@ -37,11 +44,13 @@ export type ThemePickerProps = Omit<
|
|
|
37
44
|
label?: string;
|
|
38
45
|
};
|
|
39
46
|
|
|
47
|
+
/** Render context passed to a function-as-children {@link ThemeToggleProps.children}. */
|
|
40
48
|
export type ThemeToggleRenderContext = {
|
|
41
49
|
theme: ThemeName;
|
|
42
50
|
nextTheme: ThemeName;
|
|
43
51
|
};
|
|
44
52
|
|
|
53
|
+
/** Props for the {@link ThemeToggle} component. */
|
|
45
54
|
export type ThemeToggleProps = Omit<ButtonNativeProps, "children" | "onPress"> & {
|
|
46
55
|
children?: unknown | ((context: ThemeToggleRenderContext) => unknown);
|
|
47
56
|
lightIcon?: unknown;
|
|
@@ -51,12 +60,14 @@ export type ThemeToggleProps = Omit<ButtonNativeProps, "children" | "onPress"> &
|
|
|
51
60
|
onPress?: (event: PressEvent) => void;
|
|
52
61
|
};
|
|
53
62
|
|
|
63
|
+
/** Default light/dark/system theme options used by {@link ThemeScope} and {@link ThemePicker}. */
|
|
54
64
|
export const DEFAULT_THEME_OPTIONS: readonly ThemeOption[] = [
|
|
55
65
|
{ value: "system", label: "System" },
|
|
56
66
|
{ value: "light", label: "Light" },
|
|
57
67
|
{ value: "dark", label: "Dark" },
|
|
58
68
|
];
|
|
59
69
|
|
|
70
|
+
/** Theme options for the built-in "cat" theme presets, keyed to {@link CAT_THEME_NAMES}. */
|
|
60
71
|
export const CAT_THEME_OPTIONS: readonly ThemeOption[] = [
|
|
61
72
|
{ value: "tabby", label: "Tabby" },
|
|
62
73
|
{ value: "ginger", label: "Ginger" },
|
|
@@ -84,10 +95,18 @@ const ThemeScopeContext = defineScope<InternalThemeScopeValue>({
|
|
|
84
95
|
depth: -1,
|
|
85
96
|
});
|
|
86
97
|
|
|
98
|
+
/** Reads the current {@link ThemeScopeValue} from the nearest enclosing {@link ThemeScope}. */
|
|
87
99
|
export function theme(): ThemeScopeValue {
|
|
88
100
|
return readScope(ThemeScopeContext);
|
|
89
101
|
}
|
|
90
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Establishes a theme boundary: tracks the active theme (persisted to
|
|
105
|
+
* `localStorage` under `storageKey` and synced across tabs/scopes), resolves
|
|
106
|
+
* the OS `"system"` preference, and reflects the choice onto the DOM via
|
|
107
|
+
* `data-theme`/`data-theme-choice` attributes. Nested scopes cooperate
|
|
108
|
+
* through a shared coordinator so the deepest explicitly-set scope wins.
|
|
109
|
+
*/
|
|
91
110
|
export function ThemeScope(props: ThemeScopeProps): JSX.Element {
|
|
92
111
|
const {
|
|
93
112
|
children,
|
|
@@ -318,6 +337,7 @@ function createThemeCoordinator() {
|
|
|
318
337
|
});
|
|
319
338
|
}
|
|
320
339
|
|
|
340
|
+
/** A `<select>` bound to the current {@link theme}, listing `themes` (defaults to the enclosing scope's options). */
|
|
321
341
|
export function ThemePicker(props: ThemePickerProps): JSX.Element {
|
|
322
342
|
const activeTheme = theme();
|
|
323
343
|
const { themes = activeTheme.themes, label = "Theme", ...rest } = props;
|
|
@@ -362,6 +382,11 @@ function getThemePickerTarget(event: Event): HTMLSelectElement | null {
|
|
|
362
382
|
return null;
|
|
363
383
|
}
|
|
364
384
|
|
|
385
|
+
/**
|
|
386
|
+
* A button that cycles through `themes` (defaults to `["light", "dark"]`) on
|
|
387
|
+
* press. Supports icon props per theme, or a function-as-children render
|
|
388
|
+
* prop receiving {@link ThemeToggleRenderContext}.
|
|
389
|
+
*/
|
|
365
390
|
export function ThemeToggle(props: ThemeToggleProps): JSX.Element {
|
|
366
391
|
const activeTheme = theme();
|
|
367
392
|
const {
|
|
@@ -2,6 +2,7 @@ import type { JSX } from "@askrjs/askr/jsx-runtime";
|
|
|
2
2
|
import { Block } from "../block";
|
|
3
3
|
import type { ToolbarProps } from "./toolbar.types";
|
|
4
4
|
|
|
5
|
+
/** Titled toolbar row with an actions area, wrapping to a new line on small screens. */
|
|
5
6
|
export function Toolbar(props: ToolbarProps): JSX.Element {
|
|
6
7
|
const { title, actions, ...rest } = props;
|
|
7
8
|
|