@prismora/elements 0.0.0-stage → 0.1.1

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,31 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Accordion. With `single`, opening one item closes the others.
5
+ * @tag pm-accordion
6
+ * @example <pm-accordion single><pm-accordion-item heading="Shipping">…</pm-accordion-item></pm-accordion>
7
+ */
8
+ export declare class PmAccordion extends PmElement {
9
+ static componentName: string;
10
+ static styles: import("lit").CSSResult[];
11
+ static properties: PropertyDeclarations;
12
+ /** Only one item open at a time. */
13
+ single: boolean;
14
+ constructor();
15
+ render(): import("lit").TemplateResult<1>;
16
+ }
17
+ /**
18
+ * Accordion item built on `<details>` (find-in-page and keyboard for free).
19
+ * @tag pm-accordion-item
20
+ * @fires pm-toggle - detail: { open }
21
+ */
22
+ export declare class PmAccordionItem extends PmElement {
23
+ static styles: import("lit").CSSResult[];
24
+ static properties: PropertyDeclarations;
25
+ heading: string;
26
+ open: boolean;
27
+ /** Cannot be opened or closed by the user (its current state stays). */
28
+ disabled: boolean;
29
+ constructor();
30
+ render(): import("lit").TemplateResult<1>;
31
+ }
@@ -0,0 +1,63 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { PmElement, defineElement } from '../base.js';
3
+ import accordionCss from '../styles/accordion.js';
4
+ /**
5
+ * Accordion. With `single`, opening one item closes the others.
6
+ * @tag pm-accordion
7
+ * @example <pm-accordion single><pm-accordion-item heading="Shipping">…</pm-accordion-item></pm-accordion>
8
+ */
9
+ export class PmAccordion extends PmElement {
10
+ static { this.componentName = 'accordion'; }
11
+ static { this.styles = [...PmElement.styles, accordionCss, css `:host { display: block; }`]; }
12
+ static { this.properties = { single: { type: Boolean } }; }
13
+ constructor() {
14
+ super();
15
+ this.single = false;
16
+ this.addEventListener('pm-toggle', (e) => {
17
+ const src = e.target;
18
+ if (!this.single || !src.open)
19
+ return;
20
+ for (const item of this.querySelectorAll(':scope > pm-accordion-item')) {
21
+ if (item !== src)
22
+ item.open = false;
23
+ }
24
+ });
25
+ }
26
+ render() {
27
+ return html `<div part="base" class="pm-accordion"><slot></slot></div>`;
28
+ }
29
+ }
30
+ /**
31
+ * Accordion item built on `<details>` (find-in-page and keyboard for free).
32
+ * @tag pm-accordion-item
33
+ * @fires pm-toggle - detail: { open }
34
+ */
35
+ export class PmAccordionItem extends PmElement {
36
+ static { this.styles = [...PmElement.styles, accordionCss,
37
+ css `:host { display: block; } :host(:not(:last-child)) .pm-accordion-item { border-block-end: 1px solid var(--pm-color-border); }`,
38
+ ]; }
39
+ static { this.properties = { heading: {}, open: { type: Boolean, reflect: true }, disabled: { type: Boolean, reflect: true } }; }
40
+ constructor() {
41
+ super();
42
+ this.heading = '';
43
+ this.open = false;
44
+ this.disabled = false;
45
+ }
46
+ render() {
47
+ return html `<details class="pm-accordion-item" part="base" ?open=${this.open}
48
+ @toggle=${(e) => {
49
+ const open = e.target.open;
50
+ if (open !== this.open) {
51
+ this.open = open;
52
+ this.emit('pm-toggle', { open });
53
+ }
54
+ }}>
55
+ <summary part="summary" tabindex=${this.disabled ? -1 : nothing} aria-disabled=${this.disabled ? 'true' : nothing}
56
+ @click=${(e) => { if (this.disabled)
57
+ e.preventDefault(); }}><slot name="heading">${this.heading}</slot></summary>
58
+ <div part="content"><slot></slot></div>
59
+ </details>`;
60
+ }
61
+ }
62
+ defineElement('pm-accordion', PmAccordion);
63
+ defineElement('pm-accordion-item', PmAccordionItem);
@@ -0,0 +1,27 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Inline alert / callout. Not a live region by default; set `live` for dynamic messages.
5
+ * @tag pm-alert
6
+ * @slot icon - Custom icon (default depends on tone).
7
+ * @slot - Body.
8
+ * @slot actions - Trailing actions.
9
+ * @fires pm-dismiss - When the close button is pressed (cancelable).
10
+ * @example <pm-alert tone="warning" heading="Heads up">Your trial ends in 3 days.</pm-alert>
11
+ */
12
+ export declare class PmAlert extends PmElement {
13
+ #private;
14
+ static componentName: string;
15
+ static styles: import("lit").CSSResult[];
16
+ static properties: PropertyDeclarations;
17
+ /** Registered icon name (see `registerIcons`); an `icon` slot overrides it. */
18
+ icon?: string;
19
+ heading?: string;
20
+ variant?: 'soft' | 'solid' | 'outline';
21
+ /** Show a close button; the alert hides itself and fires `pm-dismiss`. */
22
+ dismissible?: boolean;
23
+ /** Announce the alert to screen readers when it appears (role="alert"). */
24
+ live?: boolean;
25
+ static icons: Record<string, string>;
26
+ render(): import("lit").TemplateResult<1>;
27
+ }
@@ -0,0 +1,40 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { PmElement, defineElement } from '../base.js';
4
+ import buttonCss from '../styles/button.js';
5
+ import alertCss from '../styles/alert.js';
6
+ import { namedIcon } from '../named-icon.js';
7
+ /**
8
+ * Inline alert / callout. Not a live region by default; set `live` for dynamic messages.
9
+ * @tag pm-alert
10
+ * @slot icon - Custom icon (default depends on tone).
11
+ * @slot - Body.
12
+ * @slot actions - Trailing actions.
13
+ * @fires pm-dismiss - When the close button is pressed (cancelable).
14
+ * @example <pm-alert tone="warning" heading="Heads up">Your trial ends in 3 days.</pm-alert>
15
+ */
16
+ export class PmAlert extends PmElement {
17
+ static { this.componentName = 'alert'; }
18
+ static { this.styles = [...PmElement.styles, buttonCss, alertCss, css `:host { display: block; } :host([hidden]) { display: none; }`]; }
19
+ static { this.properties = { icon: { reflect: true }, heading: {}, variant: { reflect: true }, dismissible: { type: Boolean }, live: { type: Boolean } }; }
20
+ static { this.icons = { success: '✓', warning: '⚠', danger: '⨯', info: 'ℹ', accent: '✦', neutral: '•', secondary: '✦' }; }
21
+ render() {
22
+ const tone = this.tone ?? 'info';
23
+ return html `<div part="base" class="pm-alert" data-variant=${ifDefined(this.variant)} role=${this.live ? (tone === 'danger' ? 'alert' : 'status') : nothing}>
24
+ <span class="pm-alert-icon" aria-hidden="true"><slot name="icon">${this.icon ? namedIcon(this.icon) : PmAlert.icons[tone]}</slot></span>
25
+ ${this.heading ? html `<div class="pm-alert-title" part="title">${this.heading}</div>` : nothing}
26
+ <div class="pm-alert-body" part="body"><slot></slot></div>
27
+ <div class="pm-alert-actions">
28
+ <slot name="actions"></slot>
29
+ ${this.dismissible
30
+ ? html `<button class="pm-button" data-variant="ghost" data-size="xs" data-icon aria-label="Dismiss" @click=${this.#dismiss}>✕</button>`
31
+ : nothing}
32
+ </div>
33
+ </div>`;
34
+ }
35
+ #dismiss() {
36
+ if (this.emit('pm-dismiss'))
37
+ this.hidden = true;
38
+ }
39
+ }
40
+ defineElement('pm-alert', PmAlert);
@@ -0,0 +1,23 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Overlapping avatars with an overflow count.
5
+ * @tag pm-avatar-group
6
+ * @slot - `pm-avatar` elements.
7
+ * @example <pm-avatar-group max="3"><pm-avatar name="Ada Lovelace"></pm-avatar><pm-avatar name="Alan Turing"></pm-avatar><pm-avatar name="Grace Hopper"></pm-avatar><pm-avatar name="Linus Torvalds"></pm-avatar></pm-avatar-group>
8
+ */
9
+ export declare class PmAvatarGroup extends PmElement {
10
+ #private;
11
+ static componentName: string;
12
+ static styles: import("lit").CSSResult[];
13
+ static properties: PropertyDeclarations;
14
+ /** Show at most this many avatars, then "+N". */
15
+ max?: number;
16
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
17
+ /** Accessible group name, e.g. "Project members". */
18
+ label?: string;
19
+ _extra: number;
20
+ constructor();
21
+ render(): import("lit").TemplateResult<1>;
22
+ protected updated(): void;
23
+ }
@@ -0,0 +1,43 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { PmElement, defineElement } from '../base.js';
3
+ import avatarCss from '../styles/avatar.js';
4
+ /**
5
+ * Overlapping avatars with an overflow count.
6
+ * @tag pm-avatar-group
7
+ * @slot - `pm-avatar` elements.
8
+ * @example <pm-avatar-group max="3"><pm-avatar name="Ada Lovelace"></pm-avatar><pm-avatar name="Alan Turing"></pm-avatar><pm-avatar name="Grace Hopper"></pm-avatar><pm-avatar name="Linus Torvalds"></pm-avatar></pm-avatar-group>
9
+ */
10
+ export class PmAvatarGroup extends PmElement {
11
+ static { this.componentName = 'avatar-group'; }
12
+ static { this.styles = [...PmElement.styles, avatarCss, css `
13
+ :host { display: inline-flex; }
14
+ [part='base'] { display: inline-flex; align-items: center; }
15
+ ::slotted(*) { box-shadow: 0 0 0 2px var(--pm-color-bg-surface); border-radius: 50%; }
16
+ ::slotted(:not(:first-child)), .pm-avatar { margin-inline-start: calc(var(--_size, 2.5rem) * -0.2); }
17
+ .pm-avatar { box-shadow: 0 0 0 2px var(--pm-color-bg-surface); font-size: 0.8em; }
18
+ `]; }
19
+ static { this.properties = { max: { type: Number }, size: { reflect: true }, label: {}, _extra: { state: true } }; }
20
+ constructor() { super(); this._extra = 0; }
21
+ render() {
22
+ return html `<div part="base" role="group" aria-label=${this.label ?? nothing}>
23
+ <slot @slotchange=${this.#layout}></slot>
24
+ ${this._extra > 0
25
+ ? html `<span class="pm-avatar" data-size=${this.size ?? nothing} part="overflow" role="img" aria-label=${`${this._extra} more`}>+${this._extra}</span>`
26
+ : nothing}
27
+ </div>`;
28
+ }
29
+ updated() { this.#layout(); }
30
+ #layout() {
31
+ const items = [...this.children];
32
+ const max = this.max && this.max > 0 ? this.max : items.length;
33
+ items.forEach((el, i) => {
34
+ el.hidden = i >= max;
35
+ if (this.size && !el.hasAttribute('size'))
36
+ el.setAttribute('size', this.size);
37
+ });
38
+ const extra = Math.max(0, items.length - max);
39
+ if (extra !== this._extra)
40
+ this._extra = extra;
41
+ }
42
+ }
43
+ defineElement('pm-avatar-group', PmAvatarGroup);
@@ -0,0 +1,24 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement, type Size } from '../base.js';
3
+ /**
4
+ * Avatar with image + initials fallback.
5
+ * @tag pm-avatar
6
+ * @example <pm-avatar name="Ada Lovelace" src="/ada.jpg"></pm-avatar>
7
+ */
8
+ export declare class PmAvatar extends PmElement {
9
+ static componentName: string;
10
+ static styles: import("lit").CSSResult[];
11
+ static properties: PropertyDeclarations;
12
+ /** Presence dot: online, away, busy or offline (included in the accessible name). */
13
+ status?: 'online' | 'away' | 'busy' | 'offline';
14
+ /** Image URL; falls back to initials from `name` if it fails to load. */
15
+ src?: string;
16
+ /** Full name: used for alt text and initials. */
17
+ name?: string;
18
+ size?: Size;
19
+ shape?: 'circle' | 'square';
20
+ _failed: boolean;
21
+ constructor();
22
+ get initials(): string;
23
+ render(): import("lit").TemplateResult<1>;
24
+ }
@@ -0,0 +1,43 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { PmElement, defineElement } from '../base.js';
4
+ import avatarCss from '../styles/avatar.js';
5
+ /**
6
+ * Avatar with image + initials fallback.
7
+ * @tag pm-avatar
8
+ * @example <pm-avatar name="Ada Lovelace" src="/ada.jpg"></pm-avatar>
9
+ */
10
+ export class PmAvatar extends PmElement {
11
+ static { this.componentName = 'avatar'; }
12
+ static { this.styles = [...PmElement.styles, avatarCss, css `:host { display: inline-flex; vertical-align: middle; position: relative; }
13
+ .pm-avatar-status { position: absolute; inset-block-end: 0; inset-inline-end: 0; inline-size: 28%; block-size: 28%; min-inline-size: 8px; min-block-size: 8px;
14
+ border-radius: 50%; border: 2px solid var(--pm-color-bg-surface); background: var(--pm-color-neutral-solid, gray); }
15
+ .pm-avatar-status[data-status='online'] { background: var(--pm-color-success-solid); }
16
+ .pm-avatar-status[data-status='away'] { background: var(--pm-color-warning-solid); }
17
+ .pm-avatar-status[data-status='busy'] { background: var(--pm-color-danger-solid); }
18
+ .pm-avatar-status[data-status='offline'] { background: var(--pm-color-bg-surface); box-shadow: inset 0 0 0 2px var(--pm-color-border-strong); }
19
+ @media (forced-colors: active) { .pm-avatar-status { forced-color-adjust: none; } }`]; }
20
+ static { this.properties = { src: {}, name: {}, size: { reflect: true }, shape: { reflect: true }, status: { reflect: true }, _failed: { state: true } }; }
21
+ constructor() {
22
+ super();
23
+ this._failed = false;
24
+ }
25
+ get initials() {
26
+ return (this.name ?? '')
27
+ .split(/\s+/)
28
+ .filter(Boolean)
29
+ .slice(0, 2)
30
+ .map((p) => p[0]?.toUpperCase())
31
+ .join('');
32
+ }
33
+ render() {
34
+ const img = this.src && !this._failed;
35
+ return html `<span part="base" class="pm-avatar" data-size=${ifDefined(this.size)} data-shape=${ifDefined(this.shape)}
36
+ role="img" aria-label=${ifDefined(this.name ? (this.status ? `${this.name} (${this.status})` : this.name) : this.status)}>
37
+ ${img
38
+ ? html `<img src=${this.src} alt="" loading="lazy" decoding="async" @error=${() => { this._failed = true; }} />`
39
+ : html `<span aria-hidden="true">${this.initials || '?'}</span>`}
40
+ </span>${this.status ? html `<span class="pm-avatar-status" part="status" data-status=${this.status} aria-hidden="true"></span>` : nothing}`;
41
+ }
42
+ }
43
+ defineElement('pm-avatar', PmAvatar);
@@ -0,0 +1,32 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Back to top: a floating button that appears after the page has been scrolled and returns to the top
5
+ * (instantly when the user prefers reduced motion). Focus moves to the top of the page as well.
6
+ *
7
+ * For a scrolling panel instead of the page, put the element inside the panel and set `target` to the panel's id: the
8
+ * button then floats in the panel's bottom corner.
9
+ * @tag pm-back-to-top
10
+ * @slot - Custom icon or text.
11
+ * @example <pm-back-to-top></pm-back-to-top>
12
+ */
13
+ export declare class PmBackToTop extends PmElement {
14
+ #private;
15
+ static componentName: string;
16
+ static styles: import("lit").CSSResult[];
17
+ static properties: PropertyDeclarations;
18
+ /** Pixels scrolled before the button appears (default 600). */
19
+ threshold: number;
20
+ /** Accessible name (default "Back to top"). */
21
+ label?: string;
22
+ /** Corner: end (default), start or center. */
23
+ position?: 'end' | 'start' | 'center';
24
+ /** Id of a scrolling element to watch and scroll instead of the page. */
25
+ target?: string;
26
+ _shown: boolean;
27
+ constructor();
28
+ connectedCallback(): void;
29
+ disconnectedCallback(): void;
30
+ updated(changed: Map<string, unknown>): void;
31
+ render(): import("lit").TemplateResult<1>;
32
+ }
@@ -0,0 +1,50 @@
1
+ import { css, html } from 'lit';
2
+ import { PmElement, defineElement } from '../base.js';
3
+ import buttonCss from '../styles/button.js';
4
+ import helpersCss from '../styles/helpers.js';
5
+ /**
6
+ * Back to top: a floating button that appears after the page has been scrolled and returns to the top
7
+ * (instantly when the user prefers reduced motion). Focus moves to the top of the page as well.
8
+ *
9
+ * For a scrolling panel instead of the page, put the element inside the panel and set `target` to the panel's id: the
10
+ * button then floats in the panel's bottom corner.
11
+ * @tag pm-back-to-top
12
+ * @slot - Custom icon or text.
13
+ * @example <pm-back-to-top></pm-back-to-top>
14
+ */
15
+ export class PmBackToTop extends PmElement {
16
+ static { this.componentName = 'back-to-top'; }
17
+ static { this.styles = [...PmElement.styles, buttonCss, helpersCss, css `:host { display: contents; }`]; }
18
+ static { this.properties = { threshold: { type: Number }, label: {}, position: { reflect: true }, target: {}, _shown: { state: true } }; }
19
+ constructor() { super(); this.threshold = 600; this._shown = false; }
20
+ #watched = null;
21
+ get #box() { return this.target ? document.getElementById(this.target) : null; }
22
+ #onScroll = () => { const box = this.#box; const on = (box ? box.scrollTop : scrollY) >= this.threshold; if (on !== this._shown)
23
+ this._shown = on; };
24
+ #watch() {
25
+ this.#watched?.removeEventListener('scroll', this.#onScroll);
26
+ this.#watched = this.#box ?? window;
27
+ this.#watched.addEventListener('scroll', this.#onScroll, { passive: true });
28
+ this.#onScroll();
29
+ }
30
+ connectedCallback() { super.connectedCallback(); this.#watch(); }
31
+ disconnectedCallback() { super.disconnectedCallback(); this.#watched?.removeEventListener('scroll', this.#onScroll); this.#watched = null; }
32
+ updated(changed) { if (changed.has('target') && this.isConnected)
33
+ this.#watch(); }
34
+ #go() {
35
+ const box = this.#box;
36
+ (box ?? window).scrollTo({ top: 0, behavior: matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
37
+ // Keyboard users continue from the top, not from a button that is about to hide.
38
+ const target = box ?? document.querySelector('main, [role="main"]') ?? document.body;
39
+ if (!target.hasAttribute('tabindex'))
40
+ target.setAttribute('tabindex', '-1');
41
+ target.focus({ preventScroll: true });
42
+ }
43
+ render() {
44
+ return html `<button type="button" part="base" class="pm-button pm-fab pm-back-to-top" data-icon data-variant="soft" data-position=${this.position ?? 'end'} ?data-contained=${!!this.target}
45
+ ?data-hidden=${!this._shown} aria-label=${this.label ?? 'Back to top'} @click=${this.#go}>
46
+ <slot><svg viewBox="0 0 24 24" width="1.25em" height="1.25em" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 19V5M5 12l7-7 7 7"/></svg></slot>
47
+ </button>`;
48
+ }
49
+ }
50
+ defineElement('pm-back-to-top', PmBackToTop);
@@ -0,0 +1,17 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Small label for status, counts or categories.
5
+ * @tag pm-badge
6
+ * @example <pm-badge tone="success" dot>Active</pm-badge>
7
+ */
8
+ export declare class PmBadge extends PmElement {
9
+ static componentName: string;
10
+ static styles: import("lit").CSSResult[];
11
+ static properties: PropertyDeclarations;
12
+ variant?: 'soft' | 'solid' | 'outline';
13
+ size?: 'md' | 'lg';
14
+ /** Show a small status dot before the text. */
15
+ dot?: boolean;
16
+ render(): import("lit").TemplateResult<1>;
17
+ }
@@ -0,0 +1,20 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { PmElement, defineElement } from '../base.js';
4
+ import badgeCss from '../styles/badge.js';
5
+ /**
6
+ * Small label for status, counts or categories.
7
+ * @tag pm-badge
8
+ * @example <pm-badge tone="success" dot>Active</pm-badge>
9
+ */
10
+ export class PmBadge extends PmElement {
11
+ static { this.componentName = 'badge'; }
12
+ static { this.styles = [...PmElement.styles, badgeCss, css `:host { display: inline-flex; vertical-align: middle; }`]; }
13
+ static { this.properties = { variant: { reflect: true }, size: { reflect: true }, dot: { type: Boolean } }; }
14
+ render() {
15
+ return html `<span part="base" class="pm-badge" data-variant=${ifDefined(this.variant ?? this.defaultFor('variant'))} data-size=${ifDefined(this.size)}>
16
+ ${this.dot ? html `<span class="pm-badge-dot" aria-hidden="true"></span>` : nothing}<slot></slot>
17
+ </span>`;
18
+ }
19
+ }
20
+ defineElement('pm-badge', PmBadge);
@@ -0,0 +1,34 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Banner: a page-wide announcement bar above the content (maintenance, a new release, a trial ending, cookie notice).
5
+ * For a message inside the page, use `<pm-alert>`.
6
+ *
7
+ * `dismissible` adds a close button; with `storage-key` the dismissal is remembered in this browser, so the banner
8
+ * stays closed on the next visit. `sticky` keeps it at the top while scrolling.
9
+ * @tag pm-banner
10
+ * @slot - Message; links are styled.
11
+ * @slot icon - Custom icon.
12
+ * @slot actions - Buttons after the message.
13
+ * @fires pm-dismiss - The close button was pressed (cancelable).
14
+ * @example <pm-banner tone="info" icon="sparkles" dismissible>Version 2 is here. <a href="/changelog">See what changed</a></pm-banner>
15
+ */
16
+ export declare class PmBanner extends PmElement {
17
+ #private;
18
+ static componentName: string;
19
+ static styles: import("lit").CSSResult[];
20
+ static properties: PropertyDeclarations;
21
+ /** Registered icon name (see `registerIcons`). */
22
+ icon?: string;
23
+ variant?: 'soft' | 'solid';
24
+ /** Show a close button. */
25
+ dismissible?: boolean;
26
+ /** Stay at the top of the page while scrolling. */
27
+ sticky?: boolean;
28
+ /** Remember the dismissal in localStorage under this key. */
29
+ storageKey?: string;
30
+ /** Announce to screen readers when it appears. */
31
+ live?: boolean;
32
+ connectedCallback(): void;
33
+ render(): import("lit").TemplateResult<1>;
34
+ }
@@ -0,0 +1,54 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { PmElement, defineElement } from '../base.js';
4
+ import buttonCss from '../styles/button.js';
5
+ import bannerCss from '../styles/banner.js';
6
+ import { namedIcon } from '../named-icon.js';
7
+ /**
8
+ * Banner: a page-wide announcement bar above the content (maintenance, a new release, a trial ending, cookie notice).
9
+ * For a message inside the page, use `<pm-alert>`.
10
+ *
11
+ * `dismissible` adds a close button; with `storage-key` the dismissal is remembered in this browser, so the banner
12
+ * stays closed on the next visit. `sticky` keeps it at the top while scrolling.
13
+ * @tag pm-banner
14
+ * @slot - Message; links are styled.
15
+ * @slot icon - Custom icon.
16
+ * @slot actions - Buttons after the message.
17
+ * @fires pm-dismiss - The close button was pressed (cancelable).
18
+ * @example <pm-banner tone="info" icon="sparkles" dismissible>Version 2 is here. <a href="/changelog">See what changed</a></pm-banner>
19
+ */
20
+ export class PmBanner extends PmElement {
21
+ static { this.componentName = 'banner'; }
22
+ static { this.styles = [...PmElement.styles, buttonCss, bannerCss, css `:host { display: block; } :host([hidden]) { display: none; } ::slotted(a) { color: var(--pm-tone-text-strong); font-weight: var(--pm-font-weight-semibold); text-underline-offset: 0.2em; } :host([variant="solid"]) ::slotted(a) { color: inherit !important; } :host([sticky]) { position: sticky; inset-block-start: 0; z-index: 20; }`]; }
23
+ static { this.properties = {
24
+ icon: { reflect: true }, variant: { reflect: true }, dismissible: { type: Boolean }, sticky: { type: Boolean, reflect: true },
25
+ storageKey: { attribute: 'storage-key' }, live: { type: Boolean },
26
+ }; }
27
+ connectedCallback() {
28
+ super.connectedCallback();
29
+ try {
30
+ if (this.storageKey && localStorage.getItem(`pm-banner:${this.storageKey}`))
31
+ this.hidden = true;
32
+ }
33
+ catch { /* storage blocked */ }
34
+ }
35
+ #dismiss() {
36
+ if (!this.emit('pm-dismiss'))
37
+ return;
38
+ this.hidden = true;
39
+ try {
40
+ if (this.storageKey)
41
+ localStorage.setItem(`pm-banner:${this.storageKey}`, '1');
42
+ }
43
+ catch { /* storage blocked */ }
44
+ }
45
+ render() {
46
+ return html `<div part="base" class="pm-banner" data-variant=${ifDefined(this.variant)} role=${this.live ? 'status' : nothing}>
47
+ <span class="pm-banner-icon" aria-hidden="true"><slot name="icon">${this.icon ? namedIcon(this.icon) : nothing}</slot></span>
48
+ <div class="pm-banner-body" part="body"><slot></slot></div>
49
+ <div class="pm-banner-actions"><slot name="actions"></slot></div>
50
+ ${this.dismissible ? html `<button type="button" class="pm-button pm-banner-close" data-variant="ghost" data-tone="neutral" data-size="xs" data-icon aria-label="Dismiss" @click=${this.#dismiss}>✕</button>` : nothing}
51
+ </div>`;
52
+ }
53
+ }
54
+ defineElement('pm-banner', PmBanner);
@@ -0,0 +1,42 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Breadcrumb trail. The last item is the current page. Long trails collapse to first … last `max` items.
5
+ * @tag pm-breadcrumb
6
+ * @slot - `pm-breadcrumb-item` elements.
7
+ * @example <pm-breadcrumb><pm-breadcrumb-item href="/">Home</pm-breadcrumb-item><pm-breadcrumb-item href="/projects">Projects</pm-breadcrumb-item><pm-breadcrumb-item>Prismora</pm-breadcrumb-item></pm-breadcrumb>
8
+ */
9
+ export declare class PmBreadcrumb extends PmElement {
10
+ #private;
11
+ static componentName: string;
12
+ static styles: import("lit").CSSResult[];
13
+ static properties: PropertyDeclarations;
14
+ /** Accessible name of the navigation landmark. */
15
+ label: string;
16
+ /** Collapse middle items when there are more than this many. */
17
+ max?: number;
18
+ /** Separator character (default "/"). */
19
+ separator?: string;
20
+ _expanded: boolean;
21
+ constructor();
22
+ render(): import("lit").TemplateResult<1>;
23
+ protected updated(): void;
24
+ }
25
+ /**
26
+ * Breadcrumb entry (a link, or plain text for the current page).
27
+ * @tag pm-breadcrumb-item
28
+ * @slot - Label.
29
+ * @example <pm-breadcrumb-item href="/projects">Projects</pm-breadcrumb-item>
30
+ */
31
+ export declare class PmBreadcrumbItem extends PmElement {
32
+ static componentName: string;
33
+ static styles: import("lit").CSSResult[];
34
+ static properties: PropertyDeclarations;
35
+ href?: string;
36
+ /** Marks the current page (set automatically on the last item). */
37
+ current: boolean;
38
+ collapsedBefore: boolean;
39
+ constructor();
40
+ connectedCallback(): void;
41
+ render(): import("lit").TemplateResult<1>;
42
+ }
@@ -0,0 +1,63 @@
1
+ import { css, html, nothing } from 'lit';
2
+ import { PmElement, defineElement } from '../base.js';
3
+ import breadcrumbCss from '../styles/breadcrumb.js';
4
+ /**
5
+ * Breadcrumb trail. The last item is the current page. Long trails collapse to first … last `max` items.
6
+ * @tag pm-breadcrumb
7
+ * @slot - `pm-breadcrumb-item` elements.
8
+ * @example <pm-breadcrumb><pm-breadcrumb-item href="/">Home</pm-breadcrumb-item><pm-breadcrumb-item href="/projects">Projects</pm-breadcrumb-item><pm-breadcrumb-item>Prismora</pm-breadcrumb-item></pm-breadcrumb>
9
+ */
10
+ export class PmBreadcrumb extends PmElement {
11
+ static { this.componentName = 'breadcrumb'; }
12
+ static { this.styles = [...PmElement.styles, breadcrumbCss, css `:host { display: block; }`]; }
13
+ static { this.properties = { label: {}, max: { type: Number }, separator: {}, _expanded: { state: true } }; }
14
+ constructor() { super(); this.label = 'Breadcrumb'; this._expanded = false; }
15
+ render() {
16
+ return html `<nav aria-label=${this.label} part="base" style=${this.separator ? `--pm-breadcrumb-separator: "${this.separator.replace(/"/g, '')}"` : nothing}>
17
+ <ol class="pm-breadcrumb" role="list"><slot @slotchange=${this.#layout} @pm-expand=${this.#expand}></slot></ol>
18
+ </nav>`;
19
+ }
20
+ updated() { this.#layout(); }
21
+ #expand = () => { this._expanded = true; };
22
+ #layout() {
23
+ const items = [...this.children].filter((e) => e instanceof PmBreadcrumbItem);
24
+ const collapse = !this._expanded && this.max && items.length > this.max ? items.length - this.max : 0;
25
+ items.forEach((it, i) => {
26
+ it.toggleAttribute('data-first', i === 0);
27
+ it.current = it.current || i === items.length - 1;
28
+ const hidden = collapse > 0 && i >= 1 && i <= collapse;
29
+ it.hidden = hidden;
30
+ it.collapsedBefore = collapse > 0 && i === collapse + 1;
31
+ });
32
+ }
33
+ }
34
+ /**
35
+ * Breadcrumb entry (a link, or plain text for the current page).
36
+ * @tag pm-breadcrumb-item
37
+ * @slot - Label.
38
+ * @example <pm-breadcrumb-item href="/projects">Projects</pm-breadcrumb-item>
39
+ */
40
+ export class PmBreadcrumbItem extends PmElement {
41
+ static { this.componentName = 'breadcrumb-item'; }
42
+ static { this.styles = [...PmElement.styles, breadcrumbCss, css `
43
+ :host { display: inline-flex; align-items: center; gap: var(--pm-space-1-5); color: var(--pm-color-fg-muted); font-size: var(--pm-font-size-sm); }
44
+ :host([hidden]) { display: none; }
45
+ :host(:not([data-first]))::before { content: var(--pm-breadcrumb-separator, "/"); content: var(--pm-breadcrumb-separator, "/") / ""; color: var(--pm-color-border-strong); }
46
+ .pm-breadcrumb-more + .sep::before { content: var(--pm-breadcrumb-separator, "/"); color: var(--pm-color-border-strong); }
47
+ `]; }
48
+ static { this.properties = { href: {}, current: { type: Boolean, reflect: true }, collapsedBefore: { type: Boolean, attribute: false } }; }
49
+ constructor() { super(); this.current = false; this.collapsedBefore = false; }
50
+ connectedCallback() { super.connectedCallback(); this.setAttribute('role', 'listitem'); }
51
+ render() {
52
+ const more = this.collapsedBefore
53
+ ? html `<button type="button" class="pm-breadcrumb-more" aria-label="Show all breadcrumb items"
54
+ @click=${() => this.emit('pm-expand')}>…</button><span class="sep" aria-hidden="true"></span>`
55
+ : nothing;
56
+ const link = this.href && !this.current
57
+ ? html `<a class="pm-breadcrumb-link" part="link" href=${this.href}><slot></slot></a>`
58
+ : html `<span class="pm-breadcrumb-link" part="link" aria-current=${this.current ? 'page' : nothing}><slot></slot></span>`;
59
+ return html `${more}${link}`;
60
+ }
61
+ }
62
+ defineElement('pm-breadcrumb', PmBreadcrumb);
63
+ defineElement('pm-breadcrumb-item', PmBreadcrumbItem);
@@ -0,0 +1,14 @@
1
+ import { type PropertyDeclarations } from 'lit';
2
+ import { PmElement } from '../base.js';
3
+ /**
4
+ * Groups buttons with joined edges.
5
+ * @tag pm-button-group
6
+ * @slot - `pm-button` elements.
7
+ */
8
+ export declare class PmButtonGroup extends PmElement {
9
+ #private;
10
+ static properties: PropertyDeclarations;
11
+ label?: string;
12
+ static styles: import("lit").CSSResult[];
13
+ render(): import("lit").TemplateResult<1>;
14
+ }