@kirana-ui/solid 0.2.0 → 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 (71) hide show
  1. package/dom/avatar.js +36 -11
  2. package/dom/calendar.js +66 -11
  3. package/dom/checkbox-group-context.js +3 -0
  4. package/dom/checkbox-group.js +38 -0
  5. package/dom/checkbox.js +6 -2
  6. package/dom/combobox.js +53 -3
  7. package/dom/command.js +2 -1
  8. package/dom/date-picker.js +7 -1
  9. package/dom/dialog.js +8 -1
  10. package/dom/index.js +1 -0
  11. package/dom/number-field.js +36 -3
  12. package/dom/otp.js +2 -1
  13. package/dom/popover.js +18 -2
  14. package/dom/primitive.js +92 -0
  15. package/dom/radio-group.js +3 -2
  16. package/dom/select.js +1 -0
  17. package/dom/slider.js +1 -1
  18. package/llms.txt +312 -82
  19. package/package.json +18 -2
  20. package/server/avatar.js +36 -11
  21. package/server/calendar.js +66 -11
  22. package/server/checkbox-group-context.js +3 -0
  23. package/server/checkbox-group.js +38 -0
  24. package/server/checkbox.js +6 -2
  25. package/server/combobox.js +53 -3
  26. package/server/command.js +2 -1
  27. package/server/date-picker.js +7 -1
  28. package/server/dialog.js +8 -1
  29. package/server/index.js +1 -0
  30. package/server/number-field.js +36 -3
  31. package/server/otp.js +2 -1
  32. package/server/popover.js +18 -2
  33. package/server/primitive.js +92 -0
  34. package/server/radio-group.js +3 -2
  35. package/server/select.js +1 -0
  36. package/server/slider.js +1 -1
  37. package/skills/kirana-ui-primitives/SKILL.md +29 -8
  38. package/src/avatar.jsx +16 -9
  39. package/src/calendar.jsx +62 -10
  40. package/src/checkbox-group-context.js +3 -0
  41. package/src/checkbox-group.jsx +33 -0
  42. package/src/checkbox.jsx +5 -1
  43. package/src/combobox.jsx +50 -1
  44. package/src/command.jsx +2 -0
  45. package/src/date-picker.jsx +6 -0
  46. package/src/dialog.jsx +5 -1
  47. package/src/index.js +1 -0
  48. package/src/number-field.jsx +23 -3
  49. package/src/otp.jsx +2 -0
  50. package/src/popover.jsx +15 -1
  51. package/src/primitive.jsx +81 -0
  52. package/src/radio-group.jsx +2 -2
  53. package/src/select.jsx +1 -0
  54. package/src/slider.jsx +1 -0
  55. package/types/alert-dialog.d.ts +1 -1
  56. package/types/autocomplete.d.ts +1 -1
  57. package/types/avatar.d.ts +5 -4
  58. package/types/calendar.d.ts +15 -3
  59. package/types/checkbox-group-context.d.ts +3 -0
  60. package/types/checkbox-group.d.ts +13 -0
  61. package/types/checkbox.d.ts +1 -0
  62. package/types/combobox.d.ts +41 -2
  63. package/types/command.d.ts +2 -0
  64. package/types/date-picker.d.ts +2 -1
  65. package/types/dialog.d.ts +5 -0
  66. package/types/index.d.ts +5 -2
  67. package/types/number-field.d.ts +9 -1
  68. package/types/otp.d.ts +1 -0
  69. package/types/popover.d.ts +17 -3
  70. package/types/primitive.d.ts +50 -0
  71. package/types/radio-group.d.ts +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirana-ui/solid",
3
- "version": "0.2.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,14 @@
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
+ },
26
34
  "./agent": {
27
35
  "types": "./types/agent.d.ts",
28
36
  "solid": "./src/agent.js",
@@ -79,6 +87,14 @@
79
87
  "worker": "./server/checkbox.js",
80
88
  "default": "./dom/checkbox.js"
81
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
+ },
82
98
  "./collapsible": {
83
99
  "types": "./types/collapsible.d.ts",
84
100
  "solid": "./src/collapsible.jsx",
@@ -434,7 +450,7 @@
434
450
  "./package.json": "./package.json"
435
451
  },
