@kirana-ui/solid 0.1.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.
Files changed (193) hide show
  1. package/dom/accordion.js +9 -6
  2. package/dom/agent.js +3 -0
  3. package/dom/autosize.js +1 -1
  4. package/dom/avatar.js +3 -3
  5. package/dom/button.js +1 -1
  6. package/dom/calendar.js +12 -8
  7. package/dom/carousel.js +6 -6
  8. package/dom/checkbox.js +3 -3
  9. package/dom/collapsible.js +3 -3
  10. package/dom/combobox.js +19 -11
  11. package/dom/command.js +8 -8
  12. package/dom/date-field.js +7 -3
  13. package/dom/date-picker.js +2 -2
  14. package/dom/dialog.js +5 -2
  15. package/dom/field.js +3 -3
  16. package/dom/fieldset.js +2 -2
  17. package/dom/form.js +1 -1
  18. package/dom/hover-popup.js +3 -3
  19. package/dom/input.js +1 -1
  20. package/dom/label.js +1 -1
  21. package/dom/listbox.js +5 -5
  22. package/dom/menu.js +11 -11
  23. package/dom/menubar.js +1 -1
  24. package/dom/message-scroller.js +4 -4
  25. package/dom/navigation-menu.js +18 -21
  26. package/dom/number-field.js +3 -3
  27. package/dom/otp.js +4 -4
  28. package/dom/pagination.js +3 -3
  29. package/dom/popover.js +20 -7
  30. package/dom/qr-code.js +3 -3
  31. package/dom/radio-group.js +4 -4
  32. package/dom/resizable.js +3 -3
  33. package/dom/runtime.js +23 -7
  34. package/dom/scroll-area.js +5 -5
  35. package/dom/select.js +25 -13
  36. package/dom/separator.js +1 -1
  37. package/dom/slider.js +10 -7
  38. package/dom/switch.js +3 -3
  39. package/dom/tabs.js +5 -5
  40. package/dom/testing.js +3 -0
  41. package/dom/toast.js +57 -20
  42. package/dom/toggle-group.js +1 -1
  43. package/dom/toggle.js +1 -1
  44. package/dom/toolbar.js +4 -4
  45. package/dom/value-bar.js +3 -3
  46. package/llms.txt +1588 -224
  47. package/package.json +18 -2
  48. package/server/accordion.js +9 -6
  49. package/server/agent.js +3 -0
  50. package/server/autosize.js +1 -1
  51. package/server/avatar.js +3 -3
  52. package/server/button.js +1 -1
  53. package/server/calendar.js +12 -8
  54. package/server/carousel.js +6 -6
  55. package/server/checkbox.js +3 -3
  56. package/server/collapsible.js +3 -3
  57. package/server/combobox.js +19 -11
  58. package/server/command.js +8 -8
  59. package/server/date-field.js +7 -3
  60. package/server/date-picker.js +2 -2
  61. package/server/dialog.js +5 -2
  62. package/server/field.js +3 -3
  63. package/server/fieldset.js +2 -2
  64. package/server/form.js +1 -1
  65. package/server/hover-popup.js +3 -3
  66. package/server/input.js +1 -1
  67. package/server/label.js +1 -1
  68. package/server/listbox.js +5 -5
  69. package/server/menu.js +11 -11
  70. package/server/menubar.js +1 -1
  71. package/server/message-scroller.js +4 -4
  72. package/server/navigation-menu.js +18 -15
  73. package/server/number-field.js +3 -3
  74. package/server/otp.js +4 -4
  75. package/server/pagination.js +3 -3
  76. package/server/popover.js +20 -7
  77. package/server/qr-code.js +3 -3
  78. package/server/radio-group.js +4 -4
  79. package/server/resizable.js +3 -3
  80. package/server/runtime.js +23 -7
  81. package/server/scroll-area.js +5 -5
  82. package/server/select.js +25 -13
  83. package/server/separator.js +1 -1
  84. package/server/slider.js +10 -7
  85. package/server/switch.js +3 -3
  86. package/server/tabs.js +5 -5
  87. package/server/testing.js +3 -0
  88. package/server/toast.js +57 -20
  89. package/server/toggle-group.js +1 -1
  90. package/server/toggle.js +1 -1
  91. package/server/toolbar.js +4 -4
  92. package/server/value-bar.js +3 -3
  93. package/skills/kirana-ui-primitives/SKILL.md +142 -0
  94. package/src/accordion.jsx +10 -7
  95. package/src/agent.js +3 -0
  96. package/src/autosize.jsx +1 -1
  97. package/src/avatar.jsx +3 -3
  98. package/src/button.jsx +1 -1
  99. package/src/calendar.jsx +12 -8
  100. package/src/carousel.jsx +6 -6
  101. package/src/checkbox.jsx +3 -3
  102. package/src/collapsible.jsx +3 -3
  103. package/src/combobox.jsx +20 -12
  104. package/src/command.jsx +8 -8
  105. package/src/date-field.jsx +7 -3
  106. package/src/date-picker.jsx +2 -2
  107. package/src/dialog.jsx +8 -2
  108. package/src/field.jsx +3 -3
  109. package/src/fieldset.jsx +2 -2
  110. package/src/form.jsx +1 -1
  111. package/src/hover-popup.jsx +3 -3
  112. package/src/input.jsx +1 -1
  113. package/src/label.jsx +1 -1
  114. package/src/listbox.jsx +6 -6
  115. package/src/menu.jsx +11 -11
  116. package/src/menubar.jsx +1 -1
  117. package/src/message-scroller.jsx +4 -4
  118. package/src/navigation-menu.jsx +14 -13
  119. package/src/number-field.jsx +3 -3
  120. package/src/otp.jsx +4 -4
  121. package/src/pagination.jsx +3 -3
  122. package/src/popover.jsx +20 -4
  123. package/src/qr-code.jsx +3 -3
  124. package/src/radio-group.jsx +5 -5
  125. package/src/resizable.jsx +3 -3
  126. package/src/runtime.jsx +21 -7
  127. package/src/scroll-area.jsx +5 -5
  128. package/src/select.jsx +28 -14
  129. package/src/separator.jsx +1 -1
  130. package/src/slider.jsx +11 -8
  131. package/src/switch.jsx +3 -3
  132. package/src/tabs.jsx +6 -6
  133. package/src/testing.js +3 -0
  134. package/src/toast.jsx +38 -10
  135. package/src/toggle-group.jsx +2 -2
  136. package/src/toggle.jsx +1 -1
  137. package/src/toolbar.jsx +4 -4
  138. package/src/value-bar.jsx +3 -3
  139. package/types/accordion.d.ts +21 -19
  140. package/types/agent.d.ts +1 -0
  141. package/types/alert-dialog.d.ts +1 -0
  142. package/types/autocomplete.d.ts +1 -0
  143. package/types/autosize.d.ts +4 -1
  144. package/types/avatar.d.ts +12 -5
  145. package/types/button.d.ts +4 -2
  146. package/types/calendar.d.ts +35 -18
  147. package/types/carousel.d.ts +18 -10
  148. package/types/checkbox.d.ts +9 -6
  149. package/types/collapsible.d.ts +11 -7
  150. package/types/combobox.d.ts +61 -62
  151. package/types/command.d.ts +27 -17
  152. package/types/context-menu.d.ts +1 -0
  153. package/types/date-field.d.ts +20 -9
  154. package/types/date-picker.d.ts +25 -34
  155. package/types/dialog.d.ts +42 -31
  156. package/types/direction.d.ts +1 -0
  157. package/types/drawer.d.ts +1 -0
  158. package/types/field.d.ts +19 -11
  159. package/types/fieldset.d.ts +8 -3
  160. package/types/form.d.ts +5 -2
  161. package/types/hover-card.d.ts +16 -10
  162. package/types/hover-popup.d.ts +23 -13
  163. package/types/index.d.ts +12 -1
  164. package/types/input.d.ts +4 -3
  165. package/types/label.d.ts +4 -1
  166. package/types/listbox.d.ts +18 -20
  167. package/types/menu.d.ts +56 -42
  168. package/types/menubar.d.ts +6 -4
  169. package/types/message-scroller.d.ts +12 -6
  170. package/types/meter.d.ts +16 -7
  171. package/types/navigation-menu.d.ts +35 -29
  172. package/types/number-field.d.ts +13 -6
  173. package/types/otp.d.ts +17 -10
  174. package/types/pagination.d.ts +18 -10
  175. package/types/popover.d.ts +37 -12
  176. package/types/progress.d.ts +16 -7
  177. package/types/qr-code.d.ts +10 -4
  178. package/types/radio-group.d.ts +15 -17
  179. package/types/resizable.d.ts +12 -7
  180. package/types/runtime.d.ts +36 -12
  181. package/types/scroll-area.d.ts +17 -9
  182. package/types/select.d.ts +55 -46
  183. package/types/separator.d.ts +5 -3
  184. package/types/slider.d.ts +25 -13
  185. package/types/switch.d.ts +7 -4
  186. package/types/tabs.d.ts +20 -16
  187. package/types/testing.d.ts +1 -0
  188. package/types/toast.d.ts +40 -16
  189. package/types/toggle-group.d.ts +6 -11
  190. package/types/toggle.d.ts +4 -3
  191. package/types/toolbar.d.ts +19 -14
  192. package/types/tooltip.d.ts +16 -10
  193. package/types/value-bar.d.ts +21 -10
