@kirana-ui/solid 0.0.0 → 0.1.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 (120) hide show
  1. package/LICENSE +1 -1
  2. package/dom/accordion.js +106 -0
  3. package/dom/alert-dialog.js +2 -0
  4. package/dom/avatar.js +68 -0
  5. package/dom/button.js +18 -0
  6. package/dom/checkbox.js +76 -0
  7. package/dom/collapsible.js +64 -0
  8. package/dom/dialog.js +73 -0
  9. package/dom/direction-context.js +3 -0
  10. package/dom/direction.js +27 -0
  11. package/dom/field-context.js +3 -0
  12. package/dom/field.js +88 -0
  13. package/dom/fieldset.js +41 -0
  14. package/dom/form.js +29 -0
  15. package/dom/hover-card.js +3 -0
  16. package/dom/hover-popup.js +63 -0
  17. package/dom/index.js +22 -0
  18. package/dom/meter.js +3 -0
  19. package/dom/popover.js +68 -0
  20. package/dom/progress.js +3 -0
  21. package/dom/radio-group.js +100 -0
  22. package/dom/runtime.js +99 -0
  23. package/dom/select.js +149 -0
  24. package/dom/separator.js +17 -0
  25. package/dom/slider.js +93 -0
  26. package/dom/switch.js +62 -0
  27. package/dom/tabs.js +97 -0
  28. package/dom/toggle.js +20 -0
  29. package/dom/tooltip.js +3 -0
  30. package/dom/value-bar.js +62 -0
  31. package/package.json +219 -6
  32. package/server/accordion.js +106 -0
  33. package/server/alert-dialog.js +2 -0
  34. package/server/avatar.js +68 -0
  35. package/server/button.js +18 -0
  36. package/server/checkbox.js +76 -0
  37. package/server/collapsible.js +64 -0
  38. package/server/dialog.js +73 -0
  39. package/server/direction-context.js +3 -0
  40. package/server/direction.js +27 -0
  41. package/server/field-context.js +3 -0
  42. package/server/field.js +87 -0
  43. package/server/fieldset.js +41 -0
  44. package/server/form.js +29 -0
  45. package/server/hover-card.js +3 -0
  46. package/server/hover-popup.js +63 -0
  47. package/server/index.js +22 -0
  48. package/server/meter.js +3 -0
  49. package/server/popover.js +68 -0
  50. package/server/progress.js +3 -0
  51. package/server/radio-group.js +100 -0
  52. package/server/runtime.js +98 -0
  53. package/server/select.js +149 -0
  54. package/server/separator.js +17 -0
  55. package/server/slider.js +92 -0
  56. package/server/switch.js +61 -0
  57. package/server/tabs.js +97 -0
  58. package/server/toggle.js +20 -0
  59. package/server/tooltip.js +3 -0
  60. package/server/value-bar.js +61 -0
  61. package/src/accordion.jsx +68 -0
  62. package/src/alert-dialog.js +2 -0
  63. package/src/avatar.jsx +35 -0
  64. package/src/button.jsx +9 -0
  65. package/src/checkbox.jsx +57 -0
  66. package/src/collapsible.jsx +35 -0
  67. package/src/dialog.jsx +47 -0
  68. package/src/direction-context.js +3 -0
  69. package/src/direction.jsx +17 -0
  70. package/src/field-context.js +3 -0
  71. package/src/field.jsx +64 -0
  72. package/src/fieldset.jsx +24 -0
  73. package/src/form.jsx +26 -0
  74. package/src/hover-card.jsx +3 -0
  75. package/src/hover-popup.jsx +40 -0
  76. package/src/index.js +22 -0
  77. package/src/meter.jsx +3 -0
  78. package/src/popover.jsx +49 -0
  79. package/src/progress.jsx +3 -0
  80. package/src/radio-group.jsx +66 -0
  81. package/src/runtime.jsx +88 -0
  82. package/src/select.jsx +85 -0
  83. package/src/separator.jsx +8 -0
  84. package/src/slider.jsx +74 -0
  85. package/src/switch.jsx +47 -0
  86. package/src/tabs.jsx +58 -0
  87. package/src/toggle.jsx +18 -0
  88. package/src/tooltip.jsx +3 -0
  89. package/src/value-bar.jsx +45 -0
  90. package/types/accordion.d.ts +30 -0
  91. package/types/alert-dialog.d.ts +1 -0
  92. package/types/avatar.d.ts +15 -0
  93. package/types/button.d.ts +9 -0
  94. package/types/checkbox.d.ts +25 -0
  95. package/types/collapsible.d.ts +21 -0
  96. package/types/dialog.d.ts +40 -0
  97. package/types/direction-context.d.ts +3 -0
  98. package/types/direction.d.ts +14 -0
  99. package/types/field-context.d.ts +3 -0
  100. package/types/field.d.ts +28 -0
  101. package/types/fieldset.d.ts +14 -0
  102. package/types/form.d.ts +7 -0
  103. package/types/hover-card.d.ts +10 -0
  104. package/types/hover-popup.d.ts +26 -0
  105. package/types/index.d.ts +24 -0
  106. package/types/meter.d.ts +9 -0
  107. package/types/popover.d.ts +28 -0
  108. package/types/progress.d.ts +9 -0
  109. package/types/radio-group.d.ts +28 -0
  110. package/types/runtime.d.ts +31 -0
  111. package/types/select.d.ts +50 -0
  112. package/types/separator.d.ts +6 -0
  113. package/types/slider.d.ts +24 -0
  114. package/types/switch.d.ts +20 -0
  115. package/types/tabs.d.ts +32 -0
  116. package/types/toggle.d.ts +10 -0
  117. package/types/tooltip.d.ts +10 -0
  118. package/types/value-bar.d.ts +17 -0
  119. package/README.md +0 -7
  120. package/index.js +0 -5
