@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.
Files changed (208) hide show
  1. package/dom/accordion.js +9 -6
  2. package/dom/agent.js +3 -0
  3. package/dom/autosize.js +1 -1
  4. package/dom/avatar.js +39 -14
  5. package/dom/button.js +1 -1
  6. package/dom/calendar.js +78 -19
  7. package/dom/carousel.js +6 -6
  8. package/dom/checkbox-group-context.js +3 -0
  9. package/dom/checkbox-group.js +38 -0
  10. package/dom/checkbox.js +9 -5
  11. package/dom/collapsible.js +3 -3
  12. package/dom/combobox.js +72 -14
  13. package/dom/command.js +10 -9
  14. package/dom/date-field.js +7 -3
  15. package/dom/date-picker.js +9 -3
  16. package/dom/dialog.js +13 -3
  17. package/dom/field.js +3 -3
  18. package/dom/fieldset.js +2 -2
  19. package/dom/form.js +1 -1
  20. package/dom/hover-popup.js +3 -3
  21. package/dom/index.js +1 -0
  22. package/dom/input.js +1 -1
  23. package/dom/label.js +1 -1
  24. package/dom/listbox.js +5 -5
  25. package/dom/menu.js +11 -11
  26. package/dom/menubar.js +1 -1
  27. package/dom/message-scroller.js +4 -4
  28. package/dom/navigation-menu.js +18 -21
  29. package/dom/number-field.js +39 -6
  30. package/dom/otp.js +6 -5
  31. package/dom/pagination.js +3 -3
  32. package/dom/popover.js +37 -8
  33. package/dom/primitive.js +92 -0
  34. package/dom/qr-code.js +3 -3
  35. package/dom/radio-group.js +7 -6
  36. package/dom/resizable.js +3 -3
  37. package/dom/runtime.js +23 -7
  38. package/dom/scroll-area.js +5 -5
  39. package/dom/select.js +26 -13
  40. package/dom/separator.js +1 -1
  41. package/dom/slider.js +11 -8
  42. package/dom/switch.js +3 -3
  43. package/dom/tabs.js +5 -5
  44. package/dom/testing.js +3 -0
  45. package/dom/toast.js +57 -20
  46. package/dom/toggle-group.js +1 -1
  47. package/dom/toggle.js +1 -1
  48. package/dom/toolbar.js +4 -4
  49. package/dom/value-bar.js +3 -3
  50. package/llms.txt +1846 -252
  51. package/package.json +34 -2
  52. package/server/accordion.js +9 -6
  53. package/server/agent.js +3 -0
  54. package/server/autosize.js +1 -1
  55. package/server/avatar.js +39 -14
  56. package/server/button.js +1 -1
  57. package/server/calendar.js +78 -19
  58. package/server/carousel.js +6 -6
  59. package/server/checkbox-group-context.js +3 -0
  60. package/server/checkbox-group.js +38 -0
  61. package/server/checkbox.js +9 -5
  62. package/server/collapsible.js +3 -3
  63. package/server/combobox.js +72 -14
  64. package/server/command.js +10 -9
  65. package/server/date-field.js +7 -3
  66. package/server/date-picker.js +9 -3
  67. package/server/dialog.js +13 -3
  68. package/server/field.js +3 -3
  69. package/server/fieldset.js +2 -2
  70. package/server/form.js +1 -1
  71. package/server/hover-popup.js +3 -3
  72. package/server/index.js +1 -0
  73. package/server/input.js +1 -1
  74. package/server/label.js +1 -1
  75. package/server/listbox.js +5 -5
  76. package/server/menu.js +11 -11
  77. package/server/menubar.js +1 -1
  78. package/server/message-scroller.js +4 -4
  79. package/server/navigation-menu.js +18 -15
  80. package/server/number-field.js +39 -6
  81. package/server/otp.js +6 -5
  82. package/server/pagination.js +3 -3
  83. package/server/popover.js +37 -8
  84. package/server/primitive.js +92 -0
  85. package/server/qr-code.js +3 -3
  86. package/server/radio-group.js +7 -6
  87. package/server/resizable.js +3 -3
  88. package/server/runtime.js +23 -7
  89. package/server/scroll-area.js +5 -5
  90. package/server/select.js +26 -13
  91. package/server/separator.js +1 -1
  92. package/server/slider.js +11 -8
  93. package/server/switch.js +3 -3
  94. package/server/tabs.js +5 -5
  95. package/server/testing.js +3 -0
  96. package/server/toast.js +57 -20
  97. package/server/toggle-group.js +1 -1
  98. package/server/toggle.js +1 -1
  99. package/server/toolbar.js +4 -4
  100. package/server/value-bar.js +3 -3
  101. package/skills/kirana-ui-primitives/SKILL.md +163 -0
  102. package/src/accordion.jsx +10 -7
  103. package/src/agent.js +3 -0
  104. package/src/autosize.jsx +1 -1
  105. package/src/avatar.jsx +17 -10
  106. package/src/button.jsx +1 -1
  107. package/src/calendar.jsx +72 -16
  108. package/src/carousel.jsx +6 -6
  109. package/src/checkbox-group-context.js +3 -0
  110. package/src/checkbox-group.jsx +33 -0
  111. package/src/checkbox.jsx +8 -4
  112. package/src/collapsible.jsx +3 -3
  113. package/src/combobox.jsx +70 -13
  114. package/src/command.jsx +10 -8
  115. package/src/date-field.jsx +7 -3
  116. package/src/date-picker.jsx +8 -2
  117. package/src/dialog.jsx +12 -2
  118. package/src/field.jsx +3 -3
  119. package/src/fieldset.jsx +2 -2
  120. package/src/form.jsx +1 -1
  121. package/src/hover-popup.jsx +3 -3
  122. package/src/index.js +1 -0
  123. package/src/input.jsx +1 -1
  124. package/src/label.jsx +1 -1
  125. package/src/listbox.jsx +6 -6
  126. package/src/menu.jsx +11 -11
  127. package/src/menubar.jsx +1 -1
  128. package/src/message-scroller.jsx +4 -4
  129. package/src/navigation-menu.jsx +14 -13
  130. package/src/number-field.jsx +26 -6
  131. package/src/otp.jsx +6 -4
  132. package/src/pagination.jsx +3 -3
  133. package/src/popover.jsx +35 -5
  134. package/src/primitive.jsx +81 -0
  135. package/src/qr-code.jsx +3 -3
  136. package/src/radio-group.jsx +7 -7
  137. package/src/resizable.jsx +3 -3
  138. package/src/runtime.jsx +21 -7
  139. package/src/scroll-area.jsx +5 -5
  140. package/src/select.jsx +29 -14
  141. package/src/separator.jsx +1 -1
  142. package/src/slider.jsx +12 -8
  143. package/src/switch.jsx +3 -3
  144. package/src/tabs.jsx +6 -6
  145. package/src/testing.js +3 -0
  146. package/src/toast.jsx +38 -10
  147. package/src/toggle-group.jsx +2 -2
  148. package/src/toggle.jsx +1 -1
  149. package/src/toolbar.jsx +4 -4
  150. package/src/value-bar.jsx +3 -3
  151. package/types/accordion.d.ts +21 -19
  152. package/types/agent.d.ts +1 -0
  153. package/types/alert-dialog.d.ts +1 -0
  154. package/types/autocomplete.d.ts +1 -0
  155. package/types/autosize.d.ts +4 -1
  156. package/types/avatar.d.ts +14 -6
  157. package/types/button.d.ts +4 -2
  158. package/types/calendar.d.ts +48 -19
  159. package/types/carousel.d.ts +18 -10
  160. package/types/checkbox-group-context.d.ts +3 -0
  161. package/types/checkbox-group.d.ts +13 -0
  162. package/types/checkbox.d.ts +10 -6
  163. package/types/collapsible.d.ts +11 -7
  164. package/types/combobox.d.ts +102 -64
  165. package/types/command.d.ts +29 -17
  166. package/types/context-menu.d.ts +1 -0
  167. package/types/date-field.d.ts +20 -9
  168. package/types/date-picker.d.ts +26 -34
  169. package/types/dialog.d.ts +47 -31
  170. package/types/direction.d.ts +1 -0
  171. package/types/drawer.d.ts +1 -0
  172. package/types/field.d.ts +19 -11
  173. package/types/fieldset.d.ts +8 -3
  174. package/types/form.d.ts +5 -2
  175. package/types/hover-card.d.ts +16 -10
  176. package/types/hover-popup.d.ts +23 -13
  177. package/types/index.d.ts +15 -1
  178. package/types/input.d.ts +4 -3
  179. package/types/label.d.ts +4 -1
  180. package/types/listbox.d.ts +18 -20
  181. package/types/menu.d.ts +56 -42
  182. package/types/menubar.d.ts +6 -4
  183. package/types/message-scroller.d.ts +12 -6
  184. package/types/meter.d.ts +16 -7
  185. package/types/navigation-menu.d.ts +35 -29
  186. package/types/number-field.d.ts +22 -7
  187. package/types/otp.d.ts +18 -10
  188. package/types/pagination.d.ts +18 -10
  189. package/types/popover.d.ts +52 -13
  190. package/types/primitive.d.ts +50 -0
  191. package/types/progress.d.ts +16 -7
  192. package/types/qr-code.d.ts +10 -4
  193. package/types/radio-group.d.ts +18 -17
  194. package/types/resizable.d.ts +12 -7
  195. package/types/runtime.d.ts +36 -12
  196. package/types/scroll-area.d.ts +17 -9
  197. package/types/select.d.ts +55 -46
  198. package/types/separator.d.ts +5 -3
  199. package/types/slider.d.ts +25 -13
  200. package/types/switch.d.ts +7 -4
  201. package/types/tabs.d.ts +20 -16
  202. package/types/testing.d.ts +1 -0
  203. package/types/toast.d.ts +40 -16
  204. package/types/toggle-group.d.ts +6 -11
  205. package/types/toggle.d.ts +4 -3
  206. package/types/toolbar.d.ts +19 -14
  207. package/types/tooltip.d.ts +16 -10
  208. 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 part() {
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 item = useAccordion().item(untrack(() => local.value), () => defined(options.get()));
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 part() {
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 part() {
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 part() {
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 part() {
95
+ get of() {
93
96
  return item.panel;
94
97
  },
95
98
  tag: "div"
package/dom/agent.js ADDED
@@ -0,0 +1,3 @@
1
+ // The agent bridge is the core's, and the same on every framework: it is an entry here too,
2
+ // so an application imports it from the one package it installed.
3
+ export * from "@kirana-ui/core/agent";
package/dom/autosize.js CHANGED
@@ -8,7 +8,7 @@ function Textarea(props) {
8
8
  value: props.value
9
9
  }));
10
10
  return _$createComponent(Part, _$mergeProps({
11
- get part() {
11
+ get of() {
12
12
  return made.textarea;
13
13
  },
14
14
  tag: "textarea"
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 part() {
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 status() === "loaded";
36
+ return !local.keepMounted;
35
37
  },
36
- get children() {
38
+ get fallback() {
37
39
  return _$createComponent(Part, _$mergeProps({
38
- get part() {
39
- return made.image;
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 status = fromSignal(made.status);
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 status() !== "loaded";
77
+ return shown();
53
78
  },
54
79
  get children() {
55
80
  return _$createComponent(Part, _$mergeProps({
56
- get part() {
81
+ get of() {
57
82
  return made.fallback;
58
83
  },
59
84
  tag: "span"
60
- }, props));
85
+ }, rest));
61
86
  }
62
87
  });
63
88
  }
package/dom/button.js CHANGED
@@ -10,7 +10,7 @@ export function Button(props) {
10
10
  ...local
11
11
  }));
12
12
  return _$createComponent(Part, _$mergeProps({
13
- get part() {
13
+ get of() {
14
14
  return made.root;
15
15
  },
16
16
  tag: "button"
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", "defaultFocusedValue", "onMonthChange", "locale", "calendarSystem", "min", "max", "isDateUnavailable", "disabled", "readOnly", "fixedWeeks", "id"]);
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 part() {
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 made = useCalendar();
55
- const title = fromSignal(made.title);
71
+ const month = useMonth();
72
+ const title = fromSignal(month.title);
56
73
  return _$createComponent(Part, _$mergeProps({
57
- get part() {
58
- return made.heading;
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 part() {
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 part() {
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 part() {
81
- return useCalendar().grid;
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(useCalendar().weeks);
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
- part: part,
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
- part: part,
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
- part: part,
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 part() {
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 part() {
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
- part: part,
51
+ of: part,
52
52
  tag: "div"
53
53
  }, rest));
54
54
  }
55
55
  const Previous = props => _$createComponent(Part, _$mergeProps({
56
- get part() {
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 part() {
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
- part: part,
72
+ of: part,
73
73
  tag: "button"
74
74
  }, rest));
75
75
  }
@@ -0,0 +1,3 @@
1
+ import { createContext } from "solid-js";
2
+ /** The group a checkbox is one of the boxes of, if it is in one. */
3
+ export const CheckboxGroupContext = createContext(null);
@@ -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 part() {
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 part() {
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 part() {
70
+ get of() {
67
71
  return made.indicator;
68
72
  },
69
73
  tag: "span"
@@ -24,7 +24,7 @@ function Root(props) {
24
24
  value: made,
25
25
  get children() {
26
26
  return _$createComponent(Part, _$mergeProps({
27
- get part() {
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 part() {
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 part() {
52
+ get of() {
53
53
  return made.panel;
54
54
  },
55
55
  tag: "div"