@askrjs/themes 0.0.10 → 0.0.12
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/README.md +5 -5
- package/THEMING.md +2 -2
- package/dist/components/_internal/block-layout.d.ts +1 -1
- package/dist/components/_internal/block-layout.js +1 -1
- package/dist/components/_internal/block-layout.js.map +1 -1
- package/dist/components/_internal/jsx.js +9 -1
- package/dist/components/_internal/jsx.js.map +1 -1
- package/dist/components/alert/alert.d.ts +0 -1
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert/alert.types.d.ts +0 -1
- package/dist/components/alert/index.d.ts +2 -1
- package/dist/components/aside/aside.d.ts +0 -1
- package/dist/components/aside/aside.types.d.ts +1 -0
- package/dist/components/aside/index.d.ts +2 -1
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +0 -1
- package/dist/components/aspect-ratio/aspect-ratio.js +2 -4
- package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
- package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +1 -2
- package/dist/components/aspect-ratio/index.d.ts +2 -1
- package/dist/components/badge/badge.d.ts +0 -1
- package/dist/components/badge/badge.js +2 -4
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/badge/badge.types.d.ts +1 -2
- package/dist/components/badge/index.d.ts +2 -1
- package/dist/components/block/block.d.ts +0 -1
- package/dist/components/block/block.js +2 -4
- package/dist/components/block/block.js.map +1 -1
- package/dist/components/block/block.types.d.ts +2 -3
- package/dist/components/block/index.d.ts +2 -1
- package/dist/components/brand/brand.d.ts +0 -1
- package/dist/components/brand/brand.js +4 -5
- package/dist/components/brand/brand.js.map +1 -1
- package/dist/components/brand/brand.types.d.ts +0 -1
- package/dist/components/brand/index.d.ts +2 -1
- package/dist/components/button-group/button-group.d.ts +0 -1
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/button-group/button-group.types.d.ts +0 -1
- package/dist/components/button-group/index.d.ts +2 -1
- package/dist/components/card/card.d.ts +0 -1
- package/dist/components/card/card.types.d.ts +0 -1
- package/dist/components/card/index.d.ts +2 -1
- package/dist/components/catalog.d.ts +0 -1
- package/dist/components/catalog.js +2 -1
- package/dist/components/catalog.js.map +1 -1
- package/dist/components/close/close.d.ts +0 -1
- package/dist/components/close/close.types.d.ts +0 -1
- package/dist/components/close/index.d.ts +2 -1
- package/dist/components/container/container.d.ts +0 -1
- package/dist/components/container/container.types.d.ts +1 -0
- package/dist/components/container/index.d.ts +2 -1
- package/dist/components/empty-state/empty-state.d.ts +0 -1
- package/dist/components/empty-state/empty-state.types.d.ts +1 -0
- package/dist/components/empty-state/index.d.ts +2 -1
- package/dist/components/field/field.d.ts +0 -1
- package/dist/components/field/field.types.d.ts +0 -1
- package/dist/components/field/index.d.ts +2 -1
- package/dist/components/footer/footer.d.ts +0 -1
- package/dist/components/footer/footer.types.d.ts +1 -1
- package/dist/components/footer/index.d.ts +2 -1
- package/dist/components/grid/grid.d.ts +0 -1
- package/dist/components/grid/grid.js +2 -5
- package/dist/components/grid/grid.js.map +1 -1
- package/dist/components/grid/grid.types.d.ts +0 -1
- package/dist/components/grid/index.d.ts +2 -1
- package/dist/components/header/header.d.ts +0 -1
- package/dist/components/header/header.types.d.ts +1 -0
- package/dist/components/header/index.d.ts +2 -1
- package/dist/components/input-group/index.d.ts +2 -1
- package/dist/components/input-group/input-group.d.ts +0 -1
- package/dist/components/input-group/input-group.js +2 -4
- package/dist/components/input-group/input-group.js.map +1 -1
- package/dist/components/input-group/input-group.types.d.ts +0 -1
- package/dist/components/main/index.d.ts +2 -1
- package/dist/components/main/main.d.ts +0 -1
- package/dist/components/main/main.types.d.ts +1 -0
- package/dist/components/nav/index.d.ts +2 -1
- package/dist/components/nav/nav.d.ts +0 -1
- package/dist/components/nav/nav.js +22 -15
- package/dist/components/nav/nav.js.map +1 -1
- package/dist/components/nav/nav.types.d.ts +1 -2
- package/dist/components/navbar/index.d.ts +3 -1
- package/dist/components/navbar/navbar.d.ts +0 -1
- package/dist/components/navbar/navbar.js +9 -8
- package/dist/components/navbar/navbar.js.map +1 -1
- package/dist/components/navbar/navbar.types.d.ts +1 -1
- package/dist/components/overlays/dropdown-content.d.ts +0 -1
- package/dist/components/page/index.d.ts +2 -1
- package/dist/components/page/page.d.ts +0 -1
- package/dist/components/page/page.types.d.ts +1 -0
- package/dist/components/page-header/index.d.ts +2 -1
- package/dist/components/page-header/page-header.d.ts +0 -1
- package/dist/components/page-header/page-header.types.d.ts +1 -0
- package/dist/components/section/index.d.ts +2 -1
- package/dist/components/section/section.d.ts +0 -1
- package/dist/components/section/section.types.d.ts +1 -0
- package/dist/components/separator/index.d.ts +2 -1
- package/dist/components/separator/separator.d.ts +0 -1
- package/dist/components/separator/separator.js +2 -4
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/separator/separator.types.d.ts +0 -1
- package/dist/components/sidebar/index.d.ts +2 -1
- package/dist/components/sidebar/sidebar.d.ts +2 -3
- package/dist/components/sidebar/sidebar.js +5 -8
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/sidebar/sidebar.types.d.ts +1 -0
- package/dist/components/skeleton/index.d.ts +2 -1
- package/dist/components/skeleton/skeleton.d.ts +0 -1
- package/dist/components/skeleton/skeleton.js +8 -8
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/skeleton/skeleton.types.d.ts +0 -1
- package/dist/components/spinner/index.d.ts +2 -1
- package/dist/components/spinner/spinner.d.ts +0 -1
- package/dist/components/spinner/spinner.types.d.ts +0 -1
- package/dist/components/stat/index.d.ts +2 -1
- package/dist/components/stat/stat.d.ts +0 -1
- package/dist/components/stat/stat.types.d.ts +0 -1
- package/dist/components/text/index.d.ts +2 -1
- package/dist/components/text/text.d.ts +0 -1
- package/dist/components/text/text.js +2 -5
- package/dist/components/text/text.js.map +1 -1
- package/dist/components/text/text.types.d.ts +0 -1
- package/dist/components/theme/index.d.ts +2 -1
- package/dist/components/theme/theme.d.ts +5 -6
- package/dist/components/theme/theme.js +102 -70
- package/dist/components/theme/theme.js.map +1 -1
- package/dist/components/toolbar/index.d.ts +2 -1
- package/dist/components/toolbar/toolbar.d.ts +0 -1
- package/dist/components/toolbar/toolbar.types.d.ts +1 -0
- package/dist/components.d.ts +34 -4
- package/dist/components.js +4 -4
- package/dist/controls.d.ts +4 -0
- package/dist/core.d.ts +18 -2
- package/dist/navs.d.ts +1 -0
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +2 -2
- package/dist/surfaces.d.ts +8 -0
- package/dist/theme.d.ts +3 -2
- package/dist/theme.js +2 -2
- package/dist/themes/default/index.css +3 -3
- package/package.json +19 -12
- package/src/components/_internal/jsx.ts +11 -0
- package/src/components/alert/alert.tsx +1 -1
- package/src/components/aspect-ratio/aspect-ratio.tsx +2 -1
- package/src/components/badge/badge.tsx +2 -1
- package/src/components/block/block.tsx +2 -2
- package/src/components/brand/brand.tsx +3 -3
- package/src/components/button-group/button-group.tsx +1 -1
- package/src/components/catalog.tsx +3 -1
- package/src/components/grid/grid.tsx +2 -2
- package/src/components/input-group/input-group.tsx +3 -2
- package/src/components/nav/nav.tsx +25 -19
- package/src/components/navbar/navbar.tsx +22 -14
- package/src/components/separator/separator.tsx +2 -1
- package/src/components/sidebar/index.ts +1 -1
- package/src/components/sidebar/sidebar.tsx +7 -7
- package/src/components/skeleton/skeleton.tsx +8 -10
- package/src/components/text/text.tsx +2 -2
- package/src/components/theme/index.ts +4 -4
- package/src/components/theme/theme.tsx +135 -99
- package/src/components.ts +4 -4
- package/src/overlays.ts +3 -3
- package/src/theme.ts +4 -4
- package/src/themes/default/styles/display/coverage.css +1 -1
- package/src/themes/default/styles/overlays/toast.css +1 -1
- package/src/themes/default/styles/shell/sidebar.css +1 -1
- package/templates/theme/styles/display/coverage.css +1 -1
- package/templates/theme/styles/overlays/toast.css +1 -1
- package/templates/theme/styles/shell/sidebar.css +1 -1
|
@@ -3,6 +3,7 @@ import { currentRoute, Link, navigate } from "@askrjs/askr/router";
|
|
|
3
3
|
import { Block } from "../block";
|
|
4
4
|
import { classes } from "../_internal/classes";
|
|
5
5
|
import { mergeProps } from "../_internal/merge-props";
|
|
6
|
+
import { intrinsicElement } from "../_internal/jsx";
|
|
6
7
|
import { resolvePathname } from "../_internal/pathname";
|
|
7
8
|
import type {
|
|
8
9
|
NavItemAsChildProps,
|
|
@@ -16,6 +17,8 @@ import type {
|
|
|
16
17
|
TabsProps,
|
|
17
18
|
} from "./nav.types";
|
|
18
19
|
|
|
20
|
+
const LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;
|
|
21
|
+
|
|
19
22
|
function normalizePathname(pathname: string): string {
|
|
20
23
|
return pathname.endsWith("/") && pathname !== "/" ? pathname.slice(0, -1) : pathname;
|
|
21
24
|
}
|
|
@@ -87,7 +90,7 @@ function renderNavSet(
|
|
|
87
90
|
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
return
|
|
93
|
+
return intrinsicElement("nav", finalProps, children);
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
function renderRoutedLink(
|
|
@@ -98,7 +101,8 @@ function renderRoutedLink(
|
|
|
98
101
|
const {
|
|
99
102
|
active,
|
|
100
103
|
children,
|
|
101
|
-
href,
|
|
104
|
+
href: suppliedHref,
|
|
105
|
+
to,
|
|
102
106
|
onClick,
|
|
103
107
|
ref,
|
|
104
108
|
class: className,
|
|
@@ -106,6 +110,10 @@ function renderRoutedLink(
|
|
|
106
110
|
target,
|
|
107
111
|
...rest
|
|
108
112
|
} = props as NavLinkProps & { onClick?: (event: MouseEvent) => void };
|
|
113
|
+
const href = to?.href ?? suppliedHref;
|
|
114
|
+
if (!href) {
|
|
115
|
+
throw new Error("Nav link requires href or to.");
|
|
116
|
+
}
|
|
109
117
|
const inheritedSlot =
|
|
110
118
|
options.inheritSlot && typeof (rest as Record<string, unknown>)["data-slot"] === "string"
|
|
111
119
|
? String((rest as Record<string, unknown>)["data-slot"])
|
|
@@ -130,12 +138,10 @@ function renderRoutedLink(
|
|
|
130
138
|
: {
|
|
131
139
|
"data-active": undefined,
|
|
132
140
|
};
|
|
133
|
-
const
|
|
134
|
-
const childProps =
|
|
135
|
-
...childRest,
|
|
136
|
-
href,
|
|
137
|
-
target,
|
|
138
|
-
};
|
|
141
|
+
const rendersRouterLink = targetPathname !== null && !target && typeof onClick !== "function";
|
|
142
|
+
const childProps: NavLinkProps = to
|
|
143
|
+
? ({ ...childRest, to, target } as NavLinkProps)
|
|
144
|
+
: ({ ...childRest, href, target } as NavLinkProps);
|
|
139
145
|
const handleClick = (event: MouseEvent) => {
|
|
140
146
|
onClick?.(event);
|
|
141
147
|
|
|
@@ -148,25 +154,25 @@ function renderRoutedLink(
|
|
|
148
154
|
};
|
|
149
155
|
|
|
150
156
|
return (
|
|
151
|
-
<
|
|
157
|
+
<LayoutBlock
|
|
152
158
|
asChild
|
|
153
159
|
paddingX="sm"
|
|
154
160
|
paddingY="xs"
|
|
155
161
|
radius={resolvedSlot === "pill" ? "round" : "md"}
|
|
156
162
|
background={isActive && options.activeBackground ? "selected" : undefined}
|
|
157
163
|
ref={ref}
|
|
158
|
-
|
|
164
|
+
className={classes(options.className, inheritedNavClass, className)}
|
|
159
165
|
data-slot={resolvedSlot}
|
|
160
166
|
{...activeProps}
|
|
161
167
|
>
|
|
162
|
-
{
|
|
168
|
+
{rendersRouterLink ? (
|
|
163
169
|
<Link {...childProps}>{children}</Link>
|
|
164
170
|
) : (
|
|
165
|
-
<a {...
|
|
171
|
+
<a {...childRest} href={href} target={target} onClick={handleClick}>
|
|
166
172
|
{children}
|
|
167
173
|
</a>
|
|
168
174
|
)}
|
|
169
|
-
</
|
|
175
|
+
</LayoutBlock>
|
|
170
176
|
);
|
|
171
177
|
}
|
|
172
178
|
|
|
@@ -206,7 +212,7 @@ export function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element
|
|
|
206
212
|
|
|
207
213
|
if (asChild) {
|
|
208
214
|
return (
|
|
209
|
-
<
|
|
215
|
+
<LayoutBlock
|
|
210
216
|
asChild
|
|
211
217
|
paddingX="sm"
|
|
212
218
|
paddingY="xs"
|
|
@@ -214,17 +220,17 @@ export function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element
|
|
|
214
220
|
background={active ? "selected" : undefined}
|
|
215
221
|
{...rest}
|
|
216
222
|
ref={ref}
|
|
217
|
-
|
|
223
|
+
className={className}
|
|
218
224
|
data-active={active ? "true" : undefined}
|
|
219
225
|
data-slot="nav-item"
|
|
220
226
|
>
|
|
221
227
|
{children}
|
|
222
|
-
</
|
|
228
|
+
</LayoutBlock>
|
|
223
229
|
);
|
|
224
230
|
}
|
|
225
231
|
|
|
226
232
|
return (
|
|
227
|
-
<
|
|
233
|
+
<LayoutBlock
|
|
228
234
|
as="a"
|
|
229
235
|
paddingX="sm"
|
|
230
236
|
paddingY="xs"
|
|
@@ -232,12 +238,12 @@ export function NavItem(props: NavItemProps | NavItemAsChildProps): JSX.Element
|
|
|
232
238
|
background={active ? "selected" : undefined}
|
|
233
239
|
{...rest}
|
|
234
240
|
ref={ref}
|
|
235
|
-
|
|
241
|
+
className={className}
|
|
236
242
|
data-active={active ? "true" : undefined}
|
|
237
243
|
data-slot="nav-item"
|
|
238
244
|
>
|
|
239
245
|
{children}
|
|
240
|
-
</
|
|
246
|
+
</LayoutBlock>
|
|
241
247
|
);
|
|
242
248
|
}
|
|
243
249
|
|
|
@@ -6,6 +6,7 @@ import { DropdownContent } from "../overlays/dropdown-content";
|
|
|
6
6
|
import type { NavBrandProps, NavDropdownProps, NavGroupProps, NavbarProps } from "./navbar.types";
|
|
7
7
|
|
|
8
8
|
const ASKR_FRAGMENT = Symbol.for("askr.fragment");
|
|
9
|
+
const LayoutBlock = Block as (props: Record<string, unknown>) => JSX.Element;
|
|
9
10
|
|
|
10
11
|
function flattenNavbarChildren(children: unknown): unknown[] {
|
|
11
12
|
return toChildArray(children).flatMap((child) => {
|
|
@@ -45,7 +46,7 @@ export function Navbar(props: NavbarProps): JSX.Element {
|
|
|
45
46
|
|
|
46
47
|
if (!collapseAt) {
|
|
47
48
|
return (
|
|
48
|
-
<
|
|
49
|
+
<LayoutBlock
|
|
49
50
|
as="nav"
|
|
50
51
|
direction="row"
|
|
51
52
|
align="center"
|
|
@@ -55,7 +56,7 @@ export function Navbar(props: NavbarProps): JSX.Element {
|
|
|
55
56
|
data-slot="navbar"
|
|
56
57
|
>
|
|
57
58
|
{children}
|
|
58
|
-
</
|
|
59
|
+
</LayoutBlock>
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -64,9 +65,9 @@ export function Navbar(props: NavbarProps): JSX.Element {
|
|
|
64
65
|
const navChildren = navbarChildren.filter((child) => !isNavBrandChild(child));
|
|
65
66
|
const hasNavContent = hasRenderableChildren(navChildren);
|
|
66
67
|
const content = (
|
|
67
|
-
<
|
|
68
|
+
<LayoutBlock direction="row" align="center" gap="md" width="full" data-slot="navbar-content">
|
|
68
69
|
{navChildren}
|
|
69
|
-
</
|
|
70
|
+
</LayoutBlock>
|
|
70
71
|
);
|
|
71
72
|
const collapse = hasNavContent ? (
|
|
72
73
|
<details data-slot="navbar-collapse">
|
|
@@ -79,7 +80,7 @@ export function Navbar(props: NavbarProps): JSX.Element {
|
|
|
79
80
|
) : null;
|
|
80
81
|
|
|
81
82
|
return (
|
|
82
|
-
<
|
|
83
|
+
<LayoutBlock
|
|
83
84
|
as="nav"
|
|
84
85
|
direction="row"
|
|
85
86
|
align="center"
|
|
@@ -90,7 +91,7 @@ export function Navbar(props: NavbarProps): JSX.Element {
|
|
|
90
91
|
data-slot="navbar"
|
|
91
92
|
>
|
|
92
93
|
{[...brandChildren, collapse]}
|
|
93
|
-
</
|
|
94
|
+
</LayoutBlock>
|
|
94
95
|
);
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -98,9 +99,16 @@ export function NavBrand(props: NavBrandProps): JSX.Element {
|
|
|
98
99
|
const { children, ...rest } = props;
|
|
99
100
|
|
|
100
101
|
return (
|
|
101
|
-
<
|
|
102
|
+
<LayoutBlock
|
|
103
|
+
direction="row"
|
|
104
|
+
align="center"
|
|
105
|
+
gap="sm"
|
|
106
|
+
shrink={false}
|
|
107
|
+
{...rest}
|
|
108
|
+
data-slot="nav-brand"
|
|
109
|
+
>
|
|
102
110
|
{children}
|
|
103
|
-
</
|
|
111
|
+
</LayoutBlock>
|
|
104
112
|
);
|
|
105
113
|
}
|
|
106
114
|
|
|
@@ -108,12 +116,12 @@ export function NavGroup(props: NavGroupProps): JSX.Element {
|
|
|
108
116
|
const { align, children, label, title = label, ...rest } = props;
|
|
109
117
|
|
|
110
118
|
return (
|
|
111
|
-
<
|
|
119
|
+
<LayoutBlock align={align} gap="sm" {...rest} data-align={align} data-slot="nav-group">
|
|
112
120
|
{title !== undefined ? <div data-slot="nav-group-label">{title}</div> : null}
|
|
113
|
-
<
|
|
121
|
+
<LayoutBlock gap="xs" data-slot="nav-group-body">
|
|
114
122
|
{children}
|
|
115
|
-
</
|
|
116
|
-
</
|
|
123
|
+
</LayoutBlock>
|
|
124
|
+
</LayoutBlock>
|
|
117
125
|
);
|
|
118
126
|
}
|
|
119
127
|
|
|
@@ -121,7 +129,7 @@ export function NavDropdown(props: NavDropdownProps): JSX.Element {
|
|
|
121
129
|
const { align = "end", children, label, side = "bottom", sideOffset = 6, ...rest } = props;
|
|
122
130
|
|
|
123
131
|
return (
|
|
124
|
-
<
|
|
132
|
+
<LayoutBlock direction="row" align="center" data-slot="nav-dropdown">
|
|
125
133
|
<Dropdown {...rest}>
|
|
126
134
|
<DropdownTrigger class={classes("nav-item")} data-slot="nav-dropdown-trigger">
|
|
127
135
|
{label}
|
|
@@ -136,6 +144,6 @@ export function NavDropdown(props: NavDropdownProps): JSX.Element {
|
|
|
136
144
|
{children}
|
|
137
145
|
</DropdownContent>
|
|
138
146
|
</Dropdown>
|
|
139
|
-
</
|
|
147
|
+
</LayoutBlock>
|
|
140
148
|
);
|
|
141
149
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Slot } from "@askrjs/askr/foundations";
|
|
2
2
|
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import { intrinsicElement } from "../_internal/jsx";
|
|
3
4
|
import type { SeparatorAsChildProps, SeparatorNativeProps } from "./separator.types";
|
|
4
5
|
|
|
5
6
|
export function Separator(props: SeparatorNativeProps): JSX.Element;
|
|
@@ -19,5 +20,5 @@ export function Separator(props: SeparatorNativeProps | SeparatorAsChildProps) {
|
|
|
19
20
|
return <Slot asChild {...finalProps} children={children} />;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
return
|
|
23
|
+
return intrinsicElement("div", finalProps, children);
|
|
23
24
|
}
|
|
@@ -2,6 +2,7 @@ import { Slot } from "@askrjs/askr/foundations";
|
|
|
2
2
|
import { Block } from "../block";
|
|
3
3
|
import { classes } from "../_internal/classes";
|
|
4
4
|
import { mergeProps } from "../_internal/merge-props";
|
|
5
|
+
import { intrinsicElement } from "../_internal/jsx";
|
|
5
6
|
import type {
|
|
6
7
|
SidebarButtonProps,
|
|
7
8
|
SidebarPartProps,
|
|
@@ -25,7 +26,6 @@ function sidebarPart(
|
|
|
25
26
|
element: keyof JSX.IntrinsicElements = "div",
|
|
26
27
|
): JSX.Element {
|
|
27
28
|
const { as, asChild, children, class: className, ...rest } = props;
|
|
28
|
-
const Element = (as ?? element) as "div";
|
|
29
29
|
const finalProps = mergeProps(rest, {
|
|
30
30
|
class: className,
|
|
31
31
|
"data-slot": slot,
|
|
@@ -35,7 +35,7 @@ function sidebarPart(
|
|
|
35
35
|
return <Slot asChild {...finalProps} children={children as JSX.Element} />;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return
|
|
38
|
+
return intrinsicElement(String(as ?? element), finalProps, children);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export function Sidebar(props: SidebarProps): JSX.Element {
|
|
@@ -69,8 +69,8 @@ export function Sidebar(props: SidebarProps): JSX.Element {
|
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export function
|
|
73
|
-
return sidebarPart(props, "sidebar-
|
|
72
|
+
export function SidebarScope(props: SidebarPartProps): JSX.Element {
|
|
73
|
+
return sidebarPart(props, "sidebar-scope");
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export function SidebarInset(props: SidebarPartProps): JSX.Element {
|
|
@@ -136,7 +136,7 @@ export function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
return (
|
|
139
|
-
<button type={type} {...finalProps}>
|
|
139
|
+
<button type={type as "button" | "submit" | "reset" | undefined} {...finalProps}>
|
|
140
140
|
{children}
|
|
141
141
|
</button>
|
|
142
142
|
);
|
|
@@ -146,7 +146,7 @@ export function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {
|
|
|
146
146
|
const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
|
|
147
147
|
return (
|
|
148
148
|
<button
|
|
149
|
-
type={type}
|
|
149
|
+
type={type as "button" | "submit" | "reset" | undefined}
|
|
150
150
|
{...mergeProps(rest, {
|
|
151
151
|
class: classes(className),
|
|
152
152
|
"data-slot": "sidebar-menu-action",
|
|
@@ -170,7 +170,7 @@ export function SidebarTrigger(props: SidebarButtonProps): JSX.Element {
|
|
|
170
170
|
const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
|
|
171
171
|
return (
|
|
172
172
|
<button
|
|
173
|
-
type={type}
|
|
173
|
+
type={type as "button" | "submit" | "reset" | undefined}
|
|
174
174
|
{...mergeProps(rest, {
|
|
175
175
|
class: classes("btn btn-ghost btn-icon", className),
|
|
176
176
|
"data-slot": "sidebar-trigger",
|
|
@@ -2,6 +2,7 @@ import { Slot } from "@askrjs/askr/foundations";
|
|
|
2
2
|
import { mergeLayoutStyles } from "../_internal/block-layout";
|
|
3
3
|
import { classes } from "../_internal/classes";
|
|
4
4
|
import { mergeProps } from "../_internal/merge-props";
|
|
5
|
+
import { intrinsicElement } from "../_internal/jsx";
|
|
5
6
|
import { styleDeclarationsToClass } from "../_internal/style";
|
|
6
7
|
import type { SkeletonAsChildProps, SkeletonProps } from "./skeleton.types";
|
|
7
8
|
|
|
@@ -28,15 +29,12 @@ export function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {
|
|
|
28
29
|
className?: unknown;
|
|
29
30
|
style?: unknown;
|
|
30
31
|
};
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
style,
|
|
38
|
-
),
|
|
39
|
-
);
|
|
32
|
+
const dimensions: Record<string, string | number> = {};
|
|
33
|
+
const blockSize = resolveSkeletonDimension(height);
|
|
34
|
+
const inlineSize = resolveSkeletonDimension(width);
|
|
35
|
+
if (blockSize !== undefined) dimensions.blockSize = blockSize;
|
|
36
|
+
if (inlineSize !== undefined) dimensions.inlineSize = inlineSize;
|
|
37
|
+
const layoutClass = styleDeclarationsToClass(mergeLayoutStyles(dimensions, style));
|
|
40
38
|
const finalProps = mergeProps(rest, {
|
|
41
39
|
ref,
|
|
42
40
|
class: classes(classProp, className, layoutClass),
|
|
@@ -49,5 +47,5 @@ export function Skeleton(props: SkeletonProps | SkeletonAsChildProps) {
|
|
|
49
47
|
return <Slot asChild {...finalProps} children={children} />;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
return
|
|
50
|
+
return intrinsicElement("div", finalProps, children);
|
|
53
51
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { classes } from "../_internal/classes";
|
|
2
2
|
import { mergeProps } from "../_internal/merge-props";
|
|
3
|
+
import { intrinsicElement } from "../_internal/jsx";
|
|
3
4
|
import type { TextElement, TextProps } from "./text.types";
|
|
4
5
|
|
|
5
6
|
const DEFAULT_ELEMENT = "p";
|
|
@@ -34,6 +35,5 @@ export function Text<TElement extends TextElement = "p">(props: TextProps<TEleme
|
|
|
34
35
|
"data-truncate": truncate ? "true" : undefined,
|
|
35
36
|
});
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
return <Element {...finalProps}>{children}</Element>;
|
|
38
|
+
return intrinsicElement(as ?? DEFAULT_ELEMENT, finalProps, children);
|
|
39
39
|
}
|
|
@@ -3,17 +3,17 @@ export {
|
|
|
3
3
|
CAT_THEME_OPTIONS,
|
|
4
4
|
DEFAULT_THEME_OPTIONS,
|
|
5
5
|
ThemePicker,
|
|
6
|
-
|
|
6
|
+
ThemeScope,
|
|
7
7
|
ThemeToggle,
|
|
8
|
-
|
|
8
|
+
theme,
|
|
9
9
|
} from "./theme";
|
|
10
10
|
export type {
|
|
11
11
|
CatThemeName,
|
|
12
|
-
|
|
12
|
+
ThemeScopeValue,
|
|
13
13
|
ThemeName,
|
|
14
14
|
ThemeOption,
|
|
15
15
|
ThemePickerProps,
|
|
16
|
-
|
|
16
|
+
ThemeScopeProps,
|
|
17
17
|
ThemeToggleProps,
|
|
18
18
|
ThemeToggleRenderContext,
|
|
19
19
|
} from "./theme";
|