@askrjs/themes 0.0.16 → 0.0.17

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.
Files changed (177) hide show
  1. package/README.md +25 -0
  2. package/THEMING.md +6 -5
  3. package/dist/components/_internal/block-layout.d.ts +1 -0
  4. package/dist/components/_internal/block-layout.js +14 -11
  5. package/dist/components/_internal/block-layout.js.map +1 -1
  6. package/dist/components/_internal/classes.js +8 -1
  7. package/dist/components/_internal/classes.js.map +1 -1
  8. package/dist/components/_internal/jsx.js.map +1 -1
  9. package/dist/components/_internal/style.js +182 -28
  10. package/dist/components/_internal/style.js.map +1 -1
  11. package/dist/components/alert/alert.d.ts +1 -0
  12. package/dist/components/alert/alert.js.map +1 -1
  13. package/dist/components/alert/alert.types.d.ts +1 -0
  14. package/dist/components/aside/aside.d.ts +1 -0
  15. package/dist/components/aside/aside.js.map +1 -1
  16. package/dist/components/aspect-ratio/aspect-ratio.d.ts +1 -0
  17. package/dist/components/aspect-ratio/aspect-ratio.js.map +1 -1
  18. package/dist/components/aspect-ratio/aspect-ratio.types.d.ts +1 -0
  19. package/dist/components/badge/badge.d.ts +1 -0
  20. package/dist/components/badge/badge.js.map +1 -1
  21. package/dist/components/badge/badge.types.d.ts +1 -0
  22. package/dist/components/block/block.d.ts +1 -0
  23. package/dist/components/block/block.js +2 -2
  24. package/dist/components/block/block.js.map +1 -1
  25. package/dist/components/block/block.types.d.ts +1 -0
  26. package/dist/components/brand/brand.d.ts +1 -0
  27. package/dist/components/brand/brand.js +2 -2
  28. package/dist/components/brand/brand.js.map +1 -1
  29. package/dist/components/brand/brand.types.d.ts +1 -0
  30. package/dist/components/button-group/button-group.d.ts +1 -0
  31. package/dist/components/button-group/button-group.js.map +1 -1
  32. package/dist/components/button-group/button-group.types.d.ts +1 -0
  33. package/dist/components/card/card.d.ts +1 -0
  34. package/dist/components/card/card.js.map +1 -1
  35. package/dist/components/card/card.types.d.ts +1 -0
  36. package/dist/components/catalog.d.ts +1 -0
  37. package/dist/components/catalog.js +22 -13
  38. package/dist/components/catalog.js.map +1 -1
  39. package/dist/components/close/close.d.ts +1 -0
  40. package/dist/components/close/close.js.map +1 -1
  41. package/dist/components/container/container.d.ts +1 -0
  42. package/dist/components/container/container.js.map +1 -1
  43. package/dist/components/empty-state/empty-state.d.ts +1 -0
  44. package/dist/components/empty-state/empty-state.js.map +1 -1
  45. package/dist/components/field/field.d.ts +1 -0
  46. package/dist/components/field/field.js.map +1 -1
  47. package/dist/components/field/field.types.d.ts +1 -0
  48. package/dist/components/footer/footer.d.ts +1 -0
  49. package/dist/components/footer/footer.js.map +1 -1
  50. package/dist/components/footer/footer.types.d.ts +1 -0
  51. package/dist/components/grid/grid.d.ts +1 -0
  52. package/dist/components/grid/grid.js.map +1 -1
  53. package/dist/components/grid/grid.types.d.ts +1 -0
  54. package/dist/components/header/header.d.ts +1 -0
  55. package/dist/components/header/header.js.map +1 -1
  56. package/dist/components/input-group/input-group.d.ts +1 -0
  57. package/dist/components/input-group/input-group.js.map +1 -1
  58. package/dist/components/input-group/input-group.types.d.ts +1 -0
  59. package/dist/components/jsx-types.d.ts +12 -0
  60. package/dist/components/main/main.d.ts +1 -0
  61. package/dist/components/main/main.js.map +1 -1
  62. package/dist/components/nav/nav.d.ts +1 -0
  63. package/dist/components/nav/nav.js +6 -2
  64. package/dist/components/nav/nav.js.map +1 -1
  65. package/dist/components/nav/nav.types.d.ts +2 -0
  66. package/dist/components/navbar/navbar.d.ts +1 -0
  67. package/dist/components/navbar/navbar.js +15 -10
  68. package/dist/components/navbar/navbar.js.map +1 -1
  69. package/dist/components/overlays/dropdown-content.d.ts +1 -0
  70. package/dist/components/overlays/dropdown-content.js.map +1 -1
  71. package/dist/components/page/page.d.ts +1 -0
  72. package/dist/components/page/page.js.map +1 -1
  73. package/dist/components/page-header/page-header.d.ts +1 -0
  74. package/dist/components/page-header/page-header.js.map +1 -1
  75. package/dist/components/section/section.d.ts +1 -0
  76. package/dist/components/section/section.js.map +1 -1
  77. package/dist/components/separator/separator.d.ts +1 -0
  78. package/dist/components/separator/separator.js.map +1 -1
  79. package/dist/components/separator/separator.types.d.ts +1 -0
  80. package/dist/components/sidebar/index.d.ts +2 -2
  81. package/dist/components/sidebar/sidebar.d.ts +2 -1
  82. package/dist/components/sidebar/sidebar.js +39 -13
  83. package/dist/components/sidebar/sidebar.js.map +1 -1
  84. package/dist/components/sidebar/sidebar.types.d.ts +3 -1
  85. package/dist/components/skeleton/skeleton.d.ts +1 -0
  86. package/dist/components/skeleton/skeleton.js.map +1 -1
  87. package/dist/components/skeleton/skeleton.types.d.ts +1 -0
  88. package/dist/components/spinner/spinner.d.ts +1 -0
  89. package/dist/components/spinner/spinner.js.map +1 -1
  90. package/dist/components/stat/stat.d.ts +1 -0
  91. package/dist/components/stat/stat.js.map +1 -1
  92. package/dist/components/stat/stat.types.d.ts +1 -0
  93. package/dist/components/text/text.d.ts +1 -0
  94. package/dist/components/text/text.js.map +1 -1
  95. package/dist/components/text/text.types.d.ts +1 -0
  96. package/dist/components/theme/theme.d.ts +2 -0
  97. package/dist/components/theme/theme.js +32 -16
  98. package/dist/components/theme/theme.js.map +1 -1
  99. package/dist/components/toolbar/toolbar.d.ts +1 -0
  100. package/dist/components/toolbar/toolbar.js.map +1 -1
  101. package/dist/components.d.ts +6 -3
  102. package/dist/core.d.ts +2 -2
  103. package/dist/ssr.d.ts +18 -0
  104. package/dist/ssr.js +63 -0
  105. package/dist/ssr.js.map +1 -0
  106. package/dist/themes/default/index.css +36 -6
  107. package/package.json +7 -3
  108. package/src/components/_internal/block-layout.ts +27 -16
  109. package/src/components/_internal/classes.ts +15 -2
  110. package/src/components/_internal/jsx.ts +1 -1
  111. package/src/components/_internal/style.ts +241 -27
  112. package/src/components/alert/alert.tsx +1 -0
  113. package/src/components/alert/alert.types.ts +1 -0
  114. package/src/components/aside/aside.tsx +1 -0
  115. package/src/components/aspect-ratio/aspect-ratio.tsx +1 -0
  116. package/src/components/aspect-ratio/aspect-ratio.types.ts +1 -0
  117. package/src/components/badge/badge.tsx +1 -0
  118. package/src/components/badge/badge.types.ts +1 -0
  119. package/src/components/block/block.tsx +4 -1
  120. package/src/components/block/block.types.ts +1 -0
  121. package/src/components/brand/brand.tsx +6 -2
  122. package/src/components/brand/brand.types.ts +1 -0
  123. package/src/components/button-group/button-group.tsx +1 -0
  124. package/src/components/button-group/button-group.types.ts +1 -0
  125. package/src/components/card/card.tsx +1 -0
  126. package/src/components/card/card.types.ts +1 -0
  127. package/src/components/catalog.tsx +15 -4
  128. package/src/components/close/close.tsx +1 -0
  129. package/src/components/container/container.tsx +1 -0
  130. package/src/components/empty-state/empty-state.tsx +1 -0
  131. package/src/components/field/field.tsx +1 -0
  132. package/src/components/field/field.types.ts +1 -0
  133. package/src/components/footer/footer.tsx +1 -0
  134. package/src/components/footer/footer.types.ts +1 -0
  135. package/src/components/grid/grid.tsx +1 -0
  136. package/src/components/grid/grid.types.ts +1 -0
  137. package/src/components/header/header.tsx +1 -0
  138. package/src/components/input-group/input-group.tsx +1 -0
  139. package/src/components/input-group/input-group.types.ts +1 -0
  140. package/src/components/jsx-types.ts +16 -0
  141. package/src/components/main/main.tsx +1 -0
  142. package/src/components/nav/nav.tsx +16 -2
  143. package/src/components/nav/nav.types.ts +2 -0
  144. package/src/components/navbar/navbar.tsx +19 -8
  145. package/src/components/overlays/dropdown-content.tsx +1 -0
  146. package/src/components/page/page.tsx +1 -0
  147. package/src/components/page-header/page-header.tsx +1 -0
  148. package/src/components/section/section.tsx +1 -0
  149. package/src/components/separator/separator.tsx +1 -0
  150. package/src/components/separator/separator.types.ts +1 -0
  151. package/src/components/sidebar/index.ts +1 -0
  152. package/src/components/sidebar/sidebar.tsx +45 -20
  153. package/src/components/sidebar/sidebar.types.ts +3 -0
  154. package/src/components/skeleton/skeleton.tsx +1 -0
  155. package/src/components/skeleton/skeleton.types.ts +1 -0
  156. package/src/components/spinner/spinner.tsx +1 -0
  157. package/src/components/stat/stat.tsx +1 -0
  158. package/src/components/stat/stat.types.ts +1 -0
  159. package/src/components/text/text.tsx +1 -0
  160. package/src/components/text/text.types.ts +1 -0
  161. package/src/components/theme/theme.tsx +43 -12
  162. package/src/components/toolbar/toolbar.tsx +1 -0
  163. package/src/components.ts +9 -0
  164. package/src/ssr.ts +102 -0
  165. package/src/themes/default/styles/base/text.css +4 -4
  166. package/src/themes/default/styles/layout/layout.css +108 -0
  167. package/src/themes/default/styles/shell/navbar.css +4 -1
  168. package/src/themes/default/tokens.css +1 -1
  169. package/src/themes/presets/ginger.css +3 -3
  170. package/templates/theme/styles/base/text.css +4 -4
  171. package/templates/theme/styles/display/progress-circle.css +2 -0
  172. package/templates/theme/styles/forms/input-group.css +2 -1
  173. package/templates/theme/styles/layout/layout.css +108 -0
  174. package/templates/theme/styles/overlays/toast.css +11 -0
  175. package/templates/theme/styles/shell/navbar.css +4 -1
  176. package/templates/theme/styles/shell/sidebar.css +18 -1
  177. package/templates/theme/tokens.css +1 -1
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { AsideProps } from "./aside.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import { mergeLayoutStyles } from "../_internal/block-layout";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { classes } from "../_internal/classes";
3
4
  import { mergeProps } from "../_internal/merge-props";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { classes } from "../_internal/classes";
