@kerf-js/veneer 0.0.0-stage → 0.1.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 (389) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +1338 -2
  3. package/package.json +56 -3
  4. package/plugin.d.mts +187 -0
  5. package/plugin.mjs +399 -0
  6. package/src/Accordion.tsx +98 -0
  7. package/src/Alert.tsx +55 -0
  8. package/src/Badge.tsx +39 -0
  9. package/src/Button.tsx +175 -0
  10. package/src/Calendar-month.tsx +140 -0
  11. package/src/Calendar.tsx +335 -0
  12. package/src/Canvas.tsx +221 -0
  13. package/src/Card.tsx +85 -0
  14. package/src/Chart.tsx +278 -0
  15. package/src/Charts.tsx +158 -0
  16. package/src/Chip.tsx +61 -0
  17. package/src/Choice-checkbox.tsx +53 -0
  18. package/src/Choice-parts.tsx +7 -0
  19. package/src/Choice-radio.tsx +78 -0
  20. package/src/Choice-segmented.tsx +76 -0
  21. package/src/Choice-switch.tsx +51 -0
  22. package/src/Choice.tsx +4 -0
  23. package/src/CloseX.tsx +14 -0
  24. package/src/CodeBlock.tsx +81 -0
  25. package/src/CodeInput.tsx +256 -0
  26. package/src/Combobox.tsx +281 -0
  27. package/src/CommandPalette-controller.ts +314 -0
  28. package/src/CommandPalette-rows.tsx +137 -0
  29. package/src/CommandPalette.tsx +196 -0
  30. package/src/DataGrid-actions.ts +119 -0
  31. package/src/DataGrid-body.tsx +58 -0
  32. package/src/DataGrid-controller.ts +145 -0
  33. package/src/DataGrid-header.tsx +108 -0
  34. package/src/DataGrid-model.ts +248 -0
  35. package/src/DataGrid-pivot.tsx +108 -0
  36. package/src/DataGrid-rows.tsx +296 -0
  37. package/src/DataGrid-toolbar.tsx +127 -0
  38. package/src/DataGrid-tree.ts +149 -0
  39. package/src/DataGrid-viewport.tsx +37 -0
  40. package/src/DataGrid.tsx +145 -0
  41. package/src/DateField-presets.tsx +27 -0
  42. package/src/DateField-range.tsx +370 -0
  43. package/src/DateField.tsx +295 -0
  44. package/src/Dither.tsx +313 -0
  45. package/src/Drawer.tsx +123 -0
  46. package/src/DurationField.tsx +227 -0
  47. package/src/Feed.tsx +78 -0
  48. package/src/Field/view.tsx +147 -0
  49. package/src/Field.tsx +238 -0
  50. package/src/HamburgerMenu.tsx +119 -0
  51. package/src/Icon.tsx +15 -0
  52. package/src/Kbd.tsx +6 -0
  53. package/src/KeyValueEditor/actions.ts +75 -0
  54. package/src/KeyValueEditor/rows.tsx +104 -0
  55. package/src/KeyValueEditor.tsx +112 -0
  56. package/src/Layout.tsx +221 -0
  57. package/src/Markdown.tsx +127 -0
  58. package/src/MentionsInput/actions.ts +161 -0
  59. package/src/MentionsInput/end.tsx +82 -0
  60. package/src/MentionsInput.tsx +103 -0
  61. package/src/Menu.tsx +221 -0
  62. package/src/Modal.tsx +109 -0
  63. package/src/MonthPicker/month.tsx +117 -0
  64. package/src/MonthPicker/period.tsx +197 -0
  65. package/src/MonthPicker/shared.tsx +272 -0
  66. package/src/MonthPicker/week.tsx +103 -0
  67. package/src/MonthPicker.tsx +11 -0
  68. package/src/MultiSelect.tsx +139 -0
  69. package/src/Nav.tsx +36 -0
  70. package/src/NumberField.tsx +156 -0
  71. package/src/Pagination.tsx +335 -0
  72. package/src/PaymentCard.tsx +111 -0
  73. package/src/Picker.tsx +228 -0
  74. package/src/PlaceField.tsx +285 -0
  75. package/src/Popover.tsx +88 -0
  76. package/src/Presence.tsx +37 -0
  77. package/src/Progress.tsx +71 -0
  78. package/src/RecurrenceField.tsx +372 -0
  79. package/src/RichSelect/codes.tsx +94 -0
  80. package/src/RichSelect/list.tsx +380 -0
  81. package/src/RichSelect/phone-view.tsx +114 -0
  82. package/src/RichSelect/phone.tsx +305 -0
  83. package/src/RichSelect/search-keys.ts +28 -0
  84. package/src/RichSelect/timezone.tsx +53 -0
  85. package/src/RichSelect.tsx +13 -0
  86. package/src/RichTextEditor/controller.tsx +305 -0
  87. package/src/RichTextEditor/editor.tsx +61 -0
  88. package/src/RichTextEditor/tools.tsx +132 -0
  89. package/src/RichTextEditor/view.tsx +210 -0
  90. package/src/RichTextEditor.tsx +9 -0
  91. package/src/ScrollGrid/measure.ts +39 -0
  92. package/src/ScrollGrid/parts.tsx +112 -0
  93. package/src/ScrollGrid.tsx +375 -0
  94. package/src/ScrollRail.tsx +114 -0
  95. package/src/ScrollView.tsx +57 -0
  96. package/src/Segments/controller.tsx +148 -0
  97. package/src/Segments/events.ts +99 -0
  98. package/src/Segments/view.tsx +77 -0
  99. package/src/Segments.tsx +2 -0
  100. package/src/Select.tsx +343 -0
  101. package/src/Shape.tsx +41 -0
  102. package/src/Shell/branches.tsx +108 -0
  103. package/src/Shell/button.tsx +33 -0
  104. package/src/Shell/shared.tsx +220 -0
  105. package/src/Shell/shell.tsx +25 -0
  106. package/src/Shell/state.ts +138 -0
  107. package/src/Shell/view.tsx +280 -0
  108. package/src/Shell.tsx +17 -0
  109. package/src/SideNav/sections.tsx +50 -0
  110. package/src/SideNav/state.ts +140 -0
  111. package/src/SideNav.tsx +130 -0
  112. package/src/SideNavTitle.tsx +25 -0
  113. package/src/SignaturePad/state.ts +172 -0
  114. package/src/SignaturePad/view.tsx +69 -0
  115. package/src/SignaturePad.tsx +76 -0
  116. package/src/Skeleton.tsx +46 -0
  117. package/src/Slider.tsx +81 -0
  118. package/src/Spinner.tsx +21 -0
  119. package/src/Stage-director.ts +361 -0
  120. package/src/Stage-look.ts +75 -0
  121. package/src/Stage-poster.tsx +62 -0
  122. package/src/Stage-types.ts +206 -0
  123. package/src/Stage.tsx +147 -0
  124. package/src/TabBar.tsx +114 -0
  125. package/src/Table-actions.tsx +51 -0
  126. package/src/Table-base.ts +70 -0
  127. package/src/Table-body.tsx +84 -0
  128. package/src/Table-columns.tsx +58 -0
  129. package/src/Table-details.tsx +66 -0
  130. package/src/Table-editor.tsx +66 -0
  131. package/src/Table-head.tsx +52 -0
  132. package/src/Table-model.ts +82 -0
  133. package/src/Table-notice.ts +39 -0
  134. package/src/Table-paging.ts +50 -0
  135. package/src/Table-rows.tsx +308 -0
  136. package/src/Table-selection.ts +63 -0
  137. package/src/Table-sortbar.tsx +41 -0
  138. package/src/Table-source.ts +66 -0
  139. package/src/Table-toolbar.tsx +71 -0
  140. package/src/Table-types.ts +115 -0
  141. package/src/Table-view.tsx +87 -0
  142. package/src/Table.tsx +31 -0
  143. package/src/Tabs.tsx +129 -0
  144. package/src/Tag.tsx +40 -0
  145. package/src/Ticker.tsx +42 -0
  146. package/src/TimeField-date-model.ts +77 -0
  147. package/src/TimeField-date-view.tsx +152 -0
  148. package/src/TimeField-model.ts +80 -0
  149. package/src/TimeField-options.tsx +224 -0
  150. package/src/TimeField-slots.tsx +32 -0
  151. package/src/TimeField-types.ts +33 -0
  152. package/src/TimeField-view.tsx +124 -0
  153. package/src/TimeField.tsx +126 -0
  154. package/src/Toast.tsx +143 -0
  155. package/src/Toggle.tsx +75 -0
  156. package/src/Tooltip.tsx +69 -0
  157. package/src/Type.tsx +136 -0
  158. package/src/VirtualList-controls.ts +105 -0
  159. package/src/VirtualList-data.ts +43 -0
  160. package/src/VirtualList-measure.ts +169 -0
  161. package/src/VirtualList-metrics.ts +41 -0
  162. package/src/VirtualList-mount.ts +145 -0
  163. package/src/VirtualList-rows.tsx +91 -0
  164. package/src/VirtualList-types.ts +76 -0
  165. package/src/VirtualList-view.tsx +123 -0
  166. package/src/VirtualList.tsx +81 -0
  167. package/src/admin/ApiKeys-actions.ts +124 -0
  168. package/src/admin/ApiKeys-form.tsx +64 -0
  169. package/src/admin/ApiKeys-view.tsx +101 -0
  170. package/src/admin/ApiKeys.tsx +224 -0
  171. package/src/admin/Audit.tsx +246 -0
  172. package/src/admin/Billing.tsx +307 -0
  173. package/src/admin/Cart.tsx +177 -0
  174. package/src/admin/Checkout-address.tsx +125 -0
  175. package/src/admin/Checkout-cart.tsx +78 -0
  176. package/src/admin/Checkout-coupon.ts +34 -0
  177. package/src/admin/Checkout-done.tsx +31 -0
  178. package/src/admin/Checkout-model.ts +33 -0
  179. package/src/admin/Checkout-navigation.ts +76 -0
  180. package/src/admin/Checkout-payment-view.tsx +49 -0
  181. package/src/admin/Checkout-payment.ts +80 -0
  182. package/src/admin/Checkout-review.tsx +60 -0
  183. package/src/admin/Checkout-shipping.tsx +47 -0
  184. package/src/admin/Checkout-state.ts +122 -0
  185. package/src/admin/Checkout-steps.ts +10 -0
  186. package/src/admin/Checkout-summary.tsx +97 -0
  187. package/src/admin/Checkout-types.ts +60 -0
  188. package/src/admin/Checkout-view.tsx +51 -0
  189. package/src/admin/Checkout.tsx +72 -0
  190. package/src/admin/CsvImport-actions.ts +131 -0
  191. package/src/admin/CsvImport.tsx +379 -0
  192. package/src/admin/Danger.tsx +240 -0
  193. package/src/admin/Integrations/Card.tsx +82 -0
  194. package/src/admin/Integrations/Webhooks.tsx +341 -0
  195. package/src/admin/Integrations.tsx +169 -0
  196. package/src/admin/InviteDialog.tsx +153 -0
  197. package/src/admin/Members/columns.tsx +181 -0
  198. package/src/admin/Members.tsx +316 -0
  199. package/src/admin/Order.tsx +115 -0
  200. package/src/admin/PlainTable.tsx +34 -0
  201. package/src/admin/Plans.tsx +375 -0
  202. package/src/admin/SaveBar/actions.ts +86 -0
  203. package/src/admin/SaveBar.tsx +153 -0
  204. package/src/admin/Secret.tsx +74 -0
  205. package/src/admin/Settings.tsx +145 -0
  206. package/src/admin/StepBar.tsx +66 -0
  207. package/src/admin/TagsInput/actions.ts +60 -0
  208. package/src/admin/TagsInput.tsx +95 -0
  209. package/src/admin/atoms.tsx +73 -0
  210. package/src/admin/index.ts +67 -0
  211. package/src/agent/Actions/reasons.tsx +38 -0
  212. package/src/agent/Actions.tsx +166 -0
  213. package/src/agent/AgentPlan.tsx +86 -0
  214. package/src/agent/ArtifactPanel.tsx +299 -0
  215. package/src/agent/Assistant.tsx +168 -0
  216. package/src/agent/Checkpoint.tsx +19 -0
  217. package/src/agent/Cite.tsx +70 -0
  218. package/src/agent/ContextMeter.tsx +70 -0
  219. package/src/agent/Conversation.tsx +70 -0
  220. package/src/agent/Message.tsx +92 -0
  221. package/src/agent/ModelPicker.tsx +167 -0
  222. package/src/agent/Prompt-model.ts +118 -0
  223. package/src/agent/Prompt-view.tsx +246 -0
  224. package/src/agent/Prompt.tsx +128 -0
  225. package/src/agent/Prose.tsx +118 -0
  226. package/src/agent/Question.tsx +137 -0
  227. package/src/agent/Reasoning.tsx +31 -0
  228. package/src/agent/Shimmer.tsx +11 -0
  229. package/src/agent/Sources.tsx +23 -0
  230. package/src/agent/SpeechInput.tsx +243 -0
  231. package/src/agent/Suggestions.tsx +36 -0
  232. package/src/agent/ToolCall.tsx +219 -0
  233. package/src/agent/TraceViewer.tsx +96 -0
  234. package/src/agent/bits.tsx +88 -0
  235. package/src/agent/index.ts +38 -0
  236. package/src/bind.ts +57 -0
  237. package/src/collab/AutoTrack.tsx +91 -0
  238. package/src/collab/Comments.tsx +204 -0
  239. package/src/collab/Composer/state.ts +125 -0
  240. package/src/collab/Composer/view.tsx +155 -0
  241. package/src/collab/Composer.tsx +141 -0
  242. package/src/collab/ConversationList.tsx +120 -0
  243. package/src/collab/Cursors.tsx +71 -0
  244. package/src/collab/DataIntegrity.tsx +103 -0
  245. package/src/collab/Kanban-card.ts +74 -0
  246. package/src/collab/Kanban.tsx +368 -0
  247. package/src/collab/Lock.tsx +36 -0
  248. package/src/collab/PresenceStack.tsx +176 -0
  249. package/src/collab/ShareDialog.tsx +273 -0
  250. package/src/collab/Status.tsx +101 -0
  251. package/src/collab/SyncedForm.tsx +42 -0
  252. package/src/collab/Thread/Message.tsx +265 -0
  253. package/src/collab/Thread/rows.tsx +56 -0
  254. package/src/collab/Thread.tsx +323 -0
  255. package/src/collab/VersionHistory.tsx +173 -0
  256. package/src/collab/ViewportRail.tsx +73 -0
  257. package/src/collab/index.ts +37 -0
  258. package/src/collab/peer.tsx +42 -0
  259. package/src/fields.ts +5 -0
  260. package/src/flow/AuthScreen.tsx +81 -0
  261. package/src/flow/AuthSteps.tsx +296 -0
  262. package/src/flow/Checklist.tsx +211 -0
  263. package/src/flow/ConnBanner.tsx +304 -0
  264. package/src/flow/Flow.tsx +97 -0
  265. package/src/flow/MfaSetup.tsx +244 -0
  266. package/src/flow/Otp.tsx +243 -0
  267. package/src/flow/ReauthDialog.tsx +79 -0
  268. package/src/flow/ShortcutsOverlay.tsx +121 -0
  269. package/src/flow/SignGate.tsx +184 -0
  270. package/src/flow/SignIn.tsx +136 -0
  271. package/src/flow/SignUp.tsx +149 -0
  272. package/src/flow/Sso.tsx +96 -0
  273. package/src/flow/SystemPage/accounts.tsx +74 -0
  274. package/src/flow/SystemPage/art.tsx +113 -0
  275. package/src/flow/SystemPage.tsx +395 -0
  276. package/src/flow/Tour.tsx +207 -0
  277. package/src/flow/index.ts +29 -0
  278. package/src/flow/kit.tsx +334 -0
  279. package/src/index.ts +237 -0
  280. package/src/layout.css +4 -0
  281. package/src/links.css +4 -0
  282. package/src/live/ActivityFeed.tsx +88 -0
  283. package/src/live/Bell.tsx +108 -0
  284. package/src/live/Connection.tsx +113 -0
  285. package/src/live/Inbox.tsx +113 -0
  286. package/src/live/InboxFeed.tsx +67 -0
  287. package/src/live/InboxGestures.ts +41 -0
  288. package/src/live/InboxHandlers.ts +102 -0
  289. package/src/live/InboxHeader.tsx +81 -0
  290. package/src/live/InboxModel.ts +81 -0
  291. package/src/live/InboxRow.tsx +125 -0
  292. package/src/live/MeetingRoom.tsx +22 -0
  293. package/src/live/MeetingRoomControlBar.tsx +197 -0
  294. package/src/live/MeetingRoomHandlers.ts +53 -0
  295. package/src/live/MeetingRoomLayout.tsx +27 -0
  296. package/src/live/MeetingRoomModel.ts +49 -0
  297. package/src/live/MeetingRoomMount.ts +49 -0
  298. package/src/live/MeetingRoomParts.tsx +178 -0
  299. package/src/live/MeetingRoomPerson.tsx +21 -0
  300. package/src/live/MeetingRoomState.ts +88 -0
  301. package/src/live/MeetingRoomTile.tsx +84 -0
  302. package/src/live/MeetingRoomTypes.ts +68 -0
  303. package/src/live/MeetingRoomView.tsx +36 -0
  304. package/src/live/NotificationPreferences.tsx +99 -0
  305. package/src/live/NotificationPreferencesActions.ts +55 -0
  306. package/src/live/NotificationPreferencesCell.tsx +26 -0
  307. package/src/live/NotificationPreferencesCells.tsx +59 -0
  308. package/src/live/NotificationPreferencesGrid.tsx +129 -0
  309. package/src/live/NotificationPreferencesModel.tsx +91 -0
  310. package/src/live/NotificationPreferencesSave.ts +85 -0
  311. package/src/live/NotificationPreferencesWatch.ts +31 -0
  312. package/src/live/Prejoin.tsx +238 -0
  313. package/src/live/PrejoinMeter.tsx +26 -0
  314. package/src/live/PrejoinPreview.tsx +53 -0
  315. package/src/live/PushSoftAsk.tsx +63 -0
  316. package/src/live/TransportPicker.tsx +341 -0
  317. package/src/live/TransportPickerDetails.tsx +130 -0
  318. package/src/live/index.ts +31 -0
  319. package/src/live/notify.tsx +22 -0
  320. package/src/live/shared.tsx +110 -0
  321. package/src/parts.tsx +199 -0
  322. package/src/plugin/catalog.mjs +129 -0
  323. package/src/plugin/dtcg.mjs +79 -0
  324. package/src/plugin/icons.mjs +7 -0
  325. package/src/plugin/seed.mjs +40 -0
  326. package/src/plugin/theme-context.mjs +44 -0
  327. package/src/plugin/theme-css.mjs +143 -0
  328. package/src/plugin/theme-motion.mjs +43 -0
  329. package/src/plugin/theme-parts.d.mts +41 -0
  330. package/src/plugin/theme-parts.mjs +224 -0
  331. package/src/plugin/theme-text.mjs +93 -0
  332. package/src/plugin/theme-values.mjs +15 -0
  333. package/src/plugin/theme.d.mts +82 -0
  334. package/src/plugin/theme.mjs +316 -0
  335. package/src/schedule/Agenda.tsx +124 -0
  336. package/src/schedule/AgendaActions.ts +31 -0
  337. package/src/schedule/AgendaDay.tsx +124 -0
  338. package/src/schedule/AgendaGestures.ts +27 -0
  339. package/src/schedule/AgendaKeys.ts +52 -0
  340. package/src/schedule/AgendaModel.ts +82 -0
  341. package/src/schedule/AgendaNavigation.ts +38 -0
  342. package/src/schedule/AgendaPage.tsx +39 -0
  343. package/src/schedule/AgendaStrip.tsx +55 -0
  344. package/src/schedule/AvailabilityEditor-actions.ts +146 -0
  345. package/src/schedule/AvailabilityEditor-day.tsx +119 -0
  346. package/src/schedule/AvailabilityEditor-view.tsx +205 -0
  347. package/src/schedule/AvailabilityEditor.tsx +113 -0
  348. package/src/schedule/BookingCalendar.tsx +121 -0
  349. package/src/schedule/BookingCalendarActions.ts +85 -0
  350. package/src/schedule/BookingCalendarModel.ts +86 -0
  351. package/src/schedule/BookingCalendarParts.tsx +87 -0
  352. package/src/schedule/Calendar/AgendaView.tsx +45 -0
  353. package/src/schedule/Calendar/CalendarDialogs.tsx +105 -0
  354. package/src/schedule/Calendar/CalendarMain.tsx +47 -0
  355. package/src/schedule/Calendar/CalendarToolbar.tsx +106 -0
  356. package/src/schedule/Calendar/Column.tsx +129 -0
  357. package/src/schedule/Calendar/EventBlock.tsx +71 -0
  358. package/src/schedule/Calendar/MiniMonth.tsx +169 -0
  359. package/src/schedule/Calendar/MonthGrid.tsx +296 -0
  360. package/src/schedule/Calendar/TimeGrid.tsx +252 -0
  361. package/src/schedule/Calendar/Timeline.tsx +287 -0
  362. package/src/schedule/Calendar/ZoneChip.tsx +73 -0
  363. package/src/schedule/Calendar/calendar-shell.ts +160 -0
  364. package/src/schedule/Calendar/calendar-state.ts +30 -0
  365. package/src/schedule/Calendar/now-spans.tsx +33 -0
  366. package/src/schedule/Calendar/shared.ts +3 -0
  367. package/src/schedule/Calendar/state-actions.ts +189 -0
  368. package/src/schedule/Calendar/state-base.ts +143 -0
  369. package/src/schedule/Calendar/state-keys.ts +128 -0
  370. package/src/schedule/Calendar/time-fit.ts +84 -0
  371. package/src/schedule/Calendar.tsx +182 -0
  372. package/src/schedule/EventEditor.tsx +267 -0
  373. package/src/schedule/EventPopover.tsx +190 -0
  374. package/src/schedule/MeetingPlanner-model.ts +222 -0
  375. package/src/schedule/MeetingPlanner-view.tsx +310 -0
  376. package/src/schedule/MeetingPlanner.tsx +122 -0
  377. package/src/schedule/MoveSheet.tsx +168 -0
  378. package/src/schedule/YearView-model.ts +164 -0
  379. package/src/schedule/YearView-parts.tsx +147 -0
  380. package/src/schedule/YearView.tsx +100 -0
  381. package/src/schedule/bits.tsx +65 -0
  382. package/src/schedule/index.ts +25 -0
  383. package/src/skeleton-css.ts +4 -0
  384. package/src/styles.ts +13 -0
  385. package/src/type.css +15 -0
  386. package/src/ui.ts +41 -0
  387. package/src/use-ui.ts +10 -0
  388. package/tailwind.css +38 -0
  389. package/tokens/color.mjs +87 -0
