@prismora/elements 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 (393) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -2
  3. package/components.json +15600 -0
  4. package/custom-elements.json +56320 -0
  5. package/dist/base.d.ts +42 -0
  6. package/dist/base.js +62 -0
  7. package/dist/catalog.d.ts +33 -0
  8. package/dist/catalog.js +803 -0
  9. package/dist/components/accordion.d.ts +31 -0
  10. package/dist/components/accordion.js +63 -0
  11. package/dist/components/alert.d.ts +27 -0
  12. package/dist/components/alert.js +40 -0
  13. package/dist/components/avatar-group.d.ts +23 -0
  14. package/dist/components/avatar-group.js +43 -0
  15. package/dist/components/avatar.d.ts +24 -0
  16. package/dist/components/avatar.js +43 -0
  17. package/dist/components/back-to-top.d.ts +32 -0
  18. package/dist/components/back-to-top.js +50 -0
  19. package/dist/components/badge.d.ts +17 -0
  20. package/dist/components/badge.js +20 -0
  21. package/dist/components/banner.d.ts +34 -0
  22. package/dist/components/banner.js +54 -0
  23. package/dist/components/breadcrumb.d.ts +42 -0
  24. package/dist/components/breadcrumb.js +63 -0
  25. package/dist/components/button-group.d.ts +14 -0
  26. package/dist/components/button-group.js +28 -0
  27. package/dist/components/button.d.ts +59 -0
  28. package/dist/components/button.js +162 -0
  29. package/dist/components/calendar.d.ts +48 -0
  30. package/dist/components/calendar.js +296 -0
  31. package/dist/components/card.d.ts +23 -0
  32. package/dist/components/card.js +44 -0
  33. package/dist/components/carousel.d.ts +41 -0
  34. package/dist/components/carousel.js +156 -0
  35. package/dist/components/cascader.d.ts +70 -0
  36. package/dist/components/cascader.js +220 -0
  37. package/dist/components/chart.d.ts +59 -0
  38. package/dist/components/chart.js +267 -0
  39. package/dist/components/chat.d.ts +98 -0
  40. package/dist/components/chat.js +134 -0
  41. package/dist/components/checkbox-group.d.ts +48 -0
  42. package/dist/components/checkbox-group.js +111 -0
  43. package/dist/components/checkbox.d.ts +23 -0
  44. package/dist/components/checkbox.js +70 -0
  45. package/dist/components/code-block.d.ts +46 -0
  46. package/dist/components/code-block.js +86 -0
  47. package/dist/components/color-picker.d.ts +46 -0
  48. package/dist/components/color-picker.js +292 -0
  49. package/dist/components/combobox.d.ts +89 -0
  50. package/dist/components/combobox.js +384 -0
  51. package/dist/components/command.d.ts +96 -0
  52. package/dist/components/command.js +289 -0
  53. package/dist/components/context-menu.d.ts +23 -0
  54. package/dist/components/context-menu.js +110 -0
  55. package/dist/components/copy-button.d.ts +33 -0
  56. package/dist/components/copy-button.js +62 -0
  57. package/dist/components/countdown.d.ts +36 -0
  58. package/dist/components/countdown.js +56 -0
  59. package/dist/components/data-table.d.ts +180 -0
  60. package/dist/components/data-table.js +1060 -0
  61. package/dist/components/date-picker.d.ts +47 -0
  62. package/dist/components/date-picker.js +267 -0
  63. package/dist/components/description-list.d.ts +38 -0
  64. package/dist/components/description-list.js +41 -0
  65. package/dist/components/dialog.d.ts +47 -0
  66. package/dist/components/dialog.js +189 -0
  67. package/dist/components/divider.d.ts +16 -0
  68. package/dist/components/divider.js +23 -0
  69. package/dist/components/drawer.d.ts +19 -0
  70. package/dist/components/drawer.js +27 -0
  71. package/dist/components/editor.d.ts +50 -0
  72. package/dist/components/editor.js +474 -0
  73. package/dist/components/empty-state.d.ts +24 -0
  74. package/dist/components/empty-state.js +27 -0
  75. package/dist/components/file-upload.d.ts +56 -0
  76. package/dist/components/file-upload.js +176 -0
  77. package/dist/components/form-control.d.ts +69 -0
  78. package/dist/components/form-control.js +134 -0
  79. package/dist/components/form.d.ts +38 -0
  80. package/dist/components/form.js +161 -0
  81. package/dist/components/format-number.d.ts +37 -0
  82. package/dist/components/format-number.js +86 -0
  83. package/dist/components/icon.d.ts +34 -0
  84. package/dist/components/icon.js +47 -0
  85. package/dist/components/image.d.ts +44 -0
  86. package/dist/components/image.js +53 -0
  87. package/dist/components/indicator.d.ts +41 -0
  88. package/dist/components/indicator.js +65 -0
  89. package/dist/components/inline-edit.d.ts +45 -0
  90. package/dist/components/inline-edit.js +129 -0
  91. package/dist/components/input.d.ts +55 -0
  92. package/dist/components/input.js +186 -0
  93. package/dist/components/kbd.d.ts +15 -0
  94. package/dist/components/kbd.js +18 -0
  95. package/dist/components/list.d.ts +68 -0
  96. package/dist/components/list.js +180 -0
  97. package/dist/components/menu.d.ts +22 -0
  98. package/dist/components/menu.js +182 -0
  99. package/dist/components/menubar.d.ts +20 -0
  100. package/dist/components/menubar.js +120 -0
  101. package/dist/components/meter.d.ts +38 -0
  102. package/dist/components/meter.js +48 -0
  103. package/dist/components/nav.d.ts +91 -0
  104. package/dist/components/nav.js +228 -0
  105. package/dist/components/number-input.d.ts +26 -0
  106. package/dist/components/number-input.js +70 -0
  107. package/dist/components/pagination.d.ts +44 -0
  108. package/dist/components/pagination.js +94 -0
  109. package/dist/components/pin-input.d.ts +25 -0
  110. package/dist/components/pin-input.js +128 -0
  111. package/dist/components/popover.d.ts +23 -0
  112. package/dist/components/popover.js +140 -0
  113. package/dist/components/progress.d.ts +26 -0
  114. package/dist/components/progress.js +66 -0
  115. package/dist/components/pull-refresh.d.ts +41 -0
  116. package/dist/components/pull-refresh.js +101 -0
  117. package/dist/components/qr-code.d.ts +33 -0
  118. package/dist/components/qr-code.js +54 -0
  119. package/dist/components/radio-group.d.ts +37 -0
  120. package/dist/components/radio-group.js +82 -0
  121. package/dist/components/range-slider.d.ts +46 -0
  122. package/dist/components/range-slider.js +95 -0
  123. package/dist/components/rating.d.ts +38 -0
  124. package/dist/components/rating.js +80 -0
  125. package/dist/components/relative-time.d.ts +31 -0
  126. package/dist/components/relative-time.js +51 -0
  127. package/dist/components/scheduler.d.ts +84 -0
  128. package/dist/components/scheduler.js +187 -0
  129. package/dist/components/segmented.d.ts +58 -0
  130. package/dist/components/segmented.js +129 -0
  131. package/dist/components/select.d.ts +62 -0
  132. package/dist/components/select.js +140 -0
  133. package/dist/components/share-button.d.ts +37 -0
  134. package/dist/components/share-button.js +60 -0
  135. package/dist/components/signature.d.ts +54 -0
  136. package/dist/components/signature.js +152 -0
  137. package/dist/components/skeleton.d.ts +21 -0
  138. package/dist/components/skeleton.js +26 -0
  139. package/dist/components/slider.d.ts +31 -0
  140. package/dist/components/slider.js +80 -0
  141. package/dist/components/sortable.d.ts +22 -0
  142. package/dist/components/sortable.js +196 -0
  143. package/dist/components/sparkline.d.ts +28 -0
  144. package/dist/components/sparkline.js +46 -0
  145. package/dist/components/spinner.d.ts +16 -0
  146. package/dist/components/spinner.js +22 -0
  147. package/dist/components/splitter.d.ts +28 -0
  148. package/dist/components/splitter.js +89 -0
  149. package/dist/components/stat.d.ts +28 -0
  150. package/dist/components/stat.js +33 -0
  151. package/dist/components/steps.d.ts +53 -0
  152. package/dist/components/steps.js +91 -0
  153. package/dist/components/switch.d.ts +12 -0
  154. package/dist/components/switch.js +18 -0
  155. package/dist/components/table.d.ts +58 -0
  156. package/dist/components/table.js +96 -0
  157. package/dist/components/tabs.d.ts +62 -0
  158. package/dist/components/tabs.js +310 -0
  159. package/dist/components/tag.d.ts +32 -0
  160. package/dist/components/tag.js +58 -0
  161. package/dist/components/textarea.d.ts +25 -0
  162. package/dist/components/textarea.js +56 -0
  163. package/dist/components/theme-switch.d.ts +51 -0
  164. package/dist/components/theme-switch.js +85 -0
  165. package/dist/components/time-picker.d.ts +39 -0
  166. package/dist/components/time-picker.js +257 -0
  167. package/dist/components/timeline.d.ts +38 -0
  168. package/dist/components/timeline.js +56 -0
  169. package/dist/components/toaster.d.ts +25 -0
  170. package/dist/components/toaster.js +44 -0
  171. package/dist/components/toggle-group.d.ts +70 -0
  172. package/dist/components/toggle-group.js +172 -0
  173. package/dist/components/toolbar.d.ts +23 -0
  174. package/dist/components/toolbar.js +81 -0
  175. package/dist/components/tooltip.d.ts +18 -0
  176. package/dist/components/tooltip.js +92 -0
  177. package/dist/components/tour.d.ts +41 -0
  178. package/dist/components/tour.js +197 -0
  179. package/dist/components/transfer.d.ts +57 -0
  180. package/dist/components/transfer.js +161 -0
  181. package/dist/components/tree-select.d.ts +66 -0
  182. package/dist/components/tree-select.js +282 -0
  183. package/dist/components/tree.d.ts +129 -0
  184. package/dist/components/tree.js +427 -0
  185. package/dist/components/virtual-list.d.ts +41 -0
  186. package/dist/components/virtual-list.js +77 -0
  187. package/dist/confirm.d.ts +21 -0
  188. package/dist/confirm.js +69 -0
  189. package/dist/count.d.ts +5 -0
  190. package/dist/count.js +12 -0
  191. package/dist/data-table/icons.d.ts +8 -0
  192. package/dist/data-table/icons.js +10 -0
  193. package/dist/data-table/logic.d.ts +33 -0
  194. package/dist/data-table/logic.js +141 -0
  195. package/dist/data-table/strings.d.ts +37 -0
  196. package/dist/data-table/strings.js +36 -0
  197. package/dist/data-table/types.d.ts +76 -0
  198. package/dist/data-table/types.js +1 -0
  199. package/dist/define.d.ts +2 -0
  200. package/dist/define.js +2 -0
  201. package/dist/field-validity.d.ts +42 -0
  202. package/dist/field-validity.js +58 -0
  203. package/dist/floating.d.ts +13 -0
  204. package/dist/floating.js +65 -0
  205. package/dist/highlight.d.ts +11 -0
  206. package/dist/highlight.js +103 -0
  207. package/dist/id.d.ts +2 -0
  208. package/dist/id.js +3 -0
  209. package/dist/index.d.ts +102 -0
  210. package/dist/index.js +102 -0
  211. package/dist/manifest.d.ts +51 -0
  212. package/dist/manifest.js +11 -0
  213. package/dist/named-icon.d.ts +8 -0
  214. package/dist/named-icon.js +8 -0
  215. package/dist/patterns/account.d.ts +6 -0
  216. package/dist/patterns/account.js +137 -0
  217. package/dist/patterns/app.d.ts +7 -0
  218. package/dist/patterns/app.js +351 -0
  219. package/dist/patterns/commerce.d.ts +4 -0
  220. package/dist/patterns/commerce.js +200 -0
  221. package/dist/patterns/flows.d.ts +3 -0
  222. package/dist/patterns/flows.js +100 -0
  223. package/dist/patterns/index.d.ts +9 -0
  224. package/dist/patterns/index.js +29 -0
  225. package/dist/patterns/marketing.d.ts +4 -0
  226. package/dist/patterns/marketing.js +173 -0
  227. package/dist/patterns/more.d.ts +15 -0
  228. package/dist/patterns/more.js +581 -0
  229. package/dist/patterns/shell.d.ts +9 -0
  230. package/dist/patterns/shell.js +48 -0
  231. package/dist/patterns/types.d.ts +19 -0
  232. package/dist/patterns/types.js +1 -0
  233. package/dist/position.d.ts +2 -0
  234. package/dist/position.js +33 -0
  235. package/dist/prismora.standalone.js +5222 -0
  236. package/dist/prismora.standalone.js.map +199 -0
  237. package/dist/qr.d.ts +14 -0
  238. package/dist/qr.js +258 -0
  239. package/dist/register.d.ts +8 -0
  240. package/dist/register.js +21 -0
  241. package/dist/registry.d.ts +203 -0
  242. package/dist/registry.js +203 -0
  243. package/dist/remote.d.ts +58 -0
  244. package/dist/remote.js +130 -0
  245. package/dist/sheet.d.ts +34 -0
  246. package/dist/sheet.js +153 -0
  247. package/dist/styles/accordion.d.ts +2 -0
  248. package/dist/styles/accordion.js +3 -0
  249. package/dist/styles/alert.d.ts +2 -0
  250. package/dist/styles/alert.js +3 -0
  251. package/dist/styles/avatar.d.ts +2 -0
  252. package/dist/styles/avatar.js +3 -0
  253. package/dist/styles/badge.d.ts +2 -0
  254. package/dist/styles/badge.js +3 -0
  255. package/dist/styles/banner.d.ts +2 -0
  256. package/dist/styles/banner.js +3 -0
  257. package/dist/styles/breadcrumb.d.ts +2 -0
  258. package/dist/styles/breadcrumb.js +3 -0
  259. package/dist/styles/button.d.ts +2 -0
  260. package/dist/styles/button.js +3 -0
  261. package/dist/styles/calendar.d.ts +2 -0
  262. package/dist/styles/calendar.js +3 -0
  263. package/dist/styles/card.d.ts +2 -0
  264. package/dist/styles/card.js +3 -0
  265. package/dist/styles/carousel.d.ts +2 -0
  266. package/dist/styles/carousel.js +3 -0
  267. package/dist/styles/chart.d.ts +2 -0
  268. package/dist/styles/chart.js +3 -0
  269. package/dist/styles/chat.d.ts +2 -0
  270. package/dist/styles/chat.js +3 -0
  271. package/dist/styles/checkbox.d.ts +2 -0
  272. package/dist/styles/checkbox.js +3 -0
  273. package/dist/styles/color-picker.d.ts +2 -0
  274. package/dist/styles/color-picker.js +3 -0
  275. package/dist/styles/combobox.d.ts +2 -0
  276. package/dist/styles/combobox.js +3 -0
  277. package/dist/styles/command.d.ts +2 -0
  278. package/dist/styles/command.js +3 -0
  279. package/dist/styles/data-table.d.ts +2 -0
  280. package/dist/styles/data-table.js +3 -0
  281. package/dist/styles/description-list.d.ts +2 -0
  282. package/dist/styles/description-list.js +3 -0
  283. package/dist/styles/dialog.d.ts +2 -0
  284. package/dist/styles/dialog.js +3 -0
  285. package/dist/styles/drawer.d.ts +2 -0
  286. package/dist/styles/drawer.js +3 -0
  287. package/dist/styles/editor.d.ts +2 -0
  288. package/dist/styles/editor.js +3 -0
  289. package/dist/styles/empty-state.d.ts +2 -0
  290. package/dist/styles/empty-state.js +3 -0
  291. package/dist/styles/extras.d.ts +2 -0
  292. package/dist/styles/extras.js +3 -0
  293. package/dist/styles/field.d.ts +2 -0
  294. package/dist/styles/field.js +3 -0
  295. package/dist/styles/file-upload.d.ts +2 -0
  296. package/dist/styles/file-upload.js +3 -0
  297. package/dist/styles/foundation.d.ts +2 -0
  298. package/dist/styles/foundation.js +3 -0
  299. package/dist/styles/helpers.d.ts +2 -0
  300. package/dist/styles/helpers.js +3 -0
  301. package/dist/styles/icon.d.ts +2 -0
  302. package/dist/styles/icon.js +3 -0
  303. package/dist/styles/image.d.ts +2 -0
  304. package/dist/styles/image.js +3 -0
  305. package/dist/styles/indicator.d.ts +2 -0
  306. package/dist/styles/indicator.js +3 -0
  307. package/dist/styles/input.d.ts +2 -0
  308. package/dist/styles/input.js +3 -0
  309. package/dist/styles/kbd.d.ts +2 -0
  310. package/dist/styles/kbd.js +3 -0
  311. package/dist/styles/list.d.ts +2 -0
  312. package/dist/styles/list.js +3 -0
  313. package/dist/styles/listbox.d.ts +2 -0
  314. package/dist/styles/listbox.js +3 -0
  315. package/dist/styles/meter.d.ts +2 -0
  316. package/dist/styles/meter.js +3 -0
  317. package/dist/styles/nav.d.ts +2 -0
  318. package/dist/styles/nav.js +3 -0
  319. package/dist/styles/number-input.d.ts +2 -0
  320. package/dist/styles/number-input.js +3 -0
  321. package/dist/styles/overlay.d.ts +2 -0
  322. package/dist/styles/overlay.js +3 -0
  323. package/dist/styles/pagination.d.ts +2 -0
  324. package/dist/styles/pagination.js +3 -0
  325. package/dist/styles/pickers.d.ts +2 -0
  326. package/dist/styles/pickers.js +3 -0
  327. package/dist/styles/pin-input.d.ts +2 -0
  328. package/dist/styles/pin-input.js +3 -0
  329. package/dist/styles/popover.d.ts +2 -0
  330. package/dist/styles/popover.js +3 -0
  331. package/dist/styles/progress.d.ts +2 -0
  332. package/dist/styles/progress.js +3 -0
  333. package/dist/styles/pull-refresh.d.ts +2 -0
  334. package/dist/styles/pull-refresh.js +3 -0
  335. package/dist/styles/range-slider.d.ts +2 -0
  336. package/dist/styles/range-slider.js +3 -0
  337. package/dist/styles/rating.d.ts +2 -0
  338. package/dist/styles/rating.js +3 -0
  339. package/dist/styles/scheduler.d.ts +2 -0
  340. package/dist/styles/scheduler.js +3 -0
  341. package/dist/styles/segmented.d.ts +2 -0
  342. package/dist/styles/segmented.js +3 -0
  343. package/dist/styles/select.d.ts +2 -0
  344. package/dist/styles/select.js +3 -0
  345. package/dist/styles/separator.d.ts +2 -0
  346. package/dist/styles/separator.js +3 -0
  347. package/dist/styles/sheet.d.ts +2 -0
  348. package/dist/styles/sheet.js +3 -0
  349. package/dist/styles/skeleton.d.ts +2 -0
  350. package/dist/styles/skeleton.js +3 -0
  351. package/dist/styles/slider.d.ts +2 -0
  352. package/dist/styles/slider.js +3 -0
  353. package/dist/styles/sortable.d.ts +2 -0
  354. package/dist/styles/sortable.js +3 -0
  355. package/dist/styles/spinner.d.ts +2 -0
  356. package/dist/styles/spinner.js +3 -0
  357. package/dist/styles/splitter.d.ts +2 -0
  358. package/dist/styles/splitter.js +3 -0
  359. package/dist/styles/stat.d.ts +2 -0
  360. package/dist/styles/stat.js +3 -0
  361. package/dist/styles/steps.d.ts +2 -0
  362. package/dist/styles/steps.js +3 -0
  363. package/dist/styles/surface.d.ts +2 -0
  364. package/dist/styles/surface.js +3 -0
  365. package/dist/styles/switch.d.ts +2 -0
  366. package/dist/styles/switch.js +3 -0
  367. package/dist/styles/table.d.ts +2 -0
  368. package/dist/styles/table.js +3 -0
  369. package/dist/styles/tabs.d.ts +2 -0
  370. package/dist/styles/tabs.js +3 -0
  371. package/dist/styles/tag.d.ts +2 -0
  372. package/dist/styles/tag.js +3 -0
  373. package/dist/styles/time-picker.d.ts +2 -0
  374. package/dist/styles/time-picker.js +3 -0
  375. package/dist/styles/timeline.d.ts +2 -0
  376. package/dist/styles/timeline.js +3 -0
  377. package/dist/styles/toast.d.ts +2 -0
  378. package/dist/styles/toast.js +3 -0
  379. package/dist/styles/toggle.d.ts +2 -0
  380. package/dist/styles/toggle.js +3 -0
  381. package/dist/styles/toolbar.d.ts +2 -0
  382. package/dist/styles/toolbar.js +3 -0
  383. package/dist/styles/tooltip.d.ts +2 -0
  384. package/dist/styles/tooltip.js +3 -0
  385. package/dist/styles/tree.d.ts +2 -0
  386. package/dist/styles/tree.js +3 -0
  387. package/dist/table-core.d.ts +75 -0
  388. package/dist/table-core.js +205 -0
  389. package/dist/toast.d.ts +42 -0
  390. package/dist/toast.js +206 -0
  391. package/dist/top-layer.d.ts +4 -0
  392. package/dist/top-layer.js +33 -0
  393. package/package.json +101 -4