package/src/select.jsx ADDED
@@ -0,0 +1,85 @@
1
+ import { defined, within } from "@kirana-ui/core";
2
+ import { createSelect } from "@kirana-ui/core/select";
3
+ import { Show, createContext, createUniqueId, splitProps, untrack, useContext } from "solid-js";
4
+ import { positioned } from "./popover.jsx";
5
+ import { FieldContext } from "./field-context.js";
6
+ import { Part, Portal as BodyPortal, controller, fromSignal, toSignal } from "./runtime.jsx";
7
+ const Context = createContext();
8
+ const ItemContext = createContext();
9
+ function useSelect() {
10
+ const made = useContext(Context);
11
+ if (!made)
12
+ throw new Error("A Select part must be inside <Select.Root>");
13
+ return made;
14
+ }
15
+ function Root(props) {
16
+ const generated = createUniqueId();
17
+ const field = useContext(FieldContext);
18
+ const made = controller(within(createSelect, { field }), () => ({
19
+ id: props.id ?? generated,
20
+ value: props.value,
21
+ defaultValue: props.defaultValue,
22
+ open: props.open,
23
+ defaultOpen: props.defaultOpen,
24
+ disabled: props.disabled,
25
+ required: props.required,
26
+ name: props.name,
27
+ items: props.items,
28
+ onValueChange: (value, details) => props.onValueChange?.(value, details),
29
+ onOpenChange: (open, details) => props.onOpenChange?.(open, details),
30
+ }));
31
+ const named = fromSignal(made.named);
32
+ return (<Context.Provider value={made}>
33
+ {props.children}
34
+ <Show when={named()}>
35
+ <Part part={made.input} tag="input"/>
36
+ </Show>
37
+ </Context.Provider>);
38
+ }
39
+ const Portal = (props) => (<BodyPortal mounted={useSelect().mounted}>{props.children}</BodyPortal>);
40
+ function Positioner(props) {
41
+ const made = useSelect();
42
+ return <Part part={made.positioner} tag="div" {...positioned(props, made.positioning)}/>;
43
+ }
44
+ /** Shows the chosen value's label, or `placeholder` while nothing is chosen. */
45
+ function Value(props) {
46
+ const [local, rest] = splitProps(props, ["placeholder", "children"]);
47
+ const made = useSelect();
48
+ const label = fromSignal(made.label);
49
+ return (<Part part={made.valuePart} tag="span" {...rest}>
50
+ {local.children ?? label() ?? local.placeholder}
51
+ </Part>);
52
+ }
53
+ /** `label` is what typeahead matches and the trigger shows; the item's text when left out. */
54
+ function Item(props) {
55
+ const [local, rest] = splitProps(props, ["value", "disabled", "label"]);
56
+ // An item is its value for as long as it is in the page.
57
+ const value = untrack(() => local.value);
58
+ const options = toSignal(() => ({ disabled: local.disabled, label: local.label }));
59
+ const part = useSelect().item(value, () => defined(options.get()));
60
+ return (<ItemContext.Provider value={value}>
61
+ <Part part={part} tag="div" {...rest}/>
62
+ </ItemContext.Provider>);
63
+ }
64
+ const ItemText = (props) => (<Part part={useSelect().itemText(useContext(ItemContext))} tag="span" {...props}/>);
65
+ function ItemIndicator(props) {
66
+ const [local, rest] = splitProps(props, ["keepMounted"]);
67
+ const made = useSelect();
68
+ const value = useContext(ItemContext);
69
+ const selected = fromSignal(made.selected(value));
70
+ return (<Show when={selected() || local.keepMounted}>
71
+ <Part part={made.itemIndicator(value)} tag="span" {...rest}/>
72
+ </Show>);
73
+ }
74
+ const part = (name, tag) => (props) => (<Part part={useSelect()[name]} tag={tag} {...props}/>);
75
+ export const Select = {
76
+ Root,
77
+ Portal,
78
+ Positioner,
79
+ Value,
80
+ Item,
81
+ ItemText,
82
+ ItemIndicator,
83
+ Trigger: part("trigger", "button"),
84
+ Popup: part("popup", "div"),
85
+ };
@@ -0,0 +1,8 @@
1
+ import { createSeparator } from "@kirana-ui/core/separator";
2
+ import { splitProps } from "solid-js";
3
+ import { Part, controller } from "./runtime.jsx";
4
+ export function Separator(props) {
5
+ const [local, rest] = splitProps(props, ["orientation"]);
6
+ const made = controller(createSeparator, () => ({ orientation: local.orientation }));
7
+ return <Part part={made.root} tag="div" {...rest}/>;
8
+ }
package/src/slider.jsx ADDED
@@ -0,0 +1,74 @@
1
+ import { within } from "@kirana-ui/core";
2
+ import { createSlider } from "@kirana-ui/core/slider";
3
+ import { createContext, createUniqueId, splitProps, untrack, useContext } from "solid-js";
4
+ import { DirectionContext } from "./direction-context.js";
5
+ import { FieldContext } from "./field-context.js";
6
+ import { Part, controller, fromSignal } from "./runtime.jsx";
7
+ const Context = createContext();
8
+ function useSlider() {
9
+ const made = useContext(Context);
10
+ if (!made)
11
+ throw new Error("A Slider part must be inside <Slider.Root>");
12
+ return made;
13
+ }
14
+ function Root(props) {
15
+ const [local, rest] = splitProps(props, [
16
+ "value",
17
+ "defaultValue",
18
+ "onValueChange",
19
+ "onValueCommitted",
20
+ "min",
21
+ "max",
22
+ "step",
23
+ "largeStep",
24
+ "minStepsBetweenValues",
25
+ "orientation",
26
+ "disabled",
27
+ "name",
28
+ "format",
29
+ "locale",
30
+ "getAriaValueText",
31
+ "id",
32
+ ]);
33
+ const generated = createUniqueId();
34
+ const field = useContext(FieldContext);
35
+ const made = controller(within(createSlider, { field, direction: useContext(DirectionContext) }), () => ({
36
+ ...local,
37
+ id: local.id ?? generated,
38
+ onValueChange: (value, details) => local.onValueChange?.(value, details),
39
+ onValueCommitted: (value, details) => local.onValueCommitted?.(value, details),
40
+ }));
41
+ return (<Context.Provider value={made}>
42
+ <Part part={made.root} tag="div" {...rest}/>
43
+ </Context.Provider>);
44
+ }
45
+ /** `index` is which value of a range the thumb is, from 0. */
46
+ function Thumb(props) {
47
+ const [local, rest] = splitProps(props, ["index", "children"]);
48
+ // A thumb is its index for as long as it is in the page.
49
+ const index = untrack(() => local.index ?? 0);
50
+ const slider = useSlider();
51
+ return (<Part part={slider.thumb(index)} tag="div" {...rest}>
52
+ {local.children}
53
+ <Part part={slider.thumbInput(index)} tag="input"/>
54
+ </Part>);
55
+ }
56
+ /** The written value, or what its child, a function, makes of it and of the values. */
57
+ function Value(props) {
58
+ const [local, rest] = splitProps(props, ["children"]);
59
+ const made = useSlider();
60
+ const text = fromSignal(made.text);
61
+ const values = fromSignal(made.values);
62
+ return (<Part part={made.value} tag="output" {...rest}>
63
+ {local.children ? local.children(text, values) : text()}
64
+ </Part>);
65
+ }
66
+ const part = (key) => (props) => (<Part part={useSlider()[key]} tag="div" {...props}/>);
67
+ export const Slider = {
68
+ Root,
69
+ Value,
70
+ Control: part("control"),
71
+ Track: part("track"),
72
+ Indicator: part("indicator"),
73
+ Thumb,
74
+ };
package/src/switch.jsx ADDED
@@ -0,0 +1,47 @@
1
+ import { within } from "@kirana-ui/core";
2
+ import { createSwitch } from "@kirana-ui/core/switch";
3
+ import { createContext, createUniqueId, splitProps, useContext } from "solid-js";
4
+ import { FieldContext } from "./field-context.js";
5
+ import { Part, controller } from "./runtime.jsx";
6
+ const Context = createContext();
7
+ function useSwitch() {
8
+ const made = useContext(Context);
9
+ if (!made)
10
+ throw new Error("A Switch part must be inside <Switch.Root>");
11
+ return made;
12
+ }
13
+ function Root(props) {
14
+ const [local, rest] = splitProps(props, [
15
+ "checked",
16
+ "defaultChecked",
17
+ "onCheckedChange",
18
+ "disabled",
19
+ "readOnly",
20
+ "required",
21
+ "name",
22
+ "value",
23
+ "id",
24
+ "children",
25
+ ]);
26
+ const generated = createUniqueId();
27
+ const field = useContext(FieldContext);
28
+ const made = controller(within(createSwitch, { field }), () => ({
29
+ id: local.id ?? generated,
30
+ checked: local.checked,
31
+ defaultChecked: local.defaultChecked,
32
+ disabled: local.disabled,
33
+ readOnly: local.readOnly,
34
+ required: local.required,
35
+ name: local.name,
36
+ value: local.value,
37
+ onCheckedChange: (checked, details) => local.onCheckedChange?.(checked, details),
38
+ }));
39
+ return (<Context.Provider value={made}>
40
+ <Part part={made.root} tag="span" {...rest}>
41
+ {local.children}
42
+ <Part part={made.input} tag="input"/>
43
+ </Part>
44
+ </Context.Provider>);
45
+ }
46
+ const Thumb = (props) => <Part part={useSwitch().thumb} tag="span" {...props}/>;
47
+ export const Switch = { Root, Thumb };
package/src/tabs.jsx ADDED
@@ -0,0 +1,58 @@
1
+ import { defined, within } from "@kirana-ui/core";
2
+ import { createTabs } from "@kirana-ui/core/tabs";
3
+ import { Show, createComputed, createContext, createUniqueId, onCleanup, onMount, splitProps, untrack, useContext, } from "solid-js";
4
+ import { DirectionContext } from "./direction-context.js";
5
+ import { Part, controller, fromSignal, toSignal } from "./runtime.jsx";
6
+ const Context = createContext();
7
+ function useTabs() {
8
+ const made = useContext(Context);
9
+ if (!made)
10
+ throw new Error("A Tabs part must be inside <Tabs.Root>");
11
+ return made;
12
+ }
13
+ function Root(props) {
14
+ const [local, rest] = splitProps(props, [
15
+ "value",
16
+ "defaultValue",
17
+ "onValueChange",
18
+ "orientation",
19
+ "id",
20
+ ]);
21
+ const generated = createUniqueId();
22
+ const direction = useContext(DirectionContext);
23
+ const made = controller(within(createTabs, { direction }), () => ({
24
+ id: local.id ?? generated,
25
+ value: local.value,
26
+ defaultValue: local.defaultValue,
27
+ orientation: local.orientation,
28
+ onValueChange: (value, details) => local.onValueChange?.(value, details),
29
+ }));
30
+ return (<Context.Provider value={made}>
31
+ <Part part={made.root} tag="div" {...rest}/>
32
+ </Context.Provider>);
33
+ }
34
+ function List(props) {
35
+ const [local, rest] = splitProps(props, ["activateOnFocus", "loop"]);
36
+ const made = useTabs();
37
+ createComputed(() => made.listOptions.set(defined({ ...local })));
38
+ return <Part part={made.list} tag="div" {...rest}/>;
39
+ }
40
+ function Tab(props) {
41
+ const [local, rest] = splitProps(props, ["value", "disabled"]);
42
+ const options = toSignal(() => ({ disabled: local.disabled }));
43
+ // A tab is its value for as long as it is in the page.
44
+ const part = useTabs().tab(untrack(() => local.value), () => defined(options.get()));
45
+ return <Part part={part} tag="button" {...rest}/>;
46
+ }
47
+ const Indicator = (props) => (<Part part={useTabs().indicator} tag="span" {...props}/>);
48
+ /** `keepMounted` keeps the panel in the page, `hidden`, while its tab is not the active one. */
49
+ function Panel(props) {
50
+ const [local, rest] = splitProps(props, ["value", "keepMounted"]);
51
+ const panel = useTabs().panel(untrack(() => local.value));
52
+ onMount(() => onCleanup(panel.mount()));
53
+ const mounted = fromSignal(panel.mounted);
54
+ return (<Show when={mounted() || local.keepMounted}>
55
+ <Part part={panel.part} tag="div" {...rest}/>
56
+ </Show>);
57
+ }
58
+ export const Tabs = { Root, List, Tab, Indicator, Panel };
package/src/toggle.jsx ADDED
@@ -0,0 +1,18 @@
1
+ import { createToggle } from "@kirana-ui/core/toggle";
2
+ import { splitProps } from "solid-js";
3
+ import { Part, controller } from "./runtime.jsx";
4
+ export function Toggle(props) {
5
+ const [local, rest] = splitProps(props, [
6
+ "pressed",
7
+ "defaultPressed",
8
+ "onPressedChange",
9
+ "disabled",
10
+ ]);
11
+ const made = controller(createToggle, () => ({
12
+ pressed: local.pressed,
13
+ defaultPressed: local.defaultPressed,
14
+ disabled: local.disabled,
15
+ onPressedChange: (pressed, details) => local.onPressedChange?.(pressed, details),
16
+ }));
17
+ return <Part part={made.root} tag="button" {...rest}/>;
18
+ }
@@ -0,0 +1,3 @@
1
+ import { createTooltip } from "@kirana-ui/core/tooltip";
2
+ import { hoverPopup } from "./hover-popup.jsx";
3
+ export const Tooltip = hoverPopup("Tooltip", createTooltip, "button");
@@ -0,0 +1,45 @@
1
+ import { createContext, createUniqueId, splitProps, useContext } from "solid-js";
2
+ import { Part, controller, fromSignal } from "./runtime.jsx";
3
+ /** The parts of a value drawn as a filled track: a progress bar's, a meter's. */
4
+ export function valueBar(name, create) {
5
+ const Context = createContext();
6
+ function use() {
7
+ const made = useContext(Context);
8
+ if (!made)
9
+ throw new Error(`A ${name} part must be inside <${name}.Root>`);
10
+ return made;
11
+ }
12
+ function Root(props) {
13
+ const [local, rest] = splitProps(props, [
14
+ "value",
15
+ "min",
16
+ "max",
17
+ "format",
18
+ "locale",
19
+ "getAriaValueText",
20
+ "id",
21
+ ]);
22
+ const generated = createUniqueId();
23
+ const made = controller(create, () => ({ ...local, id: local.id ?? generated }));
24
+ return (<Context.Provider value={made}>
25
+ <Part part={made.root} tag="div" {...rest}/>
26
+ </Context.Provider>);
27
+ }
28
+ /** The written value, or what its child, a function, makes of it. */
29
+ function Value(props) {
30
+ const [local, rest] = splitProps(props, ["children"]);
31
+ const made = use();
32
+ const text = fromSignal(made.text);
33
+ return (<Part part={made.value} tag="span" {...rest}>
34
+ {local.children ? local.children(text) : text()}
35
+ </Part>);
36
+ }
37
+ const part = (key, tag) => (props) => (<Part part={use()[key]} tag={tag} {...props}/>);
38
+ return {
39
+ Root,
40
+ Value,
41
+ Track: part("track", "div"),
42
+ Indicator: part("indicator", "div"),
43
+ Label: part("label", "span"),
44
+ };
45
+ }
@@ -0,0 +1,30 @@
1
+ import type { ChangeDetails, Orientation } from "@kirana-ui/core";
2
+ import type { JSX } from "solid-js";
3
+ 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;
12
+ id?: string;
13
+ };
14
+ declare function Root(props: RootProps): JSX.Element;
15
+ declare function Item(props: PartComponentProps & {
16
+ value: unknown;
17
+ disabled?: boolean;
18
+ }): JSX.Element;
19
+ /** `keepMounted` keeps the closed panel in the page, `hidden`. */
20
+ declare function Panel(props: PartComponentProps & {
21
+ keepMounted?: boolean;
22
+ }): JSX.Element;
23
+ export declare const Accordion: {
24
+ Root: typeof Root;
25
+ Item: typeof Item;
26
+ Header: (props: PartComponentProps) => JSX.Element;
27
+ Trigger: (props: PartComponentProps) => JSX.Element;
28
+ Panel: typeof Panel;
29
+ };
30
+ export {};
@@ -0,0 +1 @@
1
+ export { AlertDialog } from "./dialog.tsx";
@@ -0,0 +1,15 @@
1
+ import type { JSX } from "solid-js";
2
+ 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 & {
6
+ src?: string;
7
+ }): JSX.Element;
8
+ /** What shows until the picture has loaded, or when it cannot. */
9
+ declare function Fallback(props: PartComponentProps): JSX.Element;
10
+ export declare const Avatar: {
11
+ Root: typeof Root;
12
+ Image: typeof Image;
13
+ Fallback: typeof Fallback;
14
+ };
15
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { JSX } from "solid-js";
2
+ import type { PartComponentProps } from "./runtime.tsx";
3
+ export type ButtonProps = PartComponentProps & {
4
+ disabled?: boolean;
5
+ focusableWhenDisabled?: boolean;
6
+ nativeButton?: boolean;
7
+ };
8
+ /** A `<button>`, or with `as` and `nativeButton={false}` another element that acts as one. */
9
+ export declare function Button(props: ButtonProps): JSX.Element;
@@ -0,0 +1,25 @@
1
+ import type { ChangeDetails } from "@kirana-ui/core";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ export type RootProps = PartComponentProps & {
5
+ checked?: boolean;
6
+ defaultChecked?: boolean;
7
+ onCheckedChange?: (checked: boolean, details: ChangeDetails) => void;
8
+ indeterminate?: boolean;
9
+ disabled?: boolean;
10
+ readOnly?: boolean;
11
+ required?: boolean;
12
+ name?: string;
13
+ value?: string;
14
+ id?: string;
15
+ };
16
+ declare function Root(props: RootProps): JSX.Element;
17
+ /** `keepMounted` keeps the mark in the page while the box is unchecked. */
18
+ declare function Indicator(props: PartComponentProps & {
19
+ keepMounted?: boolean;
20
+ }): JSX.Element;
21
+ export declare const Checkbox: {
22
+ Root: typeof Root;
23
+ Indicator: typeof Indicator;
24
+ };
25
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { ChangeDetails } from "@kirana-ui/core";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ export type RootProps = PartComponentProps & {
5
+ open?: boolean;
6
+ defaultOpen?: boolean;
7
+ onOpenChange?: (open: boolean, details: ChangeDetails) => void;
8
+ disabled?: boolean;
9
+ id?: string;
10
+ };
11
+ declare function Root(props: RootProps): JSX.Element;
12
+ /** `keepMounted` keeps the closed panel in the page, `hidden`. */
13
+ declare function Panel(props: PartComponentProps & {
14
+ keepMounted?: boolean;
15
+ }): JSX.Element;
16
+ export declare const Collapsible: {
17
+ Root: typeof Root;
18
+ Trigger: (props: PartComponentProps) => JSX.Element;
19
+ Panel: typeof Panel;
20
+ };
21
+ export {};
@@ -0,0 +1,40 @@
1
+ import type { ChangeDetails } from "@kirana-ui/core";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ export type RootProps = {
5
+ open?: boolean;
6
+ defaultOpen?: boolean;
7
+ onOpenChange?: (open: boolean, details: ChangeDetails) => void;
8
+ modal?: boolean;
9
+ dismissible?: boolean;
10
+ id?: string;
11
+ children?: JSX.Element;
12
+ };
13
+ declare function Root(props: RootProps): JSX.Element;
14
+ declare function AlertRoot(props: Omit<RootProps, "modal" | "dismissible">): JSX.Element;
15
+ export declare const Dialog: {
16
+ Root: typeof Root;
17
+ Portal: (props: {
18
+ children?: JSX.Element;
19
+ }) => JSX.Element;
20
+ Trigger: (props: PartComponentProps) => JSX.Element;
21
+ Backdrop: (props: PartComponentProps) => JSX.Element;
22
+ Popup: (props: PartComponentProps) => JSX.Element;
23
+ Title: (props: PartComponentProps) => JSX.Element;
24
+ Description: (props: PartComponentProps) => JSX.Element;
25
+ Close: (props: PartComponentProps) => JSX.Element;
26
+ };
27
+ /** A dialog that asks for an answer: a press outside it does not close it. Its parts are a dialog's. */
28
+ export declare const AlertDialog: {
29
+ Root: typeof AlertRoot;
30
+ Portal: (props: {
31
+ children?: JSX.Element;
32
+ }) => JSX.Element;
33
+ Trigger: (props: PartComponentProps) => JSX.Element;
34
+ Backdrop: (props: PartComponentProps) => JSX.Element;
35
+ Popup: (props: PartComponentProps) => JSX.Element;
36
+ Title: (props: PartComponentProps) => JSX.Element;
37
+ Description: (props: PartComponentProps) => JSX.Element;
38
+ Close: (props: PartComponentProps) => JSX.Element;
39
+ };
40
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Direction, ReadonlySignal } from "@kirana-ui/core";
2
+ /** The reading direction a provider states, if a component is inside one. */
3
+ export declare const DirectionContext: import("solid-js").Context<ReadonlySignal<Direction> | undefined>;
@@ -0,0 +1,14 @@
1
+ import type { Direction } from "@kirana-ui/core";
2
+ import type { JSX } from "solid-js";
3
+ export interface DirectionProviderProps {
4
+ /** The reading direction of what is inside. `ltr` when left out. */
5
+ direction?: Direction;
6
+ children?: JSX.Element;
7
+ }
8
+ /**
9
+ * States the reading direction for the components inside. It draws nothing: set the page's own
10
+ * `dir` attribute with it.
11
+ */
12
+ export declare function DirectionProvider(props: DirectionProviderProps): JSX.Element;
13
+ /** The direction the nearest provider states; `ltr` outside one. */
14
+ export declare function useDirection(): () => Direction;
@@ -0,0 +1,3 @@
1
+ import type { Field } from "@kirana-ui/core/field";
2
+ /** The field a part or a control is in, if it is in one. */
3
+ export declare const FieldContext: import("solid-js").Context<Field | undefined>;
@@ -0,0 +1,28 @@
1
+ import type { FieldProps, FieldValidity, ValidityKey } from "@kirana-ui/core/field";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ export type RootProps = PartComponentProps & Omit<FieldProps, "id"> & {
5
+ id?: string;
6
+ };
7
+ declare function Root(props: RootProps): JSX.Element;
8
+ /**
9
+ * What is wrong, or its children in its place. In the page while it applies. `match` is one of
10
+ * the browser's findings (`"valueMissing"`) to show for only that, or `true` to show always.
11
+ */
12
+ declare function FieldError(props: PartComponentProps & {
13
+ match?: ValidityKey | boolean;
14
+ }): JSX.Element;
15
+ /** Draws nothing itself: its child, a function, is given the field's validity. */
16
+ declare function Validity(props: {
17
+ children: (validity: () => FieldValidity) => JSX.Element;
18
+ }): JSX.Element;
19
+ export declare const Field: {
20
+ Root: typeof Root;
21
+ Label: (props: PartComponentProps) => JSX.Element;
22
+ /** An `<input>`; `as="textarea"` or `as="select"` for another. */
23
+ Control: (props: PartComponentProps) => JSX.Element;
24
+ Description: (props: PartComponentProps) => JSX.Element;
25
+ Error: typeof FieldError;
26
+ Validity: typeof Validity;
27
+ };
28
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { Fieldset as Controller } from "@kirana-ui/core/fieldset";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ /** The fieldset a field is in, if it is in one. */
5
+ export declare const FieldsetContext: import("solid-js").Context<Controller | undefined>;
6
+ declare function Root(props: PartComponentProps & {
7
+ disabled?: boolean;
8
+ id?: string;
9
+ }): JSX.Element;
10
+ export declare const Fieldset: {
11
+ Root: typeof Root;
12
+ Legend: (props: PartComponentProps) => JSX.Element;
13
+ };
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Form as Controller, FormProps } from "@kirana-ui/core/form";
2
+ import type { JSX } from "solid-js";
3
+ import type { PartComponentProps } from "./runtime.tsx";
4
+ /** The form a field is in, if it is in one. */
5
+ export declare const FormContext: import("solid-js").Context<Controller | undefined>;
6
+ /** A `<form>` whose fields say what is wrong; `onFormSubmit` takes the values once all are valid. */
7
+ export declare function Form(props: PartComponentProps & FormProps): JSX.Element;
@@ -0,0 +1,10 @@
1
+ export declare const HoverCard: {
2
+ Root: (props: import("./hover-popup.tsx").RootProps) => import("solid-js").JSX.Element;
3
+ Portal: (props: {
4
+ children?: import("solid-js").JSX.Element;
5
+ }) => import("solid-js").JSX.Element;
6
+ Positioner: (props: import("./popover.tsx").PositionerProps) => import("solid-js").JSX.Element;
7
+ Trigger: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
8
+ Popup: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
9
+ Arrow: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
10
+ };
@@ -0,0 +1,26 @@
1
+ import type { ChangeDetails, ReadonlySignal } from "@kirana-ui/core";
2
+ import type { HoverPopup, HoverPopupProps } from "@kirana-ui/core/tooltip";
3
+ import type { JSX } from "solid-js";
4
+ import type { PositionerProps } from "./popover.tsx";
5
+ import type { PartComponentProps } from "./runtime.tsx";
6
+ export type RootProps = {
7
+ open?: boolean;
8
+ defaultOpen?: boolean;
9
+ onOpenChange?: (open: boolean, details: ChangeDetails) => void;
10
+ delay?: number;
11
+ closeDelay?: number;
12
+ disabled?: boolean;
13
+ id?: string;
14
+ children?: JSX.Element;
15
+ };
16
+ /** The parts of a popup the pointer opens: a tooltip's, a hover card's. */
17
+ export declare function hoverPopup(name: string, create: (props: ReadonlySignal<HoverPopupProps>) => HoverPopup, triggerTag: string): {
18
+ Root: (props: RootProps) => JSX.Element;
19
+ Portal: (props: {
20
+ children?: JSX.Element;
21
+ }) => JSX.Element;
22
+ Positioner: (props: PositionerProps) => JSX.Element;
23
+ Trigger: (props: PartComponentProps) => JSX.Element;
24
+ Popup: (props: PartComponentProps) => JSX.Element;
25
+ Arrow: (props: PartComponentProps) => JSX.Element;
26
+ };
@@ -0,0 +1,24 @@
1
+ export { Accordion } from "./accordion.tsx";
2
+ export { Checkbox } from "./checkbox.tsx";
3
+ export { Collapsible } from "./collapsible.tsx";
4
+ export { AlertDialog, Dialog } from "./dialog.tsx";
5
+ export { HoverCard } from "./hover-card.tsx";
6
+ export { Popover } from "./popover.tsx";
7
+ export { RadioGroup } from "./radio-group.tsx";
8
+ export { Select } from "./select.tsx";
9
+ export { Switch } from "./switch.tsx";
10
+ export { Tabs } from "./tabs.tsx";
11
+ export { Tooltip } from "./tooltip.tsx";
12
+ export type { PartComponentProps } from "./runtime.tsx";
13
+ export { Avatar } from "./avatar.tsx";
14
+ export { Button } from "./button.tsx";
15
+ export { Meter } from "./meter.tsx";
16
+ export { Progress } from "./progress.tsx";
17
+ export { Separator } from "./separator.tsx";
18
+ export { Toggle } from "./toggle.tsx";
19
+ export { Slider } from "./slider.tsx";
20
+ export { Field } from "./field.tsx";
21
+ export { Fieldset } from "./fieldset.tsx";
22
+ export { Form } from "./form.tsx";
23
+ export { DirectionProvider, useDirection } from "./direction.tsx";
24
+ export type { DirectionProviderProps } from "./direction.tsx";
@@ -0,0 +1,9 @@
1
+ export declare const Meter: {
2
+ Root: (props: import("./value-bar.tsx").RootProps) => import("solid-js").JSX.Element;
3
+ Value: (props: Omit<import("./runtime.tsx").PartComponentProps, "children"> & {
4
+ children?: (text: () => string | undefined) => import("solid-js").JSX.Element;
5
+ }) => import("solid-js").JSX.Element;
6
+ Track: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
7
+ Indicator: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
8
+ Label: (props: import("./runtime.tsx").PartComponentProps) => import("solid-js").JSX.Element;
9
+ };