@@ -0,0 +1,87 @@
1
+ // Render a table from its per-instance model.
2
+ import { untrack } from '@kerf-js/core'
3
+ import { hideRule } from '@kerf-js/veneer-core'
4
+ import { tableSheet } from './Table-rows'
5
+ import { Checkbox } from './Choice'
6
+ import { tableHead } from './Table-head'
7
+ import { tableBody } from './Table-body'
8
+ import { tableToolbar } from './Table-toolbar'
9
+ import { tableSortbar } from './Table-sortbar'
10
+ import { tableBulk, tableFooter } from './Table-actions'
11
+ import type { TableRender } from './Table-model'
12
+
13
+ /** Render the table under the caller's owner. */
14
+ export const tableView: TableRender = (m) => {
15
+ const { input, refs, base, paging, toolbar, hideable, flip } = m
16
+ const [id, , , , , , , , sel, , hidden, , sheet, , , , shape] = base
17
+ const [, , , shown, , , phase] = m.source
18
+ const [, chosen, write, , headerCheck, pickAll, , sortChoices] = m.selection
19
+ const [ctx, hasDetails, closeSheet] = m.details
20
+ const [, , , , , footer] = paging
21
+ return (
22
+ <div
23
+ ref={(n) => (refs.el = n)}
24
+ data-scope="table"
25
+ data-phone={shape.value}
26
+ data-state={phase.value}
27
+ data-density={input.density}
28
+ id={id}
29
+ >
30
+ {untrack(() => hidden.value.length > 0) && (
31
+ <style
32
+ data-part="hide"
33
+ // oxlint-disable-next-line kerf/no-html-sink -- hideRule builds a CSS rule from escaped column ids, no markup
34
+ innerHTML={untrack(() => hideRule(id, hidden.value))}
35
+ ></style>
36
+ )}
37
+ {toolbar.value && tableToolbar({ input, refs, base, paging, hideable, flip })}
38
+ {sel && tableBulk(chosen, write, input)}
39
+ {shape.value === 'cards' && sortChoices.value.length > 0 && tableSortbar(base, m.selection)}
40
+ <div
41
+ data-part="viewport"
42
+ tabindex="0"
43
+ role="region"
44
+ aria-labelledby={`${id}-cap`}
45
+ style={input.maxHeight ? `--veneer-table-max-h:${input.maxHeight}` : undefined}
46
+ >
47
+ <table role="table" aria-labelledby={`${id}-cap`} aria-rowcount={shown.value.length + 1}>
48
+ <caption id={`${id}-cap`} data-part={input.captionHidden ? 'sr-only' : undefined}>
49
+ {input.caption}
50
+ </caption>
51
+ <thead>
52
+ <tr role="row">
53
+ {sel && (
54
+ <th role="columnheader" scope="col" data-part="select" data-pinned="first">
55
+ <Checkbox
56
+ checked={headerCheck.value === 'all'}
57
+ indeterminate={headerCheck.value === 'some'}
58
+ aria-label="Select all rows on this page"
59
+ onClick={pickAll}
60
+ />
61
+ </th>
62
+ )}
63
+ {hasDetails && (
64
+ <th role="columnheader" scope="col" style="inline-size:1px;padding-inline:4px">
65
+ <span data-part="sr-only">Details</span>
66
+ </th>
67
+ )}
68
+ {tableHead(base, m.selection)}
69
+ </tr>
70
+ </thead>
71
+ <tbody aria-busy={phase.value === 'loading' ? 'true' : undefined}>
72
+ {tableBody({ input, base, source: m.source, details: m.details, notice: m.notice })}
73
+ </tbody>
74
+ </table>
75
+ </div>
76
+ {footer.value && tableFooter(paging)}
77
+ {sheet.value &&
78
+ untrack(() =>
79
+ tableSheet(
80
+ () => sheet.value!.row,
81
+ () => ctx,
82
+ { onClose: closeSheet },
83
+ ),
84
+ )}
85
+ </div>
86
+ )
87
+ }
package/src/Table.tsx ADDED
@@ -0,0 +1,31 @@
1
+ import { untrack } from '@kerf-js/core'
2
+ import type { TableProps } from './Table-types'
3
+ import { tableModel } from './Table-model'
4
+ import { tableView } from './Table-view'
5
+ import './styles'
6
+ import '@kerf-js/veneer-core/styles/components/popover.css' // the Columns panel
7
+ import '@kerf-js/veneer-core/styles/data/tokens.css'
8
+ import '@kerf-js/veneer-core/styles/data/base.css'
9
+ import '@kerf-js/veneer-core/styles/data/table.css'
10
+ import '@kerf-js/veneer-core/styles/data/desc.css'
11
+
12
+ export { ColumnsPanel } from './Table-columns'
13
+ export { Editor, chevron } from './Table-rows'
14
+ export type { Column, ListPage, TableSort, TableStatus, TableProps } from './Table-types'
15
+ export { sortIcon } from './Table-head'
16
+ export { columnsIcon } from './Table-toolbar'
17
+
18
+ /* @kerf visible: what it does by itself is fetch and measure, and focus only moves once someone is using it */
19
+ /**
20
+ * A data table (06 §5; data.html:1095-1124): a semantic <table> with explicit ARIA roles, so they survive the phone
21
+ * cards' display change. Sort, filter, Columns, resize, pin, selection with a bulk bar, details, inline edit and live
22
+ * cells, in the states ready, loading, empty and error, inside one frame. Rows are keyed: a sort moves nodes, a new
23
+ * value patches a cell. Given `T[]` it sorts, filters and pages by itself; a Resource or `server` leaves that to the
24
+ * server and reports what was asked. Queries its own width, never the window.
25
+ */
26
+ export function Table<T>(props: TableProps<T>) {
27
+ return tableModel(
28
+ untrack(() => props),
29
+ tableView,
30
+ )
31
+ }
package/src/Tabs.tsx ADDED
@@ -0,0 +1,129 @@
1
+ import { indicator, nextIndex, overflow, uid } from '@kerf-js/veneer-core'
2
+ import { untrack } from '@kerf-js/core'
3
+ import { use } from '@kerf-js/veneer-core/kerf'
4
+ import './styles'
5
+ import '@kerf-js/veneer-core/styles/components/tabs.css'
6
+
7
+ /** One tab. */
8
+ export type TabOption<V extends string> = {
9
+ value: V
10
+ label: unknown
11
+ disabled?: boolean | undefined
12
+ }
13
+
14
+ function tabKeys<V extends string>(
15
+ options: () => TabOption<V>[],
16
+ value: () => V,
17
+ onChange: (read: () => V) => void,
18
+ ) {
19
+ return (e: KeyboardEvent) => {
20
+ const tabs = options().filter((o) => !o.disabled)
21
+ const at = tabs.findIndex((o) => o.value === value())
22
+ const rtl = getComputedStyle(e.currentTarget as Element).direction === 'rtl'
23
+ const to = nextIndex(e.key, at, tabs.length, { rtl })
24
+ if (to < 0) return
25
+ e.preventDefault()
26
+ onChange(() => tabs[to]!.value)
27
+ ;(e.currentTarget as HTMLElement)
28
+ .querySelectorAll<HTMLElement>('[role="tab"]') // oxlint-disable-next-line no-unexpected-multiline -- computed member in this chain
29
+ [options().findIndex((o) => o.value === tabs[to]!.value)]?.focus() // by position: a hydrated server id isn't this side's
30
+ }
31
+ }
32
+
33
+ function bindTabs<V extends string>(value: () => V) {
34
+ let list: HTMLDivElement | undefined
35
+ use(
36
+ indicator,
37
+ () => list,
38
+ () => ({ selected: '[aria-selected="true"]', at: value() }),
39
+ )
40
+ use(
41
+ overflow,
42
+ () => list,
43
+ () => list?.querySelector<HTMLElement>('[aria-selected="true"]') ?? null,
44
+ )
45
+ return (n: HTMLDivElement) => (list = n)
46
+ }
47
+
48
+ /**
49
+ * Tabs (05 §4; components.html:660-706, 1821-1849): line (default) · pill · enclosed. APG automatic activation:
50
+ * ←/→ move and select (wrapping), Home/End, one tab stop; every tab controls a tabpanel. The indicator travels
51
+ * through the rail on the sweep curve; a list wider than its box scrolls with edge fades and keeps the selected tab
52
+ * in view. `children(value)` renders a panel; a pill strip filters one shared panel.
53
+ */
54
+ export function Tabs<V extends string>({
55
+ label,
56
+ value,
57
+ onChange,
58
+ options,
59
+ variant,
60
+ children,
61
+ }: {
62
+ label: string
63
+ value: V
64
+ onChange: (v: V) => void
65
+ options: TabOption<V>[]
66
+ variant?: 'line' | 'pill' | 'enclosed' | undefined
67
+ children?: (value: V) => unknown
68
+ }) {
69
+ const base = uid('tabs')
70
+ const kind = untrack(() => variant)
71
+ const tab = (i: number) => `${base}-t${i}`
72
+ const panel = (i: number) => (kind === 'pill' ? `${base}-p0` : `${base}-p${i}`)
73
+ const setList = bindTabs(() => value)
74
+ const onKey = tabKeys(
75
+ () => options,
76
+ () => value,
77
+ (readNext) => onChange(readNext()),
78
+ )
79
+ const selected = () => options.findIndex((o) => o.value === value)
80
+ return (
81
+ <div data-scope="tabs" data-part="root" data-variant={kind === 'line' ? undefined : kind}>
82
+ <div ref={setList} data-part="list" role="tablist" aria-label={label} onKeyDown={onKey}>
83
+ {options.map((o, i) => (
84
+ <button
85
+ key={o.value}
86
+ data-part="trigger"
87
+ role="tab"
88
+ type="button"
89
+ id={tab(i)}
90
+ aria-controls={panel(i)}
91
+ aria-selected={o.value === value ? 'true' : 'false'}
92
+ tabindex={o.value === value ? undefined : '-1'}
93
+ disabled={o.disabled}
94
+ onClick={() => onChange(o.value)}
95
+ >
96
+ {o.label}
97
+ </button>
98
+ ))}
99
+ <span data-part="indicator" aria-hidden="true" data-instant=""></span>
100
+ </div>
101
+ {kind === 'pill' ? (
102
+ <div
103
+ data-part="content"
104
+ role="tabpanel"
105
+ id={panel(0)}
106
+ aria-labelledby={tab(selected())}
107
+ tabindex="0"
108
+ hidden={!children}
109
+ >
110
+ {children?.(value)}
111
+ </div>
112
+ ) : (
113
+ options.map((o, i) => (
114
+ <div
115
+ key={o.value}
116
+ data-part="content"
117
+ role="tabpanel"
118
+ id={panel(i)}
119
+ aria-labelledby={tab(i)}
120
+ tabindex="0"
121
+ hidden={o.value !== value}
122
+ >
123
+ {children?.(o.value)}
124
+ </div>
125
+ ))
126
+ )}
127
+ </div>
128
+ )
129
+ }
package/src/Tag.tsx ADDED
@@ -0,0 +1,40 @@
1
+ import { XIcon } from '@kerf-js/veneer-icons'
2
+ import type { Tone } from './Button'
3
+ import './styles'
4
+ import '@kerf-js/veneer-core/styles/components/tag.css'
5
+
6
+ /** A tag: user content (05 §6). `onRemove` adds the remove button, named "Remove {label}". */
7
+ export function Tag({
8
+ tone,
9
+ swatch,
10
+ onRemove,
11
+ label,
12
+ children,
13
+ ...rest
14
+ }: {
15
+ tone?: Tone | undefined
16
+ swatch?: boolean
17
+ onRemove?: () => void
18
+ /** The name for the remove button, when `children` is an expression (the compiler hands those over as a thunk). */ label?:
19
+ | string
20
+ | undefined
21
+ children: unknown
22
+ [attr: string]: unknown
23
+ }) {
24
+ return (
25
+ <span data-scope="tag" data-tone={tone} {...rest}>
26
+ {swatch && <span data-part="swatch"></span>}
27
+ {children}
28
+ {onRemove && (
29
+ <button
30
+ type="button"
31
+ data-part="remove"
32
+ aria-label={`Remove ${(label ?? children) as string}`}
33
+ onClick={onRemove}
34
+ >
35
+ <XIcon />
36
+ </button>
37
+ )}
38
+ </span>
39
+ )
40
+ }
package/src/Ticker.tsx ADDED
@@ -0,0 +1,42 @@
1
+ import { derived } from '@kerf-js/core'
2
+ import './styles'
3
+ import '@kerf-js/veneer-core/styles/components/ticker.css'
4
+
5
+ /** Props for Ticker. */
6
+ export interface TickerProps {
7
+ value: number
8
+ /** Passed to Intl.NumberFormat: `{ style: 'currency', currency: 'USD' }`. */
9
+ format?: Intl.NumberFormatOptions | undefined
10
+ locale?: string | undefined
11
+ }
12
+
13
+ /**
14
+ * A number that rolls (05 §5): each digit is a column of 0–9 drawn by CSS and moved by one custom property, so a change
15
+ * writes one attribute per digit that moved. Digits are keyed from the right, so a new leading digit arrives on its own.
16
+ * The real value is in the DOM for readers; under reduced motion it swaps.
17
+ */
18
+ export function Ticker({ value, format, locale }: TickerProps) {
19
+ const fmt = derived(() => new Intl.NumberFormat(locale, format)) // apart from the text: a tick mustn't rebuild it
20
+ const text = derived(() => fmt.value.format(value))
21
+ const parts = derived(() => {
22
+ // oxlint-disable-next-line typescript/no-misused-spread -- code points are what it wants: a glyph per step, and Intl.Segmenter would cost a hot loop
23
+ const s = [...text.value]
24
+ return s.map((c, i) => ({ c, at: s.length - i }))
25
+ })
26
+ return (
27
+ <span data-scope="ticker">
28
+ <span data-part="sr">{text.value}</span>
29
+ <span aria-hidden="true">
30
+ {parts.value.map((p) =>
31
+ /\d/.test(p.c) ? (
32
+ <span key={p.at} data-part="digit" style={`--_d:${p.c};--_at:${p.at}`}></span>
33
+ ) : (
34
+ <span key={p.at} data-part="sym">
35
+ {p.c}
36
+ </span>
37
+ ),
38
+ )}
39
+ </span>
40
+ </span>
41
+ )
42
+ }
@@ -0,0 +1,77 @@
1
+ // Per-instance state for a combined date and time picker.
2
+ import { derived, state, untrack } from '@kerf-js/core'
3
+ import {
4
+ daysIn,
5
+ fmt,
6
+ isoOf,
7
+ readDate,
8
+ readTime,
9
+ type ChangeReason,
10
+ type IsoDateTime,
11
+ type SegmentPart,
12
+ } from '@kerf-js/veneer-core'
13
+ import { bindable, useOpen, usePickerEnv } from './Picker'
14
+ import type { SegmentState } from './Segments'
15
+ import type { DateTimeFieldProps } from './TimeField-types'
16
+
17
+ type Read<T, K extends keyof T> = { [P in K]-?: () => T[P] }
18
+ type Keys =
19
+ | 'value'
20
+ | 'defaultValue'
21
+ | 'onValueChange'
22
+ | 'open'
23
+ | 'defaultOpen'
24
+ | 'onOpenChange'
25
+ | 'min'
26
+ | 'max'
27
+ | 'isDateUnavailable'
28
+ | 'firstDayOfWeek'
29
+ | 'step'
30
+ | 'locale'
31
+ | 'today'
32
+ | 'name'
33
+ | 'presentation'
34
+ | 'label'
35
+ | 'hint'
36
+ | 'error'
37
+ | 'disabled'
38
+ | 'readonly'
39
+ /** Live access to the date-time field's props. */
40
+ export type DateTimeInput = Read<DateTimeFieldProps, Keys> & {
41
+ rest: () => Record<string, unknown> & { required?: boolean | undefined }
42
+ }
43
+
44
+ /** Create the date-time picker's state under the caller's owner. */
45
+ export function dateTimeModel(input: DateTimeInput) {
46
+ const env = usePickerEnv(input.locale, input.today)
47
+ const value = bindable<IsoDateTime | null>(
48
+ input.value,
49
+ input.defaultValue,
50
+ null,
51
+ input.onValueChange,
52
+ )
53
+ const pop = useOpen(input.open, input.defaultOpen, input.onOpenChange)
54
+ const date = state<string | null>(untrack(() => value.value?.slice(0, 10) ?? null))
55
+ const time = state<string | null>(untrack(() => value.value?.slice(11) ?? null))
56
+ const refs: { trigger: HTMLButtonElement | undefined } = { trigger: undefined }
57
+ const emit = (reason: ChangeReason) =>
58
+ value.set(
59
+ date.value && time.value ? (`${date.value}T${time.value}` as IsoDateTime) : null,
60
+ reason,
61
+ )
62
+ const said = derived(() =>
63
+ value.value
64
+ ? `${fmt(value.value, { dateStyle: 'full', timeStyle: 'short' }, env.locale.value)} · wall clock, no zone`
65
+ : input.hint(),
66
+ )
67
+ const onDate = (st: SegmentState, parts: SegmentPart[]) => {
68
+ const d = readDate(parts)
69
+ date.value = st === 'complete' && d.day! <= daysIn(d.year!, d.month!) ? isoOf(d) : null
70
+ emit('keyboard')
71
+ }
72
+ const onTime = (st: SegmentState, parts: SegmentPart[]) => {
73
+ time.value = st === 'complete' ? readTime(parts) : null
74
+ emit('keyboard')
75
+ }
76
+ return { input, env, value, pop, date, time, refs, emit, said, onDate, onTime }
77
+ }
@@ -0,0 +1,152 @@
1
+ // Render the combined date and time picker under its caller's owner.
2
+ import { CalendarIcon } from '@kerf-js/veneer-icons'
3
+ import type { IsoDate } from '@kerf-js/veneer-core'
4
+ import { CalendarGrid } from './Calendar'
5
+ import { Composite, Hidden, Panel, Trigger } from './Picker'
6
+ import { Segments } from './Segments'
7
+ import { DateTimeSlots } from './TimeField-slots'
8
+ import type { dateTimeModel } from './TimeField-date-model'
9
+
10
+ type Model = ReturnType<typeof dateTimeModel>
11
+
12
+ /** Render the date-time field using its per-instance model. */
13
+ export function dateTimeView(m: Model) {
14
+ const live = liveProps(m.input)
15
+ const { input, env, value, pop, date, time, said, refs, emit } = m
16
+ return (
17
+ <Composite
18
+ {...input.rest()}
19
+ label={live.label}
20
+ hint={said.value}
21
+ error={live.error}
22
+ disabled={live.disabled}
23
+ readonly={live.readonly}
24
+ bound={value}
25
+ onReset={() => {
26
+ date.value = value.value?.slice(0, 10) ?? null
27
+ time.value = value.value?.slice(11) ?? null
28
+ }}
29
+ filled={!!(date.value || time.value)}
30
+ hold={pop.value}
31
+ control={() => dateTimeControls(m)}
32
+ end={
33
+ <Panel
34
+ label="Choose date and time"
35
+ open={pop}
36
+ trigger={() => refs.trigger!}
37
+ presentation={live.presentation}
38
+ >
39
+ {() => (
40
+ <div class="dt-pop">
41
+ <CalendarGrid
42
+ mode="single"
43
+ value={() => date.value as IsoDate | null}
44
+ locale={env.locale.value}
45
+ today={env.today.value}
46
+ min={live.min}
47
+ max={live.max}
48
+ isDateUnavailable={live.isDateUnavailable}
49
+ firstDayOfWeek={live.firstDayOfWeek}
50
+ autofocus
51
+ onPick={(iso, reason) => {
52
+ date.value = iso
53
+ emit(reason)
54
+ }}
55
+ />
56
+ <div class="dt-side">
57
+ <p class="dt-cap">Time</p>
58
+ {DateTimeSlots({
59
+ get step() {
60
+ return live.step!
61
+ },
62
+ m,
63
+ })}
64
+ </div>
65
+ </div>
66
+ )}
67
+ </Panel>
68
+ }
69
+ />
70
+ )
71
+ }
72
+
73
+ function dateTimeControls(m: Model) {
74
+ const live = liveProps(m.input)
75
+ const { input, env, value, pop, date, time, refs, onDate, onTime } = m
76
+ return (
77
+ <>
78
+ <Segments
79
+ required={input.rest().required}
80
+ kind="date"
81
+ label="Date"
82
+ locale={env.locale.value}
83
+ value={date.value}
84
+ today={env.today.value}
85
+ disabled={live.disabled}
86
+ readonly={live.readonly}
87
+ onEdit={onDate}
88
+ />
89
+ <span data-part="literal" class="dt-sep" aria-hidden="true">
90
+ ·
91
+ </span>
92
+ <Segments
93
+ required={input.rest().required}
94
+ kind="time"
95
+ label="Time"
96
+ locale={env.locale.value}
97
+ value={time.value}
98
+ today={env.today.value}
99
+ disabled={live.disabled}
100
+ readonly={live.readonly}
101
+ onEdit={onTime}
102
+ />
103
+ <Trigger
104
+ ref={(n: HTMLButtonElement) => (refs.trigger = n)}
105
+ icon={CalendarIcon}
106
+ label="Choose date and time"
107
+ open={pop.value}
108
+ disabled={live.disabled}
109
+ onToggle={() => pop.set(!pop.value)}
110
+ />
111
+ <Hidden name={live.name} value={() => value.value ?? ''} />
112
+ </>
113
+ )
114
+ }
115
+
116
+ function liveProps(input: Model['input']) {
117
+ return {
118
+ get label() {
119
+ return input.label()
120
+ },
121
+ get error() {
122
+ return input.error()
123
+ },
124
+ get disabled() {
125
+ return input.disabled()
126
+ },
127
+ get readonly() {
128
+ return input.readonly()
129
+ },
130
+ get name() {
131
+ return input.name()
132
+ },
133
+ get presentation() {
134
+ return input.presentation()
135
+ },
136
+ get min() {
137
+ return input.min()
138
+ },
139
+ get max() {
140
+ return input.max()
141
+ },
142
+ get isDateUnavailable() {
143
+ return input.isDateUnavailable()
144
+ },
145
+ get firstDayOfWeek() {
146
+ return input.firstDayOfWeek()
147
+ },
148
+ get step() {
149
+ return input.step()
150
+ },
151
+ }
152
+ }
@@ -0,0 +1,80 @@
1
+ // Per-instance state for the time picker.
2
+ import { derived, state } from '@kerf-js/core'
3
+ import {
4
+ fmt,
5
+ fmtTime,
6
+ readTime,
7
+ wallTimeIssue,
8
+ type IsoTime,
9
+ type SegmentPart,
10
+ } from '@kerf-js/veneer-core'
11
+ import { bindable, isSheet, messages, useOpen, usePickerEnv } from './Picker'
12
+ import { stepSlots } from './TimeField-slots'
13
+ import type { SegmentState } from './Segments'
14
+ import type { TimeFieldProps } from './TimeField-types'
15
+
16
+ type Read<T, K extends keyof T> = { [P in K]-?: () => T[P] }
17
+ type Keys =
18
+ | 'value'
19
+ | 'defaultValue'
20
+ | 'onValueChange'
21
+ | 'open'
22
+ | 'defaultOpen'
23
+ | 'onOpenChange'
24
+ | 'hourCycle'
25
+ | 'step'
26
+ | 'seconds'
27
+ | 'min'
28
+ | 'max'
29
+ | 'slots'
30
+ | 'date'
31
+ | 'timeZone'
32
+ | 'locale'
33
+ | 'today'
34
+ | 'name'
35
+ | 'presentation'
36
+ | 'label'
37
+ | 'hint'
38
+ | 'error'
39
+ | 'disabled'
40
+ | 'readonly'
41
+ /** Live access to the time field's props. */
42
+ export type TimeInput = Read<TimeFieldProps, Keys> & {
43
+ rest: () => Record<string, unknown> & { required?: boolean | undefined }
44
+ }
45
+
46
+ /** Create the time picker's state under the caller's owner. */
47
+ export function timeModel(input: TimeInput) {
48
+ const env = usePickerEnv(input.locale, input.today)
49
+ const value = bindable<IsoTime | null>(input.value, input.defaultValue, null, input.onValueChange)
50
+ const pop = useOpen(input.open, input.defaultOpen, input.onOpenChange)
51
+ const started = state(false)
52
+ const sheet = state(false)
53
+ const text = derived(() => messages(env.locale.value))
54
+ const options = derived(() => input.slots() ?? stepSlots(input.step()!, input.min(), input.max()))
55
+ const refs: { trigger: HTMLButtonElement | undefined } = { trigger: undefined }
56
+ const dst = derived(() => {
57
+ if (!value.value || !input.date() || !input.timeZone()) return undefined
58
+ const issue = wallTimeIssue(input.date()!, value.value, input.timeZone()!)
59
+ if (!issue) return undefined
60
+ const day = fmt(input.date()!, { month: 'short', day: 'numeric' }, env.locale.value)
61
+ const city = input.timeZone()!.split('/').pop()!.replace(/_/g, ' ')
62
+ const at = fmtTime(value.value, env.locale.value, input.hourCycle())
63
+ return issue.kind === 'gap'
64
+ ? `${at} doesn't exist on ${day} in ${city}; using ${fmtTime(issue.resolved, env.locale.value, input.hourCycle())}.`
65
+ : `${at} happens twice on ${day} in ${city}; using the first.`
66
+ })
67
+ const onEdit = (st: SegmentState, parts: SegmentPart[]) => {
68
+ started.value = st !== 'empty'
69
+ if (st === 'empty') return value.set(null, 'keyboard')
70
+ if (st === 'complete') {
71
+ const x = readTime(parts)
72
+ if (x) value.set(x, 'keyboard')
73
+ }
74
+ }
75
+ const open = () => {
76
+ sheet.value = isSheet(refs.trigger!, input.presentation())
77
+ pop.set(true)
78
+ }
79
+ return { input, env, value, pop, started, sheet, text, options, refs, dst, onEdit, open }
80
+ }