package/src/toast.jsx CHANGED
@@ -1,6 +1,12 @@
1
- import { createToast } from "@kirana-ui/core/toast";
2
- import { For, createContext, createMemo, createUniqueId, splitProps, useContext } from "solid-js";
1
+ import { createToast, createToaster as createCoreToaster } from "@kirana-ui/core/toast";
2
+ import { For, Show, createContext, createMemo, createUniqueId, splitProps, useContext, } from "solid-js";
3
3
  import { Part, controller, fromSignal } from "./runtime.jsx";
4
+ /**
5
+ * The toasts of a page, made once, in a module: `toaster.add({ title })` from anywhere. A
6
+ * title, a description and an action's label are anything Solid draws, unless `Content` says
7
+ * otherwise.
8
+ */
9
+ export const createToaster = createCoreToaster;
4
10
  const Context = createContext();
5
11
  const ToastContext = createContext();
6
12
  function useToast() {
@@ -27,7 +33,7 @@ function Viewport(props) {
27
33
  swipeDirection: local.swipeDirection,
28
34
  }));
29
35
  return (<Context.Provider value={made}>
30
- <Part part={made.viewport} tag="div" {...rest}/>
36
+ <Part of={made.viewport} tag="div" {...rest}/>
31
37
  </Context.Provider>);
