@kirana-ui/solid 0.1.1 → 0.3.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 +39 -14
- package/dom/button.js +1 -1
- package/dom/calendar.js +78 -19
- package/dom/carousel.js +6 -6
- package/dom/checkbox-group-context.js +3 -0
- package/dom/checkbox-group.js +38 -0
- package/dom/checkbox.js +9 -5
- package/dom/collapsible.js +3 -3
- package/dom/combobox.js +72 -14
- package/dom/command.js +10 -9
- package/dom/date-field.js +7 -3
- package/dom/date-picker.js +9 -3
- package/dom/dialog.js +13 -3
- 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/index.js +1 -0
- 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 +39 -6
- package/dom/otp.js +6 -5
- package/dom/pagination.js +3 -3
- package/dom/popover.js +37 -8
- package/dom/primitive.js +92 -0
- package/dom/qr-code.js +3 -3
- package/dom/radio-group.js +7 -6
- package/dom/resizable.js +3 -3
- package/dom/runtime.js +23 -7
- package/dom/scroll-area.js +5 -5
- package/dom/select.js +26 -13
- package/dom/separator.js +1 -1
- package/dom/slider.js +11 -8
- 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 +1846 -252
- package/package.json +34 -2
- package/server/accordion.js +9 -6
- package/server/agent.js +3 -0
- package/server/autosize.js +1 -1
- package/server/avatar.js +39 -14
- package/server/button.js +1 -1
- package/server/calendar.js +78 -19
- package/server/carousel.js +6 -6
- package/server/checkbox-group-context.js +3 -0
- package/server/checkbox-group.js +38 -0
- package/server/checkbox.js +9 -5
- package/server/collapsible.js +3 -3
- package/server/combobox.js +72 -14
- package/server/command.js +10 -9
- package/server/date-field.js +7 -3
- package/server/date-picker.js +9 -3
- package/server/dialog.js +13 -3
- 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/index.js +1 -0
- 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 +39 -6
- package/server/otp.js +6 -5
- package/server/pagination.js +3 -3
- package/server/popover.js +37 -8
- package/server/primitive.js +92 -0
- package/server/qr-code.js +3 -3
- package/server/radio-group.js +7 -6
- package/server/resizable.js +3 -3
- package/server/runtime.js +23 -7
- package/server/scroll-area.js +5 -5
- package/server/select.js +26 -13
- package/server/separator.js +1 -1
- package/server/slider.js +11 -8
- 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 +163 -0
- package/src/accordion.jsx +10 -7
- package/src/agent.js +3 -0
- package/src/autosize.jsx +1 -1
- package/src/avatar.jsx +17 -10
- package/src/button.jsx +1 -1
- package/src/calendar.jsx +72 -16
- package/src/carousel.jsx +6 -6
- package/src/checkbox-group-context.js +3 -0
- package/src/checkbox-group.jsx +33 -0
- package/src/checkbox.jsx +8 -4
- package/src/collapsible.jsx +3 -3
- package/src/combobox.jsx +70 -13
- package/src/command.jsx +10 -8
- package/src/date-field.jsx +7 -3
- package/src/date-picker.jsx +8 -2
- package/src/dialog.jsx +12 -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/index.js +1 -0
- 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 +26 -6
- package/src/otp.jsx +6 -4
- package/src/pagination.jsx +3 -3
- package/src/popover.jsx +35 -5
- package/src/primitive.jsx +81 -0
- package/src/qr-code.jsx +3 -3
- package/src/radio-group.jsx +7 -7
- package/src/resizable.jsx +3 -3
- package/src/runtime.jsx +21 -7
- package/src/scroll-area.jsx +5 -5
- package/src/select.jsx +29 -14
- package/src/separator.jsx +1 -1
- package/src/slider.jsx +12 -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 +14 -6
- package/types/button.d.ts +4 -2
- package/types/calendar.d.ts +48 -19
- package/types/carousel.d.ts +18 -10
- package/types/checkbox-group-context.d.ts +3 -0
- package/types/checkbox-group.d.ts +13 -0
- package/types/checkbox.d.ts +10 -6
- package/types/collapsible.d.ts +11 -7
- package/types/combobox.d.ts +102 -64
- package/types/command.d.ts +29 -17
- package/types/context-menu.d.ts +1 -0
- package/types/date-field.d.ts +20 -9
- package/types/date-picker.d.ts +26 -34
- package/types/dialog.d.ts +47 -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 +15 -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 +22 -7
- package/types/otp.d.ts +18 -10
- package/types/pagination.d.ts +18 -10
- package/types/popover.d.ts +52 -13
- package/types/primitive.d.ts +50 -0
- package/types/progress.d.ts +16 -7
- package/types/qr-code.d.ts +10 -4
- package/types/radio-group.d.ts +18 -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/dom/accordion.js
CHANGED
|
@@ -38,7 +38,7 @@ function Root(props) {
|
|
|
38
38
|
value: made,
|
|
39
39
|
get children() {
|
|
40
40
|
return _$createComponent(Part, _$mergeProps({
|
|
41
|
-
get
|
|
41
|
+
get of() {
|
|
42
42
|
return made.root;
|
|
43
43
|
},
|
|
44
44
|
tag: "div"
|
|
@@ -46,19 +46,22 @@ function Root(props) {
|
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
/** `value` tells this item from the others; an item that is given none makes its own. */
|
|
49
50
|
function Item(props) {
|
|
50
51
|
const [local, rest] = splitProps(props, ["value", "disabled"]);
|
|
51
52
|
const options = toSignal(() => ({
|
|
52
53
|
disabled: local.disabled
|
|
53
54
|
}));
|
|
55
|
+
const generated = createUniqueId();
|
|
54
56
|
// An item is its value for as long as it is in the page.
|
|
55
|
-
const
|
|
57
|
+
const value = untrack(() => local.value);
|
|
58
|
+
const item = useAccordion().item(value === undefined ? generated : value, () => defined(options.get()));
|
|
56
59
|
onMount(() => onCleanup(item.mount()));
|
|
57
60
|
return _$createComponent(ItemContext.Provider, {
|
|
58
61
|
value: item,
|
|
59
62
|
get children() {
|
|
60
63
|
return _$createComponent(Part, _$mergeProps({
|
|
61
|
-
get
|
|
64
|
+
get of() {
|
|
62
65
|
return item.root;
|
|
63
66
|
},
|
|
64
67
|
tag: "div"
|
|
@@ -67,13 +70,13 @@ function Item(props) {
|
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
72
|
const Header = props => _$createComponent(Part, _$mergeProps({
|
|
70
|
-
get
|
|
73
|
+
get of() {
|
|
71
74
|
return useItem().header;
|
|
72
75
|
},
|
|
73
76
|
tag: "h3"
|
|
74
77
|
}, props));
|
|
75
78
|
const Trigger = props => _$createComponent(Part, _$mergeProps({
|
|
76
|
-
get
|
|
79
|
+
get of() {
|
|
77
80
|
return useItem().trigger;
|
|
78
81
|
},
|
|
79
82
|
tag: "button"
|
|
@@ -89,7 +92,7 @@ function Panel(props) {
|
|
|
89
92
|
},
|
|
90
93
|
get children() {
|
|
91
94
|
return _$createComponent(Part, _$mergeProps({
|
|
92
|
-
get
|
|
95
|
+
get of() {
|
|
93
96
|
return item.panel;
|
|
94
97
|
},
|
|
95
98
|
tag: "div"
|
package/dom/agent.js
ADDED
package/dom/autosize.js
CHANGED
package/dom/avatar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
2
2
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
3
|
import { createAvatar } from "@kirana-ui/core/avatar";
|
|
4
|
-
import { Show, createComputed, createContext, splitProps, useContext } from "solid-js";
|
|
4
|
+
import { Show, createComputed, createContext, onCleanup, onMount, splitProps, untrack, useContext } from "solid-js";
|
|
5
5
|
import { Part, controller, fromSignal } from "./runtime.js";
|
|
6
6
|
const Context = createContext();
|
|
7
7
|
function useAvatar() {
|
|
@@ -15,7 +15,7 @@ function Root(props) {
|
|
|
15
15
|
value: made,
|
|
16
16
|
get children() {
|
|
17
17
|
return _$createComponent(Part, _$mergeProps({
|
|
18
|
-
get
|
|
18
|
+
get of() {
|
|
19
19
|
return made.root;
|
|
20
20
|
},
|
|
21
21
|
tag: "span"
|
|
@@ -23,41 +23,66 @@ function Root(props) {
|
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
|
-
/** The picture: in the page once `src` has loaded
|
|
26
|
+
/** The picture: in the page once `src` has loaded, or all along with `keepMounted`. */
|
|
27
27
|
function Image(props) {
|
|
28
|
-
const [local, rest] = splitProps(props, ["src"]);
|
|
28
|
+
const [local, rest] = splitProps(props, ["src", "onLoadingStatusChange", "keepMounted"]);
|
|
29
29
|
const made = useAvatar();
|
|
30
30
|
createComputed(() => made.source.set(local.src));
|
|
31
|
+
const report = made.statusReport(() => local.onLoadingStatusChange);
|
|
32
|
+
onMount(() => onCleanup(report.mount()));
|
|
31
33
|
const status = fromSignal(made.status);
|
|
32
34
|
return _$createComponent(Show, {
|
|
33
35
|
get when() {
|
|
34
|
-
return
|
|
36
|
+
return !local.keepMounted;
|
|
35
37
|
},
|
|
36
|
-
get
|
|
38
|
+
get fallback() {
|
|
37
39
|
return _$createComponent(Part, _$mergeProps({
|
|
38
|
-
get
|
|
39
|
-
return made.
|
|
40
|
+
get of() {
|
|
41
|
+
return made.keptImage;
|
|
40
42
|
},
|
|
41
|
-
tag: "img"
|
|
43
|
+
tag: "img",
|
|
44
|
+
get src() {
|
|
45
|
+
return local.src;
|
|
46
|
+
}
|
|
42
47
|
}, rest));
|
|
48
|
+
},
|
|
49
|
+
get children() {
|
|
50
|
+
return _$createComponent(Show, {
|
|
51
|
+
get when() {
|
|
52
|
+
return status() === "loaded";
|
|
53
|
+
},
|
|
54
|
+
get children() {
|
|
55
|
+
return _$createComponent(Part, _$mergeProps({
|
|
56
|
+
get of() {
|
|
57
|
+
return made.image;
|
|
58
|
+
},
|
|
59
|
+
tag: "img"
|
|
60
|
+
}, rest));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
43
63
|
}
|
|
44
64
|
});
|
|
45
65
|
}
|
|
46
|
-
/** What shows until the picture has loaded, or when it cannot. */
|
|
66
|
+
/** What shows until the picture has loaded, or when it cannot; after `delay`, when given one. */
|
|
47
67
|
function Fallback(props) {
|
|
68
|
+
const [local, rest] = splitProps(props, ["delay"]);
|
|
48
69
|
const made = useAvatar();
|
|
49
|
-
const
|
|
70
|
+
const presence = made.fallbackPresence({
|
|
71
|
+
delay: untrack(() => local.delay)
|
|
72
|
+
});
|
|
73
|
+
onMount(() => onCleanup(presence.mount()));
|
|
74
|
+
const shown = fromSignal(presence.shown);
|
|
50
75
|
return _$createComponent(Show, {
|
|
51
76
|
get when() {
|
|
52
|
-
return
|
|
77
|
+
return shown();
|
|
53
78
|
},
|
|
54
79
|
get children() {
|
|
55
80
|
return _$createComponent(Part, _$mergeProps({
|
|
56
|
-
get
|
|
81
|
+
get of() {
|
|
57
82
|
return made.fallback;
|
|
58
83
|
},
|
|
59
84
|
tag: "span"
|
|
60
|
-
},
|
|
85
|
+
}, rest));
|
|
61
86
|
}
|
|
62
87
|
});
|
|
63
88
|
}
|
package/dom/button.js
CHANGED
package/dom/calendar.js
CHANGED
|
@@ -3,9 +3,13 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
3
3
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
4
4
|
import { within } from "@kirana-ui/core";
|
|
5
5
|
import { createCalendar } from "@kirana-ui/core/calendar";
|
|
6
|
-
import { For, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
6
|
+
import { For, Index, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
7
7
|
import { DirectionContext } from "./direction-context.js";
|
|
8
8
|
import { Part, controller, fromSignal } from "./runtime.js";
|
|
9
|
+
/**
|
|
10
|
+
* The calendar its parts are inside. Exported for a component that is made of one (a date picker
|
|
11
|
+
* provides its own to the calendar's parts).
|
|
12
|
+
*/
|
|
9
13
|
const Context = createContext();
|
|
10
14
|
/** For a component made of this one's parts: a date picker. */
|
|
11
15
|
export { Context as CalendarContext };
|
|
@@ -14,17 +18,28 @@ function useCalendar() {
|
|
|
14
18
|
if (!made) throw new Error("A Calendar part must be inside <Calendar.Root>");
|
|
15
19
|
return made;
|
|
16
20
|
}
|
|
21
|
+
/** The place of the month its parts are drawn in, inside `Calendar.Months`. */
|
|
22
|
+
const MonthContext = createContext();
|
|
23
|
+
/** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */
|
|
24
|
+
const useMonth = () => useCalendar().monthAt(useContext(MonthContext) ?? 0);
|
|
17
25
|
function Root(props) {
|
|
18
|
-
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "mode", "
|
|
26
|
+
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "mode", "minDays", "maxDays", "months", "pagedNavigation", "month", "defaultMonth", "onMonthChange", "defaultFocusedValue", "locale", "calendarSystem", "min", "max", "isDateUnavailable", "disabled", "readOnly", "fixedWeeks", "name", "form", "id"]);
|
|
19
27
|
const generated = createUniqueId();
|
|
20
28
|
const direction = useContext(DirectionContext);
|
|
21
29
|
const made = controller(within(createCalendar, {
|
|
22
30
|
direction
|
|
23
31
|
}), () => ({
|
|
24
32
|
id: local.id ?? generated,
|
|
33
|
+
// The core holds any mode's value; the caller's is its mode's.
|
|
25
34
|
value: local.value,
|
|
26
35
|
defaultValue: local.defaultValue,
|
|
27
36
|
mode: local.mode,
|
|
37
|
+
minDays: local.minDays,
|
|
38
|
+
maxDays: local.maxDays,
|
|
39
|
+
months: local.months,
|
|
40
|
+
pagedNavigation: local.pagedNavigation,
|
|
41
|
+
month: local.month,
|
|
42
|
+
defaultMonth: local.defaultMonth,
|
|
28
43
|
defaultFocusedValue: local.defaultFocusedValue,
|
|
29
44
|
locale: local.locale,
|
|
30
45
|
calendarSystem: local.calendarSystem,
|
|
@@ -34,14 +49,16 @@ function Root(props) {
|
|
|
34
49
|
disabled: local.disabled,
|
|
35
50
|
readOnly: local.readOnly,
|
|
36
51
|
fixedWeeks: local.fixedWeeks,
|
|
52
|
+
name: local.name,
|
|
53
|
+
form: local.form,
|
|
37
54
|
onValueChange: (value, details) => local.onValueChange?.(value, details),
|
|
38
|
-
onMonthChange: month => local.onMonthChange?.(month)
|
|
55
|
+
onMonthChange: (month, details) => local.onMonthChange?.(month, details)
|
|
39
56
|
}));
|
|
40
57
|
return _$createComponent(Context.Provider, {
|
|
41
58
|
value: made,
|
|
42
59
|
get children() {
|
|
43
60
|
return _$createComponent(Part, _$mergeProps({
|
|
44
|
-
get
|
|
61
|
+
get of() {
|
|
45
62
|
return made.root;
|
|
46
63
|
},
|
|
47
64
|
tag: "div"
|
|
@@ -51,11 +68,11 @@ function Root(props) {
|
|
|
51
68
|
}
|
|
52
69
|
/** Names the month shown, unless it is given something else to say. */
|
|
53
70
|
function Heading(props) {
|
|
54
|
-
const
|
|
55
|
-
const title = fromSignal(
|
|
71
|
+
const month = useMonth();
|
|
72
|
+
const title = fromSignal(month.title);
|
|
56
73
|
return _$createComponent(Part, _$mergeProps({
|
|
57
|
-
get
|
|
58
|
-
return
|
|
74
|
+
get of() {
|
|
75
|
+
return month.heading;
|
|
59
76
|
},
|
|
60
77
|
tag: "div"
|
|
61
78
|
}, props, {
|
|
@@ -65,23 +82,56 @@ function Heading(props) {
|
|
|
65
82
|
}));
|
|
66
83
|
}
|
|
67
84
|
const Previous = props => _$createComponent(Part, _$mergeProps({
|
|
68
|
-
get
|
|
85
|
+
get of() {
|
|
69
86
|
return useCalendar().previous;
|
|
70
87
|
},
|
|
71
88
|
tag: "button"
|
|
72
89
|
}, props));
|
|
73
90
|
const Next = props => _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
91
|
+
get of() {
|
|
75
92
|
return useCalendar().next;
|
|
76
93
|
},
|
|
77
94
|
tag: "button"
|
|
78
95
|
}, props));
|
|
79
96
|
const Grid = props => _$createComponent(Part, _$mergeProps({
|
|
80
|
-
get
|
|
81
|
-
return
|
|
97
|
+
get of() {
|
|
98
|
+
return useMonth().grid;
|
|
82
99
|
},
|
|
83
100
|
tag: "table"
|
|
84
101
|
}, props));
|
|
102
|
+
/**
|
|
103
|
+
* Draws its child once for each month shown (`months` on the root), side by side: the parts
|
|
104
|
+
* inside each are that month's. Left out for one month.
|
|
105
|
+
*/
|
|
106
|
+
function Months(props) {
|
|
107
|
+
const months = fromSignal(useCalendar().months);
|
|
108
|
+
// Kept by place: the month given reads the one now there, as props do.
|
|
109
|
+
return _$createComponent(Index, {
|
|
110
|
+
get each() {
|
|
111
|
+
return months();
|
|
112
|
+
},
|
|
113
|
+
children: (month, index) => _$createComponent(MonthContext.Provider, {
|
|
114
|
+
value: index,
|
|
115
|
+
get children() {
|
|
116
|
+
return props.children({
|
|
117
|
+
index,
|
|
118
|
+
get month() {
|
|
119
|
+
return month().month;
|
|
120
|
+
},
|
|
121
|
+
get title() {
|
|
122
|
+
return month().title;
|
|
123
|
+
},
|
|
124
|
+
get weekdays() {
|
|
125
|
+
return month().weekdays;
|
|
126
|
+
},
|
|
127
|
+
get weeks() {
|
|
128
|
+
return month().weeks;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
85
135
|
/** Draws its child once for each day of the week, in the locale's order. */
|
|
86
136
|
function Weekdays(props) {
|
|
87
137
|
const weekdays = fromSignal(useCalendar().weekdays);
|
|
@@ -94,7 +144,7 @@ function Weekdays(props) {
|
|
|
94
144
|
}
|
|
95
145
|
/** Draws its child once for each week of the month shown. */
|
|
96
146
|
function Weeks(props) {
|
|
97
|
-
const weeks = fromSignal(
|
|
147
|
+
const weeks = fromSignal(useMonth().weeks);
|
|
98
148
|
return _$createComponent(For, {
|
|
99
149
|
get each() {
|
|
100
150
|
return weeks();
|
|
@@ -106,36 +156,45 @@ function HeadCell(props) {
|
|
|
106
156
|
const [local, rest] = splitProps(props, ["weekday"]);
|
|
107
157
|
const part = useCalendar().headCell(local.weekday);
|
|
108
158
|
return _$createComponent(Part, _$mergeProps({
|
|
109
|
-
|
|
159
|
+
of: part,
|
|
110
160
|
tag: "th"
|
|
111
161
|
}, rest));
|
|
112
162
|
}
|
|
113
163
|
function Cell(props) {
|
|
114
164
|
const [local, rest] = splitProps(props, ["date"]);
|
|
115
165
|
// A cell is its day for as long as it is in the page.
|
|
116
|
-
const part = useCalendar().cell(local.date);
|
|
166
|
+
const part = useCalendar().cell(local.date, useContext(MonthContext));
|
|
117
167
|
return _$createComponent(Part, _$mergeProps({
|
|
118
|
-
|
|
168
|
+
of: part,
|
|
119
169
|
tag: "td"
|
|
120
170
|
}, rest));
|
|
121
171
|
}
|
|
122
172
|
function Day(props) {
|
|
123
173
|
const [local, rest] = splitProps(props, ["date"]);
|
|
124
|
-
const part = useCalendar().day(local.date);
|
|
174
|
+
const part = useCalendar().day(local.date, useContext(MonthContext));
|
|
125
175
|
return _$createComponent(Part, _$mergeProps({
|
|
126
|
-
|
|
176
|
+
of: part,
|
|
127
177
|
tag: "button"
|
|
128
178
|
}, rest));
|
|
129
179
|
}
|
|
180
|
+
/** The hidden input the value is submitted by, when the root has a `name`. */
|
|
181
|
+
const Input = props => _$createComponent(Part, _$mergeProps({
|
|
182
|
+
get of() {
|
|
183
|
+
return useCalendar().input;
|
|
184
|
+
},
|
|
185
|
+
tag: "input"
|
|
186
|
+
}, props));
|
|
130
187
|
export const Calendar = {
|
|
131
188
|
Root,
|
|
132
189
|
Heading,
|
|
133
190
|
Previous,
|
|
134
191
|
Next,
|
|
192
|
+
Months,
|
|
135
193
|
Grid,
|
|
136
194
|
Weekdays,
|
|
137
195
|
HeadCell,
|
|
138
196
|
Weeks,
|
|
139
197
|
Cell,
|
|
140
|
-
Day
|
|
198
|
+
Day,
|
|
199
|
+
Input
|
|
141
200
|
};
|
package/dom/carousel.js
CHANGED
|
@@ -29,7 +29,7 @@ function Root(props) {
|
|
|
29
29
|
value: made,
|
|
30
30
|
get children() {
|
|
31
31
|
return _$createComponent(Part, _$mergeProps({
|
|
32
|
-
get
|
|
32
|
+
get of() {
|
|
33
33
|
return made.root;
|
|
34
34
|
},
|
|
35
35
|
tag: "div"
|
|
@@ -38,7 +38,7 @@ function Root(props) {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
const Viewport = props => _$createComponent(Part, _$mergeProps({
|
|
41
|
-
get
|
|
41
|
+
get of() {
|
|
42
42
|
return useCarousel().viewport;
|
|
43
43
|
},
|
|
44
44
|
tag: "div"
|
|
@@ -48,18 +48,18 @@ function Item(props) {
|
|
|
48
48
|
// A slide is its place for as long as it is in the page.
|
|
49
49
|
const part = useCarousel().item(local.index);
|
|
50
50
|
return _$createComponent(Part, _$mergeProps({
|
|
51
|
-
|
|
51
|
+
of: part,
|
|
52
52
|
tag: "div"
|
|
53
53
|
}, rest));
|
|
54
54
|
}
|
|
55
55
|
const Previous = props => _$createComponent(Part, _$mergeProps({
|
|
56
|
-
get
|
|
56
|
+
get of() {
|
|
57
57
|
return useCarousel().previous;
|
|
58
58
|
},
|
|
59
59
|
tag: "button"
|
|
60
60
|
}, props));
|
|
61
61
|
const Next = props => _$createComponent(Part, _$mergeProps({
|
|
62
|
-
get
|
|
62
|
+
get of() {
|
|
63
63
|
return useCarousel().next;
|
|
64
64
|
},
|
|
65
65
|
tag: "button"
|
|
@@ -69,7 +69,7 @@ function Indicator(props) {
|
|
|
69
69
|
// A button is its slide for as long as it is in the page.
|
|
70
70
|
const part = useCarousel().indicator(local.index);
|
|
71
71
|
return _$createComponent(Part, _$mergeProps({
|
|
72
|
-
|
|
72
|
+
of: part,
|
|
73
73
|
tag: "button"
|
|
74
74
|
}, rest));
|
|
75
75
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
2
|
+
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
|
+
import { within } from "@kirana-ui/core";
|
|
4
|
+
import { createCheckboxGroup } from "@kirana-ui/core/checkbox-group";
|
|
5
|
+
import { createUniqueId, splitProps, useContext } from "solid-js";
|
|
6
|
+
import { CheckboxGroupContext } from "./checkbox-group-context.js";
|
|
7
|
+
import { FieldContext } from "./field-context.js";
|
|
8
|
+
import { Part, controller } from "./runtime.js";
|
|
9
|
+
/**
|
|
10
|
+
* Checkboxes that hold one list of values. Each `<Checkbox.Root value>` inside it is checked
|
|
11
|
+
* while the list has its value; with `allValues`, a `<Checkbox.Root parent>` stands for them all.
|
|
12
|
+
*/
|
|
13
|
+
export function CheckboxGroup(props) {
|
|
14
|
+
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "allValues", "disabled", "id"]);
|
|
15
|
+
const generated = createUniqueId();
|
|
16
|
+
const field = useContext(FieldContext);
|
|
17
|
+
const made = controller(within(createCheckboxGroup, {
|
|
18
|
+
field
|
|
19
|
+
}), () => ({
|
|
20
|
+
id: local.id ?? generated,
|
|
21
|
+
value: local.value,
|
|
22
|
+
defaultValue: local.defaultValue,
|
|
23
|
+
allValues: local.allValues,
|
|
24
|
+
disabled: local.disabled,
|
|
25
|
+
onValueChange: (value, details) => local.onValueChange?.(value, details)
|
|
26
|
+
}));
|
|
27
|
+
return _$createComponent(CheckboxGroupContext.Provider, {
|
|
28
|
+
value: made,
|
|
29
|
+
get children() {
|
|
30
|
+
return _$createComponent(Part, _$mergeProps({
|
|
31
|
+
get of() {
|
|
32
|
+
return made.root;
|
|
33
|
+
},
|
|
34
|
+
tag: "div"
|
|
35
|
+
}, rest));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
package/dom/checkbox.js
CHANGED
|
@@ -4,6 +4,7 @@ import { memo as _$memo } from "solid-js/web";
|
|
|
4
4
|
import { within } from "@kirana-ui/core";
|
|
5
5
|
import { createCheckbox } from "@kirana-ui/core/checkbox";
|
|
6
6
|
import { Show, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
7
|
+
import { CheckboxGroupContext } from "./checkbox-group-context.js";
|
|
7
8
|
import { FieldContext } from "./field-context.js";
|
|
8
9
|
import { Part, controller, fromSignal } from "./runtime.js";
|
|
9
10
|
const Context = createContext();
|
|
@@ -13,16 +14,19 @@ function useCheckbox() {
|
|
|
13
14
|
return made;
|
|
14
15
|
}
|
|
15
16
|
function Root(props) {
|
|
16
|
-
const [local, rest] = splitProps(props, ["checked", "defaultChecked", "onCheckedChange", "indeterminate", "disabled", "readOnly", "required", "name", "form", "value", "id", "children"]);
|
|
17
|
+
const [local, rest] = splitProps(props, ["checked", "defaultChecked", "onCheckedChange", "indeterminate", "parent", "disabled", "readOnly", "required", "name", "form", "value", "id", "children"]);
|
|
17
18
|
const generated = createUniqueId();
|
|
18
19
|
const field = useContext(FieldContext);
|
|
20
|
+
const group = useContext(CheckboxGroupContext) ?? undefined;
|
|
19
21
|
const made = controller(within(createCheckbox, {
|
|
20
|
-
field
|
|
22
|
+
field,
|
|
23
|
+
group
|
|
21
24
|
}), () => ({
|
|
22
25
|
id: local.id ?? generated,
|
|
23
26
|
checked: local.checked,
|
|
24
27
|
defaultChecked: local.defaultChecked,
|
|
25
28
|
indeterminate: local.indeterminate,
|
|
29
|
+
parent: local.parent,
|
|
26
30
|
disabled: local.disabled,
|
|
27
31
|
readOnly: local.readOnly,
|
|
28
32
|
required: local.required,
|
|
@@ -35,14 +39,14 @@ function Root(props) {
|
|
|
35
39
|
value: made,
|
|
36
40
|
get children() {
|
|
37
41
|
return _$createComponent(Part, _$mergeProps({
|
|
38
|
-
get
|
|
42
|
+
get of() {
|
|
39
43
|
return made.root;
|
|
40
44
|
},
|
|
41
45
|
tag: "span"
|
|
42
46
|
}, rest, {
|
|
43
47
|
get children() {
|
|
44
48
|
return [_$memo(() => local.children), _$createComponent(Part, {
|
|
45
|
-
get
|
|
49
|
+
get of() {
|
|
46
50
|
return made.input;
|
|
47
51
|
},
|
|
48
52
|
tag: "input"
|
|
@@ -63,7 +67,7 @@ function Indicator(props) {
|
|
|
63
67
|
},
|
|
64
68
|
get children() {
|
|
65
69
|
return _$createComponent(Part, _$mergeProps({
|
|
66
|
-
get
|
|
70
|
+
get of() {
|
|
67
71
|
return made.indicator;
|
|
68
72
|
},
|
|
69
73
|
tag: "span"
|
package/dom/collapsible.js
CHANGED
|
@@ -24,7 +24,7 @@ function Root(props) {
|
|
|
24
24
|
value: made,
|
|
25
25
|
get children() {
|
|
26
26
|
return _$createComponent(Part, _$mergeProps({
|
|
27
|
-
get
|
|
27
|
+
get of() {
|
|
28
28
|
return made.root;
|
|
29
29
|
},
|
|
30
30
|
tag: "div"
|
|
@@ -33,7 +33,7 @@ function Root(props) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
const Trigger = props => _$createComponent(Part, _$mergeProps({
|
|
36
|
-
get
|
|
36
|
+
get of() {
|
|
37
37
|
return useCollapsible().trigger;
|
|
38
38
|
},
|
|
39
39
|
tag: "button"
|
|
@@ -49,7 +49,7 @@ function Panel(props) {
|
|
|
49
49
|
},
|
|
50
50
|
get children() {
|
|
51
51
|
return _$createComponent(Part, _$mergeProps({
|
|
52
|
-
get
|
|
52
|
+
get of() {
|
|
53
53
|
return made.panel;
|
|
54
54
|
},
|
|
55
55
|
tag: "div"
|