@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/select.js
CHANGED
|
@@ -26,12 +26,17 @@ function Root(props) {
|
|
|
26
26
|
open: props.open,
|
|
27
27
|
defaultOpen: props.defaultOpen,
|
|
28
28
|
disabled: props.disabled,
|
|
29
|
+
readOnly: props.readOnly,
|
|
29
30
|
required: props.required,
|
|
30
31
|
name: props.name,
|
|
31
32
|
form: props.form,
|
|
32
33
|
items: props.items,
|
|
34
|
+
multiple: props.multiple,
|
|
35
|
+
values: props.values,
|
|
36
|
+
defaultValues: props.defaultValues,
|
|
33
37
|
virtualized: props.virtualized,
|
|
34
38
|
onValueChange: (value, details) => props.onValueChange?.(value, details),
|
|
39
|
+
onValuesChange: (values, details) => props.onValuesChange?.(values, details),
|
|
35
40
|
onOpenChange: (open, details) => props.onOpenChange?.(open, details)
|
|
36
41
|
}));
|
|
37
42
|
const named = fromSignal(made.named);
|
|
@@ -44,7 +49,7 @@ function Root(props) {
|
|
|
44
49
|
},
|
|
45
50
|
get children() {
|
|
46
51
|
return _$createComponent(Part, {
|
|
47
|
-
get
|
|
52
|
+
get of() {
|
|
48
53
|
return made.input;
|
|
49
54
|
},
|
|
50
55
|
tag: "input"
|
|
@@ -71,25 +76,33 @@ function Positioner(props) {
|
|
|
71
76
|
const [local, rest] = splitProps(props, ["alignItemWithTrigger"]);
|
|
72
77
|
createComputed(() => made.alignItemWithTrigger.set(Boolean(local.alignItemWithTrigger)));
|
|
73
78
|
return _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
79
|
+
get of() {
|
|
75
80
|
return made.positioner;
|
|
76
81
|
},
|
|
77
82
|
tag: "div"
|
|
78
83
|
}, () => positioned(rest, made.positioning)));
|
|
79
84
|
}
|
|
80
|
-
/** Shows the chosen value's label, or `placeholder` while nothing is chosen. */
|
|
81
85
|
function Value(props) {
|
|
82
86
|
const [local, rest] = splitProps(props, ["placeholder", "children"]);
|
|
83
87
|
const made = useSelect();
|
|
84
|
-
const
|
|
88
|
+
const shown = fromSignal(made.shown);
|
|
89
|
+
const drawn = () => {
|
|
90
|
+
const given = local.children;
|
|
91
|
+
// A function that takes nothing is an element of Solid's own, drawn as it is.
|
|
92
|
+
if (typeof given !== "function" || given.length === 0) {
|
|
93
|
+
return given ?? shown().label ?? local.placeholder;
|
|
94
|
+
}
|
|
95
|
+
const draw = given;
|
|
96
|
+
return made.multiple ? draw(() => shown().values, () => shown().labels) : draw(() => shown().value, () => shown().label);
|
|
97
|
+
};
|
|
85
98
|
return _$createComponent(Part, _$mergeProps({
|
|
86
|
-
get
|
|
99
|
+
get of() {
|
|
87
100
|
return made.valuePart;
|
|
88
101
|
},
|
|
89
102
|
tag: "span"
|
|
90
103
|
}, rest, {
|
|
91
104
|
get children() {
|
|
92
|
-
return
|
|
105
|
+
return drawn();
|
|
93
106
|
}
|
|
94
107
|
}));
|
|
95
108
|
}
|
|
@@ -108,14 +121,14 @@ function Item(props) {
|
|
|
108
121
|
value: value,
|
|
109
122
|
get children() {
|
|
110
123
|
return _$createComponent(Part, _$mergeProps({
|
|
111
|
-
|
|
124
|
+
of: part,
|
|
112
125
|
tag: "div"
|
|
113
126
|
}, rest));
|
|
114
127
|
}
|
|
115
128
|
});
|
|
116
129
|
}
|
|
117
130
|
const ItemText = props => _$createComponent(Part, _$mergeProps({
|
|
118
|
-
get
|
|
131
|
+
get of() {
|
|
119
132
|
return useSelect().itemText(useContext(ItemContext));
|
|
120
133
|
},
|
|
121
134
|
tag: "span"
|
|
@@ -131,7 +144,7 @@ function ItemIndicator(props) {
|
|
|
131
144
|
},
|
|
132
145
|
get children() {
|
|
133
146
|
return _$createComponent(Part, _$mergeProps({
|
|
134
|
-
get
|
|
147
|
+
get of() {
|
|
135
148
|
return made.itemIndicator(value);
|
|
136
149
|
},
|
|
137
150
|
tag: "span"
|
|
@@ -149,7 +162,7 @@ function Group(props) {
|
|
|
149
162
|
value: group,
|
|
150
163
|
get children() {
|
|
151
164
|
return _$createComponent(Part, _$mergeProps({
|
|
152
|
-
get
|
|
165
|
+
get of() {
|
|
153
166
|
return group.root;
|
|
154
167
|
},
|
|
155
168
|
tag: "div"
|
|
@@ -159,7 +172,7 @@ function Group(props) {
|
|
|
159
172
|
}
|
|
160
173
|
/** Names the group it is in. With no group around it, it is plain text. */
|
|
161
174
|
const GroupLabel = props => _$createComponent(Part, _$mergeProps({
|
|
162
|
-
get
|
|
175
|
+
get of() {
|
|
163
176
|
return useContext(GroupContext)?.label ?? useSelect().groupLabel;
|
|
164
177
|
},
|
|
165
178
|
tag: "div"
|
|
@@ -175,7 +188,7 @@ function scrollArrow(direction) {
|
|
|
175
188
|
},
|
|
176
189
|
get children() {
|
|
177
190
|
return _$createComponent(Part, _$mergeProps({
|
|
178
|
-
get
|
|
191
|
+
get of() {
|
|
179
192
|
return arrow.part;
|
|
180
193
|
},
|
|
181
194
|
tag: "div"
|
|
@@ -185,7 +198,7 @@ function scrollArrow(direction) {
|
|
|
185
198
|
};
|
|
186
199
|
}
|
|
187
200
|
const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
188
|
-
get
|
|
201
|
+
get of() {
|
|
189
202
|
return useSelect()[name];
|
|
190
203
|
},
|
|
191
204
|
tag: tag
|
package/dom/separator.js
CHANGED
package/dom/slider.js
CHANGED
|
@@ -13,8 +13,9 @@ function useSlider() {
|
|
|
13
13
|
if (!made) throw new Error("A Slider part must be inside <Slider.Root>");
|
|
14
14
|
return made;
|
|
15
15
|
}
|
|
16
|
+
// Given neither `value` nor `defaultValue`, a slider has one thumb: its value is a number.
|
|
16
17
|
function Root(props) {
|
|
17
|
-
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "onValueCommitted", "min", "max", "step", "largeStep", "minStepsBetweenValues", "thumbAlignment", "orientation", "disabled", "name", "form", "format", "locale", "getAriaValueText", "id"]);
|
|
18
|
+
const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "onValueCommitted", "min", "max", "step", "largeStep", "minStepsBetweenValues", "thumbAlignment", "orientation", "disabled", "readOnly", "name", "form", "format", "locale", "getAriaValueText", "id"]);
|
|
18
19
|
const generated = createUniqueId();
|
|
19
20
|
const field = useContext(FieldContext);
|
|
20
21
|
const made = controller(within(createSlider, {
|
|
@@ -30,7 +31,7 @@ function Root(props) {
|
|
|
30
31
|
value: made,
|
|
31
32
|
get children() {
|
|
32
33
|
return _$createComponent(Part, _$mergeProps({
|
|
33
|
-
get
|
|
34
|
+
get of() {
|
|
34
35
|
return made.root;
|
|
35
36
|
},
|
|
36
37
|
tag: "div"
|
|
@@ -41,18 +42,20 @@ function Root(props) {
|
|
|
41
42
|
/** `index` is which value of a range the thumb is, from 0. */
|
|
42
43
|
function Thumb(props) {
|
|
43
44
|
const [local, rest] = splitProps(props, ["index", "children"]);
|
|
44
|
-
// A thumb is its index for as long as it is in the page.
|
|
45
|
-
|
|
45
|
+
// A thumb is its index for as long as it is in the page. Given none, it takes its place
|
|
46
|
+
// among the slider's thumbs, in the order they are written.
|
|
47
|
+
const generated = createUniqueId();
|
|
48
|
+
const index = untrack(() => local.index ?? generated);
|
|
46
49
|
const slider = useSlider();
|
|
47
50
|
return _$createComponent(Part, _$mergeProps({
|
|
48
|
-
get
|
|
51
|
+
get of() {
|
|
49
52
|
return slider.thumb(index);
|
|
50
53
|
},
|
|
51
54
|
tag: "div"
|
|
52
55
|
}, rest, {
|
|
53
56
|
get children() {
|
|
54
57
|
return [_$memo(() => local.children), _$createComponent(Part, {
|
|
55
|
-
get
|
|
58
|
+
get of() {
|
|
56
59
|
return slider.thumbInput(index);
|
|
57
60
|
},
|
|
58
61
|
tag: "input"
|
|
@@ -67,7 +70,7 @@ function Value(props) {
|
|
|
67
70
|
const text = fromSignal(made.text);
|
|
68
71
|
const values = fromSignal(made.values);
|
|
69
72
|
return _$createComponent(Part, _$mergeProps({
|
|
70
|
-
get
|
|
73
|
+
get of() {
|
|
71
74
|
return made.value;
|
|
72
75
|
},
|
|
73
76
|
tag: "output"
|
|
@@ -78,7 +81,7 @@ function Value(props) {
|
|
|
78
81
|
}));
|
|
79
82
|
}
|
|
80
83
|
const part = key => props => _$createComponent(Part, _$mergeProps({
|
|
81
|
-
get
|
|
84
|
+
get of() {
|
|
82
85
|
return useSlider()[key];
|
|
83
86
|
},
|
|
84
87
|
tag: "div"
|
package/dom/switch.js
CHANGED
|
@@ -34,14 +34,14 @@ function Root(props) {
|
|
|
34
34
|
value: made,
|
|
35
35
|
get children() {
|
|
36
36
|
return _$createComponent(Part, _$mergeProps({
|
|
37
|
-
get
|
|
37
|
+
get of() {
|
|
38
38
|
return made.root;
|
|
39
39
|
},
|
|
40
40
|
tag: "span"
|
|
41
41
|
}, rest, {
|
|
42
42
|
get children() {
|
|
43
43
|
return [_$memo(() => local.children), _$createComponent(Part, {
|
|
44
|
-
get
|
|
44
|
+
get of() {
|
|
45
45
|
return made.input;
|
|
46
46
|
},
|
|
47
47
|
tag: "input"
|
|
@@ -52,7 +52,7 @@ function Root(props) {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
const Thumb = props => _$createComponent(Part, _$mergeProps({
|
|
55
|
-
get
|
|
55
|
+
get of() {
|
|
56
56
|
return useSwitch().thumb;
|
|
57
57
|
},
|
|
58
58
|
tag: "span"
|
package/dom/tabs.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"
|
|
@@ -44,7 +44,7 @@ function List(props) {
|
|
|
44
44
|
...local
|
|
45
45
|
})));
|
|
46
46
|
return _$createComponent(Part, _$mergeProps({
|
|
47
|
-
get
|
|
47
|
+
get of() {
|
|
48
48
|
return made.list;
|
|
49
49
|
},
|
|
50
50
|
tag: "div"
|
|
@@ -58,12 +58,12 @@ function Tab(props) {
|
|
|
58
58
|
// A tab is its value for as long as it is in the page.
|
|
59
59
|
const part = useTabs().tab(untrack(() => local.value), () => defined(options.get()));
|
|
60
60
|
return _$createComponent(Part, _$mergeProps({
|
|
61
|
-
|
|
61
|
+
of: part,
|
|
62
62
|
tag: "button"
|
|
63
63
|
}, rest));
|
|
64
64
|
}
|
|
65
65
|
const Indicator = props => _$createComponent(Part, _$mergeProps({
|
|
66
|
-
get
|
|
66
|
+
get of() {
|
|
67
67
|
return useTabs().indicator;
|
|
68
68
|
},
|
|
69
69
|
tag: "span"
|
|
@@ -80,7 +80,7 @@ function Panel(props) {
|
|
|
80
80
|
},
|
|
81
81
|
get children() {
|
|
82
82
|
return _$createComponent(Part, _$mergeProps({
|
|
83
|
-
get
|
|
83
|
+
get of() {
|
|
84
84
|
return panel.part;
|
|
85
85
|
},
|
|
86
86
|
tag: "div"
|
package/dom/testing.js
ADDED
package/dom/toast.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { memo as _$memo } from "solid-js/web";
|
|
1
2
|
import { createComponent as _$createComponent } from "solid-js/web";
|
|
2
3
|
import { mergeProps as _$mergeProps } from "solid-js/web";
|
|
3
|
-
import { createToast } from "@kirana-ui/core/toast";
|
|
4
|
-
import { For, createContext, createMemo, createUniqueId, splitProps, useContext } from "solid-js";
|
|
4
|
+
import { createToast, createToaster as createCoreToaster } from "@kirana-ui/core/toast";
|
|
5
|
+
import { For, Show, createContext, createMemo, createUniqueId, splitProps, useContext } from "solid-js";
|
|
5
6
|
import { Part, controller, fromSignal } from "./runtime.js";
|
|
7
|
+
/**
|
|
8
|
+
* The toasts of a page, made once, in a module: `toaster.add({ title })` from anywhere. A
|
|
9
|
+
* title, a description and an action's label are anything Solid draws, unless `Content` says
|
|
10
|
+
* otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export const createToaster = createCoreToaster;
|
|
6
13
|
const Context = createContext();
|
|
7
14
|
const ToastContext = createContext();
|
|
8
15
|
function useToast() {
|
|
@@ -30,7 +37,7 @@ function Viewport(props) {
|
|
|
30
37
|
value: made,
|
|
31
38
|
get children() {
|
|
32
39
|
return _$createComponent(Part, _$mergeProps({
|
|
33
|
-
get
|
|
40
|
+
get of() {
|
|
34
41
|
return made.viewport;
|
|
35
42
|
},
|
|
36
43
|
tag: "div"
|
|
@@ -62,7 +69,7 @@ function Root(props) {
|
|
|
62
69
|
value: parts,
|
|
63
70
|
get children() {
|
|
64
71
|
return _$createComponent(Part, _$mergeProps({
|
|
65
|
-
get
|
|
72
|
+
get of() {
|
|
66
73
|
return parts.root;
|
|
67
74
|
},
|
|
68
75
|
tag: "div"
|
|
@@ -71,33 +78,64 @@ function Root(props) {
|
|
|
71
78
|
});
|
|
72
79
|
}
|
|
73
80
|
const Content = props => _$createComponent(Part, _$mergeProps({
|
|
74
|
-
get
|
|
81
|
+
get of() {
|
|
75
82
|
return useParts().content;
|
|
76
83
|
},
|
|
77
84
|
tag: "div"
|
|
78
85
|
}, props));
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
/**
|
|
87
|
+
* A part that says something of the toast's: the caller's children when it has any, what the
|
|
88
|
+
* toast was added with otherwise, and nothing in the page when there is neither.
|
|
89
|
+
*/
|
|
90
|
+
function Said(props) {
|
|
91
|
+
const [local, rest] = splitProps(props, ["said", "tag", "children"]);
|
|
92
|
+
const parts = useParts();
|
|
93
|
+
const toast = fromSignal(parts.record);
|
|
94
|
+
const children = createMemo(() => local.children ?? (local.said === "action" ? toast()?.action?.label : toast()?.[local.said]));
|
|
95
|
+
return (// A `render` draws what it likes; without one, an element with nothing to say is not drawn.
|
|
96
|
+
_$createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return children() != null || rest.render;
|
|
99
|
+
},
|
|
100
|
+
get children() {
|
|
101
|
+
return _$createComponent(Part, _$mergeProps({
|
|
102
|
+
get of() {
|
|
103
|
+
return parts[local.said];
|
|
104
|
+
},
|
|
105
|
+
get tag() {
|
|
106
|
+
return local.tag;
|
|
107
|
+
}
|
|
108
|
+
}, rest, {
|
|
109
|
+
get children() {
|
|
110
|
+
return children();
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
/** The toast's title, unless it is given children of its own. */
|
|
118
|
+
const Title = props => _$createComponent(Said, _$mergeProps({
|
|
119
|
+
said: "title",
|
|
83
120
|
tag: "div"
|
|
84
121
|
}, props));
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
122
|
+
/** The toast's description, unless it is given children of its own. */
|
|
123
|
+
const Description = props => _$createComponent(Said, _$mergeProps({
|
|
124
|
+
said: "description",
|
|
89
125
|
tag: "div"
|
|
90
126
|
}, props));
|
|
91
127
|
const Close = props => _$createComponent(Part, _$mergeProps({
|
|
92
|
-
get
|
|
128
|
+
get of() {
|
|
93
129
|
return useParts().close;
|
|
94
130
|
},
|
|
95
131
|
tag: "button"
|
|
96
132
|
}, props));
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
133
|
+
/**
|
|
134
|
+
* The toast's action, its label unless it is given children of its own. A press tells the
|
|
135
|
+
* action (`onAction`), then closes the toast unless the action called `details.cancel()`.
|
|
136
|
+
*/
|
|
137
|
+
const Action = props => _$createComponent(Said, _$mergeProps({
|
|
138
|
+
said: "action",
|
|
101
139
|
tag: "button"
|
|
102
140
|
}, props));
|
|
103
141
|
export const Toast = {
|
|
@@ -109,5 +147,4 @@ export const Toast = {
|
|
|
109
147
|
Description,
|
|
110
148
|
Close,
|
|
111
149
|
Action
|
|
112
|
-
};
|
|
113
|
-
export { createToaster } from "@kirana-ui/core/toast";
|
|
150
|
+
};
|
package/dom/toggle-group.js
CHANGED
package/dom/toggle.js
CHANGED
package/dom/toolbar.js
CHANGED
|
@@ -28,7 +28,7 @@ function Root(props) {
|
|
|
28
28
|
value: null,
|
|
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"
|
|
@@ -45,18 +45,18 @@ const item = (name, tag) => props => {
|
|
|
45
45
|
}));
|
|
46
46
|
const part = useToolbar()[name](() => defined(options.get()));
|
|
47
47
|
return _$createComponent(Part, _$mergeProps({
|
|
48
|
-
|
|
48
|
+
of: part,
|
|
49
49
|
tag: tag
|
|
50
50
|
}, rest));
|
|
51
51
|
};
|
|
52
52
|
const Link = props => _$createComponent(Part, _$mergeProps({
|
|
53
|
-
get
|
|
53
|
+
get of() {
|
|
54
54
|
return useToolbar().link();
|
|
55
55
|
},
|
|
56
56
|
tag: "a"
|
|
57
57
|
}, props));
|
|
58
58
|
const Separator = props => _$createComponent(Part, _$mergeProps({
|
|
59
|
-
get
|
|
59
|
+
get of() {
|
|
60
60
|
return useToolbar().separator;
|
|
61
61
|
},
|
|
62
62
|
tag: "div"
|
package/dom/value-bar.js
CHANGED
|
@@ -22,7 +22,7 @@ export function valueBar(name, create) {
|
|
|
22
22
|
value: made,
|
|
23
23
|
get children() {
|
|
24
24
|
return _$createComponent(Part, _$mergeProps({
|
|
25
|
-
get
|
|
25
|
+
get of() {
|
|
26
26
|
return made.root;
|
|
27
27
|
},
|
|
28
28
|
tag: "div"
|
|
@@ -36,7 +36,7 @@ export function valueBar(name, create) {
|
|
|
36
36
|
const made = use();
|
|
37
37
|
const text = fromSignal(made.text);
|
|
38
38
|
return _$createComponent(Part, _$mergeProps({
|
|
39
|
-
get
|
|
39
|
+
get of() {
|
|
40
40
|
return made.value;
|
|
41
41
|
},
|
|
42
42
|
tag: "span"
|
|
@@ -47,7 +47,7 @@ export function valueBar(name, create) {
|
|
|
47
47
|
}));
|
|
48
48
|
}
|
|
49
49
|
const part = (key, tag) => props => _$createComponent(Part, _$mergeProps({
|
|
50
|
-
get
|
|
50
|
+
get of() {
|
|
51
51
|
return use()[key];
|
|
52
52
|
},
|
|
53
53
|
tag: tag
|