436
452
  "dependencies": {
437
- "@kirana-ui/core": "0.2.0"
453
+ "@kirana-ui/core": "0.3.0"
438
454
  },
439
455
  "peerDependencies": {
440
456
  "solid-js": "^1.9.0"
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() {
@@ -23,33 +23,58 @@ 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
40
  get of() {
39
- return made.image;
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({
@@ -57,7 +82,7 @@ function Fallback(props) {
57
82
  return made.fallback;
58
83
  },
59
84
  tag: "span"
60
- }, props));
85
+ }, rest));
61
86
  }
62
87
  });
63
88
  }
@@ -2,7 +2,7 @@ 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
8
  /**
@@ -17,17 +17,28 @@ function useCalendar() {
17
17
  if (!made) throw new Error("A Calendar part must be inside <Calendar.Root>");
18
18
  return made;
19
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);
20
24
  function Root(props) {
21
- const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "mode", "defaultFocusedValue", "onMonthChange", "locale", "calendarSystem", "min", "max", "isDateUnavailable", "disabled", "readOnly", "fixedWeeks", "id"]);
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"]);
22
26
  const generated = createUniqueId();
23
27
  const direction = useContext(DirectionContext);
24
28
  const made = controller(within(createCalendar, {
25
29
  direction
26
30
  }), () => ({
27
31
  id: local.id ?? generated,
32
+ // The core holds any mode's value; the caller's is its mode's.
28
33
  value: local.value,
29
34
  defaultValue: local.defaultValue,
30
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,
31
42
  defaultFocusedValue: local.defaultFocusedValue,
32
43
  locale: local.locale,
33
44
  calendarSystem: local.calendarSystem,
@@ -37,8 +48,10 @@ function Root(props) {
37
48
  disabled: local.disabled,
38
49
  readOnly: local.readOnly,
39
50
  fixedWeeks: local.fixedWeeks,
51
+ name: local.name,
52
+ form: local.form,
40
53
  onValueChange: (value, details) => local.onValueChange?.(value, details),
41
- onMonthChange: month => local.onMonthChange?.(month)
54
+ onMonthChange: (month, details) => local.onMonthChange?.(month, details)
42
55
  }));
43
56
  return _$createComponent(Context.Provider, {
44
57
  value: made,
@@ -54,11 +67,11 @@ function Root(props) {
54
67
  }
55
68
  /** Names the month shown, unless it is given something else to say. */
