@kahitsan/ksui 0.49.0 → 0.51.0-solid2.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 (307) hide show
  1. package/README.md +10 -0
  2. package/package.json +10 -7
  3. package/src/components/base/AccountAvatar.tsx +1 -1
  4. package/src/components/base/ActionMenu.tsx +7 -5
  5. package/src/components/base/AddAttachmentTile.tsx +6 -6
  6. package/src/components/base/BadgeSelect.tsx +11 -9
  7. package/src/components/base/Button.test.tsx +23 -0
  8. package/src/components/base/Button.tsx +35 -41
  9. package/src/components/base/CameraCapture.tsx +5 -2
  10. package/src/components/base/CopyButton.tsx +2 -1
  11. package/src/components/base/DataTable.tsx +89 -112
  12. package/src/components/base/DatePicker.tsx +15 -17
  13. package/src/components/base/DateTile.tsx +14 -12
  14. package/src/components/base/Dropdown.tsx +6 -5
  15. package/src/components/base/ExistingAttachmentTile.test.tsx +3 -3
  16. package/src/components/base/ExistingAttachmentTile.tsx +6 -4
  17. package/src/components/base/EyebrowBadge.tsx +2 -1
  18. package/src/components/base/FormErrorBanner.tsx +2 -1
  19. package/src/components/base/FormField.tsx +1 -1
  20. package/src/components/base/ImageCropper.tsx +3 -3
  21. package/src/components/base/ImageViewer.test.tsx +2 -0
  22. package/src/components/base/ImageViewer.tsx +4 -3
  23. package/src/components/base/KpiCard.tsx +3 -2
  24. package/src/components/base/Modal.test.tsx +3 -2
  25. package/src/components/base/Modal.tsx +11 -12
  26. package/src/components/base/ModalHeader.tsx +2 -1
  27. package/src/components/base/MonthCalendar.tsx +2 -1
  28. package/src/components/base/MultiSelectGroup.tsx +7 -5
  29. package/src/components/base/ProgressBar.tsx +8 -17
  30. package/src/components/base/RadioCardGroup.tsx +14 -12
  31. package/src/components/base/SectionHeading.tsx +2 -1
  32. package/src/components/base/SegmentedFilter.tsx +10 -8
  33. package/src/components/base/SocialLinksBar.tsx +2 -1
  34. package/src/components/base/StatusIndicator.tsx +2 -1
  35. package/src/components/base/StatusPill.tsx +1 -1
  36. package/src/components/base/TagPill.tsx +1 -1
  37. package/src/components/base/ThemeToggle.tsx +5 -11
  38. package/src/components/base/Tooltip.tsx +2 -1
  39. package/src/components/composite/AccountRadioPicker.tsx +14 -11
  40. package/src/components/composite/ComboBox.tsx +18 -13
  41. package/src/components/composite/CustomRenderer.tsx +1 -1
  42. package/src/components/composite/FileField.tsx +6 -3
  43. package/src/components/composite/FlowGraph.tsx +15 -12
  44. package/src/components/composite/FlowRunner.test.tsx +2 -0
  45. package/src/components/composite/FlowRunner.tsx +2 -1
  46. package/src/components/composite/FormActions.tsx +1 -1
  47. package/src/components/composite/FormAdvancedSection.tsx +13 -13
  48. package/src/components/composite/LiveTimer.tsx +8 -14
  49. package/src/components/composite/MarkdownNotes.tsx +2 -1
  50. package/src/components/composite/MentionTextarea.tsx +31 -22
  51. package/src/components/composite/MultiPeriodPicker.tsx +11 -9
  52. package/src/components/composite/NotFound.tsx +4 -15
  53. package/src/components/composite/PaymentAccountPicker.tsx +19 -24
  54. package/src/components/composite/SalesBodyEditor.tsx +10 -7
  55. package/src/components/composite/SearchableSelect.tsx +14 -13
  56. package/src/components/composite/SecretReveal.tsx +2 -2
  57. package/src/components/composite/TransactionForm.tsx +52 -42
  58. package/src/components/composite/TransferAccountsPicker.tsx +11 -10
  59. package/src/components/composite/TransferFeeChip.tsx +7 -6
  60. package/src/components/composite/VoucherPicker.test.tsx +55 -48
  61. package/src/components/composite/VoucherPicker.tsx +36 -27
  62. package/src/components/composite/picker-engine.ts +20 -14
  63. package/src/components/composite/resource/ResourcePage.test.tsx +1 -1
  64. package/src/components/composite/resource/ResourcePage.tsx +21 -7
  65. package/src/components/composite/resource/cells.tsx +1 -1
  66. package/src/icons/README.md +10 -4
  67. package/src/icons/arrow-down-left.tsx +2 -2
  68. package/src/icons/arrow-left.tsx +2 -2
  69. package/src/icons/arrow-right-left.tsx +1 -1
  70. package/src/icons/arrow-right.tsx +2 -2
  71. package/src/icons/arrow-up-down.tsx +2 -2
  72. package/src/icons/arrow-up-right.tsx +2 -2
  73. package/src/icons/arrow-up.tsx +2 -2
  74. package/src/icons/artwork/activity.ts +1 -1
  75. package/src/icons/artwork/app-window.png +0 -0
  76. package/src/icons/artwork/app-window.ts +2 -1
  77. package/src/icons/artwork/archive-restore.ts +1 -1
  78. package/src/icons/artwork/archive.ts +1 -1
  79. package/src/icons/artwork/arrow-down.ts +1 -1
  80. package/src/icons/artwork/arrow-left-right.ts +1 -1
  81. package/src/icons/artwork/at-sign.png +0 -0
  82. package/src/icons/artwork/at-sign.ts +2 -1
  83. package/src/icons/artwork/ban.png +0 -0
  84. package/src/icons/artwork/ban.ts +2 -1
  85. package/src/icons/artwork/banknote.ts +1 -1
  86. package/src/icons/artwork/bell.ts +1 -1
  87. package/src/icons/artwork/bir-form-0619-e.png +0 -0
  88. package/src/icons/artwork/bir-form-0619-e.ts +3 -0
  89. package/src/icons/artwork/bir-form-1601-eq.png +0 -0
  90. package/src/icons/artwork/bir-form-1601-eq.ts +3 -0
  91. package/src/icons/artwork/bir-form-2307.png +0 -0
  92. package/src/icons/artwork/bir-form-2307.ts +3 -0
  93. package/src/icons/artwork/bir-office.ts +2 -0
  94. package/src/icons/artwork/blocks.png +0 -0
  95. package/src/icons/artwork/blocks.ts +2 -1
  96. package/src/icons/artwork/book-open.ts +1 -1
  97. package/src/icons/artwork/boxes.ts +1 -1
  98. package/src/icons/artwork/briefcase.png +0 -0
  99. package/src/icons/artwork/briefcase.ts +2 -1
  100. package/src/icons/artwork/building-2.ts +1 -1
  101. package/src/icons/artwork/building.png +0 -0
  102. package/src/icons/artwork/building.ts +2 -1
  103. package/src/icons/artwork/calculator.png +0 -0
  104. package/src/icons/artwork/calculator.ts +2 -1
  105. package/src/icons/artwork/calendar-clock.png +0 -0
  106. package/src/icons/artwork/calendar-clock.ts +2 -1
  107. package/src/icons/artwork/calendar.png +0 -0
  108. package/src/icons/artwork/calendar.ts +2 -1
  109. package/src/icons/artwork/camera.ts +1 -1
  110. package/src/icons/artwork/chart-bar.ts +1 -1
  111. package/src/icons/artwork/check-bold.ts +1 -1
  112. package/src/icons/artwork/check-check.ts +1 -1
  113. package/src/icons/artwork/check.ts +1 -1
  114. package/src/icons/artwork/chevron-right.ts +1 -1
  115. package/src/icons/artwork/chevrons-up-down.ts +1 -1
  116. package/src/icons/artwork/circle-alert.ts +1 -1
  117. package/src/icons/artwork/circle-check-bold.png +0 -0
  118. package/src/icons/artwork/circle-check-bold.ts +2 -1
  119. package/src/icons/artwork/circle-check.png +0 -0
  120. package/src/icons/artwork/circle-check.ts +2 -1
  121. package/src/icons/artwork/circle-dot.ts +1 -1
  122. package/src/icons/artwork/circle-question-mark.png +0 -0
  123. package/src/icons/artwork/circle-question-mark.ts +2 -1
  124. package/src/icons/artwork/circle-x.ts +1 -1
  125. package/src/icons/artwork/circle.ts +1 -1
  126. package/src/icons/artwork/clipboard-list.ts +1 -1
  127. package/src/icons/artwork/clock.png +0 -0
  128. package/src/icons/artwork/clock.ts +2 -1
  129. package/src/icons/artwork/coins.ts +1 -1
  130. package/src/icons/artwork/compass.png +0 -0
  131. package/src/icons/artwork/compass.ts +2 -1
  132. package/src/icons/artwork/copy.png +0 -0
  133. package/src/icons/artwork/copy.ts +2 -1
  134. package/src/icons/artwork/corner-down-right.ts +1 -1
  135. package/src/icons/artwork/credit-card.png +0 -0
  136. package/src/icons/artwork/credit-card.ts +2 -1
  137. package/src/icons/artwork/crown.ts +1 -1
  138. package/src/icons/artwork/database.png +0 -0
  139. package/src/icons/artwork/database.ts +2 -1
  140. package/src/icons/artwork/dollar-sign.ts +1 -1
  141. package/src/icons/artwork/door-open.png +0 -0
  142. package/src/icons/artwork/door-open.ts +2 -1
  143. package/src/icons/artwork/download.ts +1 -1
  144. package/src/icons/artwork/ellipsis.ts +1 -1
  145. package/src/icons/artwork/equal.ts +1 -1
  146. package/src/icons/artwork/external-link.ts +1 -1
  147. package/src/icons/artwork/eye.ts +1 -1
  148. package/src/icons/artwork/file-spreadsheet.png +0 -0
  149. package/src/icons/artwork/file-spreadsheet.ts +2 -1
  150. package/src/icons/artwork/file-text.png +0 -0
  151. package/src/icons/artwork/file-text.ts +2 -1
  152. package/src/icons/artwork/file.ts +1 -1
  153. package/src/icons/artwork/funnel.ts +1 -1
  154. package/src/icons/artwork/globe.png +0 -0
  155. package/src/icons/artwork/globe.ts +2 -1
  156. package/src/icons/artwork/grip-vertical.ts +1 -1
  157. package/src/icons/artwork/history.png +0 -0
  158. package/src/icons/artwork/history.ts +2 -1
  159. package/src/icons/artwork/house.ts +1 -1
  160. package/src/icons/artwork/image-off.png +0 -0
  161. package/src/icons/artwork/image-off.ts +2 -1
  162. package/src/icons/artwork/inbox.ts +1 -1
  163. package/src/icons/artwork/info.ts +1 -1
  164. package/src/icons/artwork/key.ts +1 -1
  165. package/src/icons/artwork/landmark.ts +1 -1
  166. package/src/icons/artwork/layers.png +0 -0
  167. package/src/icons/artwork/layers.ts +2 -1
  168. package/src/icons/artwork/layout-dashboard.ts +1 -1
  169. package/src/icons/artwork/layout-grid.ts +1 -1
  170. package/src/icons/artwork/layout-list.png +0 -0
  171. package/src/icons/artwork/layout-list.ts +2 -1
  172. package/src/icons/artwork/link-2.ts +1 -1
  173. package/src/icons/artwork/list.ts +1 -1
  174. package/src/icons/artwork/loader-circle.ts +1 -1
  175. package/src/icons/artwork/lock.ts +1 -1
  176. package/src/icons/artwork/log-in.ts +1 -1
  177. package/src/icons/artwork/log-out.ts +1 -1
  178. package/src/icons/artwork/mail-open.ts +1 -1
  179. package/src/icons/artwork/mail.ts +1 -1
  180. package/src/icons/artwork/megaphone.ts +1 -1
  181. package/src/icons/artwork/message-square.ts +1 -1
  182. package/src/icons/artwork/minus.ts +1 -1
  183. package/src/icons/artwork/moon.ts +1 -1
  184. package/src/icons/artwork/mouse-pointer-click.ts +1 -1
  185. package/src/icons/artwork/move.ts +1 -1
  186. package/src/icons/artwork/package.ts +1 -1
  187. package/src/icons/artwork/palette.png +0 -0
  188. package/src/icons/artwork/palette.ts +2 -1
  189. package/src/icons/artwork/panel-left-close.ts +1 -1
  190. package/src/icons/artwork/panel-left.png +0 -0
  191. package/src/icons/artwork/panel-left.ts +2 -1
  192. package/src/icons/artwork/paperclip.png +0 -0
  193. package/src/icons/artwork/paperclip.ts +2 -1
  194. package/src/icons/artwork/pencil.ts +1 -1
  195. package/src/icons/artwork/phone-call.png +0 -0
  196. package/src/icons/artwork/phone-call.ts +2 -1
  197. package/src/icons/artwork/phone.ts +1 -1
  198. package/src/icons/artwork/piggy-bank.ts +1 -1
  199. package/src/icons/artwork/play.ts +1 -1
  200. package/src/icons/artwork/plus.ts +1 -1
  201. package/src/icons/artwork/power.ts +1 -1
  202. package/src/icons/artwork/radio.png +0 -0
  203. package/src/icons/artwork/radio.ts +2 -1
  204. package/src/icons/artwork/receipt.ts +1 -1
  205. package/src/icons/artwork/refresh-cw.ts +1 -1
  206. package/src/icons/artwork/rotate-ccw.ts +1 -1
  207. package/src/icons/artwork/sales.ts +2 -0
  208. package/src/icons/artwork/save.ts +1 -1
  209. package/src/icons/artwork/search.ts +1 -1
  210. package/src/icons/artwork/settings.ts +1 -1
  211. package/src/icons/artwork/shield-alert.ts +1 -1
  212. package/src/icons/artwork/shield-check.ts +1 -1
  213. package/src/icons/artwork/shield-off.ts +1 -1
  214. package/src/icons/artwork/shield.ts +1 -1
  215. package/src/icons/artwork/shopping-bag.png +0 -0
  216. package/src/icons/artwork/shopping-bag.ts +2 -1
  217. package/src/icons/artwork/shopping-cart.ts +1 -1
  218. package/src/icons/artwork/shuffle.ts +1 -1
  219. package/src/icons/artwork/sliders-horizontal.ts +1 -1
  220. package/src/icons/artwork/smartphone.ts +1 -1
  221. package/src/icons/artwork/sparkles.ts +1 -1
  222. package/src/icons/artwork/square.ts +1 -1
  223. package/src/icons/artwork/star-filled.ts +1 -1
  224. package/src/icons/artwork/star.ts +1 -1
  225. package/src/icons/artwork/sticky-note.png +0 -0
  226. package/src/icons/artwork/sticky-note.ts +2 -1
  227. package/src/icons/artwork/store.png +0 -0
  228. package/src/icons/artwork/store.ts +2 -1
  229. package/src/icons/artwork/sun.ts +1 -1
  230. package/src/icons/artwork/tag.ts +1 -1
  231. package/src/icons/artwork/target.png +0 -0
  232. package/src/icons/artwork/target.ts +2 -1
  233. package/src/icons/artwork/ticket.png +0 -0
  234. package/src/icons/artwork/ticket.ts +2 -1
  235. package/src/icons/artwork/trash-2.png +0 -0
  236. package/src/icons/artwork/trash-2.ts +2 -1
  237. package/src/icons/artwork/trending-up.ts +1 -1
  238. package/src/icons/artwork/triangle-alert.ts +1 -1
  239. package/src/icons/artwork/trophy.ts +1 -1
  240. package/src/icons/artwork/undo-2.ts +1 -1
  241. package/src/icons/artwork/upload.ts +1 -1
  242. package/src/icons/artwork/user-check.png +0 -0
  243. package/src/icons/artwork/user-check.ts +2 -1
  244. package/src/icons/artwork/user-plus.ts +1 -1
  245. package/src/icons/artwork/user.ts +1 -1
  246. package/src/icons/artwork/users.ts +1 -1
  247. package/src/icons/artwork/volume-2.ts +1 -1
  248. package/src/icons/artwork/volume-x.ts +1 -1
  249. package/src/icons/artwork/wallet.ts +1 -1
  250. package/src/icons/artwork/x.ts +1 -1
  251. package/src/icons/artwork/zap.ts +1 -1
  252. package/src/icons/artwork/zoom-in.png +0 -0
  253. package/src/icons/artwork/zoom-in.ts +2 -1
  254. package/src/icons/asset-modules.d.ts +4 -0
  255. package/src/icons/bir-form-0619-e.tsx +4 -0
  256. package/src/icons/bir-form-1601-eq.tsx +4 -0
  257. package/src/icons/bir-form-2307.tsx +4 -0
  258. package/src/icons/bir-office.tsx +4 -0
  259. package/src/icons/calendar-days.tsx +1 -1
  260. package/src/icons/check.tsx +2 -2
  261. package/src/icons/chevron-down.tsx +2 -2
  262. package/src/icons/chevron-left.tsx +2 -2
  263. package/src/icons/chevron-up.tsx +2 -2
  264. package/src/icons/circle-check-big.tsx +3 -2
  265. package/src/icons/circle-check.tsx +2 -2
  266. package/src/icons/circle-slash.tsx +1 -1
  267. package/src/icons/cloud-upload.tsx +1 -1
  268. package/src/icons/create-artwork-icon.test.tsx +33 -1
  269. package/src/icons/create-artwork-icon.tsx +35 -40
  270. package/src/icons/ellipsis-vertical.tsx +2 -2
  271. package/src/icons/index.ts +5 -0
  272. package/src/icons/key-round.tsx +1 -1
  273. package/src/icons/registry.ts +8 -3
  274. package/src/icons/sales.tsx +4 -0
  275. package/src/icons/settings-2.tsx +1 -1
  276. package/src/icons/star.tsx +2 -2
  277. package/src/icons/user-round.tsx +1 -1
  278. package/src/icons/users-round.tsx +1 -1
  279. package/src/utils/account-icons.ts +2 -1
  280. package/src/utils/accounts-index.tsx +8 -5
  281. package/src/utils/aria.ts +13 -0
  282. package/src/utils/confirm.tsx +1 -1
  283. package/src/utils/dom.ts +7 -6
  284. package/src/utils/fetch-resource.ts +59 -0
  285. package/src/utils/highlight.tsx +1 -1
  286. package/src/utils/modal-layer.ts +3 -3
  287. package/src/utils/object-url-resource.ts +11 -8
  288. package/src/utils/top-layer.ts +9 -8
  289. package/src/icons/artwork/arrow-down-left.ts +0 -2
  290. package/src/icons/artwork/arrow-left.ts +0 -2
  291. package/src/icons/artwork/arrow-right-left.ts +0 -2
  292. package/src/icons/artwork/arrow-right.ts +0 -2
  293. package/src/icons/artwork/arrow-up-down.ts +0 -2
  294. package/src/icons/artwork/arrow-up-right.ts +0 -2
  295. package/src/icons/artwork/arrow-up.ts +0 -2
  296. package/src/icons/artwork/calendar-days.ts +0 -2
  297. package/src/icons/artwork/chevron-down.ts +0 -2
  298. package/src/icons/artwork/chevron-left.ts +0 -2
  299. package/src/icons/artwork/chevron-up.ts +0 -2
  300. package/src/icons/artwork/circle-check-big.ts +0 -2
  301. package/src/icons/artwork/circle-slash.ts +0 -2
  302. package/src/icons/artwork/cloud-upload.ts +0 -2
  303. package/src/icons/artwork/ellipsis-vertical.ts +0 -2
  304. package/src/icons/artwork/key-round.ts +0 -2
  305. package/src/icons/artwork/settings-2.ts +0 -2
  306. package/src/icons/artwork/user-round.ts +0 -2
  307. package/src/icons/artwork/users-round.ts +0 -2
