@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/combobox.js
CHANGED
|
@@ -4,7 +4,7 @@ import { memo as _$memo } 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,
|
|
@@ -36,6 +37,7 @@ function Root(props) {
|
|
|
36
37
|
onValuesChange: (values, details) => props.onValuesChange?.(values, details),
|
|
37
38
|
inline: props.inline,
|
|
38
39
|
virtualized: props.virtualized,
|
|
40
|
+
autoHighlight: props.autoHighlight,
|
|
39
41
|
name: props.name,
|
|
40
42
|
form: props.form,
|
|
41
43
|
items: props.items,
|
|
@@ -54,7 +56,7 @@ function Root(props) {
|
|
|
54
56
|
},
|
|
55
57
|
get children() {
|
|
56
58
|
return _$createComponent(Part, {
|
|
57
|
-
get
|
|
59
|
+
get of() {
|
|
58
60
|
return made.hidden;
|
|
59
61
|
},
|
|
60
62
|
tag: "input"
|
|
@@ -75,7 +77,7 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
75
77
|
function Positioner(props) {
|
|
76
78
|
const made = useCombobox();
|
|
77
79
|
return _$createComponent(Part, _$mergeProps({
|
|
78
|
-
get
|
|
80
|
+
get of() {
|
|
79
81
|
return made.positioner;
|
|
80
82
|
},
|
|
81
83
|
tag: "div"
|
|
@@ -98,7 +100,7 @@ function Item(props) {
|
|
|
98
100
|
value: value,
|
|
99
101
|
get children() {
|
|
100
102
|
return _$createComponent(Part, _$mergeProps({
|
|
101
|
-
|
|
103
|
+
of: part,
|
|
102
104
|
tag: "div"
|
|
103
105
|
}, rest));
|
|
104
106
|
}
|
|
@@ -115,7 +117,7 @@ function ItemIndicator(props) {
|
|
|
115
117
|
},
|
|
116
118
|
get children() {
|
|
117
119
|
return _$createComponent(Part, _$mergeProps({
|
|
118
|
-
get
|
|
120
|
+
get of() {
|
|
119
121
|
return made.itemIndicator(value);
|
|
120
122
|
},
|
|
121
123
|
tag: "span"
|
|
@@ -134,7 +136,7 @@ function Clear(props) {
|
|
|
134
136
|
},
|
|
135
137
|
get children() {
|
|
136
138
|
return _$createComponent(Part, _$mergeProps({
|
|
137
|
-
get
|
|
139
|
+
get of() {
|
|
138
140
|
return made.clear;
|
|
139
141
|
},
|
|
140
142
|
tag: "button"
|
|
@@ -152,7 +154,7 @@ function Chip(props) {
|
|
|
152
154
|
value: value,
|
|
153
155
|
get children() {
|
|
154
156
|
return _$createComponent(Part, _$mergeProps({
|
|
155
|
-
get
|
|
157
|
+
get of() {
|
|
156
158
|
return useCombobox().chip(value);
|
|
157
159
|
},
|
|
158
160
|
tag: "span"
|
|
@@ -161,7 +163,7 @@ function Chip(props) {
|
|
|
161
163
|
});
|
|
162
164
|
}
|
|
163
165
|
const ChipRemove = props => _$createComponent(Part, _$mergeProps({
|
|
164
|
-
get
|
|
166
|
+
get of() {
|
|
165
167
|
return useCombobox().chipRemove(useContext(ChipContext));
|
|
166
168
|
},
|
|
167
169
|
tag: "button"
|
|
@@ -176,7 +178,7 @@ function Empty(props) {
|
|
|
176
178
|
},
|
|
177
179
|
get children() {
|
|
178
180
|
return _$createComponent(Part, _$mergeProps({
|
|
179
|
-
get
|
|
181
|
+
get of() {
|
|
180
182
|
return made.emptyPart;
|
|
181
183
|
},
|
|
182
184
|
tag: "div"
|
|
@@ -194,7 +196,7 @@ function Group(props) {
|
|
|
194
196
|
value: group,
|
|
195
197
|
get children() {
|
|
196
198
|
return _$createComponent(Part, _$mergeProps({
|
|
197
|
-
get
|
|
199
|
+
get of() {
|
|
198
200
|
return group.root;
|
|
199
201
|
},
|
|
200
202
|
tag: "div"
|
|
@@ -204,13 +206,50 @@ function Group(props) {
|
|
|
204
206
|
}
|
|
205
207
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
206
208
|
const GroupLabel = props => _$createComponent(Part, _$mergeProps({
|
|
207
|
-
get
|
|
209
|
+
get of() {
|
|
208
210
|
return useContext(GroupContext)?.label ?? useCombobox().groupLabel;
|
|
209
211
|
},
|
|
210
212
|
tag: "div"
|
|
211
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 _$memo(() => {
|
|
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
|
+
}
|
|
212
251
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
213
|
-
get
|
|
252
|
+
get of() {
|
|
214
253
|
return useCombobox()[name];
|
|
215
254
|
},
|
|
216
255
|
tag: tag
|
|
@@ -231,10 +270,13 @@ function AutocompleteRoot(props) {
|
|
|
231
270
|
filter: props.filter,
|
|
232
271
|
openOnInputClick: props.openOnInputClick,
|
|
233
272
|
disabled: props.disabled,
|
|
273
|
+
readOnly: props.readOnly,
|
|
274
|
+
items: props.items,
|
|
234
275
|
required: props.required,
|
|
235
276
|
name: props.name,
|
|
236
277
|
form: props.form,
|
|
237
278
|
virtualized: props.virtualized,
|
|
279
|
+
autoHighlight: props.autoHighlight,
|
|
238
280
|
onValueChange: (value, details) => props.onValueChange?.(value, details),
|
|
239
281
|
onOpenChange: (open, details) => props.onOpenChange?.(open, details)
|
|
240
282
|
}));
|
|
@@ -249,6 +291,7 @@ export const Combobox = {
|
|
|
249
291
|
Root,
|
|
250
292
|
Input: part("input", "input"),
|
|
251
293
|
Trigger: part("trigger", "button"),
|
|
294
|
+
Value,
|
|
252
295
|
Clear,
|
|
253
296
|
/** With `multiple`: what holds the chips and the input. */
|
|
254
297
|
Chips: part("chips", "div"),
|
|
@@ -257,13 +300,25 @@ export const Combobox = {
|
|
|
257
300
|
Portal,
|
|
258
301
|
Positioner,
|
|
259
302
|
Popup: part("popup", "div"),
|
|
303
|
+
/**
|
|
304
|
+
* The items' own box inside the popup, when the popup holds more than items (an input): it
|
|
305
|
+
* is then the listbox.
|
|
306
|
+
*/
|
|
307
|
+
List: part("list", "div"),
|
|
308
|
+
Collection,
|
|
260
309
|
Group,
|
|
261
310
|
GroupLabel,
|
|
262
311
|
/** A line between groups. */
|
|
263
312
|
Separator: part("separator", "div"),
|
|
264
313
|
Item,
|
|
265
314
|
ItemIndicator,
|
|
266
|
-
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")
|
|
267
322
|
};
|
|
268
323
|
export const Autocomplete = {
|
|
269
324
|
Root: AutocompleteRoot,
|
|
@@ -273,9 +328,12 @@ export const Autocomplete = {
|
|
|
273
328
|
Portal: Combobox.Portal,
|
|
274
329
|
Positioner: Combobox.Positioner,
|
|
275
330
|
Popup: Combobox.Popup,
|
|
331
|
+
List: Combobox.List,
|
|
332
|
+
Collection: Combobox.Collection,
|
|
276
333
|
Group: Combobox.Group,
|
|
277
334
|
GroupLabel: Combobox.GroupLabel,
|
|
278
335
|
Separator: Combobox.Separator,
|
|
279
336
|
Item: Combobox.Item,
|
|
280
|
-
Empty: Combobox.Empty
|
|
337
|
+
Empty: Combobox.Empty,
|
|
338
|
+
Status: Combobox.Status
|
|
281
339
|
};
|
package/dom/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)
|
|
@@ -27,7 +28,7 @@ function Root(props) {
|
|
|
27
28
|
value: made,
|
|
28
29
|
get children() {
|
|
29
30
|
return _$createComponent(Part, _$mergeProps({
|
|
30
|
-
get
|
|
31
|
+
get of() {
|
|
31
32
|
return made.root;
|
|
32
33
|
},
|
|
33
34
|
tag: "div"
|
|
@@ -36,13 +37,13 @@ function Root(props) {
|
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
const Input = props => _$createComponent(Part, _$mergeProps({
|
|
39
|
-
get
|
|
40
|
+
get of() {
|
|
40
41
|
return useCommand().input;
|
|
41
42
|
},
|
|
42
43
|
tag: "input"
|
|
43
44
|
}, props));
|
|
44
45
|
const List = props => _$createComponent(Part, _$mergeProps({
|
|
45
|
-
get
|
|
46
|
+
get of() {
|
|
46
47
|
return useCommand().list;
|
|
47
48
|
},
|
|
48
49
|
tag: "div"
|
|
@@ -57,7 +58,7 @@ function Empty(props) {
|
|
|
57
58
|
},
|
|
58
59
|
get children() {
|
|
59
60
|
return _$createComponent(Part, _$mergeProps({
|
|
60
|
-
get
|
|
61
|
+
get of() {
|
|
61
62
|
return made.emptyPart;
|
|
62
63
|
},
|
|
63
64
|
tag: "div"
|
|
@@ -74,7 +75,7 @@ function Group(props) {
|
|
|
74
75
|
value: group,
|
|
75
76
|
get children() {
|
|
76
77
|
return _$createComponent(Part, _$mergeProps({
|
|
77
|
-
get
|
|
78
|
+
get of() {
|
|
78
79
|
return group.part;
|
|
79
80
|
},
|
|
80
81
|
tag: "div"
|
|
@@ -85,7 +86,7 @@ function Group(props) {
|
|
|
85
86
|
function GroupHeading(props) {
|
|
86
87
|
const part = useContext(GroupContext)?.heading ?? useCommand().heading;
|
|
87
88
|
return _$createComponent(Part, _$mergeProps({
|
|
88
|
-
|
|
89
|
+
of: part,
|
|
89
90
|
tag: "div"
|
|
90
91
|
}, props));
|
|
91
92
|
}
|
|
@@ -101,7 +102,7 @@ function Item(props) {
|
|
|
101
102
|
}));
|
|
102
103
|
const part = useCommand().item(untrack(() => local.value), () => options.get(), useContext(GroupContext));
|
|
103
104
|
return _$createComponent(Part, _$mergeProps({
|
|
104
|
-
|
|
105
|
+
of: part,
|
|
105
106
|
tag: "div"
|
|
106
107
|
}, rest));
|
|
107
108
|
}
|
|
@@ -113,7 +114,7 @@ function Separator(props) {
|
|
|
113
114
|
}));
|
|
114
115
|
const part = useCommand().separator(() => options.get().alwaysRender);
|
|
115
116
|
return _$createComponent(Part, _$mergeProps({
|
|
116
|
-
|
|
117
|
+
of: part,
|
|
117
118
|
tag: "div"
|
|
118
119
|
}, rest));
|
|
119
120
|
}
|
package/dom/date-field.js
CHANGED
|
@@ -5,6 +5,10 @@ import { createDateField } from "@kirana-ui/core/date-field";
|
|
|
5
5
|
import { For, 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 date field its parts are inside. Exported for a component that is made of one (a date picker
|
|
10
|
+
* provides its own to the date field'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 DateFieldContext };
|
|
@@ -38,7 +42,7 @@ function Root(props) {
|
|
|
38
42
|
value: made,
|
|
39
43
|
get children() {
|
|
40
44
|
return _$createComponent(Part, _$mergeProps({
|
|
41
|
-
get
|
|
45
|
+
get of() {
|
|
42
46
|
return made.root;
|
|
43
47
|
},
|
|
44
48
|
tag: "div"
|
|
@@ -62,7 +66,7 @@ function Segment(props) {
|
|
|
62
66
|
const made = useDateField().segment(local.segment);
|
|
63
67
|
const shown = fromSignal(made.text);
|
|
64
68
|
return _$createComponent(Part, _$mergeProps({
|
|
65
|
-
get
|
|
69
|
+
get of() {
|
|
66
70
|
return made.part;
|
|
67
71
|
},
|
|
68
72
|
tag: "span"
|
|
@@ -73,7 +77,7 @@ function Segment(props) {
|
|
|
73
77
|
}));
|
|
74
78
|
}
|
|
75
79
|
const Input = props => _$createComponent(Part, _$mergeProps({
|
|
76
|
-
get
|
|
80
|
+
get of() {
|
|
77
81
|
return useDateField().input;
|
|
78
82
|
},
|
|
79
83
|
tag: "input"
|
package/dom/date-picker.js
CHANGED
|
@@ -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,
|
|
@@ -72,7 +77,7 @@ export const DatePicker = {
|
|
|
72
77
|
Root,
|
|
73
78
|
/** The typed date: what holds its segments and its hidden input. */
|
|
74
79
|
Field: props => _$createComponent(Part, _$mergeProps({
|
|
75
|
-
get
|
|
80
|
+
get of() {
|
|
76
81
|
return useDatePicker().field.root;
|
|
77
82
|
},
|
|
78
83
|
tag: "div"
|
|
@@ -86,7 +91,7 @@ export const DatePicker = {
|
|
|
86
91
|
Popup: Popover.Popup,
|
|
87
92
|
/** The calendar: what holds its heading, its buttons and its grid. */
|
|
88
93
|
Calendar: props => _$createComponent(Part, _$mergeProps({
|
|
89
|
-
get
|
|
94
|
+
get of() {
|
|
90
95
|
return useDatePicker().calendar.root;
|
|
91
96
|
},
|
|
92
97
|
tag: "div"
|
|
@@ -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/dom/dialog.js
CHANGED
|
@@ -37,7 +37,7 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
40
|
-
get
|
|
40
|
+
get of() {
|
|
41
41
|
return useDialog()[name];
|
|
42
42
|
},
|
|
43
43
|
tag: tag
|
|
@@ -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,8 +96,16 @@ 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
|
-
...
|
|
100
|
-
Root: DrawerRoot
|
|
106
|
+
...shared,
|
|
107
|
+
Root: DrawerRoot,
|
|
108
|
+
// The same components: only what `render` reads of their state is a drawer's.
|
|
109
|
+
Backdrop: Dialog.Backdrop,
|
|
110
|
+
Popup: Dialog.Popup
|
|
101
111
|
};
|
package/dom/field.js
CHANGED
|
@@ -28,7 +28,7 @@ function Root(props) {
|
|
|
28
28
|
value: made,
|
|
29
29
|
get children() {
|
|
30
30
|
return _$createComponent(Part, _$mergeProps({
|
|
31
|
-
get
|
|
31
|
+
get of() {
|
|
32
32
|
return made.root;
|
|
33
33
|
},
|
|
34
34
|
tag: "div"
|
|
@@ -55,7 +55,7 @@ function FieldError(props) {
|
|
|
55
55
|
},
|
|
56
56
|
get children() {
|
|
57
57
|
return _$createComponent(Part, _$mergeProps({
|
|
58
|
-
get
|
|
58
|
+
get of() {
|
|
59
59
|
return error.part;
|
|
60
60
|
},
|
|
61
61
|
tag: "div"
|
|
@@ -72,7 +72,7 @@ function Validity(props) {
|
|
|
72
72
|
return props.children(fromSignal(useField().validity));
|
|
73
73
|
}
|
|
74
74
|
const part = (key, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
75
|
-
get
|
|
75
|
+
get of() {
|
|
76
76
|
return useField()[key];
|
|
77
77
|
},
|
|
78
78
|
tag: tag
|
package/dom/fieldset.js
CHANGED
|
@@ -21,7 +21,7 @@ function Root(props) {
|
|
|
21
21
|
value: made,
|
|
22
22
|
get children() {
|
|
23
23
|
return _$createComponent(Part, _$mergeProps({
|
|
24
|
-
get
|
|
24
|
+
get of() {
|
|
25
25
|
return made.root;
|
|
26
26
|
},
|
|
27
27
|
tag: "fieldset"
|
|
@@ -30,7 +30,7 @@ function Root(props) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
const Legend = props => _$createComponent(Part, _$mergeProps({
|
|
33
|
-
get
|
|
33
|
+
get of() {
|
|
34
34
|
return useFieldset().legend;
|
|
35
35
|
},
|
|
36
36
|
tag: "div"
|
package/dom/form.js
CHANGED
package/dom/hover-popup.js
CHANGED
|
@@ -41,14 +41,14 @@ export function hoverPopup(name, create, triggerTag) {
|
|
|
41
41
|
function Positioner(props) {
|
|
42
42
|
const made = use();
|
|
43
43
|
return _$createComponent(Part, _$mergeProps({
|
|
44
|
-
get
|
|
44
|
+
get of() {
|
|
45
45
|
return made.positioner;
|
|
46
46
|
},
|
|
47
47
|
tag: "div"
|
|
48
48
|
}, () => positioned(props, made.positioning)));
|
|
49
49
|
}
|
|
50
50
|
const part = (key, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
51
|
-
get
|
|
51
|
+
get of() {
|
|
52
52
|
return use()[key];
|
|
53
53
|
},
|
|
54
54
|
tag: tag
|
|
@@ -61,7 +61,7 @@ export function hoverPopup(name, create, triggerTag) {
|
|
|
61
61
|
...local
|
|
62
62
|
})));
|
|
63
63
|
return _$createComponent(Part, _$mergeProps({
|
|
64
|
-
get
|
|
64
|
+
get of() {
|
|
65
65
|
return made.trigger;
|
|
66
66
|
},
|
|
67
67
|
tag: triggerTag
|
package/dom/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";
|
package/dom/input.js
CHANGED
package/dom/label.js
CHANGED
package/dom/listbox.js
CHANGED
|
@@ -32,7 +32,7 @@ function Root(props) {
|
|
|
32
32
|
value: made,
|
|
33
33
|
get children() {
|
|
34
34
|
return _$createComponent(Part, _$mergeProps({
|
|
35
|
-
get
|
|
35
|
+
get of() {
|
|
36
36
|
return made.root;
|
|
37
37
|
},
|
|
38
38
|
tag: "div"
|
|
@@ -54,7 +54,7 @@ function Item(props) {
|
|
|
54
54
|
value: value,
|
|
55
55
|
get children() {
|
|
56
56
|
return _$createComponent(Part, _$mergeProps({
|
|
57
|
-
|
|
57
|
+
of: part,
|
|
58
58
|
tag: "div"
|
|
59
59
|
}, rest));
|
|
60
60
|
}
|
|
@@ -71,7 +71,7 @@ function ItemIndicator(props) {
|
|
|
71
71
|
},
|
|
72
72
|
get children() {
|
|
73
73
|
return _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
74
|
+
get of() {
|
|
75
75
|
return made.indicator(value);
|
|
76
76
|
},
|
|
77
77
|
tag: "span"
|
|
@@ -87,7 +87,7 @@ function Group(props) {
|
|
|
87
87
|
value: group,
|
|
88
88
|
get children() {
|
|
89
89
|
return _$createComponent(Part, _$mergeProps({
|
|
90
|
-
get
|
|
90
|
+
get of() {
|
|
91
91
|
return group.root;
|
|
92
92
|
},
|
|
93
93
|
tag: "div"
|
|
@@ -99,7 +99,7 @@ function GroupLabel(props) {
|
|
|
99
99
|
const group = useContext(GroupContext);
|
|
100
100
|
if (!group) throw new Error("A Listbox.GroupLabel must be inside <Listbox.Group>");
|
|
101
101
|
return _$createComponent(Part, _$mergeProps({
|
|
102
|
-
get
|
|
102
|
+
get of() {
|
|
103
103
|
return group.label;
|
|
104
104
|
},
|
|
105
105
|
tag: "div"
|
package/dom/menu.js
CHANGED
|
@@ -75,7 +75,7 @@ const Portal = props => _$createComponent(BodyPortal, {
|
|
|
75
75
|
function Positioner(props) {
|
|
76
76
|
const made = useMenu();
|
|
77
77
|
return _$createComponent(Part, _$mergeProps({
|
|
78
|
-
get
|
|
78
|
+
get of() {
|
|
79
79
|
return made.positioner;
|
|
80
80
|
},
|
|
81
81
|
tag: "div"
|
|
@@ -89,7 +89,7 @@ function Item(props) {
|
|
|
89
89
|
}));
|
|
90
90
|
const part = useMenu().item(() => defined(options.get()));
|
|
91
91
|
return _$createComponent(Part, _$mergeProps({
|
|
92
|
-
|
|
92
|
+
of: part,
|
|
93
93
|
tag: "div"
|
|
94
94
|
}, rest));
|
|
95
95
|
}
|
|
@@ -101,7 +101,7 @@ function LinkItem(props) {
|
|
|
101
101
|
}));
|
|
102
102
|
const part = useMenu().item(() => defined(options.get()));
|
|
103
103
|
return _$createComponent(Part, _$mergeProps({
|
|
104
|
-
|
|
104
|
+
of: part,
|
|
105
105
|
tag: "a"
|
|
106
106
|
}, rest));
|
|
107
107
|
}
|
|
@@ -113,7 +113,7 @@ function Group(props) {
|
|
|
113
113
|
value: group,
|
|
114
114
|
get children() {
|
|
115
115
|
return _$createComponent(Part, _$mergeProps({
|
|
116
|
-
get
|
|
116
|
+
get of() {
|
|
117
117
|
return group.root;
|
|
118
118
|
},
|
|
119
119
|
tag: "div"
|
|
@@ -123,7 +123,7 @@ function Group(props) {
|
|
|
123
123
|
}
|
|
124
124
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
125
125
|
const GroupLabel = props => _$createComponent(Part, _$mergeProps({
|
|
126
|
-
get
|
|
126
|
+
get of() {
|
|
127
127
|
return useContext(GroupContext)?.label ?? useMenu().label;
|
|
128
128
|
},
|
|
129
129
|
tag: "div"
|
|
@@ -142,7 +142,7 @@ function CheckboxItem(props) {
|
|
|
142
142
|
value: item,
|
|
143
143
|
get children() {
|
|
144
144
|
return _$createComponent(Part, _$mergeProps({
|
|
145
|
-
get
|
|
145
|
+
get of() {
|
|
146
146
|
return item.part;
|
|
147
147
|
},
|
|
148
148
|
tag: "div"
|
|
@@ -160,7 +160,7 @@ function CheckboxItemIndicator(props) {
|
|
|
160
160
|
},
|
|
161
161
|
get children() {
|
|
162
162
|
return _$createComponent(Part, _$mergeProps({
|
|
163
|
-
get
|
|
163
|
+
get of() {
|
|
164
164
|
return item.indicator;
|
|
165
165
|
},
|
|
166
166
|
tag: "span"
|
|
@@ -180,7 +180,7 @@ function RadioGroup(props) {
|
|
|
180
180
|
value: group,
|
|
181
181
|
get children() {
|
|
182
182
|
return _$createComponent(Part, _$mergeProps({
|
|
183
|
-
get
|
|
183
|
+
get of() {
|
|
184
184
|
return group.root;
|
|
185
185
|
},
|
|
186
186
|
tag: "div"
|
|
@@ -202,7 +202,7 @@ function RadioItem(props) {
|
|
|
202
202
|
value: value,
|
|
203
203
|
get children() {
|
|
204
204
|
return _$createComponent(Part, _$mergeProps({
|
|
205
|
-
|
|
205
|
+
of: part,
|
|
206
206
|
tag: "div"
|
|
207
207
|
}, rest));
|
|
208
208
|
}
|
|
@@ -219,7 +219,7 @@ function RadioItemIndicator(props) {
|
|
|
219
219
|
},
|
|
220
220
|
get children() {
|
|
221
221
|
return _$createComponent(Part, _$mergeProps({
|
|
222
|
-
get
|
|
222
|
+
get of() {
|
|
223
223
|
return group.indicator(value);
|
|
224
224
|
},
|
|
225
225
|
tag: "span"
|
|
@@ -228,7 +228,7 @@ function RadioItemIndicator(props) {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
231
|
-
get
|
|
231
|
+
get of() {
|
|
232
232
|
return useMenu()[name];
|
|
233
233
|
},
|
|
234
234
|
tag: tag
|