32
38
  }
33
39
  /**
@@ -46,13 +52,35 @@ function Root(props) {
46
52
  // A root is its toast for as long as it is in the page.
47
53
  const parts = useToast().toast(local.toast.id);
48
54
  return (<ToastContext.Provider value={parts}>
49
- <Part part={parts.root} tag="div" {...rest}/>
55
+ <Part of={parts.root} tag="div" {...rest}/>
50
56
  </ToastContext.Provider>);
51
57
  }
52
- const Content = (props) => (<Part part={useParts().content} tag="div" {...props}/>);
53
- const Title = (props) => <Part part={useParts().title} tag="div" {...props}/>;
54
- const Description = (props) => (<Part part={useParts().description} tag="div" {...props}/>);
55
- const Close = (props) => (<Part part={useParts().close} tag="button" {...props}/>);
56
- const Action = (props) => (<Part part={useParts().action} tag="button" {...props}/>);
58
+ const Content = (props) => <Part of={useParts().content} tag="div" {...props}/>;
59
+ /**
60
+ * A part that says something of the toast's: the caller's children when it has any, what the
61
+ * toast was added with otherwise, and nothing in the page when there is neither.
62
+ */
63
+ function Said(props) {
64
+ const [local, rest] = splitProps(props, ["said", "tag", "children"]);
65
+ const parts = useParts();
66
+ const toast = fromSignal(parts.record);
67
+ const children = createMemo(() => local.children ?? (local.said === "action" ? toast()?.action?.label : toast()?.[local.said]));
68
+ return (
69
+ // A `render` draws what it likes; without one, an element with nothing to say is not drawn.
70
+ <Show when={children() != null || rest.render}>
71
+ <Part of={parts[local.said]} tag={local.tag} {...rest}>
72
+ {children()}
73
+ </Part>
74
+ </Show>);
75
+ }
76
+ /** The toast's title, unless it is given children of its own. */
77
+ const Title = (props) => <Said said="title" tag="div" {...props}/>;
78
+ /** The toast's description, unless it is given children of its own. */
79
+ const Description = (props) => <Said said="description" tag="div" {...props}/>;
80
+ const Close = (props) => <Part of={useParts().close} tag="button" {...props}/>;
81
+ /**
82
+ * The toast's action, its label unless it is given children of its own. A press tells the
83
+ * action (`onAction`), then closes the toast unless the action called `details.cancel()`.
84
+ */
85
+ const Action = (props) => <Said said="action" tag="button" {...props}/>;
57
86
  export const Toast = { Viewport, List, Root, Content, Title, Description, Close, Action };
58
- export { createToaster } from "@kirana-ui/core/toast";
@@ -17,7 +17,7 @@ export function ToggleGroup(props) {
17
17
  ]);
18
18
  const direction = useContext(DirectionContext);
19
19
  const toolbar = useContext(ToolbarContext) ?? undefined;
20
- const made = controller(within(createToggleGroup, { direction, toolbar }), () => ({
20
+ const made = controller(within((createToggleGroup), { direction, toolbar }), () => ({
21
21
  value: local.value,
22
22
  defaultValue: local.defaultValue,
23
23
  multiple: local.multiple,
@@ -27,6 +27,6 @@ export function ToggleGroup(props) {
27
27
  onValueChange: (value, details) => local.onValueChange?.(value, details),
28
28
  }));
29
29
  return (<ToggleGroupContext.Provider value={made}>
30
- <Part part={made.root} tag="div" {...rest}/>
30
+ <Part of={made.root} tag="div" {...rest}/>
31
31
  </ToggleGroupContext.Provider>);
32
32
  }
package/src/toggle.jsx CHANGED
@@ -20,5 +20,5 @@ export function Toggle(props) {
20
20
  value: local.value,
21
21
  onPressedChange: (pressed, details) => local.onPressedChange?.(pressed, details),
22
22
  }));
23
- return <Part part={made.root} tag="button" {...rest}/>;
23
+ return <Part of={made.root} tag="button" {...rest}/>;
24
24
  }
package/src/toolbar.jsx CHANGED
@@ -21,7 +21,7 @@ function Root(props) {
21
21
  return (<ToolbarContext.Provider value={made}>
22
22
  {/* A toggle group around the toolbar is not the group of the toolbar's toggles. */}
23
23
  <ToggleGroupContext.Provider value={null}>
24
- <Part part={made.root} tag="div" {...rest}/>
24
+ <Part of={made.root} tag="div" {...rest}/>
25
25
  </ToggleGroupContext.Provider>
26
26
  </ToolbarContext.Provider>);
27
27
  }
@@ -29,10 +29,10 @@ const item = (name, tag) => (props) => {
29
29
  const [local, rest] = splitProps(props, ["disabled"]);
30
30
  const options = toSignal(() => ({ disabled: local.disabled }));
31
31
  const part = useToolbar()[name](() => defined(options.get()));
32
- return <Part part={part} tag={tag} {...rest}/>;
32
+ return <Part of={part} tag={tag} {...rest}/>;
33
33
  };