@@ -22,13 +22,12 @@ import {
22
22
  createSignal,
23
23
  createMemo,
24
24
  createEffect,
25
- on,
26
25
  For,
27
26
  Show,
28
- onMount,
27
+ onSettled,
29
28
  onCleanup,
30
29
  } from "solid-js";
31
- import { Portal } from "solid-js/web";
30
+ import { Portal } from "@solidjs/web";
32
31
  import Calendar from "../../icons/calendar";
33
32
  import ChevronLeft from "../../icons/chevron-left";
34
33
  import ChevronRight from "../../icons/chevron-right";
@@ -45,6 +44,7 @@ import {
45
44
  import { injectCSS } from "../../utils/inject-css";
46
45
  import { useTopLayer } from "../../utils/top-layer";
47
46
  import { usePopoverMount } from "../../utils/modal-layer";
47
+ import { ariaBool, ariaTri } from "../../utils/aria";
48
48
 
49
49
  // ---------------------------------------------------------------------------
50
50
  // Injected CSS
@@ -611,11 +611,9 @@ export default function DatePicker(props: DatePickerProps) {
611
611
  }
612
612
  }
613
613
 
614
- createEffect(
615
- on(time, (t) => {
616
- if (t) setTimeInput(formatTimeDisplay(t));
617
- }),
618
- );
614
+ createEffect(time, (t) => {
615
+ if (t) setTimeInput(formatTimeDisplay(t));
616
+ });
619
617
 