@@ -0,0 +1,23 @@
1
+ import { SafeHTMLElement } from '../base.js';
2
+ /**
3
+ * Toolbar that groups related controls into one Tab stop, moved through with the arrow keys.
4
+ *
5
+ * Uses role="toolbar"; Home/End jump to the ends.
6
+ *
7
+ * Light DOM, so it works around any buttons, toggles or inputs. Separate groups with `<pm-divider
8
+ * orientation="vertical">`.
9
+ * @tag pm-toolbar
10
+ * @attr {string} label - Accessible name of the toolbar.
11
+ * @attr {'horizontal' | 'vertical'} orientation - Arrow-key direction and layout.
12
+ * @slot - Controls.
13
+ * @example <pm-toolbar label="Formatting"><pm-button variant="ghost">Bold</pm-button><pm-button variant="ghost">Italic</pm-button></pm-toolbar>
14
+ */
15
+ export declare class PmToolbar extends SafeHTMLElement {
16
+ #private;
17
+ static observedAttributes: string[];
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ attributeChangedCallback(): void;
21
+ /** Enabled controls in order (nested inputs inside composite children are skipped). */
22
+ get items(): HTMLElement[];
23
+ }
@@ -0,0 +1,81 @@
1
+ import { SafeHTMLElement, defineElement } from '../base.js';
2
+ import toolbarCss from '../styles/toolbar.js';
3
+ const FOCUSABLE = 'button, [role="button"], a[href], input, select, textarea, pm-button, pm-toggle, pm-copy-button, [tabindex]';
4
+ /**
5
+ * Toolbar that groups related controls into one Tab stop, moved through with the arrow keys.
6
+ *
7
+ * Uses role="toolbar"; Home/End jump to the ends.
8
+ *
9
+ * Light DOM, so it works around any buttons, toggles or inputs. Separate groups with `<pm-divider
10
+ * orientation="vertical">`.
11
+ * @tag pm-toolbar
12
+ * @attr {string} label - Accessible name of the toolbar.
13
+ * @attr {'horizontal' | 'vertical'} orientation - Arrow-key direction and layout.
14
+ * @slot - Controls.
15
+ * @example <pm-toolbar label="Formatting"><pm-button variant="ghost">Bold</pm-button><pm-button variant="ghost">Italic</pm-button></pm-toolbar>
16
+ */
17
+ export class PmToolbar extends SafeHTMLElement {
18
+ static { this.observedAttributes = ['label', 'orientation']; }
19
+ connectedCallback() {
20
+ this.classList.add('pm-toolbar');
21
+ this.setAttribute('role', 'toolbar');
22
+ this.attributeChangedCallback();
23
+ this.addEventListener('keydown', this.#onKey);
24
+ this.addEventListener('focusin', this.#onFocus);
25
+ queueMicrotask(() => this.#reset());
26
+ }
27
+ disconnectedCallback() { this.removeEventListener('keydown', this.#onKey); this.removeEventListener('focusin', this.#onFocus); }
28
+ attributeChangedCallback() {
29
+ const l = this.getAttribute('label');
30
+ if (l)
31
+ this.setAttribute('aria-label', l);
32
+ this.setAttribute('aria-orientation', this.getAttribute('orientation') === 'vertical' ? 'vertical' : 'horizontal');
33
+ }
34
+ /** Enabled controls in order (nested inputs inside composite children are skipped). */
35
+ get items() {
36
+ return [...this.querySelectorAll(FOCUSABLE)].filter((el) => !el.matches(':disabled, [disabled], [aria-disabled="true"]') && el.closest('pm-toolbar') === this
37
+ && !el.parentElement?.closest(FOCUSABLE.replace(', [tabindex]', '')) && el.getAttribute('role') !== 'toolbar');
38
+ }
39
+ #reset() {
40
+ const items = this.items;
41
+ const cur = items.find((i) => i.tabIndex === 0) ?? items[0];
42
+ for (const i of items)
43
+ i.tabIndex = i === cur ? 0 : -1;
44
+ }
45
+ #onFocus = (e) => {
46
+ const items = this.items;
47
+ const t = items.find((i) => i === e.target || i.contains(e.target));
48
+ if (t)
49
+ for (const i of items)
50
+ i.tabIndex = i === t ? 0 : -1;
51
+ };
52
+ #onKey = (e) => {
53
+ if (e.defaultPrevented)
54
+ return;
55
+ const t = e.target;
56
+ if (t.matches('input:not([type=checkbox]):not([type=radio]), textarea, select') && (e.key === 'ArrowLeft' || e.key === 'ArrowRight'))
57
+ return;
58
+ const items = this.items;
59
+ const i = items.findIndex((x) => x === t || x.contains(t));
60
+ if (i < 0)
61
+ return;
62
+ const vert = this.getAttribute('orientation') === 'vertical';
63
+ const rtl = getComputedStyle(this).direction === 'rtl';
64
+ const next = vert ? { ArrowDown: 1, ArrowUp: -1 }[e.key] : { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[e.key];
65
+ let j;
66
+ if (next)
67
+ j = (i + next + items.length) % items.length;
68
+ else if (e.key === 'Home')
69
+ j = 0;
70
+ else if (e.key === 'End')
71
+ j = items.length - 1;
72
+ if (j === undefined)
73
+ return;
74
+ e.preventDefault();
75
+ for (const x of items)
76
+ x.tabIndex = -1;
77
+ items[j].tabIndex = 0;
78
+ items[j].focus();
79
+ };
80
+ }
81
+ defineElement('pm-toolbar', PmToolbar, [toolbarCss]);
@@ -0,0 +1,18 @@
1
+ import { SafeHTMLElement } from '../base.js';
2
+ /**
3
+ * Tooltip for a trigger referenced by `for`.
4
+ *
5
+ * Uses `popover="hint"` + interest (hover/focus/long-press), hoverable and Esc-dismissible (WCAG 1.4.13). Sets
6
+ * `aria-describedby` (or `aria-labelledby` for icon-only triggers without a name).
7
+ * @tag pm-tooltip
8
+ * @attr {string} for - id of the trigger element.
9
+ * @slot - Tooltip text.
10
+ * @example <button id="bold" aria-label="Bold">B</button><pm-tooltip for="bold">Bold (⌘B)</pm-tooltip>
11
+ */
12
+ export declare class PmTooltip extends SafeHTMLElement {
13
+ #private;
14
+ static get observedAttributes(): string[];
15
+ connectedCallback(): void;
16
+ disconnectedCallback(): void;
17
+ attributeChangedCallback(): void;
18
+ }
@@ -0,0 +1,92 @@
1
+ import { nextId, SafeHTMLElement, defineElement } from '../base.js';
2
+ import { fallbackPosition } from '../position.js';
3
+ import overlayCss from '../styles/overlay.js';
4
+ import popoverCss from '../styles/popover.js';
5
+ import tooltipCss from '../styles/tooltip.js';
6
+ /**
7
+ * Tooltip for a trigger referenced by `for`.
8
+ *
9
+ * Uses `popover="hint"` + interest (hover/focus/long-press), hoverable and Esc-dismissible (WCAG 1.4.13). Sets
10
+ * `aria-describedby` (or `aria-labelledby` for icon-only triggers without a name).
11
+ * @tag pm-tooltip
12
+ * @attr {string} for - id of the trigger element.
13
+ * @slot - Tooltip text.
14
+ * @example <button id="bold" aria-label="Bold">B</button><pm-tooltip for="bold">Bold (⌘B)</pm-tooltip>
15
+ */
16
+ export class PmTooltip extends SafeHTMLElement {
17
+ #trigger = null;
18
+ #showTimer = 0;
19
+ #hideTimer = 0;
20
+ static get observedAttributes() { return ['for']; }
21
+ connectedCallback() {
22
+ this.classList.add('pm-tooltip');
23
+ if (!this.id)
24
+ this.id = nextId('tip');
25
+ this.setAttribute('role', 'tooltip');
26
+ const probe = document.createElement('div');
27
+ probe.setAttribute('popover', 'hint');
28
+ this.setAttribute('popover', probe.popover === 'hint' ? 'hint' : 'manual');
29
+ this.addEventListener('pointerenter', () => clearTimeout(this.#hideTimer));
30
+ this.addEventListener('pointerleave', () => this.#scheduleHide());
31
+ queueMicrotask(() => this.#wire());
32
+ }
33
+ disconnectedCallback() { this.#unwire(); }
34
+ attributeChangedCallback() { if (this.isConnected) {
35
+ this.#unwire();
36
+ this.#wire();
37
+ } }
38
+ #wire() {
39
+ const id = this.getAttribute('for');
40
+ const root = this.getRootNode();
41
+ this.#trigger = id ? (root.getElementById?.(id) ?? document.getElementById(id)) : this.previousElementSibling;
42
+ const t = this.#trigger;
43
+ if (!t)
44
+ return;
45
+ const name = (t.getAttribute('aria-label') ?? t.textContent ?? '').trim();
46
+ const text = (this.textContent ?? '').trim();
47
+ if (!name && !t.hasAttribute('aria-labelledby'))
48
+ t.setAttribute('aria-labelledby', this.id);
49
+ else if (name !== text && !t.hasAttribute('aria-describedby'))
50
+ t.setAttribute('aria-describedby', this.id);
51
+ t.addEventListener('pointerenter', this.#scheduleShow);
52
+ t.addEventListener('pointerleave', this.#scheduleHide);
53
+ t.addEventListener('focusin', this.#showNow);
54
+ t.addEventListener('focusout', this.#scheduleHide);
55
+ t.addEventListener('keydown', this.#onKey);
56
+ }
57
+ #unwire() {
58
+ const t = this.#trigger;
59
+ if (!t)
60
+ return;
61
+ t.removeEventListener('pointerenter', this.#scheduleShow);
62
+ t.removeEventListener('pointerleave', this.#scheduleHide);
63
+ t.removeEventListener('focusin', this.#showNow);
64
+ t.removeEventListener('focusout', this.#scheduleHide);
65
+ t.removeEventListener('keydown', this.#onKey);
66
+ }
67
+ #scheduleShow = () => {
68
+ clearTimeout(this.#hideTimer);
69
+ this.#showTimer = window.setTimeout(this.#showNow, 350);
70
+ };
71
+ #scheduleHide = () => {
72
+ clearTimeout(this.#showTimer);
73
+ this.#hideTimer = window.setTimeout(() => this.#hide(), 150);
74
+ };
75
+ #showNow = () => {
76
+ clearTimeout(this.#hideTimer);
77
+ if (!this.#trigger || this.matches(':popover-open'))
78
+ return;
79
+ try {
80
+ this.showPopover({ source: this.#trigger });
81
+ }
82
+ catch {
83
+ this.showPopover();
84
+ }
85
+ fallbackPosition(this, this.#trigger, this.dataset.side === 'bottom' ? 'bottom' : 'top');
86
+ };
87
+ #hide() { if (this.matches(':popover-open'))
88
+ this.hidePopover(); }
89
+ #onKey = (e) => { if (e.key === 'Escape')
90
+ this.#hide(); };
91
+ }
92
+ defineElement('pm-tooltip', PmTooltip, [overlayCss, popoverCss, tooltipCss]);
@@ -0,0 +1,41 @@
1
+ import { SafeHTMLElement } from '../base.js';
2
+ export interface TourStep {
3
+ /** CSS selector of the element this step points at. Without it (or when nothing matches) the card is centred. */
4
+ target?: string;
5
+ title: string;
6
+ text?: string;
7
+ }
8
+ /**
9
+ * Product tour: a card that points at one part of the page at a time, with Back, Next and Skip.
10
+ *
11
+ * Give it `steps` and call `start()`, or use a button: `<pm-button commandfor="tour" command="--start">`. The highlighted element is scrolled into view, the rest of the page is
12
+ * dimmed, focus moves into the card and returns to where it was when the tour ends. Escape skips the tour.
13
+ * @tag pm-tour
14
+ * @attr {string} steps - JSON array of `{ target, title, text }` (also a property).
15
+ * @attr {string} label - Accessible name of the tour (default "Tour").
16
+ * @fires pm-step - A step is shown. detail: { index, step }
17
+ * @fires pm-finish - The last step was completed. detail: { index }
18
+ * @fires pm-skip - The tour was closed early. detail: { index }
19
+ * @example <pm-tour id="tour" steps='[{"target":"#new","title":"Create","text":"Start a project here."}]'></pm-tour>
20
+ */
21
+ export declare class PmTour extends SafeHTMLElement {
22
+ #private;
23
+ static get observedAttributes(): string[];
24
+ /** The steps, in order. */
25
+ get steps(): TourStep[];
26
+ set steps(v: TourStep[]);
27
+ /** Index of the step being shown, or -1 when the tour is not running. */
28
+ get index(): number;
29
+ get active(): boolean;
30
+ connectedCallback(): void;
31
+ disconnectedCallback(): void;
32
+ attributeChangedCallback(): void;
33
+ /** Start the tour at a step (default the first). */
34
+ start(index?: number): void;
35
+ next(): void;
36
+ back(): void;
37
+ /** End the tour as completed. */
38
+ finish(): void;
39
+ /** End the tour early. */
40
+ skip(): void;
41
+ }
@@ -0,0 +1,197 @@
1
+ import { SafeHTMLElement, defineElement } from '../base.js';
2
+ import buttonCss from '../styles/button.js';
3
+ import extrasCss from '../styles/extras.js';
4
+ /**
5
+ * Product tour: a card that points at one part of the page at a time, with Back, Next and Skip.
6
+ *
7
+ * Give it `steps` and call `start()`, or use a button: `<pm-button commandfor="tour" command="--start">`. The highlighted element is scrolled into view, the rest of the page is
8
+ * dimmed, focus moves into the card and returns to where it was when the tour ends. Escape skips the tour.
9
+ * @tag pm-tour
10
+ * @attr {string} steps - JSON array of `{ target, title, text }` (also a property).
11
+ * @attr {string} label - Accessible name of the tour (default "Tour").
12
+ * @fires pm-step - A step is shown. detail: { index, step }
13
+ * @fires pm-finish - The last step was completed. detail: { index }
14
+ * @fires pm-skip - The tour was closed early. detail: { index }
15
+ * @example <pm-tour id="tour" steps='[{"target":"#new","title":"Create","text":"Start a project here."}]'></pm-tour>
16
+ */
17
+ export class PmTour extends SafeHTMLElement {
18
+ static get observedAttributes() { return ['steps']; }
19
+ #steps = [];
20
+ #index = -1;
21
+ #card;
22
+ #ring;
23
+ #returnTo = null;
24
+ #raf = 0;
25
+ /** The steps, in order. */
26
+ get steps() { return this.#steps; }
27
+ set steps(v) { this.#steps = Array.isArray(v) ? v : []; }
28
+ /** Index of the step being shown, or -1 when the tour is not running. */
29
+ get index() { return this.#index; }
30
+ get active() { return this.#index >= 0; }
31
+ connectedCallback() {
32
+ this.style.display = 'contents';
33
+ this.#parse();
34
+ // Invoker commands: <pm-button commandfor="tour" command="--start">
35
+ this.addEventListener('command', this.#onCommand);
36
+ }
37
+ #onCommand = (e) => {
38
+ const c = e.command;
39
+ if (c === '--start')
40
+ this.start();
41
+ else if (c === '--skip')
42
+ this.skip();
43
+ };
44
+ disconnectedCallback() { this.#end(); }
45
+ attributeChangedCallback() { this.#parse(); }
46
+ #parse() {
47
+ const raw = this.getAttribute('steps');
48
+ if (!raw)
49
+ return;
50
+ try {
51
+ const v = JSON.parse(raw);
52
+ if (Array.isArray(v))
53
+ this.#steps = v;
54
+ }
55
+ catch { /* keep the previous steps */ }
56
+ }
57
+ /** Start the tour at a step (default the first). */
58
+ start(index = 0) {
59
+ if (!this.#steps.length)
60
+ return;
61
+ if (!this.active)
62
+ this.#returnTo = document.activeElement;
63
+ this.#build();
64
+ this.#show(Math.max(0, Math.min(index, this.#steps.length - 1)));
65
+ }
66
+ next() { if (this.#index >= this.#steps.length - 1)
67
+ this.finish();
68
+ else
69
+ this.#show(this.#index + 1); }
70
+ back() { if (this.#index > 0)
71
+ this.#show(this.#index - 1); }
72
+ /** End the tour as completed. */
73
+ finish() { const index = this.#index; if (index < 0)
74
+ return; this.#end(); this.#notify('pm-finish', { index }); }
75
+ /** End the tour early. */
76
+ skip() { const index = this.#index; if (index < 0)
77
+ return; this.#end(); this.#notify('pm-skip', { index }); }
78
+ #notify(name, detail) { this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true })); }
79
+ #build() {
80
+ if (this.#card)
81
+ return;
82
+ const ring = document.createElement('div');
83
+ ring.className = 'pm-tour-ring';
84
+ ring.setAttribute('aria-hidden', 'true');
85
+ const card = document.createElement('div');
86
+ card.className = 'pm-tour-card';
87
+ card.setAttribute('popover', 'manual');
88
+ card.setAttribute('role', 'dialog');
89
+ card.setAttribute('aria-label', this.getAttribute('label') ?? 'Tour');
90
+ card.addEventListener('keydown', (e) => { if (e.key === 'Escape') {
91
+ e.preventDefault();
92
+ this.skip();
93
+ } });
94
+ card.addEventListener('click', (e) => {
95
+ const act = e.target.closest('[data-act]')?.dataset.act;
96
+ if (act === 'next')
97
+ this.next();
98
+ else if (act === 'back')
99
+ this.back();
100
+ else if (act === 'skip')
101
+ this.skip();
102
+ });
103
+ this.append(ring, card);
104
+ this.#ring = ring;
105
+ this.#card = card;
106
+ addEventListener('resize', this.#place);
107
+ addEventListener('scroll', this.#place, true);
108
+ }
109
+ #end() {
110
+ if (!this.#card)
111
+ return;
112
+ removeEventListener('resize', this.#place);
113
+ removeEventListener('scroll', this.#place, true);
114
+ cancelAnimationFrame(this.#raf);
115
+ try {
116
+ this.#card.hidePopover();
117
+ }
118
+ catch { /* not open */ }
119
+ this.#card.remove();
120
+ this.#ring?.remove();
121
+ this.#card = undefined;
122
+ this.#ring = undefined;
123
+ this.#index = -1;
124
+ this.#returnTo?.focus?.();
125
+ this.#returnTo = null;
126
+ }
127
+ #target() {
128
+ const sel = this.#steps[this.#index]?.target;
129
+ if (!sel)
130
+ return null;
131
+ try {
132
+ const el = document.querySelector(sel);
133
+ return el && el.getClientRects().length ? el : null;
134
+ }
135
+ catch {
136
+ return null;
137
+ }
138
+ }
139
+ #show(index) {
140
+ const card = this.#card;
141
+ const step = this.#steps[index];
142
+ this.#index = index;
143
+ const last = index === this.#steps.length - 1;
144
+ const el = (tag, cls, text) => { const n = document.createElement(tag); n.className = cls; n.textContent = text; return n; };
145
+ const button = (act, text, variant) => { const b = el('button', 'pm-button', text); b.type = 'button'; b.dataset.act = act; b.dataset.size = 'sm'; b.dataset.variant = variant; if (variant !== 'solid')
146
+ b.dataset.tone = 'neutral'; return b; };
147
+ const foot = el('div', 'pm-tour-foot', '');
148
+ foot.append(el('span', 'pm-tour-count', `${index + 1} of ${this.#steps.length}`));
149
+ if (!last)
150
+ foot.append(button('skip', 'Skip', 'ghost'));
151
+ if (index > 0)
152
+ foot.append(button('back', 'Back', 'outline'));
153
+ const primary = button('next', last ? 'Done' : 'Next', 'solid');
154
+ foot.append(primary);
155
+ const title = el('h2', 'pm-tour-title', step.title);
156
+ title.id = 'pm-tour-title';
157
+ card.setAttribute('aria-labelledby', 'pm-tour-title');
158
+ card.replaceChildren(title, ...(step.text ? [el('p', 'pm-tour-text', step.text)] : []), foot, el('span', 'pm-visually-hidden', ''));
159
+ card.lastElementChild.setAttribute('aria-live', 'polite');
160
+ this.#target()?.scrollIntoView({ block: 'center', inline: 'nearest', behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
161
+ try {
162
+ if (!card.matches(':popover-open'))
163
+ card.showPopover();
164
+ }
165
+ catch { /* not connected */ }
166
+ this.#place();
167
+ primary.focus({ preventScroll: true });
168
+ this.#notify('pm-step', { index, step });
169
+ }
170
+ /** Put the ring on the target and the card next to it (below, above, or centred when there is no target). */
171
+ #place = () => {
172
+ cancelAnimationFrame(this.#raf);
173
+ this.#raf = requestAnimationFrame(() => {
174
+ const card = this.#card, ring = this.#ring;
175
+ if (!card || !ring)
176
+ return;
177
+ const t = this.#target()?.getBoundingClientRect();
178
+ const c = card.getBoundingClientRect();
179
+ if (!t) {
180
+ Object.assign(ring.style, { top: '50%', left: '50%', width: '0px', height: '0px' });
181
+ Object.assign(card.style, { top: `${Math.max(8, (innerHeight - c.height) / 2)}px`, left: `${Math.max(8, (innerWidth - c.width) / 2)}px` });
182
+ return;
183
+ }
184
+ const pad = 6;
185
+ Object.assign(ring.style, { top: `${t.top - pad}px`, left: `${t.left - pad}px`, width: `${t.width + pad * 2}px`, height: `${t.height + pad * 2}px` });
186
+ const gap = 14;
187
+ let top = t.bottom + gap;
188
+ if (top + c.height > innerHeight - 8)
189
+ top = t.top - c.height - gap;
190
+ if (top < 8)
191
+ top = Math.max(8, innerHeight - c.height - 8);
192
+ const left = Math.max(8, Math.min(t.left + t.width / 2 - c.width / 2, innerWidth - c.width - 8));
193
+ Object.assign(card.style, { top: `${top}px`, left: `${left}px` });
194
+ });
195
+ };
196
+ }
197
+ defineElement('pm-tour', PmTour, [buttonCss, extrasCss]);
@@ -0,0 +1,57 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ export interface TransferOption {
4
+ value: string;
5
+ label: string;
6
+ disabled?: boolean;
7
+ }
8
+ type Side = 'source' | 'target';
9
+ /**
10
+ * Transfer list: move items between "available" and "selected" (assign permissions, pick table columns).
11
+ *
12
+ * Tick items and use the arrow buttons, or double-click an item to move it. In each list: Up and Down move, Space
13
+ * ticks, Enter moves the ticked items across, Ctrl+A ticks all. Form-associated: submits one entry per selected item.
14
+ * @tag pm-transfer
15
+ * @fires pm-change - The selection changed. detail: { value }
16
+ * @example <pm-transfer label="Columns" name="columns" options='[{"value":"name","label":"Name"},{"value":"email","label":"Email"}]' value='["name"]'></pm-transfer>
17
+ */
18
+ export declare class PmTransfer extends PmElement {
19
+ #private;
20
+ static componentName: string;
21
+ static formAssociated: boolean;
22
+ static styles: import("lit").CSSResult[];
23
+ static properties: PropertyDeclarations;
24
+ /** Every item that can be chosen. */
25
+ options: TransferOption[];
26
+ /** Values of the selected items, in the order they were added. */
27
+ value: string[];
28
+ name?: string;
29
+ label: string;
30
+ /** Help text under the lists. */
31
+ hint?: string;
32
+ /** Custom error message. Setting it marks the field invalid. */
33
+ error?: string;
34
+ /** At least one item must be selected. */
35
+ required: boolean;
36
+ disabled: boolean;
37
+ /** Show a filter box above each list. */
38
+ searchable: boolean;
39
+ /** Heading of the left list (default "Available"). */
40
+ sourceLabel: string;
41
+ /** Heading of the right list (default "Selected"). */
42
+ targetLabel: string;
43
+ /** Height of the lists: any CSS length (default 14rem). */
44
+ height?: string;
45
+ _ticked: Record<Side, string[]>;
46
+ _active: Record<Side, number>;
47
+ _query: Record<Side, string>;
48
+ constructor();
49
+ connectedCallback(): void;
50
+ formResetCallback(): void;
51
+ formDisabledCallback(d: boolean): void;
52
+ protected updated(): void;
53
+ /** Move values to the selected list (`to = 'target'`) or back (`'source'`). */
54
+ move(values: string[], to: Side): void;
55
+ render(): import("lit").TemplateResult<1>;
56
+ }
57
+ export {};