@kirana-ui/solid 0.1.0 → 0.2.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 (213) hide show
  1. package/dom/accordion.js +9 -6
  2. package/dom/agent.js +3 -0
  3. package/dom/autocomplete.js +2 -0
  4. package/dom/autosize.js +19 -0
  5. package/dom/avatar.js +3 -3
  6. package/dom/button.js +1 -1
  7. package/dom/calendar.js +145 -0
  8. package/dom/carousel.js +83 -0
  9. package/dom/checkbox.js +5 -4
  10. package/dom/collapsible.js +3 -3
  11. package/dom/combobox.js +289 -0
  12. package/dom/command.js +129 -0
  13. package/dom/context-menu.js +2 -0
  14. package/dom/date-field.js +90 -0
  15. package/dom/date-picker.js +103 -0
  16. package/dom/dialog.js +32 -1
  17. package/dom/drawer.js +2 -0
  18. package/dom/field.js +3 -3
  19. package/dom/fieldset.js +2 -2
  20. package/dom/form.js +1 -1
  21. package/dom/hover-popup.js +19 -4
  22. package/dom/index.js +26 -1
  23. package/dom/input.js +26 -0
  24. package/dom/label.js +18 -0
  25. package/dom/listbox.js +114 -0
  26. package/dom/menu.js +261 -0
  27. package/dom/menubar-context.js +3 -0
  28. package/dom/menubar.js +33 -0
  29. package/dom/message-scroller.js +56 -0
  30. package/dom/navigation-menu.js +147 -0
  31. package/dom/number-field.js +82 -0
  32. package/dom/otp.js +95 -0
  33. package/dom/pagination.js +74 -0
  34. package/dom/popover.js +22 -7
  35. package/dom/qr-code.js +48 -0
  36. package/dom/radio-group.js +6 -5
  37. package/dom/resizable.js +65 -0
  38. package/dom/runtime.js +59 -9
  39. package/dom/scroll-area.js +99 -0
  40. package/dom/select.js +91 -15
  41. package/dom/separator.js +1 -1
  42. package/dom/slider.js +11 -8
  43. package/dom/switch.js +5 -4
  44. package/dom/tabs.js +5 -5
  45. package/dom/testing.js +3 -0
  46. package/dom/toast.js +150 -0
  47. package/dom/toggle-group.js +37 -0
  48. package/dom/toggle.js +12 -4
  49. package/dom/toolbar-context.js +5 -0
  50. package/dom/toolbar.js +71 -0
  51. package/dom/value-bar.js +3 -3
  52. package/llms.txt +3202 -0
  53. package/package.json +236 -2
  54. package/server/accordion.js +9 -6
  55. package/server/agent.js +3 -0
  56. package/server/autocomplete.js +2 -0
  57. package/server/autosize.js +19 -0
  58. package/server/avatar.js +3 -3
  59. package/server/button.js +1 -1
  60. package/server/calendar.js +144 -0
  61. package/server/carousel.js +83 -0
  62. package/server/checkbox.js +5 -4
  63. package/server/collapsible.js +3 -3
  64. package/server/combobox.js +289 -0
  65. package/server/command.js +129 -0
  66. package/server/context-menu.js +2 -0
  67. package/server/date-field.js +90 -0
  68. package/server/date-picker.js +103 -0
  69. package/server/dialog.js +32 -1
  70. package/server/drawer.js +2 -0
  71. package/server/field.js +3 -3
  72. package/server/fieldset.js +2 -2
  73. package/server/form.js +1 -1
  74. package/server/hover-popup.js +19 -4
  75. package/server/index.js +26 -1
  76. package/server/input.js +26 -0
  77. package/server/label.js +18 -0
  78. package/server/listbox.js +114 -0
  79. package/server/menu.js +261 -0
  80. package/server/menubar-context.js +3 -0
  81. package/server/menubar.js +33 -0
  82. package/server/message-scroller.js +56 -0
  83. package/server/navigation-menu.js +147 -0
  84. package/server/number-field.js +81 -0
  85. package/server/otp.js +94 -0
  86. package/server/pagination.js +74 -0
  87. package/server/popover.js +22 -7
  88. package/server/qr-code.js +48 -0
  89. package/server/radio-group.js +6 -5
  90. package/server/resizable.js +65 -0
  91. package/server/runtime.js +58 -8
  92. package/server/scroll-area.js +99 -0
  93. package/server/select.js +91 -15
  94. package/server/separator.js +1 -1
  95. package/server/slider.js +11 -8
  96. package/server/switch.js +5 -4
  97. package/server/tabs.js +5 -5
  98. package/server/testing.js +3 -0
  99. package/server/toast.js +150 -0
  100. package/server/toggle-group.js +37 -0
  101. package/server/toggle.js +12 -4
  102. package/server/toolbar-context.js +5 -0
  103. package/server/toolbar.js +71 -0
  104. package/server/value-bar.js +3 -3
  105. package/skills/kirana-ui-primitives/SKILL.md +142 -0
  106. package/src/accordion.jsx +10 -7
  107. package/src/agent.js +3 -0
  108. package/src/autocomplete.jsx +2 -0
  109. package/src/autosize.jsx +8 -0
  110. package/src/avatar.jsx +3 -3
  111. package/src/button.jsx +1 -1
  112. package/src/calendar.jsx +108 -0
  113. package/src/carousel.jsx +51 -0
  114. package/src/checkbox.jsx +5 -3
  115. package/src/collapsible.jsx +3 -3
  116. package/src/combobox.jsx +187 -0
  117. package/src/command.jsx +81 -0
  118. package/src/context-menu.js +2 -0
  119. package/src/date-field.jsx +71 -0
  120. package/src/date-picker.jsx +72 -0
  121. package/src/dialog.jsx +27 -1
  122. package/src/drawer.js +2 -0
  123. package/src/field.jsx +3 -3
  124. package/src/fieldset.jsx +2 -2
  125. package/src/form.jsx +1 -1
  126. package/src/hover-popup.jsx +12 -4
  127. package/src/index.js +26 -1
  128. package/src/input.jsx +17 -0
  129. package/src/label.jsx +9 -0
  130. package/src/listbox.jsx +81 -0
  131. package/src/menu.jsx +164 -0
  132. package/src/menubar-context.js +3 -0
  133. package/src/menubar.jsx +21 -0
  134. package/src/message-scroller.jsx +27 -0
  135. package/src/navigation-menu.jsx +96 -0
  136. package/src/number-field.jsx +75 -0
  137. package/src/otp.jsx +73 -0
  138. package/src/pagination.jsx +60 -0
  139. package/src/popover.jsx +22 -4
  140. package/src/qr-code.jsx +25 -0
  141. package/src/radio-group.jsx +7 -5
  142. package/src/resizable.jsx +46 -0
  143. package/src/runtime.jsx +54 -9
  144. package/src/scroll-area.jsx +53 -0
  145. package/src/select.jsx +72 -14
  146. package/src/separator.jsx +1 -1
  147. package/src/slider.jsx +13 -8
  148. package/src/switch.jsx +5 -3
  149. package/src/tabs.jsx +6 -6
  150. package/src/testing.js +3 -0
  151. package/src/toast.jsx +86 -0
  152. package/src/toggle-group.jsx +32 -0
  153. package/src/toggle.jsx +9 -3
  154. package/src/toolbar-context.js +5 -0
  155. package/src/toolbar.jsx +43 -0
  156. package/src/value-bar.jsx +3 -3
  157. package/types/accordion.d.ts +21 -19
  158. package/types/agent.d.ts +1 -0
  159. package/types/alert-dialog.d.ts +1 -0
  160. package/types/autocomplete.d.ts +2 -0
  161. package/types/autosize.d.ts +11 -0
  162. package/types/avatar.d.ts +12 -5
  163. package/types/button.d.ts +4 -2
  164. package/types/calendar.d.ts +57 -0
  165. package/types/carousel.d.ts +34 -0
  166. package/types/checkbox.d.ts +10 -6
  167. package/types/collapsible.d.ts +11 -7
  168. package/types/combobox.d.ts +105 -0
  169. package/types/command.d.ts +55 -0
  170. package/types/context-menu.d.ts +2 -0
  171. package/types/date-field.d.ts +34 -0
  172. package/types/date-picker.d.ts +40 -0
  173. package/types/dialog.d.ts +52 -20
  174. package/types/direction.d.ts +1 -0
  175. package/types/drawer.d.ts +2 -0
  176. package/types/field.d.ts +19 -11
  177. package/types/fieldset.d.ts +8 -3
  178. package/types/form.d.ts +5 -2
  179. package/types/hover-card.d.ts +16 -7
  180. package/types/hover-popup.d.ts +23 -10
  181. package/types/index.d.ts +39 -2
  182. package/types/input.d.ts +13 -0
  183. package/types/label.d.ts +7 -0
  184. package/types/listbox.d.ts +36 -0
  185. package/types/menu.d.ts +105 -0
  186. package/types/menubar-context.d.ts +3 -0
  187. package/types/menubar.d.ts +12 -0
  188. package/types/message-scroller.d.ts +22 -0
  189. package/types/meter.d.ts +16 -7
  190. package/types/navigation-menu.d.ts +50 -0
  191. package/types/number-field.d.ts +22 -0
  192. package/types/otp.d.ts +39 -0
  193. package/types/pagination.d.ts +31 -0
  194. package/types/popover.d.ts +41 -13
  195. package/types/progress.d.ts +16 -7
  196. package/types/qr-code.d.ts +20 -0
  197. package/types/radio-group.d.ts +15 -16
  198. package/types/resizable.d.ts +29 -0
  199. package/types/runtime.d.ts +53 -11
  200. package/types/scroll-area.d.ts +28 -0
  201. package/types/select.d.ts +66 -33
  202. package/types/separator.d.ts +5 -3
  203. package/types/slider.d.ts +25 -13
  204. package/types/switch.d.ts +8 -4
  205. package/types/tabs.d.ts +20 -16
  206. package/types/testing.d.ts +1 -0
  207. package/types/toast.d.ts +57 -0
  208. package/types/toggle-group.d.ts +9 -0
  209. package/types/toggle.d.ts +6 -3
  210. package/types/toolbar-context.d.ts +6 -0
  211. package/types/toolbar.d.ts +28 -0
  212. package/types/tooltip.d.ts +16 -7
  213. package/types/value-bar.d.ts +21 -10