620
618
  // ── Click outside ──────────────────────────────────────────────────────────
621
619
 
@@ -631,9 +629,9 @@ export default function DatePicker(props: DatePickerProps) {
631
629
  }
632
630
  }
633
631
 
634
- onMount(() => {
632
+ onSettled(() => {
635
633
  document.addEventListener("mousedown", handleClickOutside);
636
- onCleanup(() => document.removeEventListener("mousedown", handleClickOutside));
634
+ return () => document.removeEventListener("mousedown", handleClickOutside);
637
635
  });
638
636
 
639
637
  // ── Reposition on scroll / resize ──────────────────────────────────────────
@@ -648,14 +646,14 @@ export default function DatePicker(props: DatePickerProps) {
648
646
  });
649
647
  }
650
648
 
651
- createEffect(() => {
652
- if (!open()) return;
649
+ createEffect(open, (isOpen) => {
650
+ if (!isOpen) return;
653
651
  window.addEventListener("scroll", reposition, { passive: true, capture: true });
654
652
  window.addEventListener("resize", reposition);
655
- onCleanup(() => {
653
+ return () => {
656
654
  window.removeEventListener("scroll", reposition, { capture: true } as EventListenerOptions);
657
655
  window.removeEventListener("resize", reposition);
658
- });
656
+ };
659
657
  });
660
658
 
661
659
  // ── Display value ──────────────────────────────────────────────────────────
@@ -728,7 +726,7 @@ export default function DatePicker(props: DatePickerProps) {
728
726
  type="button"
729
727
  aria-label={props.ariaLabel}
730
728
  aria-haspopup="dialog"
731
- aria-expanded={open()}
729
+ aria-expanded={ariaBool(open())}
732
730
  disabled={props.disabled}
733
731
  class={
734
732
  props.triggerClass ??
@@ -753,7 +751,7 @@ export default function DatePicker(props: DatePickerProps) {
753
751
  <div
754
752
  ref={(el) => {
755
753
  popoverPanelRef = el;
756
- onCleanup(useTopLayer(el));
754
+ useTopLayer(el);
757
755
  }}
758
756
  data-testid="datepicker-popover"
759
757
  class="ksui-datepicker-popover"
@@ -942,7 +940,7 @@ export default function DatePicker(props: DatePickerProps) {
942
940
  type="button"
943
941
  role="switch"
944
942
  aria-label="End date"
945
- aria-checked={endActive()}
943
+ aria-checked={ariaTri(endActive())}
946
944
  data-testid="datepicker-end-date-toggle"
947
945
  onClick={() => {
948
946
  const next = !endActive();
@@ -13,8 +13,10 @@
13
13
  // static, read-only cell that renders dimmed so a row can show which tiles are
14
14
  // "in" vs "out" of a selection at a glance.
15
15
 
16
- import { Show, type JSX } from "solid-js";
17
- import { Dynamic } from "solid-js/web";
16
+ import { Show } from "solid-js";
17
+ import type { JSX } from "@solidjs/web";
18
+ import { Dynamic } from "@solidjs/web";
19
+ import { ariaTri } from "../../utils/aria";
18
20
 
19
21
  export interface DateTileProps {
20
22
  /** The big primary value — typically a day-of-month number, but any short
@@ -42,14 +44,14 @@ export default function DateTile(props: DateTileProps): JSX.Element {
42
44
  component={interactive() ? "button" : "div"}
43
45
  type={interactive() ? "button" : undefined}
44
46
  onClick={props.onToggle}
45
- aria-pressed={interactive() ? on() : undefined}
47
+ aria-pressed={ariaTri(interactive() ? on() : undefined)}
46
48
  data-testid={interactive() ? props.testId : undefined}
47
49
  style={{ width: "60px", height: "68px", flex: "0 0 auto" }}
48
- class={`${interactive() ? "cursor-pointer" : ""} flex flex-col rounded-md overflow-hidden border transition-colors`}
49
- classList={{
50
+ class={[`${interactive() ? "cursor-pointer" : ""} flex flex-col rounded-md overflow-hidden border transition-colors`, {
50
51
  "border-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_25%,transparent)] bg-[color-mix(in_srgb,var(--ks-surface-raised,#1a1a1a)_40%,transparent)]": on(),
51
52
  "border-[color-mix(in_srgb,var(--ks-border,rgba(39,39,42,0.5))_60%,transparent)] bg-[color-mix(in_srgb,var(--ks-surface,#0f0f0f)_40%,transparent)] opacity-50 hover:opacity-80": !on(),
52
- }}
53
+ }]}
54
+
53
55
  >
54
56
  <div
55
57
  style={{ height: "18px" }}
@@ -59,21 +61,21 @@ export default function DateTile(props: DateTileProps): JSX.Element {
59
61
  </div>
60
62
  <div class="flex-1 flex flex-col items-center justify-center">
61
63
  <div
62
- class="text-xl font-semibold leading-none tabular-nums"
63
- classList={{
64
+ class={["text-xl font-semibold leading-none tabular-nums", {
64
65
  "text-[color-mix(in_srgb,var(--ks-accent,#fbbf24)_90%,transparent)]": on(),
65
66
  "text-[var(--ks-fg-subtle,#71717a)]": !on(),
66
- }}
67
+ }]}
68
+
67
69
  >
68
70
  {props.value}
69
71
  </div>
70
72
  <Show when={props.subLabel != null && props.subLabel !== ""}>
71
73
  <div
72
- class="text-[9px] mt-0.5 tabular-nums"
73
- classList={{
74
+ class={["text-[9px] mt-0.5 tabular-nums", {
74
75
  "text-[var(--ks-fg-subtle,#71717a)]": on(),
75
76
  "text-[var(--ks-border-strong,#3f3f46)]": !on(),
76
- }}
77
+ }]}
78
+
77
79
  >
78
80
  {props.subLabel}
79
81
  </div>
@@ -1,5 +1,6 @@
1
- import { createSignal, For, onCleanup, onMount, Show, type Component, type JSX } from "solid-js";
2
- import { Dynamic } from "solid-js/web";
1
+ import { createSignal, For, onCleanup, onSettled, Show, type Component } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { Dynamic } from "@solidjs/web";
3
4
  import ChevronDown from "../../icons/chevron-down";
4
5
 
5
6
  /** A owned icons icon component (or any component taking size/class). */
@@ -67,13 +68,13 @@ function statusColor(status?: DropdownItemStatus): string {
67
68
  // Presentational only and domain-free — no baked-in copy or business literals.
68
69
  export default function Dropdown(props: DropdownProps): JSX.Element {
69
70
  const [isOpen, setIsOpen] = createSignal(false);
70
- const [selectedItem, setSelectedItem] = createSignal<DropdownItem | undefined>(
71
+ const [selectedItem, setSelectedItem] = createSignal<DropdownItem | undefined>(() =>
71
72
  props.items.find((item) => item.id === props.value),
72
73
  );
73
74
 
74
75
  const currentSelection = () => selectedItem() ?? props.items.find((i) => i.id === props.value) ?? props.items[0];
75
76
 
76
- onMount(() => {
77
+ onSettled(() => {
77
78
  const handleClickOutside = (e: MouseEvent) => {
78
79
  const target = e.target as Element | null;
79
80
  if (!target?.closest("[data-dropdown-container]")) {
@@ -81,7 +82,7 @@ export default function Dropdown(props: DropdownProps): JSX.Element {
81
82
  }
82
83
  };
83
84
  document.addEventListener("click", handleClickOutside);
84
- onCleanup(() => document.removeEventListener("click", handleClickOutside));
85
+ return () => document.removeEventListener("click", handleClickOutside);
85
86
  });
86
87
 
87
88
  const handleSelect = (item: DropdownItem) => {
@@ -1,6 +1,6 @@
1
1
  // @vitest-environment jsdom
2
2
  import { cleanup, render, screen } from "@solidjs/testing-library";
3
- import { Suspense } from "solid-js";
3
+ import { Loading } from "solid-js";
4
4
  import { afterEach, describe, expect, it, vi } from "vitest";
5
5
  import ExistingAttachmentTile from "./ExistingAttachmentTile";
6
6
 
@@ -28,7 +28,7 @@ describe("ExistingAttachmentTile", () => {
28
28
  });
29
29
 
30
30
  render(() => (
31
- <Suspense fallback={<p>Modal fallback</p>}>
31
+ <Loading fallback={<p>Modal fallback</p>}>
32
32
  <div data-testid="modal-shell">
33
33
  <ExistingAttachmentTile
34
34
  attachment={{
@@ -41,7 +41,7 @@ describe("ExistingAttachmentTile", () => {
41
41
  testId="attachment"
42
42
  />
43
43
  </div>
44
- </Suspense>
44
+ </Loading>
45
45
  ));
46
46
 
47
47
  expect(screen.getByTestId("modal-shell")).toBeTruthy();
@@ -49,8 +49,9 @@ export default function ExistingAttachmentTile(props: Props) {
49
49
  if (currentUrl) URL.revokeObjectURL(currentUrl);
50
50
  currentUrl = null;
51
51
  };
52
- createEffect(() => {
53
- const href = props.rawHref ?? null;
52
+ createEffect(
53
+ () => ({ href: props.rawHref ?? null, init: props.rawInit }),
54
+ ({ href, init }) => {
54
55
  const id = ++requestId;
55
56
  revokeUrl();
56
57
  setBlob(null);
@@ -59,7 +60,7 @@ export default function ExistingAttachmentTile(props: Props) {
59
60
  return;
60
61
  }
61
62
  setBlobLoading(true);
62
- void fetch(href, { credentials: "include", ...props.rawInit })
63
+ void fetch(href, { credentials: "include", ...init })
63
64
  .then(async (res) => (res.ok ? URL.createObjectURL(await res.blob()) : null))
64
65
  .then((url) => {
65
66
  if (id !== requestId) {
@@ -75,7 +76,8 @@ export default function ExistingAttachmentTile(props: Props) {
75
76
  .finally(() => {
76
77
  if (id === requestId) setBlobLoading(false);
77
78
  });
78
- });
79
+ },
80
+ );
79
81
  onCleanup(() => {
80
82
  requestId++;
81
83
  revokeUrl();
@@ -1,4 +1,5 @@
1
- import { Show, type JSX } from "solid-js";
1
+ import { Show } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
2
3
 
3
4
  export type EyebrowTone = "amber" | "blue" | "emerald" | "red" | "zinc";
4
5
 
@@ -1,4 +1,5 @@
1
- import { Show, type JSX } from "solid-js";
1
+ import { Show } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
2
3
 
3
4
  interface FormErrorBannerProps {
4
5
  /** The error message to display. When falsy (null / undefined / empty
@@ -4,7 +4,7 @@
4
4
  // remote UI atoms; behavior is unchanged.
5
5
 
6
6
  import { Show } from "solid-js";
7
- import type { JSX } from "solid-js";
7
+ import type { JSX } from "@solidjs/web";
8
8
 
9
9
  export default function FormField(props: { label: string; id?: string; children: JSX.Element; hint?: string }) {
10
10
  return (
@@ -7,7 +7,7 @@
7
7
  // The widget is self-contained: it uses ksui's own Modal + Button, solid-js,
8
8
  // and a single lucide icon.
9
9
 
10
- import { createSignal, onCleanup, onMount, Show } from "solid-js";
10
+ import { createSignal, onCleanup, onSettled, Show } from "solid-js";
11
11
  import Modal from "./Modal";
12
12
  import Button from "./Button";
13
13
  import X from "../../icons/x";
@@ -48,7 +48,7 @@ export default function ImageCropper(props: ImageCropperProps) {
48
48
  let pointerStartY = 0;
49
49
  let selStart = { x: 0, y: 0, size: 0 };
50
50
 
51
- onMount(() => {
51
+ onSettled(() => {
52
52
  const url = URL.createObjectURL(props.file);
53
53
  setImageUrl(url);
54
54
 
@@ -68,7 +68,7 @@ export default function ImageCropper(props: ImageCropperProps) {
68
68
  };
69
69
  el.onerror = () => setLoadError("Could not load this image. Try a different file.");
70
70
  el.src = url;
71
- onCleanup(() => URL.revokeObjectURL(url));
71
+ return () => URL.revokeObjectURL(url);
72
72
  });
73
73
 
74
74
  function clampMove(nextX: number, nextY: number) {
@@ -1,4 +1,5 @@
1
1
  import { cleanup, fireEvent, render } from "@solidjs/testing-library";
2
+ import { flush } from "solid-js";
2
3
  import { afterEach, describe, expect, it, vi } from "vitest";
3
4
  import ImageViewer from "./ImageViewer";
4
5
 
@@ -19,6 +20,7 @@ describe("ImageViewer", () => {
19
20
  expect(showModal).toHaveBeenCalledTimes(1);
20
21
 
21
22
  fireEvent.load(image!);
23
+ flush();
22
24
  expect(image?.style.opacity).toBe("1");
23
25
 
24
26
  });
@@ -13,10 +13,11 @@
13
13
  // with unscoped `ksui-imgviewer-*` class names. Mount === open, unmount === closed
14
14
  // (wrap in `<Show when={…}>`).
15
15
 
16
- import { createSignal, onCleanup, onMount } from "solid-js";
16
+ import { createSignal, onCleanup, onSettled } from "solid-js";
17
17
  import X from "../../icons/x";
18
18
  import { lockPullToRefresh, unlockPullToRefresh } from "../../utils/dom";
19
19
  import { injectCSS } from "../../utils/inject-css";
20
+ import { ariaBool } from "../../utils/aria";
20
21
 
21
22
  const STYLE_ID = "ksui-image-viewer-style";
22
23
  // The backdrop scrim maps to --ks-overlay (§6a); the img/close-button chrome
@@ -49,7 +50,7 @@ export default function ImageViewer(props: Props) {
49
50
  lockPullToRefresh();
50
51
  onCleanup(unlockPullToRefresh);
51
52
 
52
- onMount(() => {
53
+ onSettled(() => {
53
54
  if (dialogEl && !dialogEl.open) {
54
55
  try {
55
56
  dialogEl.showModal();
@@ -91,7 +92,7 @@ export default function ImageViewer(props: Props) {
91
92
  >
92
93
  <X size={22} />
93
94
  </button>
94
- <div class="ksui-imgviewer-frame" aria-busy={!loaded()}>
95
+ <div class="ksui-imgviewer-frame" aria-busy={ariaBool(!loaded())}>
95
96
  <img
96
97
  src={props.src}
97
98
  alt={props.alt || ""}
@@ -1,5 +1,6 @@
1
- import { createMemo, Show, type JSX } from "solid-js";
2
- import { Dynamic } from "solid-js/web";
1
+ import { createMemo, Show } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { Dynamic } from "@solidjs/web";
3
4
 
4
5
  type IconComponent = (props: { size?: number; class?: string }) => JSX.Element;
5
6
 
@@ -97,7 +97,7 @@ describe("Modal", () => {
97
97
  expect(onClose).toHaveBeenCalledOnce();
98
98
  });
99
99
 
100
- it("leaves Escape to a dialog opened on top of it", () => {
100
+ it("leaves Escape to a dialog opened on top of it", async () => {
101
101
  const onSheetClose = vi.fn();
102
102
  const onDialogClose = vi.fn();
103
103
  const { container } = render(() => (
@@ -108,7 +108,8 @@ describe("Modal", () => {
108
108
  </Modal>
109
109
  ));
110
110
  const dialog = container.querySelector("dialog")!;
111
- expect(dialog.open).toBe(true);
111
+ // The dialog opens once the render settles, not during it.
112
+ await vi.waitFor(() => expect(dialog.open).toBe(true));
112
113
 
113
114
  // A browser delivers Escape as keydown (bubbling to window) and then
114
115
  // fires cancel on the topmost modal dialog.
@@ -15,7 +15,8 @@
15
15
  // sheet variant uses a <div> overlay so child popovers Portaled into
16
16
  // document.body still compose above the backdrop via z-index.
17
17
 
18
- import { JSX, onCleanup, onMount, splitProps } from "solid-js";
18
+ import { onCleanup, onSettled, omit } from "solid-js";
19
+ import type { JSX } from "@solidjs/web";
19
20
  import { autoFocusOnMount, lockPullToRefresh, unlockPullToRefresh, useFocusTrap } from "../../utils/dom";
20
21
  import { injectCSS } from "../../utils/inject-css";
21
22
  import { ModalLayerProvider } from "../../utils/modal-layer";
@@ -72,14 +73,7 @@ type LocalProps = Omit<ModalProps, "variant">;
72
73
 
73
74
  export function Modal(props: ModalProps): JSX.Element {
74
75
  injectCSS(STYLE_ID, STYLE_CSS);
75
- const [local] = splitProps(props, [
76
- "onClose",
77
- "dismissable",
78
- "size",
79
- "tone",
80
- "ariaLabel",
81
- "children",
82
- ]);
76
+ const local = props;
83
77
  // Variant is read once at mount; call sites pick it statically.
84
78
  if (props.variant === "sheet") return SheetModal(local, props.size);
85
79
  return DialogModal(local);
@@ -87,11 +81,14 @@ export function Modal(props: ModalProps): JSX.Element {
87
81
 
88
82
  function DialogModal(local: LocalProps): JSX.Element {
89
83
  let dialogEl: HTMLDialogElement | undefined;
84
+ // onCleanup is not allowed in the ref callback that creates the trap.
85
+ let releaseTrap: (() => void) | undefined;
86
+ onCleanup(() => releaseTrap?.());
90
87
 
91
88
  lockPullToRefresh();
92
89
  onCleanup(unlockPullToRefresh);
93
90
 
94
- onMount(() => {
91
+ onSettled(() => {
95
92
  if (!dialogEl) return;
96
93
  if (!dialogEl.open) {
97
94
  try {
@@ -141,7 +138,7 @@ function DialogModal(local: LocalProps): JSX.Element {
141
138
  <div
142
139
  ref={(el) => {
143
140
  autoFocusOnMount(el);
144
- onCleanup(useFocusTrap(el));
141
+ releaseTrap = useFocusTrap(el);
145
142
  }}
146
143
  class={`ksui-modal-card${local.tone === "danger" ? " danger" : ""}`}
147
144
  style={{ "max-width": SIZE_MAX_WIDTH[local.size ?? "lg"] }}
@@ -167,6 +164,8 @@ function openModalDialogs(): HTMLDialogElement[] {
167
164
 
168
165
  function SheetModal(local: LocalProps, size?: ModalSize): JSX.Element {
169
166
  let overlayEl: HTMLDivElement | undefined;
167
+ let releaseTrap: (() => void) | undefined;
168
+ onCleanup(() => releaseTrap?.());
170
169
 
171
170
  lockPullToRefresh();
172
171
  onCleanup(unlockPullToRefresh);
@@ -200,7 +199,7 @@ function SheetModal(local: LocalProps, size?: ModalSize): JSX.Element {
200
199
  <div
201
200
  ref={(el) => {
202
201
  autoFocusOnMount(el);
203
- onCleanup(useFocusTrap(el));
202
+ releaseTrap = useFocusTrap(el);
204
203
  }}
205
204
  role="dialog"
206
205
  aria-modal="true"
@@ -1,4 +1,5 @@
1
- import { Show, createUniqueId, type JSX } from "solid-js";
1
+ import { Show, createUniqueId } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
2
3
  import X from "../../icons/x";
3
4
  import { injectCSS } from "../../utils/inject-css";
4
5
 
@@ -1,4 +1,5 @@
1
- import { For, createMemo, createUniqueId, type JSX } from "solid-js";
1
+ import { For, createMemo, createUniqueId } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
2
3
  import ChevronLeft from "../../icons/chevron-left";
3
4
  import ChevronRight from "../../icons/chevron-right";
4
5
  import { injectCSS } from "../../utils/inject-css";
@@ -1,4 +1,6 @@
1
- import { For, type JSX } from "solid-js";
1
+ import { For } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { ariaTri } from "../../utils/aria";
2
4
 
3
5
  export interface MultiSelectOption {
4
6
  value: string;
@@ -36,17 +38,17 @@ export default function MultiSelectGroup(props: MultiSelectGroupProps): JSX.Elem
36
38
  {(option) => (
37
39
  <button
38
40
  type="button"
39
- aria-pressed={selected(option.value)}
41
+ aria-pressed={ariaTri(selected(option.value))}
40
42
  disabled={props.disabled || option.disabled}
41
43
  title={option.disabledNote}
42
44
  onClick={() => toggle(option)}
43
- class={`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${props.itemClass ?? ""}`}
44
- classList={{
45
+ class={[`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${props.itemClass ?? ""}`, {
45
46
  "border-[var(--ks-info,#38bdf8)] bg-[var(--ks-info,#38bdf8)] text-[var(--ks-info-fg,#7dd3fc)]": selected(option.value) && (props.variant ?? "info") === "info",
46
47
  "border-[var(--ks-accent,#fbbf24)] bg-[var(--ks-accent,#fbbf24)] font-semibold text-[var(--ks-fg-on-accent,#0a0a0a)]": selected(option.value) && props.variant === "accent",
47
48
  "border-[var(--ks-border,rgba(39,39,42,0.5))] bg-[var(--ks-surface,#0f0f0f)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-[var(--ks-border-strong,#3f3f46)] hover:text-[var(--ks-fg,#ffffff)]": !selected(option.value),
48
49
  "cursor-not-allowed opacity-50": !!props.disabled || !!option.disabled,
49
- }}
50
+ }]}
51
+
50
52
  >
51
53
  {option.label}
52
54
  </button>
@@ -3,9 +3,10 @@
3
3
  // progress visualization the session manager uses on the home page.
4
4
  // Adapted to the library's TS + shared icon conventions.
5
5
 
6
- import type { Component, JSX } from "solid-js";
7
- import { createMemo, splitProps, Show } from "solid-js";
8
- import { Dynamic } from "solid-js/web";
6
+ import type { Component } from "solid-js";
7
+ import type { JSX } from "@solidjs/web";
8
+ import { createMemo, omit, Show } from "solid-js";
9
+ import { Dynamic } from "@solidjs/web";
9
10
  import { injectCSS } from "../../utils/inject-css";
10
11
 
11
12
  // The monolith ships these as a CSS module (ProgressBar.module.css). The
@@ -164,19 +165,8 @@ function extractTextSize(className: string): number {
164
165
 
165
166
  const DefaultProgressBar: Component<ProgressBarProps> = (props) => {
166
167
  injectCSS(PROGRESS_STYLE_ID, PROGRESS_CSS);
167
- const [local, others] = splitProps(props, [
168
- "progress",
169
- "icon",
170
- "label",
171
- "statusLabel",
172
- "shimmer",
173
- "position",
174
- "hidePercentage",
175
- "rightLabel",
176
- "color",
177
- "variant",
178
- "class",
179
- ]);
168
+ const local = props;
169
+ const others = omit(props, "progress", "icon", "label", "statusLabel", "shimmer", "position", "hidePercentage", "rightLabel", "color", "variant", "class");
180
170
 
181
171
  const progressVal = createMemo(() => {
182
172
  const value = local.progress;
@@ -350,7 +340,8 @@ type CompactProgressBarProps = ProgressBarProps;
350
340
 
351
341
  const CompactProgressBar: Component<CompactProgressBarProps> = (props) => {
352
342
  injectCSS(PROGRESS_STYLE_ID, PROGRESS_CSS);
353
- const [local, others] = splitProps(props, ["progress", "icon", "label", "statusLabel", "shimmer", "position", "hidePercentage", "rightLabel", "color", "variant", "class"]);
343
+ const local = props;
344
+ const others = omit(props, "progress", "icon", "label", "statusLabel", "shimmer", "position", "hidePercentage", "rightLabel", "color", "variant", "class");
354
345
  const value = createMemo(() => {
355
346
  if (typeof local.progress !== "number" || Number.isNaN(local.progress)) return 0;
356
347
  return Math.min(100, Math.max(0, Math.round(local.progress)));
@@ -1,4 +1,6 @@
1
- import { For, type JSX } from "solid-js";
1
+ import { For } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { ariaBool, ariaTri } from "../../utils/aria";
2
4
 
3
5
  interface RadioCardGroupProps<T> {
4
6
  /** The selectable options. */
@@ -101,11 +103,11 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
101
103
  const defaultRender = (option: T, selected: boolean) => (
102
104
  <>
103
105
  <span
104
- class="h-2 w-2 rounded-full shrink-0"
105
- classList={{
106
+ class={["h-2 w-2 rounded-full shrink-0", {
106
107
  "bg-[var(--ks-accent,#fbbf24)]": selected,
107
108
  "bg-[var(--ks-fg-subtle,#71717a)] group-hover:bg-[var(--ks-fg-muted,#a1a1aa)]": !selected,
108
- }}
109
+ }]}
110
+
109
111
  />
110
112
  <span class="truncate">{label(option)}</span>
111
113
  </>
@@ -115,8 +117,8 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
115
117
  <div
116
118
  role="radiogroup"
117
119
  aria-label={props.ariaLabel}
118
- aria-disabled={props.disabled}
119
- tabIndex={-1}
120
+ aria-disabled={ariaBool(props.disabled)}
121
+ tabindex={-1}
120
122
  class={`${gridClass()} ${props.class ?? ""}`}
121
123
  onKeyDown={onKeyDown}
122
124
  >
@@ -130,18 +132,18 @@ export default function RadioCardGroup<T>(props: RadioCardGroupProps<T>): JSX.El
130
132
  ref={(el) => (buttonRefs[i()] = el)}
131
133
  type="button"
132
134
  role="radio"
133
- aria-checked={selected()}
134
- aria-disabled={props.disabled}
135
- tabIndex={isTabStop() ? 0 : -1}
135
+ aria-checked={ariaTri(selected())}
136
+ aria-disabled={ariaBool(props.disabled)}
137
+ tabindex={isTabStop() ? 0 : -1}
136
138
  onClick={() => !props.disabled && props.onChange(k)}
137
- class={`group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ${props.itemClass ?? ""}`}
138
- classList={{
139
+ class={[`group flex items-center gap-2 rounded-lg border px-3 py-3 text-left text-sm transition-colors cursor-pointer ${props.itemClass ?? ""}`, {
139
140
  "opacity-50 pointer-events-none cursor-not-allowed": !!props.disabled,
140
141
  "border-[var(--ks-accent,#fbbf24)]/50 bg-[var(--ks-accent,#fbbf24)]/10 text-[var(--ks-accent,#fbbf24)]":
141
142
  selected(),
142
143
  "border-[var(--ks-border-strong,#3f3f46)] bg-[var(--ks-surface-raised,#1a1a1a)] text-[var(--ks-fg-muted,#a1a1aa)] hover:border-[var(--ks-fg-subtle,#71717a)] hover:bg-[var(--ks-surface-sunken,#141414)]":
143
144
  !selected(),
144
- }}
145
+ }]}
146
+
145
147
  >
146
148
  {(props.renderOption ?? defaultRender)(option, selected())}
147
149
  </button>
@@ -1,4 +1,5 @@
1
- import { Show, type JSX } from "solid-js";
1
+ import { Show } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
2
3
 
3
4
  /** Horizontal alignment for the whole heading block. */
4
5
  export type SectionHeadingAlign = "left" | "center" | "right";
@@ -1,5 +1,7 @@
1
- import { For, type Component, type JSX } from "solid-js";
2
- import { Dynamic } from "solid-js/web";
1
+ import { For, type Component } from "solid-js";
2
+ import type { JSX } from "@solidjs/web";
3
+ import { Dynamic } from "@solidjs/web";
4
+ import { ariaBool, ariaTri } from "../../utils/aria";
3
5
  export type SegmentedFilterIcon = Component<{ size?: number; class?: string }>;
4
6
 
5
7
  /** One choice in the segmented row. A bare string uses the value as the label
@@ -109,18 +111,17 @@ export default function SegmentedFilter(props: SegmentedFilterProps): JSX.Elemen
109
111
  ref={(el) => (buttonRefs[i()] = el)}
110
112
  type="button"
111
113
  role="radio"
112
- aria-checked={selected()}
113
- aria-disabled={opt.disabled}
114
+ aria-checked={ariaTri(selected())}
115
+ aria-disabled={ariaBool(opt.disabled)}
114
116
  aria-describedby={opt.disabled && opt.disabledNote ? noteId : undefined}
115
117
  title={opt.disabled ? opt.disabledNote : undefined}
116
- tabIndex={opt.disabled ? -1 : isTabStop() ? 0 : -1}
118
+ tabindex={opt.disabled ? -1 : isTabStop() ? 0 : -1}
117
119
  data-testid={props.testIdPrefix ? `${props.testIdPrefix}-${opt.value}` : undefined}
118
120
  onClick={() => {
119
121
  if (opt.disabled) return;
120
122
  props.onChange(opt.value);
121
123
  }}
122
- class="inline-flex shrink-0 items-center justify-center gap-1.5 px-3 py-1.5 text-xs transition-colors"
123
- classList={{
124
+ class={["inline-flex shrink-0 items-center justify-center gap-1.5 px-3 py-1.5 text-xs transition-colors", {
124
125
  capitalize: opt.capitalize,
125
126
  "cursor-not-allowed": opt.disabled,
126
127
  "cursor-pointer": !opt.disabled,
@@ -128,7 +129,8 @@ export default function SegmentedFilter(props: SegmentedFilterProps): JSX.Elemen
128
129
  "text-[var(--ks-fg-subtle,#71717a)]": opt.disabled,
129
130
  "text-[var(--ks-fg-muted,#a1a1aa)] hover:text-[var(--ks-fg,#ffffff)] hover:bg-[var(--ks-surface-raised,#1a1a1a)]":
130
131
  !selected() && !opt.disabled,
131
- }}
132
+ }]}
133
+
132
134
  >
133
135
  {opt.icon ? <Dynamic component={opt.icon} size={14} aria-hidden="true" /> : null}
134
136
  {opt.label}