34
- const Link = (props) => <Part part={useToolbar().link()} tag="a" {...props}/>;
35
- const Separator = (props) => (<Part part={useToolbar().separator} tag="div" {...props}/>);
34
+ const Link = (props) => <Part of={useToolbar().link()} tag="a" {...props}/>;
35
+ const Separator = (props) => (<Part of={useToolbar().separator} tag="div" {...props}/>);
36
36
  export const Toolbar = {
37
37
  Root,
38
38
  Button: item("button", "button"),
package/src/value-bar.jsx CHANGED
@@ -22,7 +22,7 @@ export function valueBar(name, create) {
22
22
  const generated = createUniqueId();
23
23
  const made = controller(create, () => ({ ...local, id: local.id ?? generated }));
24
24
  return (<Context.Provider value={made}>
25
- <Part part={made.root} tag="div" {...rest}/>
25
+ <Part of={made.root} tag="div" {...rest}/>
26
26
  </Context.Provider>);
27
27
  }
28
28
  /** The written value, or what its child, a function, makes of it. */
@@ -30,11 +30,11 @@ export function valueBar(name, create) {
30
30
  const [local, rest] = splitProps(props, ["children"]);
31
31
  const made = use();
32
32
  const text = fromSignal(made.text);
33
- return (<Part part={made.value} tag="span" {...rest}>
33
+ return (<Part of={made.value} tag="span" {...rest}>
34
34
  {local.children ? local.children(text) : text()}
35
35
  </Part>);
36
36
  }
37
- const part = (key, tag) => (props) => (<Part part={use()[key]} tag={tag} {...props}/>);
37
+ const part = (key, tag) => (props) => <Part of={use()[key]} tag={tag} {...props}/>;
38
38
  return {
39
39
  Root,
40
40
  Value,
@@ -1,30 +1,32 @@
1
- import type { ChangeDetails, Orientation } from "@kirana-ui/core";
1
+ import type { StateOf } from "@kirana-ui/core";
2
+ import type { AccordionProps } from "@kirana-ui/core/accordion";
3
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
2
4
  import type { JSX } from "solid-js";
3
5
  import type { PartComponentProps } from "./runtime.tsx";
4
- export type RootProps = PartComponentProps & {
5
- value?: readonly unknown[];
6
- defaultValue?: readonly unknown[];
7
- onValueChange?: (value: unknown[], details: ChangeDetails) => void;
8
- multiple?: boolean;
9
- disabled?: boolean;
10
- orientation?: Orientation;
11
- loop?: boolean;
6
+ type Parts = Vocabulary["accordion"];
7
+ /** `Value` is what tells an item from the others: what the items' `value` and the root's hold. */
8
+ export type RootProps<Value = unknown> = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<AccordionProps<Value>, "id"> & {
12
9
  id?: string;
13
- };
14
- declare function Root(props: RootProps): JSX.Element;
15
- declare function Item(props: PartComponentProps & {
16
- value: unknown;
10
+ }>;
11
+ declare function Root<Value = unknown>(props: RootProps<Value>): JSX.Element;
12
+ export type ItemProps = PartComponentProps<"div", StateOf<Parts["item"]>, {
13
+ value?: unknown;
17
14
  disabled?: boolean;
18
- }): JSX.Element;
19
- /** `keepMounted` keeps the closed panel in the page, `hidden`. */
20
- declare function Panel(props: PartComponentProps & {
15
+ }>;
16
+ /** `value` tells this item from the others; an item that is given none makes its own. */
17
+ declare function Item(props: ItemProps): JSX.Element;
18
+ export type HeaderProps = PartComponentProps<"h3", StateOf<Parts["header"]>>;
19
+ export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>>;
20
+ export type PanelProps = PartComponentProps<"div", StateOf<Parts["panel"]>, {
21
21
  keepMounted?: boolean;
22
- }): JSX.Element;
22
+ }>;
23
+ /** `keepMounted` keeps the closed panel in the page, `hidden`. */
24
+ declare function Panel(props: PanelProps): JSX.Element;
23
25
  export declare const Accordion: {
24
26
  Root: typeof Root;
25
27
  Item: typeof Item;
26
- Header: (props: PartComponentProps) => JSX.Element;
27
- Trigger: (props: PartComponentProps) => JSX.Element;
28
+ Header: (props: HeaderProps) => JSX.Element;
29
+ Trigger: (props: TriggerProps) => JSX.Element;
28
30
  Panel: typeof Panel;
29
31
  };
30
32
  export {};
@@ -0,0 +1 @@
1
+ export * from "@kirana-ui/core/agent";
@@ -1 +1,2 @@
1
1
  export { AlertDialog } from "./dialog.tsx";
2
+ export type { AlertRootProps as RootProps, BackdropProps, CloseProps, DescriptionProps, PopupProps, PortalProps, TitleProps, TriggerProps, } from "./dialog.tsx";
@@ -1 +1,2 @@
1
1
  export { Autocomplete } from "./combobox.tsx";
2
+ export type { AutocompleteRootProps as RootProps, ClearProps, EmptyProps, GroupLabelProps, GroupProps, InputProps, ItemProps, ListProps, PopupProps, PortalProps, PositionerProps, SeparatorProps, TriggerProps, } from "./combobox.tsx";
@@ -1,7 +1,10 @@
1
+ import type { StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
1
3
  import type { JSX } from "solid-js";
2
4
  import type { PartComponentProps } from "./runtime.tsx";
5
+ export type TextareaProps = PartComponentProps<"textarea", StateOf<Vocabulary["autosize"]["textarea"]>>;
3
6
  /** A `<textarea>` as tall as its text. It takes what a `<textarea>` takes. */
4
- declare function Textarea(props: PartComponentProps): JSX.Element;
7
+ declare function Textarea(props: TextareaProps): JSX.Element;
5
8
  export declare const Autosize: {
6
9
  Textarea: typeof Textarea;
7
10
  };
package/types/avatar.d.ts CHANGED
@@ -1,12 +1,19 @@
1
+ import type { StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
1
3
  import type { JSX } from "solid-js";
2
4
  import type { PartComponentProps } from "./runtime.tsx";
3
- declare function Root(props: PartComponentProps): JSX.Element;
4
- /** The picture: in the page once `src` has loaded. */
5
- declare function Image(props: PartComponentProps & {
5
+ type Parts = Vocabulary["avatar"];
6
+ export type RootProps = PartComponentProps<"span", StateOf<Parts["root"]>>;
7
+ declare function Root(props: RootProps): JSX.Element;
8
+ export type ImageProps = PartComponentProps<"img", StateOf<Parts["image"]>, {
9
+ /** The picture's address: the element is in the page once it has loaded. */
6
10
  src?: string;
7
- }): JSX.Element;
11
+ }>;
12
+ /** The picture: in the page once `src` has loaded. */
13
+ declare function Image(props: ImageProps): JSX.Element;
14
+ export type FallbackProps = PartComponentProps<"span", StateOf<Parts["fallback"]>>;
8
15
  /** What shows until the picture has loaded, or when it cannot. */
9
- declare function Fallback(props: PartComponentProps): JSX.Element;
16
+ declare function Fallback(props: FallbackProps): JSX.Element;
10
17
  export declare const Avatar: {
11
18
  Root: typeof Root;
12
19
  Image: typeof Image;
package/types/button.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import type { StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
1
3
  import type { JSX } from "solid-js";
2
4
  import type { PartComponentProps } from "./runtime.tsx";
3
- export type ButtonProps = PartComponentProps & {
5
+ export type ButtonProps = PartComponentProps<"button", StateOf<Vocabulary["button"]["root"]>, {
4
6
  disabled?: boolean;
5
7
  focusableWhenDisabled?: boolean;
6
8
  nativeButton?: boolean;
7
- };
9
+ }>;
8
10
  /** A `<button>`, or with `as` and `nativeButton={false}` another element that acts as one. */
9
11
  export declare function Button(props: ButtonProps): JSX.Element;
@@ -1,37 +1,54 @@
1
+ import type { StateOf } from "@kirana-ui/core";
1
2
  import type { Calendar as Controller, CalendarDay, CalendarProps, CalendarWeekday } from "@kirana-ui/core/calendar";
3
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
2
4
  import type { JSX } from "solid-js";
3
5
  import type { PartComponentProps } from "./runtime.tsx";
6
+ type Parts = Vocabulary["calendar"];
7
+ /**
8
+ * The calendar its parts are inside. Exported for a component that is made of one (a date picker
9
+ * provides its own to the calendar's parts).
10
+ */
4
11
  declare const Context: import("solid-js").Context<Controller | undefined>;
5
12
  /** For a component made of this one's parts: a date picker. */
6
13
  export { Context as CalendarContext };
7
- declare function Root(props: PartComponentProps & Omit<CalendarProps, "id"> & {
14
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, Omit<CalendarProps, "id"> & {
8
15
  id?: string;
9
- }): JSX.Element;
16
+ }>;
17
+ declare function Root(props: RootProps): JSX.Element;
18
+ export type HeadingProps = PartComponentProps<"div", StateOf<Parts["heading"]>>;
10
19
  /** Names the month shown, unless it is given something else to say. */
11
- declare function Heading(props: PartComponentProps): JSX.Element;
12
- /** Draws its child once for each day of the week, in the locale's order. */
13
- declare function Weekdays(props: {
20
+ declare function Heading(props: HeadingProps): JSX.Element;
21
+ export type PreviousProps = PartComponentProps<"button", StateOf<Parts["previous"]>>;
22
+ export type NextProps = PartComponentProps<"button", StateOf<Parts["next"]>>;
23
+ export type GridProps = PartComponentProps<"table", StateOf<Parts["grid"]>>;
24
+ export type WeekdaysProps = {
14
25
  children: (weekday: CalendarWeekday) => JSX.Element;
15
- }): JSX.Element;
16
- /** Draws its child once for each week of the month shown. */
17
- declare function Weeks(props: {
26
+ };
27
+ /** Draws its child once for each day of the week, in the locale's order. */
28
+ declare function Weekdays(props: WeekdaysProps): JSX.Element;
29
+ export type WeeksProps = {
18
30
  children: (week: readonly CalendarDay[]) => JSX.Element;
19
- }): JSX.Element;
20
- declare function HeadCell(props: PartComponentProps & {
31
+ };
32
+ /** Draws its child once for each week of the month shown. */
33
+ declare function Weeks(props: WeeksProps): JSX.Element;
34
+ export type HeadCellProps = PartComponentProps<"th", StateOf<Parts["headCell"]>, {
21
35
  weekday: CalendarWeekday;
22
- }): JSX.Element;
23
- declare function Cell(props: PartComponentProps & {
36
+ }>;
37
+ declare function HeadCell(props: HeadCellProps): JSX.Element;
38
+ export type CellProps = PartComponentProps<"td", StateOf<Parts["cell"]>, {
24
39
  date: string;
25
- }): JSX.Element;
26
- declare function Day(props: PartComponentProps & {
40
+ }>;
41
+ declare function Cell(props: CellProps): JSX.Element;
42
+ export type DayProps = PartComponentProps<"button", StateOf<Parts["day"]>, {
27
43
  date: string;
28
- }): JSX.Element;
44
+ }>;
45
+ declare function Day(props: DayProps): JSX.Element;
29
46
  export declare const Calendar: {
30
47
  Root: typeof Root;
31
48
  Heading: typeof Heading;
32
- Previous: (props: PartComponentProps) => JSX.Element;
33
- Next: (props: PartComponentProps) => JSX.Element;
34
- Grid: (props: PartComponentProps) => JSX.Element;
49
+ Previous: (props: PreviousProps) => JSX.Element;
50
+ Next: (props: NextProps) => JSX.Element;
51
+ Grid: (props: GridProps) => JSX.Element;
35
52
  Weekdays: typeof Weekdays;
36
53
  HeadCell: typeof HeadCell;
37
54
  Weeks: typeof Weeks;
@@ -1,26 +1,34 @@
1
- import type { ChangeDetails, Orientation } from "@kirana-ui/core";
1
+ import type { ChangeDetails, Orientation, StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
2
3
  import type { JSX } from "solid-js";
3
4
  import type { PartComponentProps } from "./runtime.tsx";
4
- declare function Root(props: PartComponentProps & {
5
+ type Parts = Vocabulary["carousel"];
6
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, {
5
7
  index?: number;
6
8
  defaultIndex?: number;
7
9
  onIndexChange?: (index: number, details: ChangeDetails) => void;
8
10
  orientation?: Orientation;
9
11
  loop?: boolean;
10
12
  id?: string;
11
- }): JSX.Element;
12
- declare function Item(props: PartComponentProps & {
13
+ }>;
14
+ declare function Root(props: RootProps): JSX.Element;
15
+ export type ViewportProps = PartComponentProps<"div", StateOf<Parts["viewport"]>>;
16
+ export type ItemProps = PartComponentProps<"div", StateOf<Parts["item"]>, {
13
17
  index: number;
14
- }): JSX.Element;
15
- declare function Indicator(props: PartComponentProps & {
18
+ }>;
19
+ export type PreviousProps = PartComponentProps<"button", StateOf<Parts["previous"]>>;
20
+ export type NextProps = PartComponentProps<"button", StateOf<Parts["next"]>>;
21
+ export type IndicatorProps = PartComponentProps<"button", StateOf<Parts["indicator"]>, {
16
22
  index: number;
17
- }): JSX.Element;
23
+ }>;
24
+ declare function Item(props: ItemProps): JSX.Element;
25
+ declare function Indicator(props: IndicatorProps): JSX.Element;
18
26
  export declare const Carousel: {
19
27
  Root: typeof Root;
20
- Viewport: (props: PartComponentProps) => JSX.Element;
28
+ Viewport: (props: ViewportProps) => JSX.Element;
21
29
  Item: typeof Item;
22
- Previous: (props: PartComponentProps) => JSX.Element;
23
- Next: (props: PartComponentProps) => JSX.Element;
30
+ Previous: (props: PreviousProps) => JSX.Element;
31
+ Next: (props: NextProps) => JSX.Element;
24
32
  Indicator: typeof Indicator;
25
33
  };
26
34
  export {};
@@ -1,7 +1,9 @@
1
- import type { ChangeDetails } from "@kirana-ui/core";
1
+ import type { ChangeDetails, StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
2
3
  import type { JSX } from "solid-js";
3
4
  import type { PartComponentProps } from "./runtime.tsx";
4
- export type RootProps = PartComponentProps & {
5
+ type Parts = Vocabulary["checkbox"];
6
+ export type RootProps = PartComponentProps<"span", StateOf<Parts["root"]>, {
5
7
  checked?: boolean;
6
8
  defaultChecked?: boolean;
7
9
  onCheckedChange?: (checked: boolean, details: ChangeDetails) => void;
@@ -13,12 +15,13 @@ export type RootProps = PartComponentProps & {
13
15
  form?: string;
14
16
  value?: string;
15
17
  id?: string;
16
- };
18
+ }>;
17
19
  declare function Root(props: RootProps): JSX.Element;
18
- /** `keepMounted` keeps the mark in the page while the box is unchecked. */
19
- declare function Indicator(props: PartComponentProps & {
20
+ export type IndicatorProps = PartComponentProps<"span", StateOf<Parts["indicator"]>, {
20
21
  keepMounted?: boolean;
21
- }): JSX.Element;
22
+ }>;
23
+ /** `keepMounted` keeps the mark in the page while the box is unchecked. */
24
+ declare function Indicator(props: IndicatorProps): JSX.Element;
22
25
  export declare const Checkbox: {
23
26
  Root: typeof Root;
24
27
  Indicator: typeof Indicator;
@@ -1,21 +1,25 @@
1
- import type { ChangeDetails } from "@kirana-ui/core";
1
+ import type { ChangeDetails, StateOf } from "@kirana-ui/core";
2
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
2
3
  import type { JSX } from "solid-js";
3
4
  import type { PartComponentProps } from "./runtime.tsx";
4
- export type RootProps = PartComponentProps & {
5
+ type Parts = Vocabulary["collapsible"];
6
+ export type RootProps = PartComponentProps<"div", StateOf<Parts["root"]>, {
5
7
  open?: boolean;
6
8
  defaultOpen?: boolean;
7
9
  onOpenChange?: (open: boolean, details: ChangeDetails) => void;
8
10
  disabled?: boolean;
9
11
  id?: string;
10
- };
12
+ }>;
11
13
  declare function Root(props: RootProps): JSX.Element;
12
- /** `keepMounted` keeps the closed panel in the page, `hidden`. */
13
- declare function Panel(props: PartComponentProps & {
14
+ export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>>;
15
+ export type PanelProps = PartComponentProps<"div", StateOf<Parts["panel"]>, {
14
16
  keepMounted?: boolean;
15
- }): JSX.Element;
17
+ }>;
18
+ /** `keepMounted` keeps the closed panel in the page, `hidden`. */
19
+ declare function Panel(props: PanelProps): JSX.Element;
16
20
  export declare const Collapsible: {
17
21
  Root: typeof Root;
18
- Trigger: (props: PartComponentProps) => JSX.Element;
22
+ Trigger: (props: TriggerProps) => JSX.Element;
19
23
  Panel: typeof Panel;
20
24
  };
21
25
  export {};
@@ -1,64 +1,62 @@
1
- import type { ChangeDetails } from "@kirana-ui/core";
1
+ import type { StateOf } from "@kirana-ui/core";
2
2
  import type { AutocompleteProps } from "@kirana-ui/core/autocomplete";
3
3
  import type { ComboboxProps } from "@kirana-ui/core/combobox";
4
+ import type { Vocabulary } from "@kirana-ui/core/vocabulary";
4
5
  import type { JSX } from "solid-js";
5
- import type { PositionerProps } from "./popover.tsx";
6
+ import type { PortalProps, PositionerOptions } from "./popover.tsx";
6
7
  import type { PartComponentProps } from "./runtime.tsx";
7
- export type RootProps = {
8
- value?: unknown;
9
- defaultValue?: unknown;
10
- onValueChange?: (value: unknown, details: ChangeDetails) => void;
11
- inputValue?: string;
12
- defaultInputValue?: string;
13
- onInputValueChange?: (value: string, details: ChangeDetails) => void;
14
- open?: boolean;
15
- defaultOpen?: boolean;
16
- onOpenChange?: (open: boolean, details: ChangeDetails) => void;
17
- disabled?: boolean;
18
- required?: boolean;
19
- multiple?: boolean;
20
- values?: readonly unknown[];
21
- defaultValues?: readonly unknown[];
22
- onValuesChange?: (values: unknown[], details: ChangeDetails) => void;
23
- inline?: boolean;
24
- virtualized?: ComboboxProps["virtualized"];
25
- name?: string;
26
- form?: string;
27
- items?: readonly {
28
- value: unknown;
29
- label: string;
30
- }[];
31
- filter?: ((label: string, query: string) => boolean) | null;
8
+ type Parts = Vocabulary["combobox"];
9
+ export type { PortalProps };
10
+ /**
11
+ * `Value` is what an item's `value` is: the root's `value` and `onValueChange` hold one or
12
+ * `null` for none, and with `multiple` its `values` and `onValuesChange` hold several.
13
+ */
14
+ export type RootProps<Value = unknown> = Omit<ComboboxProps<Value>, "id"> & {
32
15
  id?: string;
33
16
  children?: JSX.Element;
34
17
  };
35
- declare function Root(props: RootProps): JSX.Element;
18
+ declare function Root<Value = unknown>(props: RootProps<Value>): JSX.Element;
19
+ export type PositionerProps = PartComponentProps<"div", StateOf<Parts["positioner"]>, PositionerOptions>;
36
20
  declare function Positioner(props: PositionerProps): JSX.Element;
37
- /** `label` is what is filtered and what the input shows; the item's text when left out. */
38
- declare function Item(props: PartComponentProps & {
21
+ export type ItemProps = PartComponentProps<"div", StateOf<Parts["item"]>, {
39
22
  value: unknown;
40
23
  disabled?: boolean;
41
24
  label?: string;
42
25
  id?: string;
43
26
  index?: number;
44
- }): JSX.Element;
45
- declare function ItemIndicator(props: PartComponentProps & {
27
+ }>;
28
+ /** `label` is what is filtered and what the input shows; the item's text when left out. */
29
+ declare function Item(props: ItemProps): JSX.Element;
30
+ export type ItemIndicatorProps = PartComponentProps<"span", StateOf<Parts["itemIndicator"]>, {
46
31
  keepMounted?: boolean;
47
- }): JSX.Element;
48
- /** A button that empties the input and the value. Drawn while there is something to clear. */
49
- declare function Clear(props: PartComponentProps & {
32
+ }>;
33
+ declare function ItemIndicator(props: ItemIndicatorProps): JSX.Element;
34
+ export type ClearProps = PartComponentProps<"button", StateOf<Parts["clear"]>, {
50
35
  keepMounted?: boolean;
51
- }): JSX.Element;
52
- /** With `multiple`: one chosen value. Its `value` is what its remove button takes away. */
53
- declare function Chip(props: PartComponentProps & {
36
+ }>;
37
+ /** A button that empties the input and the value. Drawn while there is something to clear. */
38
+ declare function Clear(props: ClearProps): JSX.Element;
39
+ export type ChipProps = PartComponentProps<"span", StateOf<Parts["chip"]>, {
54
40
  value: unknown;
55
- }): JSX.Element;
41
+ }>;
42
+ /** With `multiple`: one chosen value. Its `value` is what its remove button takes away. */
43
+ declare function Chip(props: ChipProps): JSX.Element;
44
+ export type ChipRemoveProps = PartComponentProps<"button", StateOf<Parts["chipRemove"]>>;
45
+ export type EmptyProps = PartComponentProps<"div", StateOf<Parts["empty"]>>;
56
46
  /** Drawn while no item is shown for what was typed. */
57
- declare function Empty(props: PartComponentProps): JSX.Element;
58
- /** Items that belong together, named by their `GroupLabel`. Hidden while none is shown. */
59
- declare function Group(props: PartComponentProps & {
47
+ declare function Empty(props: EmptyProps): JSX.Element;
48
+ export type GroupProps = PartComponentProps<"div", StateOf<Parts["group"]>, {
60
49
  id?: string;
61
- }): JSX.Element;
50
+ }>;
51
+ /** Items that belong together, named by their `GroupLabel`. Hidden while none is shown. */
52
+ declare function Group(props: GroupProps): JSX.Element;
53
+ export type GroupLabelProps = PartComponentProps<"div", StateOf<Parts["groupLabel"]>>;
54
+ export type InputProps = PartComponentProps<"input", StateOf<Parts["input"]>>;
55
+ export type TriggerProps = PartComponentProps<"button", StateOf<Parts["trigger"]>>;
56
+ export type ChipsProps = PartComponentProps<"div", StateOf<Parts["chips"]>>;
57
+ export type PopupProps = PartComponentProps<"div", StateOf<Parts["popup"]>>;
58
+ export type ListProps = PartComponentProps<"div", StateOf<Parts["list"]>>;
59
+ export type SeparatorProps = PartComponentProps<"div", StateOf<Parts["separator"]>>;
62
60
  export type AutocompleteRootProps = Omit<AutocompleteProps, "id"> & {
63
61
  id?: string;
64
62
  children?: JSX.Element;
@@ -67,40 +65,41 @@ export type AutocompleteRootProps = Omit<AutocompleteProps, "id"> & {
67
65
  declare function AutocompleteRoot(props: AutocompleteRootProps): JSX.Element;
68
66
  export declare const Combobox: {
69
67
  Root: typeof Root;
70
- Input: (props: PartComponentProps) => JSX.Element;
71
- Trigger: (props: PartComponentProps) => JSX.Element;
68
+ Input: (props: InputProps) => JSX.Element;
69
+ Trigger: (props: TriggerProps) => JSX.Element;
72
70
  Clear: typeof Clear;
73
71
  /** With `multiple`: what holds the chips and the input. */
74
- Chips: (props: PartComponentProps) => JSX.Element;
72
+ Chips: (props: ChipsProps) => JSX.Element;
75
73
  Chip: typeof Chip;
76
- ChipRemove: (props: PartComponentProps) => JSX.Element;
77
- Portal: (props: {
78
- children?: JSX.Element;
79
- }) => JSX.Element;
74
+ ChipRemove: (props: ChipRemoveProps) => JSX.Element;
75
+ Portal: (props: PortalProps) => JSX.Element;
80
76
  Positioner: typeof Positioner;
81
- Popup: (props: PartComponentProps) => JSX.Element;
77
+ Popup: (props: PopupProps) => JSX.Element;
78
+ /**
79
+ * The items' own box inside the popup, when the popup holds more than items (an input): it
80
+ * is then the listbox.
81
+ */
82
+ List: (props: ListProps) => JSX.Element;
82
83
  Group: typeof Group;
83
- GroupLabel: (props: PartComponentProps) => JSX.Element;
84
+ GroupLabel: (props: GroupLabelProps) => JSX.Element;
84
85
  /** A line between groups. */
85
- Separator: (props: PartComponentProps) => JSX.Element;
86
+ Separator: (props: SeparatorProps) => JSX.Element;
86
87
  Item: typeof Item;
87
88
  ItemIndicator: typeof ItemIndicator;
88
89
  Empty: typeof Empty;
89
90
  };
90
91
  export declare const Autocomplete: {
91
92
  Root: typeof AutocompleteRoot;
92
- Input: (props: PartComponentProps) => JSX.Element;
93
- Trigger: (props: PartComponentProps) => JSX.Element;
93
+ Input: (props: InputProps) => JSX.Element;
94
+ Trigger: (props: TriggerProps) => JSX.Element;
94
95
  Clear: typeof Clear;
95
- Portal: (props: {
96
- children?: JSX.Element;
97
- }) => JSX.Element;
96
+ Portal: (props: PortalProps) => JSX.Element;
98
97
  Positioner: typeof Positioner;
99
- Popup: (props: PartComponentProps) => JSX.Element;
98
+ Popup: (props: PopupProps) => JSX.Element;
99
+ List: (props: ListProps) => JSX.Element;
100
100
  Group: typeof Group;
101
- GroupLabel: (props: PartComponentProps) => JSX.Element;
102
- Separator: (props: PartComponentProps) => JSX.Element;
101
+ GroupLabel: (props: GroupLabelProps) => JSX.Element;
102
+ Separator: (props: SeparatorProps) => JSX.Element;
103
103
  Item: typeof Item;
104
104
  Empty: typeof Empty;
105
105
  };
106
- export {};