@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirana-ui/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Kirana UI Primitives for Solid",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "The Kirana authors",
|
|
@@ -23,6 +23,30 @@
|
|
|
23
23
|
"worker": "./server/runtime.js",
|
|
24
24
|
"default": "./dom/runtime.js"
|
|
25
25
|
},
|
|
26
|
+
"./primitive": {
|
|
27
|
+
"types": "./types/primitive.d.ts",
|
|
28
|
+
"solid": "./src/primitive.jsx",
|
|
29
|
+
"node": "./server/primitive.js",
|
|
30
|
+
"deno": "./server/primitive.js",
|
|
31
|
+
"worker": "./server/primitive.js",
|
|
32
|
+
"default": "./dom/primitive.js"
|
|
33
|
+
},
|
|
34
|
+
"./agent": {
|
|
35
|
+
"types": "./types/agent.d.ts",
|
|
36
|
+
"solid": "./src/agent.js",
|
|
37
|
+
"node": "./server/agent.js",
|
|
38
|
+
"deno": "./server/agent.js",
|
|
39
|
+
"worker": "./server/agent.js",
|
|
40
|
+
"default": "./dom/agent.js"
|
|
41
|
+
},
|
|
42
|
+
"./testing": {
|
|
43
|
+
"types": "./types/testing.d.ts",
|
|
44
|
+
"solid": "./src/testing.js",
|
|
45
|
+
"node": "./server/testing.js",
|
|
46
|
+
"deno": "./server/testing.js",
|
|
47
|
+
"worker": "./server/testing.js",
|
|
48
|
+
"default": "./dom/testing.js"
|
|
49
|
+
},
|
|
26
50
|
"./accordion": {
|
|
27
51
|
"types": "./types/accordion.d.ts",
|
|
28
52
|
"solid": "./src/accordion.jsx",
|
|
@@ -63,6 +87,14 @@
|
|
|
63
87
|
"worker": "./server/checkbox.js",
|
|
64
88
|
"default": "./dom/checkbox.js"
|
|
65
89
|
},
|
|
90
|
+
"./checkbox-group": {
|
|
91
|
+
"types": "./types/checkbox-group.d.ts",
|
|
92
|
+
"solid": "./src/checkbox-group.jsx",
|
|
93
|
+
"node": "./server/checkbox-group.js",
|
|
94
|
+
"deno": "./server/checkbox-group.js",
|
|
95
|
+
"worker": "./server/checkbox-group.js",
|
|
96
|
+
"default": "./dom/checkbox-group.js"
|
|
97
|
+
},
|
|
66
98
|
"./collapsible": {
|
|
67
99
|
"types": "./types/collapsible.d.ts",
|
|
68
100
|
"solid": "./src/collapsible.jsx",
|
|
@@ -418,7 +450,7 @@
|
|
|
418
450
|
"./package.json": "./package.json"
|
|
419
451
|
},
|
|
420
452
|
"dependencies": {
|
|
421
|
-
"@kirana-ui/core": "0.
|
|
453
|
+
"@kirana-ui/core": "0.3.0"
|
|
422
454
|
},
|
|
423
455
|
"peerDependencies": {
|
|
424
456
|
"solid-js": "^1.9.0"
|
package/server/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/server/agent.js
ADDED
package/server/autosize.js
CHANGED
package/server/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/server/button.js
CHANGED
package/server/calendar.js
CHANGED
|
@@ -2,9 +2,13 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
2
2
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
3
|
import { within } from "@kirana-ui/core";
|
|
4
4
|
import { createCalendar } from "@kirana-ui/core/calendar";
|
|
5
|
-
import { For, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
5
|
+
import { For, Index, createContext, createUniqueId, splitProps, useContext } from "solid-js";
|
|
6
6
|
import { DirectionContext } from "./direction-context.js";
|
|
7
7
|
import { Part, controller, fromSignal } from "./runtime.js";
|
|
8
|
+
/**
|
|
9
|
+
* The calendar its parts are inside. Exported for a component that is made of one (a date picker
|
|
10
|
+
* provides its own to the calendar's parts).
|
|
11
|
+
*/
|
|
8
12
|
const Context = createContext();
|
|
9
13
|
/** For a component made of this one's parts: a date picker. */
|
|
10
14
|
export { Context as CalendarContext };
|
|
@@ -13,17 +17,28 @@ function useCalendar() {
|
|
|
13
17
|
if (!made) throw new Error("A Calendar part must be inside <Calendar.Root>");
|
|
14
18
|
return made;
|
|
15
19
|
}
|
|
20
|
+
/** The place of the month its parts are drawn in, inside `Calendar.Months`. */
|
|
21
|
+
const MonthContext = createContext();
|
|
22
|
+
/** The month a part is drawn in: the one `Calendar.Months` gave, or the first. */
|
|
23
|
+
const useMonth = () => useCalendar().monthAt(useContext(MonthContext) ?? 0);
|
|
16
24
|
function Root(props) {
|
|
17
|
-
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "mode", "
|
|
25
|
+
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"]);
|
|
18
26
|
const generated = createUniqueId();
|
|
19
27
|
const direction = useContext(DirectionContext);
|
|
20
28
|
const made = controller(within(createCalendar, {
|
|
21
29
|
direction
|
|
22
30
|
}), () => ({
|
|
23
31
|
id: local.id ?? generated,
|
|
32
|
+
// The core holds any mode's value; the caller's is its mode's.
|
|
24
33
|
value: local.value,
|
|
25
34
|
defaultValue: local.defaultValue,
|
|
26
35
|
mode: local.mode,
|
|
36
|
+
minDays: local.minDays,
|
|
37
|
+
maxDays: local.maxDays,
|
|
38
|
+
months: local.months,
|
|
39
|
+
pagedNavigation: local.pagedNavigation,
|
|
40
|
+
month: local.month,
|
|
41
|
+
defaultMonth: local.defaultMonth,
|
|
27
42
|
defaultFocusedValue: local.defaultFocusedValue,
|
|
28
43
|
locale: local.locale,
|
|
29
44
|
calendarSystem: local.calendarSystem,
|
|
@@ -33,14 +48,16 @@ function Root(props) {
|
|
|
33
48
|
disabled: local.disabled,
|
|
34
49
|
readOnly: local.readOnly,
|
|
35
50
|
fixedWeeks: local.fixedWeeks,
|
|
51
|
+
name: local.name,
|
|
52
|
+
form: local.form,
|
|
36
53
|
onValueChange: (value, details) => local.onValueChange?.(value, details),
|
|
37
|
-
onMonthChange: month => local.onMonthChange?.(month)
|
|
54
|
+
onMonthChange: (month, details) => local.onMonthChange?.(month, details)
|
|
38
55
|
}));
|
|
39
56
|
return _$createComponent(Context.Provider, {
|
|
40
57
|
value: made,
|
|
41
58
|
get children() {
|
|
42
59
|
return _$createComponent(Part, _$mergeProps({
|
|
43
|
-
get
|
|
60
|
+
get of() {
|
|
44
61
|
return made.root;
|
|
45
62
|
},
|
|
46
63
|
tag: "div"
|
|
@@ -50,11 +67,11 @@ function Root(props) {
|
|
|
50
67
|
}
|
|
51
68
|
/** Names the month shown, unless it is given something else to say. */
|
|
52
69
|
function Heading(props) {
|
|
53
|
-
const
|
|
54
|
-
const title = fromSignal(
|
|
70
|
+
const month = useMonth();
|
|
71
|
+
const title = fromSignal(month.title);
|
|
55
72
|
return _$createComponent(Part, _$mergeProps({
|
|
56
|
-
get
|
|
57
|
-
return
|
|
73
|
+
get of() {
|
|
74
|
+
return month.heading;
|
|
58
75
|
},
|
|
59
76
|
tag: "div"
|
|
60
77
|
}, props, {
|
|
@@ -64,23 +81,56 @@ function Heading(props) {
|
|
|
64
81
|
}));
|
|
65
82
|
}
|
|
66
83
|
const Previous = props => _$createComponent(Part, _$mergeProps({
|
|
67
|
-
get
|
|
84
|
+
get of() {
|
|
68
85
|
return useCalendar().previous;
|
|
69
86
|
},
|
|
70
87
|
tag: "button"
|
|
71
88
|
}, props));
|
|
72
89
|
const Next = props => _$createComponent(Part, _$mergeProps({
|
|
73
|
-
get
|
|
90
|
+
get of() {
|
|
74
91
|
return useCalendar().next;
|
|
75
92
|
},
|
|
76
93
|
tag: "button"
|
|
77
94
|
}, props));
|
|
78
95
|
const Grid = props => _$createComponent(Part, _$mergeProps({
|
|
79
|
-
get
|
|
80
|
-
return
|
|
96
|
+
get of() {
|
|
97
|
+
return useMonth().grid;
|
|
81
98
|
},
|
|
82
99
|
tag: "table"
|
|
83
100
|
}, props));
|
|
101
|
+
/**
|
|
102
|
+
* Draws its child once for each month shown (`months` on the root), side by side: the parts
|
|
103
|
+
* inside each are that month's. Left out for one month.
|
|
104
|
+
*/
|
|
105
|
+
function Months(props) {
|
|
106
|
+
const months = fromSignal(useCalendar().months);
|
|
107
|
+
// Kept by place: the month given reads the one now there, as props do.
|
|
108
|
+
return _$createComponent(Index, {
|
|
109
|
+
get each() {
|
|
110
|
+
return months();
|
|
111
|
+
},
|
|
112
|
+
children: (month, index) => _$createComponent(MonthContext.Provider, {
|
|
113
|
+
value: index,
|
|
114
|
+
get children() {
|
|
115
|
+
return props.children({
|
|
116
|
+
index,
|
|
117
|
+
get month() {
|
|
118
|
+
return month().month;
|
|
119
|
+
},
|
|
120
|
+
get title() {
|
|
121
|
+
return month().title;
|
|
122
|
+
},
|
|
123
|
+
get weekdays() {
|
|
124
|
+
return month().weekdays;
|
|
125
|
+
},
|
|
126
|
+
get weeks() {
|
|
127
|
+
return month().weeks;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
});
|
|
133
|
+
}
|
|
84
134
|
/** Draws its child once for each day of the week, in the locale's order. */
|
|
85
135
|
function Weekdays(props) {
|
|
86
136
|
const weekdays = fromSignal(useCalendar().weekdays);
|
|
@@ -93,7 +143,7 @@ function Weekdays(props) {
|
|
|
93
143
|
}
|
|
94
144
|
/** Draws its child once for each week of the month shown. */
|
|
95
145
|
function Weeks(props) {
|
|
96
|
-
const weeks = fromSignal(
|
|
146
|
+
const weeks = fromSignal(useMonth().weeks);
|
|
97
147
|
return _$createComponent(For, {
|
|
98
148
|
get each() {
|
|
99
149
|
return weeks();
|
|
@@ -105,36 +155,45 @@ function HeadCell(props) {
|
|
|
105
155
|
const [local, rest] = splitProps(props, ["weekday"]);
|
|
106
156
|
const part = useCalendar().headCell(local.weekday);
|
|
107
157
|
return _$createComponent(Part, _$mergeProps({
|
|
108
|
-
|
|
158
|
+
of: part,
|
|
109
159
|
tag: "th"
|
|
110
160
|
}, rest));
|
|
111
161
|
}
|
|
112
162
|
function Cell(props) {
|
|
113
163
|
const [local, rest] = splitProps(props, ["date"]);
|
|
114
164
|
// A cell is its day for as long as it is in the page.
|
|
115
|
-
const part = useCalendar().cell(local.date);
|
|
165
|
+
const part = useCalendar().cell(local.date, useContext(MonthContext));
|
|
116
166
|
return _$createComponent(Part, _$mergeProps({
|
|
117
|
-
|
|
167
|
+
of: part,
|
|
118
168
|
tag: "td"
|
|
119
169
|
}, rest));
|
|
120
170
|
}
|
|
121
171
|
function Day(props) {
|
|
122
172
|
const [local, rest] = splitProps(props, ["date"]);
|
|
123
|
-
const part = useCalendar().day(local.date);
|
|
173
|
+
const part = useCalendar().day(local.date, useContext(MonthContext));
|
|
124
174
|
return _$createComponent(Part, _$mergeProps({
|
|
125
|
-
|
|
175
|
+
of: part,
|
|
126
176
|
tag: "button"
|
|
127
177
|
}, rest));
|
|
128
178
|
}
|
|
179
|
+
/** The hidden input the value is submitted by, when the root has a `name`. */
|
|
180
|
+
const Input = props => _$createComponent(Part, _$mergeProps({
|
|
181
|
+
get of() {
|
|
182
|
+
return useCalendar().input;
|
|
183
|
+
},
|
|
184
|
+
tag: "input"
|
|
185
|
+
}, props));
|
|
129
186
|
export const Calendar = {
|
|
130
187
|
Root,
|
|
131
188
|
Heading,
|
|
132
189
|
Previous,
|
|
133
190
|
Next,
|
|
191
|
+
Months,
|
|
134
192
|
Grid,
|
|
135
193
|
Weekdays,
|
|
136
194
|
HeadCell,
|
|
137
195
|
Weeks,
|
|
138
196
|
Cell,
|
|
139
|
-
Day
|
|
197
|
+
Day,
|
|
198
|
+
Input
|
|
140
199
|
};
|
package/server/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/server/checkbox.js
CHANGED
|
@@ -4,6 +4,7 @@ import { createComponent as _$createComponent } 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 [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/server/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"
|