3
4
  import {
@@ -15,8 +16,8 @@ const DEFAULT_ELEMENT = "div";
15
16
  export function Block(props: BlockNativeProps): JSX.Element;
16
17
  export function Block(props: BlockAsChildProps): JSX.Element;
17
18
  export function Block(props: BlockNativeProps | BlockAsChildProps) {
18
- const as = "as" in props ? props.as : DEFAULT_ELEMENT;
19
19
  const {
20
+ as: asProp,
20
21
  asChild,
21
22
  children,
22
23
  ref,
@@ -25,10 +26,12 @@ export function Block(props: BlockNativeProps | BlockAsChildProps) {
25
26
  style: userStyle,
26
27
  ...rest
27
28
  } = props as (BlockNativeProps | BlockAsChildProps) & {
29
+ as?: BlockNativeProps["as"];
28
30
  class?: unknown;
29
31
  className?: unknown;
30
32
  style?: unknown;
31
33
  };
34
+ const as = asProp ?? DEFAULT_ELEMENT;
32
35
 
33
36
  const { blockProps, rest: passthroughProps } = splitBlockLayoutProps(rest);
34
37
  const layoutStyle: Record<string, string | number> = {};
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
  import type {
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { classes } from "../_internal/classes";
3
4
  import { mergeProps } from "../_internal/merge-props";
@@ -16,14 +17,17 @@ export function Brand<TElement extends "div" | "a" | "span" = "div">(
16
17
  props: BrandProps<TElement>,
17
18
  ): JSX.Element {
18
19
  const {
20
+ as: asProp,
19
21
  asChild,
20
22
  children,
21
23
  class: classProp,
22
24
  className,
23
25
  ref,
24
26
  ...rest
25
- } = props as BrandNativeProps | BrandAsChildProps;
26
- const as = "as" in props ? props.as : undefined;
27
+ } = props as (BrandNativeProps | BrandAsChildProps) & {
28
+ as?: "div" | "a" | "span";
29
+ };
30
+ const as = asProp;
27
31
 
28
32
  const finalProps = mergeProps(rest, {
29
33
  ref,
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  export type BrandElement = "div" | "a" | "span";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { ButtonGroupProps } from "./button-group.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  export type ButtonGroupOrientation = "horizontal" | "vertical";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import type {
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  export type CardVariant = "default" | "raised";
@@ -1,11 +1,16 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
- import { DialogContent } from "@askrjs/ui";
4
+ import { DialogContent, DialogDescription, DialogTitle } from "@askrjs/ui";
4
5
  import { Block } from "./block";
5
6
  import { classes } from "./_internal/classes";
6
7
  import { mergeProps } from "./_internal/merge-props";
7
8
 
8
9
  const CatalogDialogContent = DialogContent as (props: Record<string, unknown>) => JSX.Element;
10
+ const CatalogDialogTitle = DialogTitle as (props: Record<string, unknown>) => JSX.Element;
11
+ const CatalogDialogDescription = DialogDescription as (
12
+ props: Record<string, unknown>,
13
+ ) => JSX.Element;
9
14
 
10
15
  type CatalogElement = keyof JSX.IntrinsicElements;
11
16
 
@@ -42,13 +47,18 @@ function catalogPart(props: CatalogComponentProps, defaults: CatalogDefaults): J
42
47
  }
43
48
 
44
49
  function buttonPart(props: CatalogComponentProps, slot: string, className?: string): JSX.Element {
45
- const { children, ref, class: classProp, type = "button", ...rest } = props;
50
+ const { as, asChild, children, ref, class: classProp, type = "button", ...rest } = props;
51
+ void as;
46
52
  const finalProps = mergeProps(rest, {
47
53
  ref,
48
54
  class: classes(className, classProp),
49
55
  "data-slot": slot,
50
56
  });
51
57
 
58
+ if (asChild) {
59
+ return <Slot asChild {...finalProps} children={children as JSX.Element} />;
60
+ }
61
+
52
62
  return (
53
63
  <button type={type as "button" | "submit" | "reset"} {...finalProps}>
54
64
  {children}
@@ -249,6 +259,7 @@ export function CalendarDay(
249
259
  const { disabled, outside, rangeEnd, rangeMiddle, rangeStart, selected, today, ...rest } = props;
250
260
  return buttonPart(
251
261
  {
262
+ disabled,
252
263
  "aria-disabled": disabled ? "true" : undefined,
253
264
  "aria-selected": selected ? "true" : undefined,
254
265
  "data-disabled": disabled ? "" : undefined,
@@ -661,11 +672,11 @@ export function SheetFooter(props: CatalogComponentProps): JSX.Element {
661
672
  }
662
673
 
663
674
  export function SheetTitle(props: CatalogComponentProps): JSX.Element {
664
- return catalogPart(props, { slot: "sheet-title", element: "h2" });
675
+ return <CatalogDialogTitle {...props} data-slot="sheet-title" />;
665
676
  }
666
677
 
667
678
  export function SheetDescription(props: CatalogComponentProps): JSX.Element {
668
- return catalogPart(props, { slot: "sheet-description", element: "p" });
679
+ return <CatalogDialogDescription {...props} data-slot="sheet-description" />;
669
680
  }
670
681
 
671
682
  export function Toaster(props: CatalogComponentProps): JSX.Element {
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Button, type ButtonNativeProps } from "@askrjs/ui";
2
3
  import { classes } from "../_internal/classes";
3
4
  import type { CloseNativeProps } from "./close.types";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { ContainerProps } from "./container.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { EmptyStateProps } from "./empty-state.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import type { FieldErrorProps, FieldHintProps, FieldProps } from "./field.types";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  type DivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref">;
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import { classes } from "../_internal/classes";
3
4
  import { mergeProps } from "../_internal/merge-props";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { BlockElementProps } from "../block";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { mergeLayoutStyles } from "../_internal/block-layout";
3
4
  import { mergeProps } from "../_internal/merge-props";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
  import type { BlockSpace, ResponsiveValue } from "../_internal/block-layout";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { HeaderProps } from "./header.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { mergeProps } from "@askrjs/askr/foundations/utilities";
3
4
  import { classes } from "../_internal/classes";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -0,0 +1,16 @@
1
+ import type { JSXElement } from "@askrjs/askr/foundations/structures";
2
+
3
+ declare global {
4
+ namespace JSX {
5
+ interface Element extends JSXElement {
6
+ readonly __askrThemesJsxElementBrand?: never;
7
+ }
8
+
9
+ interface IntrinsicElements {
10
+ // @ts-ignore The Askr source types already provide a compatible fallback index.
11
+ [element: string]: Record<string, unknown>;
12
+ }
13
+ }
14
+ }
15
+
16
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { MainProps } from "./main.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { currentRoute, Link, navigate } from "@askrjs/askr/router";
3
4
  import { Block } from "../block";
@@ -103,13 +104,17 @@ function renderRoutedLink(
103
104
  children,
104
105
  href: suppliedHref,
105
106
  to,
107
+ onPress,
106
108
  onClick,
107
109
  ref,
108
110
  class: className,
109
111
  match = "prefix",
110
112
  target,
111
113
  ...rest
112
- } = props as NavLinkProps & { onClick?: (event: MouseEvent) => void };
114
+ } = props as NavLinkProps & {
115
+ onPress?: (event: Event) => void;
116
+ onClick?: (event: MouseEvent) => void;
117
+ };
113
118
  const href = to?.href ?? suppliedHref;
114
119
  if (!href) {
115
120
  throw new Error("Nav link requires href or to.");
@@ -124,6 +129,7 @@ function renderRoutedLink(
124
129
  slot === "nav-item" && resolvedSlot !== "nav-item" ? "nav-item" : undefined;
125
130
  const { "data-slot": _dataSlot, ...childRest } = rest as Record<string, unknown>;
126
131
  void _dataSlot;
132
+ const hasDownload = (rest as Record<string, unknown>).download !== undefined;
127
133
  const currentPathname = getReactiveCurrentPathname();
128
134
  const targetPathname = resolvePathname(href);
129
135
  const routeActive =
@@ -139,12 +145,20 @@ function renderRoutedLink(
139
145
  : {
140
146
  "data-active": undefined,
141
147
  };
142
- const rendersRouterLink = targetPathname !== null && !target && typeof onClick !== "function";
148
+ const rendersRouterLink =
149
+ targetPathname !== null &&
150
+ !target &&
151
+ !hasDownload &&
152
+ typeof onClick !== "function" &&
153
+ typeof onPress !== "function";
143
154
  const childProps: NavLinkProps = to
144
155
  ? ({ ...childRest, to, target } as NavLinkProps)
145
156
  : ({ ...childRest, href, target } as NavLinkProps);
146
157
  const handleClick = (event: MouseEvent) => {
158
+ onPress?.(event);
159
+ if (event.defaultPrevented) return;
147
160
  onClick?.(event);
161
+ if (hasDownload) return;
148
162
 
149
163
  if (!shouldHandleClientNavigation(event, target, targetPathname)) {
150
164
  return;
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
  import type { LinkProps } from "@askrjs/askr/router";
@@ -58,6 +59,7 @@ export type NavItemAsChildProps = Omit<JSX.IntrinsicElements["a"], "children" |
58
59
 
59
60
  export type NavLinkOwnProps = NavItemOwnProps & {
60
61
  match?: NavLinkMatch;
62
+ onPress?: (event: Event) => void;
61
63
  };
62
64
 
63
65
  export type NavLinkProps = LinkProps & NavLinkOwnProps;
@@ -1,4 +1,11 @@
1
- import { Dropdown, DropdownTrigger } from "@askrjs/ui";
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
2
+ import {
3
+ Collapsible,
4
+ CollapsibleContent,
5
+ CollapsibleTrigger,
6
+ Dropdown,
7
+ DropdownTrigger,
8
+ } from "@askrjs/ui";
2
9
  import { Block } from "../block";
3
10
  import { classes } from "../_internal/classes";
4
11
  import { isJsxElement, toChildArray } from "../_internal/jsx";
@@ -70,13 +77,17 @@ export function Navbar(props: NavbarProps): JSX.Element {
70
77
  </LayoutBlock>
71
78
  );
72
79
  const collapse = hasNavContent ? (
73
- <details data-slot="navbar-collapse">
74
- <summary aria-label={collapseLabel} data-slot="navbar-toggle">
75
- {collapseIcon}
76
- <span data-slot="navbar-toggle-label">{collapseLabel}</span>
77
- </summary>
78
- {content}
79
- </details>
80
+ <div data-slot="navbar-collapse">
81
+ <Collapsible>
82
+ <CollapsibleTrigger aria-label={collapseLabel} data-slot="navbar-toggle">
83
+ {collapseIcon}
84
+ <span data-slot="navbar-toggle-label">{collapseLabel}</span>
85
+ </CollapsibleTrigger>
86
+ <CollapsibleContent forceMount asChild data-slot="navbar-content">
87
+ {content}
88
+ </CollapsibleContent>
89
+ </Collapsible>
90
+ </div>
80
91
  ) : null;
81
92
 
82
93
  return (
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { DropdownContent as UiDropdownContent } from "@askrjs/ui";
2
3
  import type { DropdownContentAsChildProps, DropdownContentProps } from "@askrjs/ui";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import { Container } from "../container";
3
4
  import type { PageProps } from "./page.types";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { PageHeaderProps } from "./page-header.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Block } from "../block";
2
3
  import type { SectionProps } from "./section.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import { intrinsicElement } from "../_internal/jsx";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -21,6 +21,7 @@ export type {
21
21
  SidebarCollapsible,
22
22
  SidebarPartProps,
23
23
  SidebarProps,
24
+ SidebarRailProps,
24
25
  SidebarSide,
25
26
  SidebarTooltipSide,
26
27
  SidebarVariant,
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { Block } from "../block";
3
4
  import { classes } from "../_internal/classes";
@@ -143,16 +144,23 @@ export function SidebarMenuButton(props: SidebarButtonProps): JSX.Element {
143
144
  }
144
145
 
145
146
  export function SidebarMenuAction(props: SidebarButtonProps): JSX.Element {
146
- const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
147
+ const {
148
+ asChild,
149
+ children,
150
+ class: className,
151
+ tooltip,
152
+ tooltipSide,
153
+ type = "button",
154
+ ...rest
155
+ } = props;
156
+ const finalProps = mergeProps(rest, {
157
+ class: classes(className),
158
+ "data-slot": "sidebar-menu-action",
159
+ ...sidebarTooltipProps(tooltip, tooltipSide),
160
+ });
161
+ if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;
147
162
  return (
148
- <button
149
- type={type as "button" | "submit" | "reset" | undefined}
150
- {...mergeProps(rest, {
151
- class: classes(className),
152
- "data-slot": "sidebar-menu-action",
153
- ...sidebarTooltipProps(tooltip, tooltipSide),
154
- })}
155
- >
163
+ <button type={type as "button" | "submit" | "reset" | undefined} {...finalProps}>
156
164
  {children}
157
165
  </button>
158
166
  );
@@ -162,21 +170,38 @@ export function SidebarMenuBadge(props: SidebarPartProps): JSX.Element {
162
170
  return sidebarPart(props, "sidebar-menu-badge", "span");
163
171
  }
164
172
 
165
- export function SidebarRail(props: SidebarPartProps): JSX.Element {
166
- return sidebarPart(props, "sidebar-rail", "button");
173
+ export function SidebarRail(props: SidebarButtonProps): JSX.Element {
174
+ const { asChild, children, class: className, type = "button", ...rest } = props;
175
+ const finalProps = mergeProps(rest, {
176
+ class: classes(className),
177
+ "data-slot": "sidebar-rail",
178
+ });
179
+ if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;
180
+ return (
181
+ <button type={type as "button" | "submit" | "reset" | undefined} {...finalProps}>
182
+ {children}
183
+ </button>
184
+ );
167
185
  }
168
186
 
169
187
  export function SidebarTrigger(props: SidebarButtonProps): JSX.Element {
170
- const { children, class: className, tooltip, tooltipSide, type = "button", ...rest } = props;
188
+ const {
189
+ asChild,
190
+ children,
191
+ class: className,
192
+ tooltip,
193
+ tooltipSide,
194
+ type = "button",
195
+ ...rest
196
+ } = props;
197
+ const finalProps = mergeProps(rest, {
198
+ class: classes("btn btn-ghost btn-icon", className),
199
+ "data-slot": "sidebar-trigger",
200
+ ...sidebarTooltipProps(tooltip, tooltipSide),
201
+ });
202
+ if (asChild) return <Slot asChild {...finalProps} children={children as JSX.Element} />;
171
203
  return (
172
- <button
173
- type={type as "button" | "submit" | "reset" | undefined}
174
- {...mergeProps(rest, {
175
- class: classes("btn btn-ghost btn-icon", className),
176
- "data-slot": "sidebar-trigger",
177
- ...sidebarTooltipProps(tooltip, tooltipSide),
178
- })}
179
- >
204
+ <button type={type as "button" | "submit" | "reset" | undefined} {...finalProps}>
180
205
  {children}
181
206
  </button>
182
207
  );
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { BlockElementProps } from "../block";
2
3
 
3
4
  export type SidebarCollapsible = "offcanvas" | "icon" | "none";
@@ -26,3 +27,5 @@ export type SidebarButtonProps = JSX.IntrinsicElements["button"] & {
26
27
  tooltipSide?: SidebarTooltipSide;
27
28
  variant?: "default" | "outline";
28
29
  };
30
+
31
+ export type SidebarRailProps = SidebarButtonProps;
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { Slot } from "@askrjs/askr/foundations";
2
3
  import { mergeLayoutStyles } from "../_internal/block-layout";
3
4
  import { classes } from "../_internal/classes";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { JSXElement } from "@askrjs/askr/foundations";
2
3
  import type { Ref } from "@askrjs/askr/foundations/utilities";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { ProgressCircle, ProgressCircleIndicator } from "@askrjs/ui";
2
3
  import type { SpinnerProps } from "./spinner.types";
3
4
 
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import type { StatDescriptionProps, StatLabelProps, StatProps, StatValueProps } from "./stat.types";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  type DivProps = Omit<JSX.IntrinsicElements["div"], "children" | "ref">;
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import { classes } from "../_internal/classes";
2
3
  import { mergeProps } from "../_internal/merge-props";
3
4
  import { intrinsicElement } from "../_internal/jsx";
@@ -1,3 +1,4 @@
1
+ import type { JSX } from "@askrjs/askr/jsx-runtime";
1
2
  import type { Ref } from "@askrjs/askr/foundations/utilities";
2
3
 
3
4
  export type TextElement = "p" | "span" | "div" | "strong";