package/server/runtime.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { mergeProps as _$mergeProps } from "solid-js/web";
2
2
  import { memo as _$memo } from "solid-js/web";
3
3
  import { createComponent as _$createComponent } from "solid-js/web";
4
- import { mergeProps, sameProps, signal } from "@kirana-ui/core";
5
- import { Show, createComputed, createMemo, createSignal, getOwner, onCleanup, onMount, runWithOwner, splitProps, untrack } from "solid-js";
4
+ import { mergeProps, sameProps, signal, stateOf } from "@kirana-ui/core";
5
+ import { Show, children, createComputed, createContext, createRenderEffect, createMemo, createSignal, getOwner, onCleanup, onMount, runWithOwner, splitProps, untrack, useContext } from "solid-js";
6
6
  import { Dynamic, Portal as SolidPortal, isServer } from "solid-js/web";
7
7
  /** A core signal as a Solid accessor: tracked by whatever calls it. */
8
8
  export function fromSignal(source) {
@@ -36,12 +36,15 @@ function toSolid(props) {
36
36
  return out;
37
37
  }
38
38
  /**
39
- * A part's element (or the caller's, through `render`), with the caller's props merged under the
40
- * part's and the part's DOM work attached once the element is in the page.
39
+ * The element of a part (`of`), or the caller's through `render`, with the caller's props merged under the
40
+ * part's and the part's DOM work attached once the element is in the page. What the part holds
41
+ * is its children here: with `as` they are the element's, and with `render` they are handed to
42
+ * the caller's function as the `children` of its props, so a control drawn as another element
43
+ * keeps the native input a form and a label reach.
41
44
  */
42
45
  export function Part(props) {
43
- const [local, caller] = splitProps(props, ["part", "tag", "as", "render", "children"]);
44
- const own = fromSignal(untrack(() => local.part).props);
46
+ const [local, caller] = splitProps(props, ["of", "tag", "as", "render", "children"]);
47
+ const own = fromSignal(untrack(() => local.of).props);
45
48
  // Solid hands over an element before it is in the page: the part's DOM work (focus, measures,
46
49
  // the starting style) waits for the mount that follows. It belongs to this component, not to
47
50
  // the effect that spreads the props (which hands the ref over again, and is torn down, each time
@@ -51,8 +54,11 @@ export function Part(props) {
51
54
  const attach = element => {
52
55
  if (element === attached) return;
53
56
  attached = element;
54
- const part = untrack(() => local.part);
57
+ const part = untrack(() => local.of);
55
58
  runWithOwner(owner, () => onMount(() => onCleanup(part.attach(element))));
59
+ // The caller's own `ref` (Solid hands a component a function, whatever was written).
60
+ const theirs = untrack(() => caller.ref);
61
+ if (typeof theirs === "function") theirs(element);
56
62
  };
57
63
  const merged = createMemo(() => {
58
64
  const theirs = {};
@@ -62,6 +68,7 @@ export function Part(props) {
62
68
  ref: attach
63
69
  };
64
70
  });
71
+ const state = () => stateOf(own());
65
72
  return _$createComponent(Show, {
66
73
  get when() {
67
74
  return local.render;
@@ -77,18 +84,61 @@ export function Part(props) {
77
84
  }
78
85
  }));
79
86
  },
80
- children: render => render()(merged)
87
+ children: render => {
88
+ // Resolved once: a change of the part's props hands the same nodes over again, and
89
+ // the element keeps them.
90
+ const held = children(() => local.children);
91
+ const handed = createMemo(() => ({
92
+ ...merged(),
93
+ children: held()
94
+ }));
95
+ return render()(handed, state);
96
+ }
97
+ });
98
+ }
99
+ /**
100
+ * Its children as children of `target`, an element drawn elsewhere: with no element of its own
101
+ * around them (Solid's `Portal` adds one), so the page is the same as on the other adapters.
102
+ */
103
+ export function Into(props) {
104
+ const resolved = children(() => props.children);
105
+ // Before any mount work of the children: their elements are in the page by then.
106
+ createRenderEffect(() => {
107
+ const target = props.target;
108
+ const nodes = resolved.toArray().filter(each => each instanceof Node);
109
+ for (const node of nodes) target.appendChild(node);
110
+ onCleanup(() => {
111
+ for (const node of nodes) if (node.parentNode === target) target.removeChild(node);
112
+ });
113
+ });
114
+ return null;
115
+ }
116
+ const PortalContainer = createContext();
117
+ /**
118
+ * Says where every popup inside it is drawn, the popups those open included: an element of
119
+ * the page (a shadow root's host, a full-screen element) in place of `<body>`.
120
+ */
121
+ export function PortalProvider(props) {
122
+ return _$createComponent(PortalContainer.Provider, {
123
+ value: () => props.container,
124
+ get children() {
125
+ return props.children;
126
+ }
81
127
  });
82
128
  }
