@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.
- package/dom/accordion.js +9 -6
- package/dom/agent.js +3 -0
- package/dom/autosize.js +1 -1
- package/dom/avatar.js +3 -3
- package/dom/button.js +1 -1
- package/dom/calendar.js +12 -8
- package/dom/carousel.js +6 -6
- package/dom/checkbox.js +3 -3
- package/dom/collapsible.js +3 -3
- package/dom/combobox.js +19 -11
- package/dom/command.js +8 -8
- package/dom/date-field.js +7 -3
- package/dom/date-picker.js +2 -2
- package/dom/dialog.js +5 -2
- package/dom/field.js +3 -3
- package/dom/fieldset.js +2 -2
- package/dom/form.js +1 -1
- package/dom/hover-popup.js +3 -3
- package/dom/input.js +1 -1
- package/dom/label.js +1 -1
- package/dom/listbox.js +5 -5
- package/dom/menu.js +11 -11
- package/dom/menubar.js +1 -1
- package/dom/message-scroller.js +4 -4
- package/dom/navigation-menu.js +18 -21
- package/dom/number-field.js +3 -3
- package/dom/otp.js +4 -4
- package/dom/pagination.js +3 -3
- package/dom/popover.js +20 -7
- package/dom/qr-code.js +3 -3
- package/dom/radio-group.js +4 -4
- package/dom/resizable.js +3 -3
- package/dom/runtime.js +23 -7
- package/dom/scroll-area.js +5 -5
- package/dom/select.js +25 -13
- package/dom/separator.js +1 -1
- package/dom/slider.js +10 -7
- package/dom/switch.js +3 -3
- package/dom/tabs.js +5 -5
- package/dom/testing.js +3 -0
- package/dom/toast.js +57 -20
- package/dom/toggle-group.js +1 -1
- package/dom/toggle.js +1 -1
- package/dom/toolbar.js +4 -4
- package/dom/value-bar.js +3 -3
- package/llms.txt +1588 -224
- package/package.json +18 -2
- package/server/accordion.js +9 -6
- package/server/agent.js +3 -0
- package/server/autosize.js +1 -1
- package/server/avatar.js +3 -3
- package/server/button.js +1 -1
- package/server/calendar.js +12 -8
- package/server/carousel.js +6 -6
- package/server/checkbox.js +3 -3
- package/server/collapsible.js +3 -3
- package/server/combobox.js +19 -11
- package/server/command.js +8 -8
- package/server/date-field.js +7 -3
- package/server/date-picker.js +2 -2
- package/server/dialog.js +5 -2
- package/server/field.js +3 -3
- package/server/fieldset.js +2 -2
- package/server/form.js +1 -1
- package/server/hover-popup.js +3 -3
- package/server/input.js +1 -1
- package/server/label.js +1 -1
- package/server/listbox.js +5 -5
- package/server/menu.js +11 -11
- package/server/menubar.js +1 -1
- package/server/message-scroller.js +4 -4
- package/server/navigation-menu.js +18 -15
- package/server/number-field.js +3 -3
- package/server/otp.js +4 -4
- package/server/pagination.js +3 -3
- package/server/popover.js +20 -7
- package/server/qr-code.js +3 -3
- package/server/radio-group.js +4 -4
- package/server/resizable.js +3 -3
- package/server/runtime.js +23 -7
- package/server/scroll-area.js +5 -5
- package/server/select.js +25 -13
- package/server/separator.js +1 -1
- package/server/slider.js +10 -7
- package/server/switch.js +3 -3
- package/server/tabs.js +5 -5
- package/server/testing.js +3 -0
- package/server/toast.js +57 -20
- package/server/toggle-group.js +1 -1
- package/server/toggle.js +1 -1
- package/server/toolbar.js +4 -4
- package/server/value-bar.js +3 -3
- package/skills/kirana-ui-primitives/SKILL.md +142 -0
- package/src/accordion.jsx +10 -7
- package/src/agent.js +3 -0
- package/src/autosize.jsx +1 -1
- package/src/avatar.jsx +3 -3
- package/src/button.jsx +1 -1
- package/src/calendar.jsx +12 -8
- package/src/carousel.jsx +6 -6
- package/src/checkbox.jsx +3 -3
- package/src/collapsible.jsx +3 -3
- package/src/combobox.jsx +20 -12
- package/src/command.jsx +8 -8
- package/src/date-field.jsx +7 -3
- package/src/date-picker.jsx +2 -2
- package/src/dialog.jsx +8 -2
- package/src/field.jsx +3 -3
- package/src/fieldset.jsx +2 -2
- package/src/form.jsx +1 -1
- package/src/hover-popup.jsx +3 -3
- package/src/input.jsx +1 -1
- package/src/label.jsx +1 -1
- package/src/listbox.jsx +6 -6
- package/src/menu.jsx +11 -11
- package/src/menubar.jsx +1 -1
- package/src/message-scroller.jsx +4 -4
- package/src/navigation-menu.jsx +14 -13
- package/src/number-field.jsx +3 -3
- package/src/otp.jsx +4 -4
- package/src/pagination.jsx +3 -3
- package/src/popover.jsx +20 -4
- package/src/qr-code.jsx +3 -3
- package/src/radio-group.jsx +5 -5
- package/src/resizable.jsx +3 -3
- package/src/runtime.jsx +21 -7
- package/src/scroll-area.jsx +5 -5
- package/src/select.jsx +28 -14
- package/src/separator.jsx +1 -1
- package/src/slider.jsx +11 -8
- package/src/switch.jsx +3 -3
- package/src/tabs.jsx +6 -6
- package/src/testing.js +3 -0
- package/src/toast.jsx +38 -10
- package/src/toggle-group.jsx +2 -2
- package/src/toggle.jsx +1 -1
- package/src/toolbar.jsx +4 -4
- package/src/value-bar.jsx +3 -3
- package/types/accordion.d.ts +21 -19
- package/types/agent.d.ts +1 -0
- package/types/alert-dialog.d.ts +1 -0
- package/types/autocomplete.d.ts +1 -0
- package/types/autosize.d.ts +4 -1
- package/types/avatar.d.ts +12 -5
- package/types/button.d.ts +4 -2
- package/types/calendar.d.ts +35 -18
- package/types/carousel.d.ts +18 -10
- package/types/checkbox.d.ts +9 -6
- package/types/collapsible.d.ts +11 -7
- package/types/combobox.d.ts +61 -62
- package/types/command.d.ts +27 -17
- package/types/context-menu.d.ts +1 -0
- package/types/date-field.d.ts +20 -9
- package/types/date-picker.d.ts +25 -34
- package/types/dialog.d.ts +42 -31
- package/types/direction.d.ts +1 -0
- package/types/drawer.d.ts +1 -0
- package/types/field.d.ts +19 -11
- package/types/fieldset.d.ts +8 -3
- package/types/form.d.ts +5 -2
- package/types/hover-card.d.ts +16 -10
- package/types/hover-popup.d.ts +23 -13
- package/types/index.d.ts +12 -1
- package/types/input.d.ts +4 -3
- package/types/label.d.ts +4 -1
- package/types/listbox.d.ts +18 -20
- package/types/menu.d.ts +56 -42
- package/types/menubar.d.ts +6 -4
- package/types/message-scroller.d.ts +12 -6
- package/types/meter.d.ts +16 -7
- package/types/navigation-menu.d.ts +35 -29
- package/types/number-field.d.ts +13 -6
- package/types/otp.d.ts +17 -10
- package/types/pagination.d.ts +18 -10
- package/types/popover.d.ts +37 -12
- package/types/progress.d.ts +16 -7
- package/types/qr-code.d.ts +10 -4
- package/types/radio-group.d.ts +15 -17
- package/types/resizable.d.ts +12 -7
- package/types/runtime.d.ts +36 -12
- package/types/scroll-area.d.ts +17 -9
- package/types/select.d.ts +55 -46
- package/types/separator.d.ts +5 -3
- package/types/slider.d.ts +25 -13
- package/types/switch.d.ts +7 -4
- package/types/tabs.d.ts +20 -16
- package/types/testing.d.ts +1 -0
- package/types/toast.d.ts +40 -16
- package/types/toggle-group.d.ts +6 -11
- package/types/toggle.d.ts +4 -3
- package/types/toolbar.d.ts +19 -14
- package/types/tooltip.d.ts +16 -10
- package/types/value-bar.d.ts +21 -10
package/src/avatar.jsx
CHANGED
|
@@ -11,7 +11,7 @@ function useAvatar() {
|
|
|
11
11
|
function Root(props) {
|
|
12
12
|
const made = controller(createAvatar, () => ({}));
|
|
13
13
|
return (<Context.Provider value={made}>
|
|
14
|
-
<Part
|
|
14
|
+
<Part of={made.root} tag="span" {...props}/>
|
|
15
15
|
</Context.Provider>);
|
|
16
16
|
}
|
|
17
17
|
/** The picture: in the page once `src` has loaded. */
|
|
@@ -21,7 +21,7 @@ function Image(props) {
|
|
|
21
21
|
createComputed(() => made.source.set(local.src));
|
|
22
22
|
const status = fromSignal(made.status);
|
|
23
23
|
return (<Show when={status() === "loaded"}>
|
|
24
|
-
<Part
|
|
24
|
+
<Part of={made.image} tag="img" {...rest}/>
|
|
25
25
|
</Show>);
|
|
26
26
|
}
|
|
27
27
|
/** What shows until the picture has loaded, or when it cannot. */
|
|
@@ -29,7 +29,7 @@ function Fallback(props) {
|
|
|
29
29
|
const made = useAvatar();
|
|
30
30
|
const status = fromSignal(made.status);
|
|
31
31
|
return (<Show when={status() !== "loaded"}>
|
|
32
|
-
<Part
|
|
32
|
+
<Part of={made.fallback} tag="span" {...props}/>
|
|
33
33
|
</Show>);
|
|
34
34
|
}
|
|
35
35
|
export const Avatar = { Root, Image, Fallback };
|
package/src/button.jsx
CHANGED
|
@@ -5,5 +5,5 @@ import { Part, controller } from "./runtime.jsx";
|
|
|
5
5
|
export function Button(props) {
|
|
6
6
|
const [local, rest] = splitProps(props, ["disabled", "focusableWhenDisabled", "nativeButton"]);
|
|
7
7
|
const made = controller(createButton, () => ({ ...local }));
|
|
8
|
-
return <Part
|
|
8
|
+
return <Part of={made.root} tag="button" {...rest}/>;
|
|
9
9
|
}
|
package/src/calendar.jsx
CHANGED
|
@@ -3,6 +3,10 @@ import { createCalendar } from "@kirana-ui/core/calendar";
|
|
|
3
3
|
import { For, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
4
4
|
import { DirectionContext } from "./direction-context.js";
|
|
5
5
|
import { Part, controller, fromSignal } from "./runtime.jsx";
|
|
6
|
+
/**
|
|
7
|
+
* The calendar its parts are inside. Exported for a component that is made of one (a date picker
|
|
8
|
+
* provides its own to the calendar's parts).
|
|
9
|
+
*/
|
|
6
10
|
const Context = createContext();
|
|
7
11
|
/** For a component made of this one's parts: a date picker. */
|
|
8
12
|
export { Context as CalendarContext };
|
|
@@ -50,20 +54,20 @@ function Root(props) {
|
|
|
50
54
|
onMonthChange: (month) => local.onMonthChange?.(month),
|
|
51
55
|
}));
|
|
52
56
|
return (<Context.Provider value={made}>
|
|
53
|
-
<Part
|
|
57
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
54
58
|
</Context.Provider>);
|
|
55
59
|
}
|
|
56
60
|
/** Names the month shown, unless it is given something else to say. */
|
|
57
61
|
function Heading(props) {
|
|
58
62
|
const made = useCalendar();
|
|
59
63
|
const title = fromSignal(made.title);
|
|
60
|
-
return (<Part
|
|
64
|
+
return (<Part of={made.heading} tag="div" {...props}>
|
|
61
65
|
{props.children ?? title()}
|
|
62
66
|
</Part>);
|
|
63
67
|
}
|
|
64
|
-
const Previous = (props) => (<Part
|
|
65
|
-
const Next = (props) =>
|
|
66
|
-
const Grid = (props) =>
|
|
68
|
+
const Previous = (props) => (<Part of={useCalendar().previous} tag="button" {...props}/>);
|
|
69
|
+
const Next = (props) => <Part of={useCalendar().next} tag="button" {...props}/>;
|
|
70
|
+
const Grid = (props) => <Part of={useCalendar().grid} tag="table" {...props}/>;
|
|
67
71
|
/** Draws its child once for each day of the week, in the locale's order. */
|
|
68
72
|
function Weekdays(props) {
|
|
69
73
|
const weekdays = fromSignal(useCalendar().weekdays);
|
|
@@ -77,18 +81,18 @@ function Weeks(props) {
|
|
|
77
81
|
function HeadCell(props) {
|
|
78
82
|
const [local, rest] = splitProps(props, ["weekday"]);
|
|
79
83
|
const part = useCalendar().headCell(local.weekday);
|
|
80
|
-
return <Part
|
|
84
|
+
return <Part of={part} tag="th" {...rest}/>;
|
|
81
85
|
}
|
|
82
86
|
function Cell(props) {
|
|
83
87
|
const [local, rest] = splitProps(props, ["date"]);
|
|
84
88
|
// A cell is its day for as long as it is in the page.
|
|
85
89
|
const part = useCalendar().cell(local.date);
|
|
86
|
-
return <Part
|
|
90
|
+
return <Part of={part} tag="td" {...rest}/>;
|
|
87
91
|
}
|
|
88
92
|
function Day(props) {
|
|
89
93
|
const [local, rest] = splitProps(props, ["date"]);
|
|
90
94
|
const part = useCalendar().day(local.date);
|
|
91
|
-
return <Part
|
|
95
|
+
return <Part of={part} tag="button" {...rest}/>;
|
|
92
96
|
}
|
|
93
97
|
export const Calendar = {
|
|
94
98
|
Root,
|
package/src/carousel.jsx
CHANGED
|
@@ -30,22 +30,22 @@ function Root(props) {
|
|
|
30
30
|
onIndexChange: (index, details) => local.onIndexChange?.(index, details),
|
|
31
31
|
}));
|
|
32
32
|
return (<Context.Provider value={made}>
|
|
33
|
-
<Part
|
|
33
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
34
34
|
</Context.Provider>);
|
|
35
35
|
}
|
|
36
|
-
const Viewport = (props) =>
|
|
36
|
+
const Viewport = (props) => <Part of={useCarousel().viewport} tag="div" {...props}/>;
|
|
37
37
|
function Item(props) {
|
|
38
38
|
const [local, rest] = splitProps(props, ["index"]);
|
|
39
39
|
// A slide is its place for as long as it is in the page.
|
|
40
40
|
const part = useCarousel().item(local.index);
|
|
41
|
-
return <Part
|
|
41
|
+
return <Part of={part} tag="div" {...rest}/>;
|
|
42
42
|
}
|
|
43
|
-
const Previous = (props) => (<Part
|
|
44
|
-
const Next = (props) =>
|
|
43
|
+
const Previous = (props) => (<Part of={useCarousel().previous} tag="button" {...props}/>);
|
|
44
|
+
const Next = (props) => <Part of={useCarousel().next} tag="button" {...props}/>;
|
|
45
45
|
function Indicator(props) {
|
|
46
46
|
const [local, rest] = splitProps(props, ["index"]);
|
|
47
47
|
// A button is its slide for as long as it is in the page.
|
|
48
48
|
const part = useCarousel().indicator(local.index);
|
|
49
|
-
return <Part
|
|
49
|
+
return <Part of={part} tag="button" {...rest}/>;
|
|
50
50
|
}
|
|
51
51
|
export const Carousel = { Root, Viewport, Item, Previous, Next, Indicator };
|
package/src/checkbox.jsx
CHANGED
|
@@ -41,9 +41,9 @@ function Root(props) {
|
|
|
41
41
|
onCheckedChange: (checked, details) => local.onCheckedChange?.(checked, details),
|
|
42
42
|
}));
|
|
43
43
|
return (<Context.Provider value={made}>
|
|
44
|
-
<Part
|
|
44
|
+
<Part of={made.root} tag="span" {...rest}>
|
|
45
45
|
{local.children}
|
|
46
|
-
<Part
|
|
46
|
+
<Part of={made.input} tag="input"/>
|
|
47
47
|
</Part>
|
|
48
48
|
</Context.Provider>);
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ function Indicator(props) {
|
|
|
53
53
|
const made = useCheckbox();
|
|
54
54
|
const mounted = fromSignal(made.indicatorMounted);
|
|
55
55
|
return (<Show when={mounted() || local.keepMounted}>
|
|
56
|
-
<Part
|
|
56
|
+
<Part of={made.indicator} tag="span" {...rest}/>
|
|
57
57
|
</Show>);
|
|
58
58
|
}
|
|
59
59
|
export const Checkbox = { Root, Indicator };
|
package/src/collapsible.jsx
CHANGED
|
@@ -19,17 +19,17 @@ function Root(props) {
|
|
|
19
19
|
onOpenChange: (open, details) => local.onOpenChange?.(open, details),
|
|
20
20
|
}));
|
|
21
21
|
return (<Context.Provider value={made}>
|
|
22
|
-
<Part
|
|
22
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
23
23
|
</Context.Provider>);
|
|
24
24
|
}
|
|
25
|
-
const Trigger = (props) => (<Part
|
|
25
|
+
const Trigger = (props) => (<Part of={useCollapsible().trigger} tag="button" {...props}/>);
|
|
26
26
|
/** `keepMounted` keeps the closed panel in the page, `hidden`. */
|
|
27
27
|
function Panel(props) {
|
|
28
28
|
const [local, rest] = splitProps(props, ["keepMounted"]);
|
|
29
29
|
const made = useCollapsible();
|
|
30
30
|
const mounted = fromSignal(made.mounted);
|
|
31
31
|
return (<Show when={mounted() || local.keepMounted}>
|
|
32
|
-
<Part
|
|
32
|
+
<Part of={made.panel} tag="div" {...rest}/>
|
|
33
33
|
</Show>);
|
|
34
34
|
}
|
|
35
35
|
export const Collapsible = { Root, Trigger, Panel };
|
package/src/combobox.jsx
CHANGED
|
@@ -16,7 +16,7 @@ function useCombobox() {
|
|
|
16
16
|
function Root(props) {
|
|
17
17
|
const generated = createUniqueId();
|
|
18
18
|
const field = useContext(FieldContext);
|
|
19
|
-
const made = controller(within(createCombobox, { field }), () => ({
|
|
19
|
+
const made = controller(within((createCombobox), { field }), () => ({
|
|
20
20
|
id: props.id ?? generated,
|
|
21
21
|
value: props.value,
|
|
22
22
|
defaultValue: props.defaultValue,
|
|
@@ -32,6 +32,7 @@ function Root(props) {
|
|
|
32
32
|
onValuesChange: (values, details) => props.onValuesChange?.(values, details),
|
|
33
33
|
inline: props.inline,
|
|
34
34
|
virtualized: props.virtualized,
|
|
35
|
+
autoHighlight: props.autoHighlight,
|
|
35
36
|
name: props.name,
|
|
36
37
|
form: props.form,
|
|
37
38
|
items: props.items,
|
|
@@ -44,14 +45,14 @@ function Root(props) {
|
|
|
44
45
|
return (<Context.Provider value={made}>
|
|
45
46
|
{props.children}
|
|
46
47
|
<Show when={named()}>
|
|
47
|
-
<Part
|
|
48
|
+
<Part of={made.hidden} tag="input"/>
|
|
48
49
|
</Show>
|
|
49
50
|
</Context.Provider>);
|
|
50
51
|
}
|
|
51
52
|
const Portal = (props) => (<BodyPortal mounted={useCombobox().mounted}>{props.children}</BodyPortal>);
|
|
52
53
|
function Positioner(props) {
|
|
53
54
|
const made = useCombobox();
|
|
54
|
-
return <Part
|
|
55
|
+
return <Part of={made.positioner} tag="div" {...positioned(props, made.positioning)}/>;
|
|
55
56
|
}
|
|
56
57
|
/** `label` is what is filtered and what the input shows; the item's text when left out. */
|
|
57
58
|
function Item(props) {
|
|
@@ -67,7 +68,7 @@ function Item(props) {
|
|
|
67
68
|
}));
|
|
68
69
|
const part = useCombobox().item(value, () => options.get(), useContext(GroupContext));
|
|
69
70
|
return (<ItemContext.Provider value={value}>
|
|
70
|
-
<Part
|
|
71
|
+
<Part of={part} tag="div" {...rest}/>
|
|
71
72
|
</ItemContext.Provider>);
|
|
72
73
|
}
|
|
73
74
|
function ItemIndicator(props) {
|
|
@@ -76,7 +77,7 @@ function ItemIndicator(props) {
|
|
|
76
77
|
const value = useContext(ItemContext);
|
|
77
78
|
const selected = fromSignal(made.selected(value));
|
|
78
79
|
return (<Show when={selected() || local.keepMounted}>
|
|
79
|
-
<Part
|
|
80
|
+
<Part of={made.itemIndicator(value)} tag="span" {...rest}/>
|
|
80
81
|
</Show>);
|
|
81
82
|
}
|
|
82
83
|
/** A button that empties the input and the value. Drawn while there is something to clear. */
|
|
@@ -85,7 +86,7 @@ function Clear(props) {
|
|
|
85
86
|
const made = useCombobox();
|
|
86
87
|
const clearable = fromSignal(made.clearable);
|
|
87
88
|
return (<Show when={clearable() || local.keepMounted}>
|
|
88
|
-
<Part
|
|
89
|
+
<Part of={made.clear} tag="button" {...rest}/>
|
|
89
90
|
</Show>);
|
|
90
91
|
}
|
|
91
92
|
const ChipContext = createContext();
|
|
@@ -95,16 +96,16 @@ function Chip(props) {
|
|
|
95
96
|
// A chip is its value for as long as it is in the page.
|
|
96
97
|
const value = untrack(() => local.value);
|
|
97
98
|
return (<ChipContext.Provider value={value}>
|
|
98
|
-
<Part
|
|
99
|
+
<Part of={useCombobox().chip(value)} tag="span" {...rest}/>
|
|
99
100
|
</ChipContext.Provider>);
|
|
100
101
|
}
|
|
101
|
-
const ChipRemove = (props) => (<Part
|
|
102
|
+
const ChipRemove = (props) => (<Part of={useCombobox().chipRemove(useContext(ChipContext))} tag="button" {...props}/>);
|
|
102
103
|
/** Drawn while no item is shown for what was typed. */
|
|
103
104
|
function Empty(props) {
|
|
104
105
|
const made = useCombobox();
|
|
105
106
|
const empty = fromSignal(made.empty);
|
|
106
107
|
return (<Show when={empty()}>
|
|
107
|
-
<Part
|
|
108
|
+
<Part of={made.emptyPart} tag="div" {...props}/>
|
|
108
109
|
</Show>);
|
|
109
110
|
}
|
|
110
111
|
const GroupContext = createContext();
|
|
@@ -114,12 +115,12 @@ function Group(props) {
|
|
|
114
115
|
const generated = createUniqueId();
|
|
115
116
|
const group = useCombobox().group(untrack(() => local.id) ?? generated);
|
|
116
117
|
return (<GroupContext.Provider value={group}>
|
|
117
|
-
<Part
|
|
118
|
+
<Part of={group.root} tag="div" {...rest}/>
|
|
118
119
|
</GroupContext.Provider>);
|
|
119
120
|
}
|
|
120
121
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
121
|
-
const GroupLabel = (props) => (<Part
|
|
122
|
-
const part = (name, tag) => (props) => <Part
|
|
122
|
+
const GroupLabel = (props) => (<Part of={useContext(GroupContext)?.label ?? useCombobox().groupLabel} tag="div" {...props}/>);
|
|
123
|
+
const part = (name, tag) => (props) => <Part of={useCombobox()[name]} tag={tag} {...props}/>;
|
|
123
124
|
/** A combobox whose text is the value: the list only suggests. */
|
|
124
125
|
function AutocompleteRoot(props) {
|
|
125
126
|
const generated = createUniqueId();
|
|
@@ -138,6 +139,7 @@ function AutocompleteRoot(props) {
|
|
|
138
139
|
name: props.name,
|
|
139
140
|
form: props.form,
|
|
140
141
|
virtualized: props.virtualized,
|
|
142
|
+
autoHighlight: props.autoHighlight,
|
|
141
143
|
onValueChange: (value, details) => props.onValueChange?.(value, details),
|
|
142
144
|
onOpenChange: (open, details) => props.onOpenChange?.(open, details),
|
|
143
145
|
}));
|
|
@@ -155,6 +157,11 @@ export const Combobox = {
|
|
|
155
157
|
Portal,
|
|
156
158
|
Positioner,
|
|
157
159
|
Popup: part("popup", "div"),
|
|
160
|
+
/**
|
|
161
|
+
* The items' own box inside the popup, when the popup holds more than items (an input): it
|
|
162
|
+
* is then the listbox.
|
|
163
|
+
*/
|
|
164
|
+
List: part("list", "div"),
|
|
158
165
|
Group,
|
|
159
166
|
GroupLabel,
|
|
160
167
|
/** A line between groups. */
|
|
@@ -171,6 +178,7 @@ export const Autocomplete = {
|
|
|
171
178
|
Portal: Combobox.Portal,
|
|
172
179
|
Positioner: Combobox.Positioner,
|
|
173
180
|
Popup: Combobox.Popup,
|
|
181
|
+
List: Combobox.List,
|
|
174
182
|
Group: Combobox.Group,
|
|
175
183
|
GroupLabel: Combobox.GroupLabel,
|
|
176
184
|
Separator: Combobox.Separator,
|
package/src/command.jsx
CHANGED
|
@@ -32,17 +32,17 @@ function Root(props) {
|
|
|
32
32
|
onSelect: (value, details) => local.onSelect?.(value, details),
|
|
33
33
|
}));
|
|
34
34
|
return (<Context.Provider value={made}>
|
|
35
|
-
<Part
|
|
35
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
36
36
|
</Context.Provider>);
|
|
37
37
|
}
|
|
38
|
-
const Input = (props) =>
|
|
39
|
-
const List = (props) => <Part
|
|
38
|
+
const Input = (props) => <Part of={useCommand().input} tag="input" {...props}/>;
|
|
39
|
+
const List = (props) => <Part of={useCommand().list} tag="div" {...props}/>;
|
|
40
40
|
/** Drawn while no item is shown for what was typed. */
|
|
41
41
|
function Empty(props) {
|
|
42
42
|
const made = useCommand();
|
|
43
43
|
const empty = fromSignal(made.empty);
|
|
44
44
|
return (<Show when={empty()}>
|
|
45
|
-
<Part
|
|
45
|
+
<Part of={made.emptyPart} tag="div" {...props}/>
|
|
46
46
|
</Show>);
|
|
47
47
|
}
|
|
48
48
|
/** Items under a `<Command.GroupHeading>`. Hidden while none of them is shown. */
|
|
@@ -51,12 +51,12 @@ function Group(props) {
|
|
|
51
51
|
const generated = createUniqueId();
|
|
52
52
|
const group = useCommand().group(untrack(() => local.id) ?? generated);
|
|
53
53
|
return (<GroupContext.Provider value={group}>
|
|
54
|
-
<Part
|
|
54
|
+
<Part of={group.part} tag="div" {...rest}/>
|
|
55
55
|
</GroupContext.Provider>);
|
|
56
56
|
}
|
|
57
57
|
function GroupHeading(props) {
|
|
58
58
|
const part = useContext(GroupContext)?.heading ?? useCommand().heading;
|
|
59
|
-
return <Part
|
|
59
|
+
return <Part of={part} tag="div" {...props}/>;
|
|
60
60
|
}
|
|
61
61
|
/** `label` is what is filtered, the item's text when left out; `keywords` are other words for it. */
|
|
62
62
|
function Item(props) {
|
|
@@ -69,13 +69,13 @@ function Item(props) {
|
|
|
69
69
|
id: local.id ?? generated,
|
|
70
70
|
}));
|
|
71
71
|
const part = useCommand().item(untrack(() => local.value), () => options.get(), useContext(GroupContext));
|
|
72
|
-
return <Part
|
|
72
|
+
return <Part of={part} tag="div" {...rest}/>;
|
|
73
73
|
}
|
|
74
74
|
/** A line between groups: gone while something is typed, unless `alwaysRender`. */
|
|
75
75
|
function Separator(props) {
|
|
76
76
|
const [local, rest] = splitProps(props, ["alwaysRender"]);
|
|
77
77
|
const options = toSignal(() => ({ alwaysRender: local.alwaysRender }));
|
|
78
78
|
const part = useCommand().separator(() => options.get().alwaysRender);
|
|
79
|
-
return <Part
|
|
79
|
+
return <Part of={part} tag="div" {...rest}/>;
|
|
80
80
|
}
|
|
81
81
|
export const Command = { Root, Input, List, Empty, Group, GroupHeading, Item, Separator };
|
package/src/date-field.jsx
CHANGED
|
@@ -3,6 +3,10 @@ import { createDateField } from "@kirana-ui/core/date-field";
|
|
|
3
3
|
import { For, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
4
4
|
import { DirectionContext } from "./direction-context.js";
|
|
5
5
|
import { Part, controller, fromSignal } from "./runtime.jsx";
|
|
6
|
+
/**
|
|
7
|
+
* The date field its parts are inside. Exported for a component that is made of one (a date picker
|
|
8
|
+
* provides its own to the date field's parts).
|
|
9
|
+
*/
|
|
6
10
|
const Context = createContext();
|
|
7
11
|
/** For a component made of this one's parts: a date picker. */
|
|
8
12
|
export { Context as DateFieldContext };
|
|
@@ -46,7 +50,7 @@ function Root(props) {
|
|
|
46
50
|
onValueChange: (value, details) => local.onValueChange?.(value, details),
|
|
47
51
|
}));
|
|
48
52
|
return (<Context.Provider value={made}>
|
|
49
|
-
<Part
|
|
53
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
50
54
|
</Context.Provider>);
|
|
51
55
|
}
|
|
52
56
|
/** Draws its child once for each piece of the date, in the locale's order. */
|
|
@@ -59,9 +63,9 @@ function Segment(props) {
|
|
|
59
63
|
const [local, rest] = splitProps(props, ["segment"]);
|
|
60
64
|
const made = useDateField().segment(local.segment);
|
|
61
65
|
const shown = fromSignal(made.text);
|
|
62
|
-
return (<Part
|
|
66
|
+
return (<Part of={made.part} tag="span" {...rest}>
|
|
63
67
|
{shown()}
|
|
64
68
|
</Part>);
|
|
65
69
|
}
|
|
66
|
-
const Input = (props) =>
|
|
70
|
+
const Input = (props) => <Part of={useDateField().input} tag="input" {...props}/>;
|
|
67
71
|
export const DateField = { Root, Segments, Segment, Input };
|
package/src/date-picker.jsx
CHANGED
|
@@ -50,7 +50,7 @@ function Root(props) {
|
|
|
50
50
|
export const DatePicker = {
|
|
51
51
|
Root,
|
|
52
52
|
/** The typed date: what holds its segments and its hidden input. */
|
|
53
|
-
Field: (props) =>
|
|
53
|
+
Field: (props) => <Part of={useDatePicker().field.root} tag="div" {...props}/>,
|
|
54
54
|
Segments: DateField.Segments,
|
|
55
55
|
Segment: DateField.Segment,
|
|
56
56
|
Input: DateField.Input,
|
|
@@ -59,7 +59,7 @@ export const DatePicker = {
|
|
|
59
59
|
Positioner: Popover.Positioner,
|
|
60
60
|
Popup: Popover.Popup,
|
|
61
61
|
/** The calendar: what holds its heading, its buttons and its grid. */
|
|
62
|
-
Calendar: (props) => (<Part
|
|
62
|
+
Calendar: (props) => (<Part of={useDatePicker().calendar.root} tag="div" {...props}/>),
|
|
63
63
|
Heading: Calendar.Heading,
|
|
64
64
|
Previous: Calendar.Previous,
|
|
65
65
|
Next: Calendar.Next,
|
package/src/dialog.jsx
CHANGED
|
@@ -23,7 +23,7 @@ function Root(props) {
|
|
|
23
23
|
return <Context.Provider value={made}>{props.children}</Context.Provider>;
|
|
24
24
|
}
|
|
25
25
|
const Portal = (props) => (<BodyPortal mounted={useDialog().mounted}>{props.children}</BodyPortal>);
|
|
26
|
-
const part = (name, tag) => (props) => <Part
|
|
26
|
+
const part = (name, tag) => (props) => <Part of={useDialog()[name]} tag={tag} {...props}/>;
|
|
27
27
|
function AlertRoot(props) {
|
|
28
28
|
const generated = createUniqueId();
|
|
29
29
|
const made = controller(createAlertDialog, () => ({
|
|
@@ -64,4 +64,10 @@ function DrawerRoot(props) {
|
|
|
64
64
|
return <Context.Provider value={made}>{props.children}</Context.Provider>;
|
|
65
65
|
}
|
|
66
66
|
/** A dialog that comes from an edge and is dragged back to it. Its parts are a dialog's. */
|
|
67
|
-
export const Drawer = {
|
|
67
|
+
export const Drawer = {
|
|
68
|
+
...Dialog,
|
|
69
|
+
Root: DrawerRoot,
|
|
70
|
+
// The same components: only what `render` reads of their state is a drawer's.
|
|
71
|
+
Backdrop: Dialog.Backdrop,
|
|
72
|
+
Popup: Dialog.Popup,
|
|
73
|
+
};
|
package/src/field.jsx
CHANGED
|
@@ -28,7 +28,7 @@ function Root(props) {
|
|
|
28
28
|
validate: (value) => local.validate?.(value) ?? null,
|
|
29
29
|
}));
|
|
30
30
|
return (<FieldContext.Provider value={made}>
|
|
31
|
-
<Part
|
|
31
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
32
32
|
</FieldContext.Provider>);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
@@ -43,7 +43,7 @@ function FieldError(props) {
|
|
|
43
43
|
const mounted = fromSignal(error.mounted);
|
|
44
44
|
const text = fromSignal(error.text);
|
|
45
45
|
return (<Show when={mounted()}>
|
|
46
|
-
<Part
|
|
46
|
+
<Part of={error.part} tag="div" {...rest}>
|
|
47
47
|
{local.children ?? text()}
|
|
48
48
|
</Part>
|
|
49
49
|
</Show>);
|
|
@@ -52,7 +52,7 @@ function FieldError(props) {
|
|
|
52
52
|
function Validity(props) {
|
|
53
53
|
return props.children(fromSignal(useField().validity));
|
|
54
54
|
}
|
|
55
|
-
const part = (key, tag) => (props) =>
|
|
55
|
+
const part = (key, tag) => (props) => <Part of={useField()[key]} tag={tag} {...props}/>;
|
|
56
56
|
export const Field = {
|
|
57
57
|
Root,
|
|
58
58
|
Label: part("label", "label"),
|
package/src/fieldset.jsx
CHANGED
|
@@ -17,8 +17,8 @@ function Root(props) {
|
|
|
17
17
|
disabled: local.disabled,
|
|
18
18
|
}));
|
|
19
19
|
return (<FieldsetContext.Provider value={made}>
|
|
20
|
-
<Part
|
|
20
|
+
<Part of={made.root} tag="fieldset" {...rest}/>
|
|
21
21
|
</FieldsetContext.Provider>);
|
|
22
22
|
}
|
|
23
|
-
const Legend = (props) =>
|
|
23
|
+
const Legend = (props) => <Part of={useFieldset().legend} tag="div" {...props}/>;
|
|
24
24
|
export const Fieldset = { Root, Legend };
|
package/src/form.jsx
CHANGED
|
@@ -21,6 +21,6 @@ export function Form(props) {
|
|
|
21
21
|
onClearErrors: (errors) => local.onClearErrors?.(errors),
|
|
22
22
|
}));
|
|
23
23
|
return (<FormContext.Provider value={made}>
|
|
24
|
-
<Part
|
|
24
|
+
<Part of={made.root} tag="form" {...rest}/>
|
|
25
25
|
</FormContext.Provider>);
|
|
26
26
|
}
|
package/src/hover-popup.jsx
CHANGED
|
@@ -27,15 +27,15 @@ export function hoverPopup(name, create, triggerTag) {
|
|
|
27
27
|
const Portal = (props) => (<BodyPortal mounted={use().mounted}>{props.children}</BodyPortal>);
|
|
28
28
|
function Positioner(props) {
|
|
29
29
|
const made = use();
|
|
30
|
-
return <Part
|
|
30
|
+
return <Part of={made.positioner} tag="div" {...positioned(props, made.positioning)}/>;
|
|
31
31
|
}
|
|
32
|
-
const part = (key, tag) => (props) =>
|
|
32
|
+
const part = (key, tag) => (props) => <Part of={use()[key]} tag={tag} {...props}/>;
|
|
33
33
|
/** `delay` and `closeDelay` here come before the root's. */
|
|
34
34
|
function Trigger(props) {
|
|
35
35
|
const [local, rest] = splitProps(props, ["delay", "closeDelay"]);
|
|
36
36
|
const made = use();
|
|
37
37
|
createComputed(() => made.timing.set(defined({ ...local })));
|
|
38
|
-
return <Part
|
|
38
|
+
return <Part of={made.trigger} tag={triggerTag} {...rest}/>;
|
|
39
39
|
}
|
|
40
40
|
return {
|
|
41
41
|
Root,
|
package/src/input.jsx
CHANGED
package/src/label.jsx
CHANGED
|
@@ -5,5 +5,5 @@ import { Part } from "./runtime.jsx";
|
|
|
5
5
|
/** A `<label>`. Inside a `<Field.Root>` it is the field's label. */
|
|
6
6
|
export function Label(props) {
|
|
7
7
|
const made = createLabel({ field: useContext(FieldContext) });
|
|
8
|
-
return <Part
|
|
8
|
+
return <Part of={made.label} tag="label" {...props}/>;
|
|
9
9
|
}
|
package/src/listbox.jsx
CHANGED
|
@@ -25,7 +25,7 @@ function Root(props) {
|
|
|
25
25
|
"id",
|
|
26
26
|
]);
|
|
27
27
|
const generated = createUniqueId();
|
|
28
|
-
const made = controller(createListbox, () => ({
|
|
28
|
+
const made = controller((createListbox), () => ({
|
|
29
29
|
id: local.id ?? generated,
|
|
30
30
|
value: local.value,
|
|
31
31
|
defaultValue: local.defaultValue,
|
|
@@ -38,7 +38,7 @@ function Root(props) {
|
|
|
38
38
|
onValueChange: (value, details) => local.onValueChange?.(value, details),
|
|
39
39
|
}));
|
|
40
40
|
return (<Context.Provider value={made}>
|
|
41
|
-
<Part
|
|
41
|
+
<Part of={made.root} tag="div" {...rest}/>
|
|
42
42
|
</Context.Provider>);
|
|
43
43
|
}
|
|
44
44
|
function Item(props) {
|
|
@@ -52,7 +52,7 @@ function Item(props) {
|
|
|
52
52
|
}));
|
|
53
53
|
const part = useListbox().item(value, () => defined(options.get()));
|
|
54
54
|
return (<ItemContext.Provider value={value}>
|
|
55
|
-
<Part
|
|
55
|
+
<Part of={part} tag="div" {...rest}/>
|
|
56
56
|
</ItemContext.Provider>);
|
|
57
57
|
}
|
|
58
58
|
function ItemIndicator(props) {
|
|
@@ -61,7 +61,7 @@ function ItemIndicator(props) {
|
|
|
61
61
|
const value = useContext(ItemContext);
|
|
62
62
|
const selected = fromSignal(made.selected(value));
|
|
63
63
|
return (<Show when={selected() || local.keepMounted}>
|
|
64
|
-
<Part
|
|
64
|
+
<Part of={made.indicator(value)} tag="span" {...rest}/>
|
|
65
65
|
</Show>);
|
|
66
66
|
}
|
|
67
67
|
function Group(props) {
|
|
@@ -69,13 +69,13 @@ function Group(props) {
|
|
|
69
69
|
const generated = createUniqueId();
|
|
70
70
|
const group = useListbox().group(untrack(() => local.id) ?? generated);
|
|
71
71
|
return (<GroupContext.Provider value={group}>
|
|
72
|
-
<Part
|
|
72
|
+
<Part of={group.root} tag="div" {...rest}/>
|
|
73
73
|
</GroupContext.Provider>);
|
|
74
74
|
}
|
|
75
75
|
function GroupLabel(props) {
|
|
76
76
|
const group = useContext(GroupContext);
|
|
77
77
|
if (!group)
|
|
78
78
|
throw new Error("A Listbox.GroupLabel must be inside <Listbox.Group>");
|
|
79
|
-
return <Part
|
|
79
|
+
return <Part of={group.label} tag="div" {...props}/>;
|
|
80
80
|
}
|
|
81
81
|
export const Listbox = { Root, Item, ItemIndicator, Group, GroupLabel };
|
package/src/menu.jsx
CHANGED
|
@@ -52,32 +52,32 @@ const SubmenuRoot = (props) => make(props, "submenu");
|
|
|
52
52
|
const Portal = (props) => (<BodyPortal mounted={useMenu().mounted}>{props.children}</BodyPortal>);
|
|
53
53
|
function Positioner(props) {
|
|
54
54
|
const made = useMenu();
|
|
55
|
-
return <Part
|
|
55
|
+
return <Part of={made.positioner} tag="div" {...positioned(props, made.positioning)}/>;
|
|
56
56
|
}
|
|
57
57
|
const ITEM = ["disabled", "label", "closeOnClick"];
|
|
58
58
|
function Item(props) {
|
|
59
59
|
const [local, rest] = splitProps(props, ITEM);
|
|
60
60
|
const options = toSignal(() => ({ ...local }));
|
|
61
61
|
const part = useMenu().item(() => defined(options.get()));
|
|
62
|
-
return <Part
|
|
62
|
+
return <Part of={part} tag="div" {...rest}/>;
|
|
63
63
|
}
|
|
64
64
|
/** An item that is a link: `href` and the rest go to its `<a>`. */
|
|
65
65
|
function LinkItem(props) {
|
|
66
66
|
const [local, rest] = splitProps(props, ITEM);
|
|
67
67
|
const options = toSignal(() => ({ ...local }));
|
|
68
68
|
const part = useMenu().item(() => defined(options.get()));
|
|
69
|
-
return <Part
|
|
69
|
+
return <Part of={part} tag="a" {...rest}/>;
|
|
70
70
|
}
|
|
71
71
|
function Group(props) {
|
|
72
72
|
const [local, rest] = splitProps(props, ["id"]);
|
|
73
73
|
const generated = createUniqueId();
|
|
74
74
|
const group = useMenu().group(untrack(() => local.id) ?? generated);
|
|
75
75
|
return (<GroupContext.Provider value={group}>
|
|
76
|
-
<Part
|
|
76
|
+
<Part of={group.root} tag="div" {...rest}/>
|
|
77
77
|
</GroupContext.Provider>);
|
|
78
78
|
}
|
|
79
79
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
80
|
-
const GroupLabel = (props) => (<Part
|
|
80
|
+
const GroupLabel = (props) => (<Part of={useContext(GroupContext)?.label ?? useMenu().label} tag="div" {...props}/>);
|
|
81
81
|
function CheckboxItem(props) {
|
|
82
82
|
const [local, rest] = splitProps(props, [...ITEM, "checked", "defaultChecked", "onCheckedChange"]);
|
|
83
83
|
const item = controller(useMenu().checkboxItem, () => ({
|
|
@@ -89,7 +89,7 @@ function CheckboxItem(props) {
|
|
|
89
89
|
onCheckedChange: (checked, details) => local.onCheckedChange?.(checked, details),
|
|
90
90
|
}));
|
|
91
91
|
return (<CheckboxContext.Provider value={item}>
|
|
92
|
-
<Part
|
|
92
|
+
<Part of={item.part} tag="div" {...rest}/>
|
|
93
93
|
</CheckboxContext.Provider>);
|
|
94
94
|
}
|
|
95
95
|
function CheckboxItemIndicator(props) {
|
|
@@ -97,7 +97,7 @@ function CheckboxItemIndicator(props) {
|
|
|
97
97
|
const item = inside(useContext(CheckboxContext), "CheckboxItem");
|
|
98
98
|
const checked = fromSignal(item.checked);
|
|
99
99
|
return (<Show when={checked() || local.keepMounted}>
|
|
100
|
-
<Part
|
|
100
|
+
<Part of={item.indicator} tag="span" {...rest}/>
|
|
101
101
|
</Show>);
|
|
102
102
|
}
|
|
103
103
|
function RadioGroup(props) {
|
|
@@ -109,7 +109,7 @@ function RadioGroup(props) {
|
|
|
109
109
|
onValueChange: (value, details) => local.onValueChange?.(value, details),
|
|
110
110
|
}));
|
|
111
111
|
return (<RadioGroupContext.Provider value={group}>
|
|
112
|
-
<Part
|
|
112
|
+
<Part of={group.root} tag="div" {...rest}/>
|
|
113
113
|
</RadioGroupContext.Provider>);
|
|
114
114
|
}
|
|
115
115
|
function RadioItem(props) {
|
|
@@ -123,7 +123,7 @@ function RadioItem(props) {
|
|
|
123
123
|
}));
|
|
124
124
|
const part = inside(useContext(RadioGroupContext), "RadioGroup").item(value, () => defined(options.get()));
|
|
125
125
|
return (<RadioItemContext.Provider value={value}>
|
|
126
|
-
<Part
|
|
126
|
+
<Part of={part} tag="div" {...rest}/>
|
|
127
127
|
</RadioItemContext.Provider>);
|
|
128
128
|
}
|
|
129
129
|
function RadioItemIndicator(props) {
|
|
@@ -132,10 +132,10 @@ function RadioItemIndicator(props) {
|
|
|
132
132
|
const value = useContext(RadioItemContext);
|
|
133
133
|
const checked = fromSignal(group.checked(value));
|
|
134
134
|
return (<Show when={checked() || local.keepMounted}>
|
|
135
|
-
<Part
|
|
135
|
+
<Part of={group.indicator(value)} tag="span" {...rest}/>
|
|
136
136
|
</Show>);
|
|
137
137
|
}
|
|
138
|
-
const part = (name, tag) => (props) => <Part
|
|
138
|
+
const part = (name, tag) => (props) => <Part of={useMenu()[name]} tag={tag} {...props}/>;
|
|
139
139
|
export const Menu = {
|
|
140
140
|
Root,
|
|
141
141
|
Portal,
|
package/src/menubar.jsx
CHANGED