56
69
  function Heading(props) {
57
- const made = useCalendar();
58
- const title = fromSignal(made.title);
70
+ const month = useMonth();
71
+ const title = fromSignal(month.title);
59
72
  return _$createComponent(Part, _$mergeProps({
60
73
  get of() {
61
- return made.heading;
74
+ return month.heading;
62
75
  },
63
76
  tag: "div"
64
77
  }, props, {
@@ -81,10 +94,43 @@ const Next = props => _$createComponent(Part, _$mergeProps({
81
94
  }, props));
82
95
  const Grid = props => _$createComponent(Part, _$mergeProps({
83
96
  get of() {
84
- return useCalendar().grid;
97
+ return useMonth().grid;
85
98
  },
86
99
  tag: "table"
87
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
+ }
88
134
  /** Draws its child once for each day of the week, in the locale's order. */
89
135
  function Weekdays(props) {
90
136
  const weekdays = fromSignal(useCalendar().weekdays);
@@ -97,7 +143,7 @@ function Weekdays(props) {
97
143
  }
98
144
  /** Draws its child once for each week of the month shown. */
99
145
  function Weeks(props) {
100
- const weeks = fromSignal(useCalendar().weeks);
146
+ const weeks = fromSignal(useMonth().weeks);
101
147
  return _$createComponent(For, {
102
148
  get each() {
103
149
  return weeks();
@@ -116,7 +162,7 @@ function HeadCell(props) {
116
162
  function Cell(props) {
117
163
  const [local, rest] = splitProps(props, ["date"]);
118
164
  // A cell is its day for as long as it is in the page.
119
- const part = useCalendar().cell(local.date);
165
+ const part = useCalendar().cell(local.date, useContext(MonthContext));
120
166
  return _$createComponent(Part, _$mergeProps({
121
167
  of: part,
122
168
  tag: "td"
@@ -124,21 +170,30 @@ function Cell(props) {
124
170
  }
125
171
  function Day(props) {
126
172
  const [local, rest] = splitProps(props, ["date"]);
127
- const part = useCalendar().day(local.date);
173
+ const part = useCalendar().day(local.date, useContext(MonthContext));
128
174
  return _$createComponent(Part, _$mergeProps({
129
175
  of: part,
130
176
  tag: "button"
131
177
  }, rest));
132
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));
133
186
  export const Calendar = {
134
187
  Root,
135
188
  Heading,
136
189
  Previous,
137
190
  Next,
191
+ Months,
138
192
  Grid,
139
193
  Weekdays,
140
194
  HeadCell,
141
195
  Weeks,
142
196
  Cell,
143
- Day
197
+ Day,
198
+ Input
144
199
  };
@@ -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
+ }
@@ -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,
@@ -4,7 +4,7 @@ import { createComponent as _$createComponent } from "solid-js/web";
4
4
  import { within } from "@kirana-ui/core";
5
5
  import { createAutocomplete } from "@kirana-ui/core/autocomplete";
6
6
  import { createCombobox } from "@kirana-ui/core/combobox";
7
- import { Show, createContext, createUniqueId, splitProps, untrack, useContext } from "solid-js";
7
+ import { For, Show, createContext, createUniqueId, splitProps, untrack, useContext } from "solid-js";
8
8
  import { FieldContext } from "./field-context.js";
9
9
  import { positioned } from "./popover.js";
10
10
  import { Part, Portal as BodyPortal, controller, fromSignal, toSignal } from "./runtime.js";
@@ -29,6 +29,7 @@ function Root(props) {
29
29
  open: props.open,
30
30
  defaultOpen: props.defaultOpen,
31
31
  disabled: props.disabled,
32
+ readOnly: props.readOnly,
32
33
  required: props.required,
33
34
  multiple: props.multiple,
34
35
  values: props.values,
@@ -210,6 +211,43 @@ const GroupLabel = props => _$createComponent(Part, _$mergeProps({
210
211
  },
211
212
  tag: "div"
212
213
  }, props));
214
+ /**
215
+ * The chosen value's label, or `placeholder` while nothing is chosen; with `multiple`, the
216
+ * chosen labels with commas between. For a button that is the combobox, its input inside the
217
+ * popup. It draws no element.
218
+ */
219
+ function Value(props) {
220
+ const made = useCombobox();
221
+ const shown = fromSignal(made.shown);
222
+ return (() => {
223
+ const given = props.children;
224
+ // A function that takes nothing is an element of Solid's own, drawn as it is.
225
+ if (typeof given !== "function" || given.length === 0) {
226
+ return given ?? shown().label ?? props.placeholder;
227
+ }
228
+ const draw = given;
229
+ return made.multiple ? draw(() => shown().values, () => shown().labels) : draw(() => shown().value, () => shown().label);
230
+ })();
231
+ }
232
+ /**
233
+ * Draws the list from the root's `items`: its child once for each item left for what was
234
+ * typed, or for each group that has items left; with `of`, for each of that group's. The root
235
+ * then filters, and no item hides itself. It draws no element.
236
+ */
237
+ function Collection(props) {
238
+ const made = useCombobox();
239
+ // A group is known by its key, which is its own for as long as it is drawn.
240
+ const entries = fromSignal(made.entries(untrack(() => props.of)));
241
+ // By key: an item that is left keeps its element.
242
+ const keys = () => entries().map(each => each.key);
243
+ const of = key => entries().find(each => each.key === key);
244
+ return _$createComponent(For, {
245
+ get each() {
246
+ return keys();
247
+ },
248
+ children: key => props.children(untrack(() => of(key)))
249
+ });
250
+ }
213
251
  const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
214
252
  get of() {
215
253
  return useCombobox()[name];
@@ -232,6 +270,8 @@ function AutocompleteRoot(props) {
232
270
  filter: props.filter,
233
271
  openOnInputClick: props.openOnInputClick,
234
272
  disabled: props.disabled,
273
+ readOnly: props.readOnly,
274
+ items: props.items,
235
275
  required: props.required,
236
276
  name: props.name,
237
277
  form: props.form,
@@ -251,6 +291,7 @@ export const Combobox = {
251
291
  Root,
252
292
  Input: part("input", "input"),
253
293
  Trigger: part("trigger", "button"),
294
+ Value,
254
295
  Clear,
255
296
  /** With `multiple`: what holds the chips and the input. */
256
297
  Chips: part("chips", "div"),
@@ -264,13 +305,20 @@ export const Combobox = {
264
305
  * is then the listbox.
265
306
  */
266
307
  List: part("list", "div"),
308
+ Collection,
267
309
  Group,
268
310
  GroupLabel,
269
311
  /** A line between groups. */
270
312
  Separator: part("separator", "div"),
271
313
  Item,
272
314
  ItemIndicator,
273
- Empty
315
+ Empty,
316
+ /**
317
+ * Says how the list stands ("3 results", "Loading") to software that reads the page, as its
318
+ * text changes. Keep it in the page and change what it holds: inside the popup, or beside
319
+ * the input.
320
+ */
321
+ Status: part("status", "div")
274
322
  };
275
323
  export const Autocomplete = {
276
324
  Root: AutocompleteRoot,
@@ -281,9 +329,11 @@ export const Autocomplete = {
281
329
  Positioner: Combobox.Positioner,
282
330
  Popup: Combobox.Popup,
283
331
  List: Combobox.List,
332
+ Collection: Combobox.Collection,
284
333
  Group: Combobox.Group,
285
334
  GroupLabel: Combobox.GroupLabel,
286
335
  Separator: Combobox.Separator,
287
336
  Item: Combobox.Item,
288
- Empty: Combobox.Empty
337
+ Empty: Combobox.Empty,
338
+ Status: Combobox.Status
289
339
  };
package/server/command.js CHANGED
@@ -11,7 +11,7 @@ function useCommand() {
11
11
  return made;
12
12
  }
13
13
  function Root(props) {
14
- const [local, rest] = splitProps(props, ["inputValue", "defaultInputValue", "onInputValueChange", "onSelect", "filter", "loop", "disabled", "id"]);
14
+ const [local, rest] = splitProps(props, ["inputValue", "defaultInputValue", "onInputValueChange", "onSelect", "filter", "loop", "autoHighlight", "disabled", "id"]);
15
15
  const generated = createUniqueId();
16
16
  const made = controller(createCommand, () => ({
17
17
  id: local.id ?? generated,
@@ -19,6 +19,7 @@ function Root(props) {
19
19
  defaultInputValue: local.defaultInputValue,
20
20
  filter: local.filter,
21
21
  loop: local.loop,
22
+ autoHighlight: local.autoHighlight,
22
23
  disabled: local.disabled,
23
24
  onInputValueChange: (value, details) => local.onInputValueChange?.(value, details),
24
25
  onSelect: (value, details) => local.onSelect?.(value, details)
@@ -31,6 +31,10 @@ function Root(props) {
31
31
  isDateUnavailable: props.isDateUnavailable,
32
32
  calendarSystem: props.calendarSystem,
33
33
  fixedWeeks: props.fixedWeeks,
34
+ months: props.months,
35
+ pagedNavigation: props.pagedNavigation,
36
+ month: props.month,
37
+ defaultMonth: props.defaultMonth,
34
38
  placeholders: props.placeholders,
35
39
  disabled: props.disabled,
36
40
  readOnly: props.readOnly,
@@ -38,7 +42,8 @@ function Root(props) {
38
42
  name: props.name,
39
43
  form: props.form,
40
44
  onValueChange: (value, details) => props.onValueChange?.(value, details),
41
- onOpenChange: (open, details) => props.onOpenChange?.(open, details)
45
+ onOpenChange: (open, details) => props.onOpenChange?.(open, details),
46
+ onMonthChange: (month, details) => props.onMonthChange?.(month, details)
42
47
  }));
43
48
  return _$createComponent(Context.Provider, {
44
49
  value: made,
@@ -94,6 +99,7 @@ export const DatePicker = {
94
99
  Heading: Calendar.Heading,
95
100
  Previous: Calendar.Previous,
96
101
  Next: Calendar.Next,
102
+ Months: Calendar.Months,
97
103
  Grid: Calendar.Grid,
98
104
  Weekdays: Calendar.Weekdays,
99
105
  HeadCell: Calendar.HeadCell,
package/server/dialog.js CHANGED
@@ -62,6 +62,8 @@ export const Dialog = {
62
62
  Portal,
63
63
  Trigger: part("trigger", "button"),
64
64
  Backdrop: part("backdrop", "div"),
65
+ /** What a long dialog scrolls in, around its popup: it may be left out. */
66
+ Viewport: part("viewport", "div"),
65
67
  Popup: part("popup", "div"),
66
68
  Title: part("title", "h2"),
67
69
  Description: part("description", "p"),
@@ -94,9 +96,14 @@ function DrawerRoot(props) {
94
96
  }
95
97
  });
96
98
  }
99
+ // A drawer has no viewport: it lies at an edge of the page, and what scrolls is inside it.
100
+ const {
101
+ Viewport: _,
102
+ ...shared
103
+ } = Dialog;
97
104
  /** A dialog that comes from an edge and is dragged back to it. Its parts are a dialog's. */
98
105
  export const Drawer = {
99
- ...Dialog,
106
+ ...shared,
100
107
  Root: DrawerRoot,
101
108
  // The same components: only what `render` reads of their state is a drawer's.
102
109
  Backdrop: Dialog.Backdrop,
package/server/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Accordion } from "./accordion.js";
2
2
  export { Checkbox } from "./checkbox.js";
3
+ export { CheckboxGroup } from "./checkbox-group.js";
3
4
  export { Collapsible } from "./collapsible.js";
4
5
  export { AlertDialog, Dialog, Drawer } from "./dialog.js";
5
6
  export { MessageScroller } from "./message-scroller.js";
@@ -1,10 +1,10 @@
1
1
  import { mergeProps as _$mergeProps } from "solid-js/web";
2
2
  import { createComponent as _$createComponent } from "solid-js/web";
3
- import { within } from "@kirana-ui/core";
3
+ import { defined, within } from "@kirana-ui/core";
4
4
  import { createNumberField } from "@kirana-ui/core/number-field";
5
- import { Show, createContext, createUniqueId, splitProps, useContext } from "solid-js";
5
+ import { Show, createComputed, createContext, createUniqueId, splitProps, useContext } from "solid-js";
6
6
  import { FieldContext } from "./field-context.js";
7
- import { Part, controller, fromSignal } from "./runtime.js";
7
+ import { Part, Portal, controller, fromSignal } from "./runtime.js";
8
8
  const Context = createContext();
9
9
  function useNumberField() {
10
10
  const made = useContext(Context);
@@ -72,8 +72,41 @@ const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
72
72
  },
73
73
  tag: tag
74
74
  }, props));
75
+ /** Pressed and dragged to change the number; `direction`, `pixelSensitivity`, `teleportDistance`. */
76
+ function ScrubArea(props) {
77
+ const [local, rest] = splitProps(props, ["direction", "pixelSensitivity", "teleportDistance"]);
78
+ const made = useNumberField();
79
+ createComputed(() => made.scrub.set(defined({
80
+ ...local
81
+ })));
82
+ return _$createComponent(Part, _$mergeProps({
83
+ get of() {
84
+ return made.scrubArea;
85
+ },
86
+ tag: "span"
87
+ }, rest));
88
+ }
89
+ /** Drawn in place of the pointer while it is locked for a drag, at the end of `<body>`. */
90
+ function ScrubAreaCursor(props) {
91
+ const made = useNumberField();
92
+ return _$createComponent(Portal, {
93
+ get mounted() {
94
+ return made.scrubAreaCursor.mounted;
95
+ },
96
+ get children() {
97
+ return _$createComponent(Part, _$mergeProps({
98
+ get of() {
99
+ return made.scrubAreaCursor.part;
100
+ },
101
+ tag: "span"
102
+ }, props));
103
+ }
104
+ });
105
+ }
75
106
  export const NumberField = {
76
107
  Root,
108
+ ScrubArea,
109
+ ScrubAreaCursor,
77
110
  Group: part("group", "div"),
78
111
  Input: part("input", "input"),
79
112
  Increment: part("increment", "button"),
package/server/otp.js CHANGED
@@ -11,7 +11,7 @@ function useOtp() {
11
11
  return made;
12
12
  }
13
13
  function Root(props) {
14
- const [local, rest] = splitProps(props, ["length", "value", "defaultValue", "onValueChange", "onComplete", "mode", "disabled", "name", "form", "id"]);
14
+ const [local, rest] = splitProps(props, ["length", "value", "defaultValue", "onValueChange", "onComplete", "mode", "pattern", "disabled", "name", "form", "id"]);
15
15
  const generated = createUniqueId();
16
16
  const made = controller(createOtp, () => ({
17
17
  id: local.id ?? generated,
@@ -19,6 +19,7 @@ function Root(props) {
19
19
  value: local.value,
20
20
  defaultValue: local.defaultValue,
21
21
  mode: local.mode,
22
+ pattern: local.pattern,
22
23
  disabled: local.disabled,
23
24
  name: local.name,
24
25
  form: local.form,
package/server/popover.js CHANGED
@@ -21,6 +21,7 @@ function Root(props) {
21
21
  const made = controller(createPopover, () => ({
22
22
  id: props.id ?? generated,
23
23
  open: props.open,
24
+ modal: props.modal,
24
25
  defaultOpen: props.defaultOpen,
25
26
  onOpenChange: (open, details) => props.onOpenChange?.(open, details)
26
27
  }));
@@ -44,7 +45,7 @@ const Portal = props => _$createComponent(BodyPortal, {
44
45
  * attaches: the one place they are named. Gives back what is left, for the part's element.
45
46
  */
46
47
  export function positioned(props, positioning) {
47
- const [local, rest] = splitProps(props, ["side", "align", "sideOffset", "alignOffset", "collisionPadding", "anchor"]);
48
+ const [local, rest] = splitProps(props, ["side", "align", "sideOffset", "alignOffset", "collisionPadding", "collisionBoundary", "collisionAvoidance", "sticky", "arrowPadding", "positionMethod", "anchor"]);
48
49
  createComputed(() => {
49
50
  const anchor = local.anchor;
50
51
  positioning.set(defined({
@@ -71,12 +72,27 @@ const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
71
72
  },
72
73
  tag: tag
73
74
  }, props));
75
+ function Trigger(props) {
76
+ const [local, rest] = splitProps(props, ["openOnHover", "delay", "closeDelay"]);
77
+ const made = usePopover();
78
+ createComputed(() => made.hovering.set(defined({
79
+ ...local
80
+ })));
81
+ return _$createComponent(Part, _$mergeProps({
82
+ get of() {
83
+ return made.trigger;
84
+ },
85
+ tag: "button"
86
+ }, rest));
87
+ }
74
88
  export const Popover = {
75
89
  Root,
76
90
  Portal,
91
+ Backdrop: part("backdrop", "div"),
77
92
  Positioner,
78
- Trigger: part("trigger", "button"),
93
+ Trigger,
79
94
  Popup: part("popup", "div"),
95
+ Arrow: part("arrow", "div"),
80
96
  Title: part("title", "h2"),
81
97
  Description: part("description", "p"),
82
98
  Close: part("close", "button")