83
129
  /** Its children in a container at the end of the page, while `mounted`. */
84
130
  export function Portal(props) {
85
131
  const shown = fromSignal(untrack(() => props.mounted));
132
+ const container = useContext(PortalContainer);
86
133
  return _$createComponent(Show, {
87
134
  get when() {
88
135
  return shown();
89
136
  },
90
137
  get children() {
91
138
  return _$createComponent(SolidPortal, {
139
+ get mount() {
140
+ return container?.() ?? undefined;
141
+ },
92
142
  get children() {
93
143
  return props.children;
94
144
  }
@@ -0,0 +1,99 @@
1
+ import { memo as _$memo } from "solid-js/web";
2
+ import { createComponent as _$createComponent } from "solid-js/web";
3
+ import { mergeProps as _$mergeProps } from "solid-js/web";
4
+ import { within } from "@kirana-ui/core";
5
+ import { createScrollArea } from "@kirana-ui/core/scroll-area";
6
+ import { Show, createContext, splitProps, untrack, useContext } from "solid-js";
7
+ import { DirectionContext } from "./direction-context.js";
8
+ import { Part, controller, fromSignal } from "./runtime.js";
9
+ const Context = createContext();
10
+ const ScrollbarContext = createContext();
11
+ function useScrollArea() {
12
+ const made = useContext(Context);
13
+ if (!made) throw new Error("A ScrollArea part must be inside <ScrollArea.Root>");
14
+ return made;
15
+ }
16
+ function Root(props) {
17
+ const direction = useContext(DirectionContext);
18
+ const made = controller(within(createScrollArea, {
19
+ direction
20
+ }), () => ({}));
21
+ return _$createComponent(Context.Provider, {
22
+ value: made,
23
+ get children() {
24
+ return _$createComponent(Part, _$mergeProps({
25
+ get of() {
26
+ return made.root;
27
+ },
28
+ tag: "div"
29
+ }, props));
30
+ }
31
+ });
32
+ }
33
+ /** `orientation` is which way it scrolls (`vertical` by default). */
34
+ function Scrollbar(props) {
35
+ const [local, rest] = splitProps(props, ["orientation", "keepMounted"]);
36
+ const bar = useScrollArea().scrollbar(untrack(() => local.orientation) ?? "vertical");
37
+ const shown = fromSignal(bar.shown);
38
+ return _$createComponent(ScrollbarContext.Provider, {
39
+ value: bar,
40
+ get children() {
41
+ return _$createComponent(Show, {
42
+ get when() {
43
+ return shown() || local.keepMounted;
44
+ },
45
+ get children() {
46
+ return _$createComponent(Part, _$mergeProps({
47
+ get of() {
48
+ return bar.part;
49
+ },
50
+ tag: "div"
51
+ }, rest));
52
+ }
53
+ });
54
+ }
55
+ });
56
+ }
57
+ function Thumb(props) {
58
+ const bar = useContext(ScrollbarContext);
59
+ if (!bar) throw new Error("A ScrollArea.Thumb must be inside <ScrollArea.Scrollbar>");
60
+ return _$createComponent(Part, _$mergeProps({
61
+ get of() {
62
+ return bar.thumb;
63
+ },
64
+ tag: "div"
65
+ }, props));
66
+ }
67
+ function Corner(props) {
68
+ const {
69
+ corner
70
+ } = useScrollArea();
71
+ const shown = fromSignal(corner.shown);
72
+ return _$createComponent(Show, {
73
+ get when() {
74
+ return shown();
75
+ },
76
+ get children() {
77
+ return _$createComponent(Part, _$mergeProps({
78
+ get of() {
79
+ return corner.part;
80
+ },
81
+ tag: "div"
82
+ }, props));
83
+ }
84
+ });
85
+ }
86
+ const part = name => props => _$createComponent(Part, _$mergeProps({
87
+ get of() {
88
+ return useScrollArea()[name];
89
+ },
90
+ tag: "div"
91
+ }, props));
92
+ export const ScrollArea = {
93
+ Root,
94
+ Viewport: part("viewport"),
95
+ Content: part("content"),
96
+ Scrollbar,
97
+ Thumb,
98
+ Corner
99
+ };
package/server/select.js CHANGED
@@ -3,7 +3,7 @@ import { mergeProps as _$mergeProps } from "solid-js/web";
3
3
  import { createComponent as _$createComponent } from "solid-js/web";
4
4
  import { defined, within } from "@kirana-ui/core";
5
5
  import { createSelect } from "@kirana-ui/core/select";
6
- import { Show, createContext, createUniqueId, splitProps, untrack, useContext } from "solid-js";
6
+ import { Show, createComputed, createContext, createUniqueId, onCleanup, onMount, splitProps, untrack, useContext } from "solid-js";
7
7
  import { positioned } from "./popover.js";
8
8
  import { FieldContext } from "./field-context.js";
9
9
  import { Part, Portal as BodyPortal, controller, fromSignal, toSignal } from "./runtime.js";
@@ -28,8 +28,14 @@ function Root(props) {
28
28
  disabled: props.disabled,
29
29
  required: props.required,
30
30
  name: props.name,
31
+ form: props.form,
31
32
  items: props.items,
33
+ multiple: props.multiple,
34
+ values: props.values,
35
+ defaultValues: props.defaultValues,
36
+ virtualized: props.virtualized,
32
37
  onValueChange: (value, details) => props.onValueChange?.(value, details),
38
+ onValuesChange: (values, details) => props.onValuesChange?.(values, details),
33
39
  onOpenChange: (open, details) => props.onOpenChange?.(open, details)
34
40
  }));
35
41
  const named = fromSignal(made.named);
@@ -42,7 +48,7 @@ function Root(props) {
42
48
  },
43
49
  get children() {
44
50
  return _$createComponent(Part, {
45
- get part() {
51
+ get of() {
46
52
  return made.input;
47
53
  },
48
54
  tag: "input"
@@ -60,53 +66,68 @@ const Portal = props => _$createComponent(BodyPortal, {
60
66
  return props.children;
61
67
  }
62
68
  });
69
+ /**
70
+ * `alignItemWithTrigger`: the list opens over its trigger, the chosen item's text on the
71
+ * trigger's own, where there is room and unless a finger opened it.
72
+ */
63
73
  function Positioner(props) {
64
74
  const made = useSelect();
75
+ const [local, rest] = splitProps(props, ["alignItemWithTrigger"]);
76
+ createComputed(() => made.alignItemWithTrigger.set(Boolean(local.alignItemWithTrigger)));
65
77
  return _$createComponent(Part, _$mergeProps({
66
- get part() {
78
+ get of() {
67
79
  return made.positioner;
68
80
  },
69
81
  tag: "div"
70
- }, () => positioned(props, made.positioning)));
82
+ }, () => positioned(rest, made.positioning)));
71
83
  }
72
- /** Shows the chosen value's label, or `placeholder` while nothing is chosen. */
73
84
  function Value(props) {
74
85
  const [local, rest] = splitProps(props, ["placeholder", "children"]);
75
86
  const made = useSelect();
76
- const label = fromSignal(made.label);
87
+ const shown = fromSignal(made.shown);
88
+ const drawn = () => {
89
+ const given = local.children;
90
+ // A function that takes nothing is an element of Solid's own, drawn as it is.
91
+ if (typeof given !== "function" || given.length === 0) {
92
+ return given ?? shown().label ?? local.placeholder;
93
+ }
94
+ const draw = given;
95
+ return made.multiple ? draw(() => shown().values, () => shown().labels) : draw(() => shown().value, () => shown().label);
96
+ };
77
97
  return _$createComponent(Part, _$mergeProps({
78
- get part() {
98
+ get of() {
79
99
  return made.valuePart;
80
100
  },
81
101
  tag: "span"
82
102
  }, rest, {
83
103
  get children() {
84
- return local.children ?? label() ?? local.placeholder;
104
+ return drawn();
85
105
  }
86
106
  }));
87
107
  }
88
108
  /** `label` is what typeahead matches and the trigger shows; the item's text when left out. */
89
109
  function Item(props) {
90
- const [local, rest] = splitProps(props, ["value", "disabled", "label"]);
110
+ const [local, rest] = splitProps(props, ["value", "disabled", "label", "index"]);
91
111
  // An item is its value for as long as it is in the page.
92
112
  const value = untrack(() => local.value);
93
113
  const options = toSignal(() => ({
94
114
  disabled: local.disabled,
95
- label: local.label
115
+ label: local.label,
116
+ index: local.index
96
117
  }));
97
118
  const part = useSelect().item(value, () => defined(options.get()));
98
119
  return _$createComponent(ItemContext.Provider, {
99
120
  value: value,
100
121
  get children() {
101
122
  return _$createComponent(Part, _$mergeProps({
102
- part: part,
123
+ of: part,
103
124
  tag: "div"
104
125
  }, rest));
105
126
  }
106
127
  });
107
128
  }
108
129
  const ItemText = props => _$createComponent(Part, _$mergeProps({
109
- get part() {
130
+ get of() {
110
131
  return useSelect().itemText(useContext(ItemContext));
111
132
  },
112
133
  tag: "span"
@@ -122,7 +143,7 @@ function ItemIndicator(props) {
122
143
  },
123
144
  get children() {
124
145
  return _$createComponent(Part, _$mergeProps({
125
- get part() {
146
+ get of() {
126
147
  return made.itemIndicator(value);
127
148
  },
128
149
  tag: "span"
@@ -130,8 +151,53 @@ function ItemIndicator(props) {
130
151
  }
131
152
  });
132
153
  }
154
+ const GroupContext = createContext();
155
+ /** Items that belong together, named by their `<Select.GroupLabel>`. */
156
+ function Group(props) {
157
+ const [local, rest] = splitProps(props, ["id"]);
158
+ const generated = createUniqueId();
159
+ const group = useSelect().group(untrack(() => local.id) ?? generated);
160
+ return _$createComponent(GroupContext.Provider, {
161
+ value: group,
162
+ get children() {
163
+ return _$createComponent(Part, _$mergeProps({
164
+ get of() {
165
+ return group.root;
166
+ },
167
+ tag: "div"
168
+ }, rest));
169
+ }
170
+ });
171
+ }
172
+ /** Names the group it is in. With no group around it, it is plain text. */
173
+ const GroupLabel = props => _$createComponent(Part, _$mergeProps({
174
+ get of() {
175
+ return useContext(GroupContext)?.label ?? useSelect().groupLabel;
176
+ },
177
+ tag: "div"
178
+ }, props));
179
+ function scrollArrow(direction) {
180
+ return props => {
181
+ const arrow = useSelect().scrollArrow(direction);
182
+ onMount(() => onCleanup(arrow.mount()));
183
+ const mounted = fromSignal(arrow.mounted);
184
+ return _$createComponent(Show, {
185
+ get when() {
186
+ return mounted();
187
+ },
188
+ get children() {
189
+ return _$createComponent(Part, _$mergeProps({
190
+ get of() {
191
+ return arrow.part;
192
+ },
193
+ tag: "div"
194
+ }, props));
195
+ }
196
+ });
197
+ };
198
+ }
133
199
  const part = (name, tag) => props => _$createComponent(Part, _$mergeProps({
134
- get part() {
200
+ get of() {
135
201
  return useSelect()[name];
136
202
  },
137
203
  tag: tag
@@ -145,5 +211,15 @@ export const Select = {
145
211
  ItemText,
146
212
  ItemIndicator,
147
213
  Trigger: part("trigger", "button"),
148
- Popup: part("popup", "div")
214
+ Popup: part("popup", "div"),
215
+ /** The items' own box inside the popup, when the popup also holds scroll arrows. */
216
+ List: part("list", "div"),
217
+ /** In the page while there is more of the list above: it scrolls it under a moving pointer. */
218
+ ScrollUpArrow: scrollArrow("up"),
219
+ /** In the page while there is more of the list below. */
220
+ ScrollDownArrow: scrollArrow("down"),
221
+ Group,
222
+ GroupLabel,
223
+ /** A line between groups. */
224
+ Separator: part("separator", "div")
149
225
  };
@@ -9,7 +9,7 @@ export function Separator(props) {
9
9
  orientation: local.orientation
10
10
  }));
11
11
  return _$createComponent(Part, _$mergeProps({
12
- get part() {
12
+ get of() {
13
13
  return made.root;
14
14
  },
15
15
  tag: "div"
package/server/slider.js CHANGED
@@ -12,8 +12,9 @@ function useSlider() {
12
12
  if (!made) throw new Error("A Slider part must be inside <Slider.Root>");
13
13
  return made;
14
14
  }
15
+ // Given neither `value` nor `defaultValue`, a slider has one thumb: its value is a number.
15
16
  function Root(props) {
16
- const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "onValueCommitted", "min", "max", "step", "largeStep", "minStepsBetweenValues", "orientation", "disabled", "name", "format", "locale", "getAriaValueText", "id"]);
17
+ const [local, rest] = splitProps(props, ["value", "defaultValue", "onValueChange", "onValueCommitted", "min", "max", "step", "largeStep", "minStepsBetweenValues", "thumbAlignment", "orientation", "disabled", "name", "form", "format", "locale", "getAriaValueText", "id"]);
17
18
  const generated = createUniqueId();
18
19
  const field = useContext(FieldContext);
19
20
  const made = controller(within(createSlider, {
@@ -29,7 +30,7 @@ function Root(props) {
29
30
  value: made,
30
31
  get children() {
31
32
  return _$createComponent(Part, _$mergeProps({
32
- get part() {
33
+ get of() {
33
34
  return made.root;
34
35
  },
35
36
  tag: "div"
@@ -40,18 +41,20 @@ function Root(props) {
40
41
  /** `index` is which value of a range the thumb is, from 0. */
41
42
  function Thumb(props) {
42
43
  const [local, rest] = splitProps(props, ["index", "children"]);
43
- // A thumb is its index for as long as it is in the page.
44
- const index = untrack(() => local.index ?? 0);
44
+ // A thumb is its index for as long as it is in the page. Given none, it takes its place
45
+ // among the slider's thumbs, in the order they are written.
46
+ const generated = createUniqueId();
47
+ const index = untrack(() => local.index ?? generated);
45
48
  const slider = useSlider();
46
49
  return _$createComponent(Part, _$mergeProps({
47
- get part() {
50
+ get of() {
48
51
  return slider.thumb(index);
49
52
  },
50
53
  tag: "div"
51
54
  }, rest, {
52
55
  get children() {
53
56
  return [local.children, _$createComponent(Part, {
54
- get part() {
57
+ get of() {
55
58
  return slider.thumbInput(index);
56
59
  },
57
60
  tag: "input"
@@ -66,7 +69,7 @@ function Value(props) {
66
69
  const text = fromSignal(made.text);
67
70
  const values = fromSignal(made.values);
68
71
  return _$createComponent(Part, _$mergeProps({
69
- get part() {
72
+ get of() {
70
73
  return made.value;
71
74
  },
72
75
  tag: "output"
@@ -77,7 +80,7 @@ function Value(props) {
77
80
  }));
78
81
  }
79
82
  const part = key => props => _$createComponent(Part, _$mergeProps({
80
- get part() {
83
+ get of() {
81
84
  return useSlider()[key];
82
85
  },
83
86
  tag: "div"
package/server/switch.js CHANGED
@@ -12,7 +12,7 @@ function useSwitch() {
12
12
  return made;
13
13
  }
14
14
  function Root(props) {
15
- const [local, rest] = splitProps(props, ["checked", "defaultChecked", "onCheckedChange", "disabled", "readOnly", "required", "name", "value", "id", "children"]);
15
+ const [local, rest] = splitProps(props, ["checked", "defaultChecked", "onCheckedChange", "disabled", "readOnly", "required", "name", "form", "value", "id", "children"]);
16
16
  const generated = createUniqueId();
17
17
  const field = useContext(FieldContext);
18
18
  const made = controller(within(createSwitch, {
@@ -25,6 +25,7 @@ function Root(props) {
25
25
  readOnly: local.readOnly,
26
26
  required: local.required,
27
27
  name: local.name,
28
+ form: local.form,
28
29
  value: local.value,
29
30
  onCheckedChange: (checked, details) => local.onCheckedChange?.(checked, details)
30
31
  }));
@@ -32,14 +33,14 @@ function Root(props) {
32
33
  value: made,
33
34
  get children() {
34
35
  return _$createComponent(Part, _$mergeProps({
35
- get part() {
36
+ get of() {
36
37
  return made.root;
37
38
  },
38
39
  tag: "span"
39
40
  }, rest, {
40
41
  get children() {
41
42
  return [local.children, _$createComponent(Part, {
42
- get part() {
43
+ get of() {
43
44
  return made.input;
44
45
  },
45
46
  tag: "input"
@@ -50,7 +51,7 @@ function Root(props) {
50
51
  });
51
52
  }
52
53
  const Thumb = props => _$createComponent(Part, _$mergeProps({
53
- get part() {
54
+ get of() {
54
55
  return useSwitch().thumb;
55
56
  },
56
57
  tag: "span"
package/server/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 part() {
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 part() {
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
- part: part,
61
+ of: part,
62
62
  tag: "button"
63
63
  }, rest));
64
64
  }
65
65
  const Indicator = props => _$createComponent(Part, _$mergeProps({
66
- get part() {
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 part() {
83
+ get of() {
84
84
  return panel.part;
85
85
  },
86
86
  tag: "div"
@@ -0,0 +1,3 @@
1
+ // The testing kit is the core's, and the same on every framework: it is an entry here too, so
2
+ // a test imports it from the one package the project installed.
3
+ export * from "@kirana-ui/core/testing";