@kubex/zinc 0.0.3 → 1.0.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 (599) hide show
  1. package/.editorconfig +18 -0
  2. package/.eslintignore +8 -0
  3. package/.eslintrc.cjs +208 -0
  4. package/.github/workflows/eleventy_build.yml +42 -0
  5. package/.github/workflows/js_build_and_deploy.yaml +65 -0
  6. package/custom-elements-manifest.config.js +230 -0
  7. package/docs/_includes/component.njk +340 -0
  8. package/docs/_includes/default.njk +137 -0
  9. package/docs/_includes/sidebar.njk +24 -0
  10. package/docs/_utilities/active-links.cjs +41 -0
  11. package/docs/_utilities/anchor-headings.cjs +74 -0
  12. package/docs/_utilities/cem.cjs +89 -0
  13. package/docs/_utilities/code-previews.cjs +98 -0
  14. package/docs/_utilities/copy-code-buttons.cjs +26 -0
  15. package/docs/_utilities/external-links.cjs +53 -0
  16. package/docs/_utilities/highlight-code.cjs +74 -0
  17. package/docs/_utilities/markdown.cjs +74 -0
  18. package/docs/_utilities/prettier.cjs +26 -0
  19. package/docs/_utilities/replacer.cjs +24 -0
  20. package/docs/_utilities/scrolling-tables.cjs +23 -0
  21. package/docs/_utilities/strings.cjs +16 -0
  22. package/docs/_utilities/table-of-contents.cjs +48 -0
  23. package/docs/_utilities/typography.cjs +24 -0
  24. package/docs/assets/icons.json +57989 -0
  25. package/docs/assets/images/chrome.png +0 -0
  26. package/docs/assets/images/edge.png +0 -0
  27. package/docs/assets/images/firefox.png +0 -0
  28. package/docs/assets/images/opera.png +0 -0
  29. package/docs/assets/images/safari.png +0 -0
  30. package/docs/assets/images/watermark.svg +1 -0
  31. package/docs/assets/rip.js +78 -0
  32. package/docs/assets/scripts/code-previews.js +250 -0
  33. package/docs/assets/scripts/docs.js +374 -0
  34. package/docs/assets/scripts/search.js +441 -0
  35. package/docs/assets/scripts/turbo.js +29 -0
  36. package/docs/assets/styles/code-previews.css +169 -0
  37. package/docs/assets/styles/docs.css +1168 -0
  38. package/docs/assets/styles/search.css +347 -0
  39. package/docs/eleventy.config.cjs +262 -0
  40. package/docs/pages/components/absolute-container.md +35 -0
  41. package/docs/pages/components/action-bar.md +58 -0
  42. package/docs/pages/components/alert.md +45 -0
  43. package/docs/pages/components/bulk-actions.md +26 -0
  44. package/docs/pages/components/button-group.md +78 -0
  45. package/docs/pages/components/button-menu.md +127 -0
  46. package/docs/pages/components/button.md +80 -0
  47. package/docs/pages/components/chart.md +27 -0
  48. package/docs/pages/components/checkbox-group.md +196 -0
  49. package/docs/pages/components/checkbox.md +157 -0
  50. package/docs/pages/components/chip.md +61 -0
  51. package/docs/pages/components/collapsible.md +52 -0
  52. package/docs/pages/components/cols.md +66 -0
  53. package/docs/pages/components/confirm.md +52 -0
  54. package/docs/pages/components/content-block.md +108 -0
  55. package/docs/pages/components/copy-button.md +22 -0
  56. package/docs/pages/components/data-select.md +54 -0
  57. package/docs/pages/components/data-table-filter.md +23 -0
  58. package/docs/pages/components/data-table-sort.md +20 -0
  59. package/docs/pages/components/data-table.md +74 -0
  60. package/docs/pages/components/datepicker.md +25 -0
  61. package/docs/pages/components/defined-label.md +26 -0
  62. package/docs/pages/components/dialog.md +145 -0
  63. package/docs/pages/components/dropdown.md +22 -0
  64. package/docs/pages/components/editor.md +26 -0
  65. package/docs/pages/components/empty-state.md +51 -0
  66. package/docs/pages/components/expanding-action.md +55 -0
  67. package/docs/pages/components/file.md +45 -0
  68. package/docs/pages/components/form-group.md +22 -0
  69. package/docs/pages/components/header.md +103 -0
  70. package/docs/pages/components/icon.md +322 -0
  71. package/docs/pages/components/inline-edit.md +41 -0
  72. package/docs/pages/components/input.md +261 -0
  73. package/docs/pages/components/item.md +78 -0
  74. package/docs/pages/components/linked-select.md +41 -0
  75. package/docs/pages/components/menu-item.md +22 -0
  76. package/docs/pages/components/menu.md +36 -0
  77. package/docs/pages/components/navbar.md +57 -0
  78. package/docs/pages/components/note.md +55 -0
  79. package/docs/pages/components/option.md +22 -0
  80. package/docs/pages/components/order-table.md +22 -0
  81. package/docs/pages/components/page-nav.md +23 -0
  82. package/docs/pages/components/pagination.md +22 -0
  83. package/docs/pages/components/pane.md +22 -0
  84. package/docs/pages/components/panel.md +124 -0
  85. package/docs/pages/components/popup.md +22 -0
  86. package/docs/pages/components/progress-bar.md +22 -0
  87. package/docs/pages/components/progress-tile.md +22 -0
  88. package/docs/pages/components/query-builder.md +148 -0
  89. package/docs/pages/components/radio-group.md +129 -0
  90. package/docs/pages/components/radio.md +20 -0
  91. package/docs/pages/components/rating.md +28 -0
  92. package/docs/pages/components/scroll-container.md +22 -0
  93. package/docs/pages/components/select.md +452 -0
  94. package/docs/pages/components/sidebar.md +28 -0
  95. package/docs/pages/components/simple-chart.md +23 -0
  96. package/docs/pages/components/skeleton.md +70 -0
  97. package/docs/pages/components/slideout.md +23 -0
  98. package/docs/pages/components/sp.md +87 -0
  99. package/docs/pages/components/split-button.md +32 -0
  100. package/docs/pages/components/split-pane.md +22 -0
  101. package/docs/pages/components/stat.md +24 -0
  102. package/docs/pages/components/status-indicator.md +13 -0
  103. package/docs/pages/components/stepper.md +20 -0
  104. package/docs/pages/components/style.md +106 -0
  105. package/docs/pages/components/table.md +22 -0
  106. package/docs/pages/components/tabs.md +57 -0
  107. package/docs/pages/components/textarea.md +120 -0
  108. package/docs/pages/components/tile-property.md +29 -0
  109. package/docs/pages/components/tile.md +51 -0
  110. package/docs/pages/components/timer.md +22 -0
  111. package/docs/pages/components/toggle.md +22 -0
  112. package/docs/pages/components/tooltip.md +242 -0
  113. package/docs/pages/components/vertical-stepper.md +22 -0
  114. package/docs/pages/components/well.md +13 -0
  115. package/docs/pages/getting-started/example-layout.md +143 -0
  116. package/docs/pages/getting-started/example-page.md +83 -0
  117. package/docs/pages/getting-started/form-controls.md +552 -0
  118. package/docs/pages/getting-started/form-examples.md +122 -0
  119. package/docs/pages/getting-started/table-examples.md +43 -0
  120. package/docs/pages/index.md +32 -0
  121. package/index.html +22 -0
  122. package/package.json +111 -11
  123. package/scripts/build.js +381 -0
  124. package/scripts/generator/generator.js +102 -0
  125. package/scripts/generator/index.js +17 -0
  126. package/scripts/generator/preprocess.js +20 -0
  127. package/scripts/generator/resolver.js +86 -0
  128. package/scripts/generator/tailwind.config.js +14 -0
  129. package/scripts/make-metadata.js +10 -0
  130. package/scripts/make-themes.js +27 -0
  131. package/scripts/plop/plopfile.js +63 -0
  132. package/scripts/plop/templates/component.hbs +43 -0
  133. package/scripts/plop/templates/define.hbs +12 -0
  134. package/scripts/plop/templates/docs.hbs +20 -0
  135. package/scripts/plop/templates/style.hbs +5 -0
  136. package/scripts/plop/templates/test.hbs +10 -0
  137. package/scss/_global-components.scss +4 -0
  138. package/scss/_global-spacing.scss +96 -0
  139. package/scss/_root.scss +202 -0
  140. package/scss/boot.scss +29 -0
  141. package/scss/mixins/_helper-mixins.scss +24 -0
  142. package/scss/mixins/_spacing-mixins.scss +84 -0
  143. package/scss/mixins/index.scss +2 -0
  144. package/scss/shared/_base.scss +138 -0
  145. package/scss/shared/_button.scss +27 -0
  146. package/scss/shared/_form-elements.scss +162 -0
  147. package/scss/shared/_opacity.scss +27 -0
  148. package/scss/shared/_reset.scss +288 -0
  149. package/scss/shared/_table.scss +73 -0
  150. package/scss/shared/divide.scss +41 -0
  151. package/scss/shared/index.scss +12 -0
  152. package/scss/shared/layout.scss +290 -0
  153. package/scss/shared/nav.scss +71 -0
  154. package/scss/themes/_dark.scss +277 -0
  155. package/scss/themes/_index.scss +3 -0
  156. package/scss/themes/_light.scss +540 -0
  157. package/scss/themes/_utility.scss +44 -0
  158. package/scss/variables/_spacing.scss +35 -0
  159. package/scss/variables/index.scss +1 -0
  160. package/src/components/absolute-container/absolute-container.component.ts +62 -0
  161. package/src/components/absolute-container/absolute-container.test.ts +10 -0
  162. package/src/components/absolute-container/index.ts +12 -0
  163. package/src/components/action-bar/action-bar.component.ts +41 -0
  164. package/src/components/action-bar/action-bar.scss +33 -0
  165. package/src/components/action-bar/action-bar.test.ts +10 -0
  166. package/src/components/action-bar/index.ts +12 -0
  167. package/src/components/alert/alert.component.ts +71 -0
  168. package/src/components/alert/alert.scss +170 -0
  169. package/src/components/alert/alert.test.ts +10 -0
  170. package/src/components/alert/index.ts +12 -0
  171. package/src/components/bulk-actions/bulk-actions.component.ts +229 -0
  172. package/src/components/bulk-actions/bulk-actions.scss +56 -0
  173. package/src/components/bulk-actions/bulk-actions.test.ts +10 -0
  174. package/src/components/bulk-actions/index.ts +12 -0
  175. package/src/components/button/button.component.ts +242 -0
  176. package/src/components/button/button.scss +346 -0
  177. package/src/components/button/button.test.ts +32 -0
  178. package/src/components/button/index.ts +12 -0
  179. package/src/components/button-group/button-group.component.ts +74 -0
  180. package/src/components/button-group/button-group.scss +39 -0
  181. package/src/components/button-group/button-group.test.ts +10 -0
  182. package/src/components/button-group/index.ts +12 -0
  183. package/src/components/button-menu/button-menu.component.ts +353 -0
  184. package/src/components/button-menu/button-menu.scss +41 -0
  185. package/src/components/button-menu/button-menu.test.ts +10 -0
  186. package/src/components/button-menu/index.ts +12 -0
  187. package/src/components/chart/chart.component.ts +206 -0
  188. package/src/components/chart/chart.scss +11 -0
  189. package/src/components/chart/chart.test.ts +10 -0
  190. package/src/components/chart/index.ts +12 -0
  191. package/src/components/checkbox/checkbox.component.ts +326 -0
  192. package/src/components/checkbox/checkbox.scss +202 -0
  193. package/src/components/checkbox/checkbox.test.ts +10 -0
  194. package/src/components/checkbox/index.ts +12 -0
  195. package/src/components/checkbox-group/checkbox-group.component.ts +351 -0
  196. package/src/components/checkbox-group/checkbox-group.scss +60 -0
  197. package/src/components/checkbox-group/checkbox-group.test.ts +10 -0
  198. package/src/components/checkbox-group/index.ts +12 -0
  199. package/src/components/chip/chip.component.ts +70 -0
  200. package/src/components/chip/chip.scss +101 -0
  201. package/src/components/chip/chip.test.ts +10 -0
  202. package/src/components/chip/index.ts +12 -0
  203. package/src/components/collapsible/collapsible.component.ts +86 -0
  204. package/src/components/collapsible/collapsible.scss +100 -0
  205. package/src/components/collapsible/collapsible.test.ts +10 -0
  206. package/src/components/collapsible/index.ts +12 -0
  207. package/src/components/cols/cols.component.ts +76 -0
  208. package/src/components/cols/cols.scss +99 -0
  209. package/src/components/cols/cols.test.ts +10 -0
  210. package/src/components/cols/index.ts +12 -0
  211. package/src/components/confirm/confirm.component.ts +181 -0
  212. package/src/components/confirm/confirm.scss +44 -0
  213. package/src/components/confirm/confirm.test.ts +10 -0
  214. package/src/components/confirm/index.ts +12 -0
  215. package/src/components/content-block/content-block.component.ts +225 -0
  216. package/src/components/content-block/content-block.scss +64 -0
  217. package/src/components/content-block/content-block.test.ts +10 -0
  218. package/src/components/content-block/index.ts +12 -0
  219. package/src/components/copy-button/copy-button.component.ts +163 -0
  220. package/src/components/copy-button/copy-button.scss +47 -0
  221. package/src/components/copy-button/copy-button.test.ts +10 -0
  222. package/src/components/copy-button/index.ts +12 -0
  223. package/src/components/data-select/data-select.component.ts +219 -0
  224. package/src/components/data-select/data-select.scss +43 -0
  225. package/src/components/data-select/data-select.test.ts +10 -0
  226. package/src/components/data-select/index.ts +12 -0
  227. package/src/components/data-select/providers/color-data-provider.ts +16 -0
  228. package/src/components/data-select/providers/country-code-data-provider.ts +517 -0
  229. package/src/components/data-select/providers/country-data-provider.ts +527 -0
  230. package/src/components/data-select/providers/currency-data-provider.ts +328 -0
  231. package/src/components/data-select/providers/provider.ts +32 -0
  232. package/src/components/data-table/data-table.component.ts +1093 -0
  233. package/src/components/data-table/data-table.scss +330 -0
  234. package/src/components/data-table/data-table.test.ts +10 -0
  235. package/src/components/data-table/index.ts +12 -0
  236. package/src/components/data-table-filter/data-table-filter.component.ts +126 -0
  237. package/src/components/data-table-filter/data-table-filter.scss +22 -0
  238. package/src/components/data-table-filter/data-table-filter.test.ts +10 -0
  239. package/src/components/data-table-filter/index.ts +12 -0
  240. package/src/components/data-table-sort/data-table-sort.component.ts +56 -0
  241. package/src/components/data-table-sort/data-table-sort.scss +37 -0
  242. package/src/components/data-table-sort/data-table-sort.test.ts +10 -0
  243. package/src/components/data-table-sort/index.ts +12 -0
  244. package/src/components/datepicker/datepicker.component.ts +315 -0
  245. package/src/components/datepicker/datepicker.scss +237 -0
  246. package/src/components/datepicker/datepicker.test.ts +10 -0
  247. package/src/components/datepicker/index.ts +12 -0
  248. package/src/components/defined-label/defined-label.component.ts +241 -0
  249. package/src/components/defined-label/defined-label.scss +43 -0
  250. package/src/components/defined-label/defined-label.test.ts +10 -0
  251. package/src/components/defined-label/index.ts +12 -0
  252. package/src/components/dialog/dialog.component.ts +237 -0
  253. package/src/components/dialog/dialog.scss +197 -0
  254. package/src/components/dialog/dialog.test.ts +10 -0
  255. package/src/components/dialog/index.ts +12 -0
  256. package/src/components/dropdown/dropdown.component.ts +380 -0
  257. package/src/components/dropdown/dropdown.scss +9 -0
  258. package/src/components/dropdown/dropdown.test.ts +10 -0
  259. package/src/components/dropdown/index.ts +12 -0
  260. package/src/components/editor/editor.component.ts +423 -0
  261. package/src/components/editor/editor.scss +131 -0
  262. package/src/components/editor/editor.test.ts +10 -0
  263. package/src/components/editor/index.ts +12 -0
  264. package/src/components/editor/modules/attachment-module.ts +195 -0
  265. package/src/components/editor/modules/dialog-module/dialog-module.component.ts +289 -0
  266. package/src/components/editor/modules/dialog-module/dialog-module.scss +115 -0
  267. package/src/components/editor/modules/dialog-module/dialog-module.ts +99 -0
  268. package/src/components/editor/modules/drag-drop-module.ts +125 -0
  269. package/src/components/editor/modules/events/zn-command-select.ts +7 -0
  270. package/src/components/editor/modules/events/zn-editor-update.ts +7 -0
  271. package/src/components/editor/modules/events/zn-show-canned-response-dialog.ts +15 -0
  272. package/src/components/editor/modules/image-resize-module/image-resize-module.ts +157 -0
  273. package/src/components/editor/modules/menu-module/menu-module.component.ts +149 -0
  274. package/src/components/editor/modules/menu-module/menu-module.scss +17 -0
  275. package/src/components/editor/modules/menu-module/menu-module.ts +203 -0
  276. package/src/components/editor/modules/time-tracking-module.ts +35 -0
  277. package/src/components/empty-state/empty-state.component.ts +63 -0
  278. package/src/components/empty-state/empty-state.scss +91 -0
  279. package/src/components/empty-state/empty-state.test.ts +10 -0
  280. package/src/components/empty-state/index.ts +12 -0
  281. package/src/components/expanding-action/expanding-action.component.ts +312 -0
  282. package/src/components/expanding-action/expanding-action.scss +87 -0
  283. package/src/components/expanding-action/expanding-action.test.ts +10 -0
  284. package/src/components/expanding-action/index.ts +12 -0
  285. package/src/components/file/file.component.ts +619 -0
  286. package/src/components/file/file.scss +200 -0
  287. package/src/components/file/file.test.ts +10 -0
  288. package/src/components/file/index.ts +12 -0
  289. package/src/components/form-group/form-group.component.ts +93 -0
  290. package/src/components/form-group/form-group.scss +84 -0
  291. package/src/components/form-group/form-group.test.ts +10 -0
  292. package/src/components/form-group/index.ts +12 -0
  293. package/src/components/header/header.component.ts +186 -0
  294. package/src/components/header/header.scss +244 -0
  295. package/src/components/header/header.test.ts +10 -0
  296. package/src/components/header/index.ts +12 -0
  297. package/src/components/hover-container/hover-container.component.ts +214 -0
  298. package/src/components/hover-container/hover-container.scss +59 -0
  299. package/src/components/hover-container/hover-container.ts +10 -0
  300. package/src/components/hover-container/index.ts +12 -0
  301. package/src/components/icon/icon.component.ts +251 -0
  302. package/src/components/icon/icon.scss +186 -0
  303. package/src/components/icon/icon.test.ts +10 -0
  304. package/src/components/icon/index.ts +13 -0
  305. package/src/components/icon/lni.scss +2492 -0
  306. package/src/components/inline-edit/index.ts +12 -0
  307. package/src/components/inline-edit/inline-edit.component.ts +289 -0
  308. package/src/components/inline-edit/inline-edit.scss +139 -0
  309. package/src/components/inline-edit/inline-edit.test.ts +10 -0
  310. package/src/components/input/index.ts +12 -0
  311. package/src/components/input/input.component.ts +614 -0
  312. package/src/components/input/input.scss +355 -0
  313. package/src/components/input/input.test.ts +10 -0
  314. package/src/components/item/index.ts +12 -0
  315. package/src/components/item/item.component.ts +102 -0
  316. package/src/components/item/item.scss +161 -0
  317. package/src/components/item/item.test.ts +10 -0
  318. package/src/components/linked-select/index.ts +12 -0
  319. package/src/components/linked-select/linked-select.component.ts +156 -0
  320. package/src/components/linked-select/linked-select.scss +9 -0
  321. package/src/components/linked-select/linked-select.test.ts +17 -0
  322. package/src/components/menu/index.ts +12 -0
  323. package/src/components/menu/menu.component.ts +243 -0
  324. package/src/components/menu/menu.scss +14 -0
  325. package/src/components/menu/menu.test.ts +10 -0
  326. package/src/components/menu-item/index.ts +12 -0
  327. package/src/components/menu-item/menu-item.component.ts +220 -0
  328. package/src/components/menu-item/menu-item.scss +157 -0
  329. package/src/components/menu-item/menu-item.test.ts +10 -0
  330. package/src/components/menu-item/submenu-controller.ts +291 -0
  331. package/src/components/navbar/index.ts +12 -0
  332. package/src/components/navbar/navbar.component.ts +240 -0
  333. package/src/components/navbar/navbar.scss +411 -0
  334. package/src/components/navbar/navbar.test.ts +10 -0
  335. package/src/components/note/index.ts +12 -0
  336. package/src/components/note/note.component.ts +60 -0
  337. package/src/components/note/note.scss +69 -0
  338. package/src/components/note/note.test.ts +10 -0
  339. package/src/components/option/index.ts +12 -0
  340. package/src/components/option/option.component.ts +152 -0
  341. package/src/components/option/option.scss +88 -0
  342. package/src/components/option/option.test.ts +10 -0
  343. package/src/components/order-table/index.ts +12 -0
  344. package/src/components/order-table/order-table.component.ts +323 -0
  345. package/src/components/order-table/order-table.scss +154 -0
  346. package/src/components/order-table/order-table.test.ts +10 -0
  347. package/src/components/page-nav/index.ts +12 -0
  348. package/src/components/page-nav/page-nav.component.ts +117 -0
  349. package/src/components/page-nav/page-nav.scss +155 -0
  350. package/src/components/page-nav/page-nav.test.ts +10 -0
  351. package/src/components/pagination/index.ts +12 -0
  352. package/src/components/pagination/pagination.component.ts +91 -0
  353. package/src/components/pagination/pagination.scss +76 -0
  354. package/src/components/pagination/pagination.test.ts +10 -0
  355. package/src/components/pane/index.ts +12 -0
  356. package/src/components/pane/pane.component.ts +52 -0
  357. package/src/components/pane/pane.scss +45 -0
  358. package/src/components/pane/pane.test.ts +10 -0
  359. package/src/components/panel/index.ts +12 -0
  360. package/src/components/panel/panel.component.ts +100 -0
  361. package/src/components/panel/panel.scss +129 -0
  362. package/src/components/panel/panel.test.ts +10 -0
  363. package/src/components/popup/index.ts +12 -0
  364. package/src/components/popup/popup.component.ts +543 -0
  365. package/src/components/popup/popup.scss +59 -0
  366. package/src/components/popup/popup.test.ts +10 -0
  367. package/src/components/progress-bar/index.ts +12 -0
  368. package/src/components/progress-bar/progress-bar.component.ts +80 -0
  369. package/src/components/progress-bar/progress-bar.scss +46 -0
  370. package/src/components/progress-bar/progress-bar.test.ts +10 -0
  371. package/src/components/progress-tile/index.ts +12 -0
  372. package/src/components/progress-tile/progress-tile.component.ts +127 -0
  373. package/src/components/progress-tile/progress-tile.scss +116 -0
  374. package/src/components/progress-tile/progress-tile.test.ts +10 -0
  375. package/src/components/query-builder/index.ts +12 -0
  376. package/src/components/query-builder/query-builder.component.ts +544 -0
  377. package/src/components/query-builder/query-builder.scss +53 -0
  378. package/src/components/query-builder/query-builder.test.ts +10 -0
  379. package/src/components/radio/index.ts +12 -0
  380. package/src/components/radio/radio.component.ts +305 -0
  381. package/src/components/radio/radio.scss +197 -0
  382. package/src/components/radio/radio.test.ts +10 -0
  383. package/src/components/radio-group/index.ts +12 -0
  384. package/src/components/radio-group/radio-group.component.ts +362 -0
  385. package/src/components/radio-group/radio-group.scss +60 -0
  386. package/src/components/radio-group/radio-group.test.ts +10 -0
  387. package/src/components/rating/index.ts +12 -0
  388. package/src/components/rating/rating.component.ts +235 -0
  389. package/src/components/rating/rating.scss +82 -0
  390. package/src/components/rating/rating.test.ts +10 -0
  391. package/src/components/scroll-container/index.ts +12 -0
  392. package/src/components/scroll-container/scroll-container.component.ts +41 -0
  393. package/src/components/scroll-container/scroll-container.scss +17 -0
  394. package/src/components/scroll-container/scroll-container.test.ts +10 -0
  395. package/src/components/select/index.ts +12 -0
  396. package/src/components/select/select.component.ts +984 -0
  397. package/src/components/select/select.scss +325 -0
  398. package/src/components/select/select.test.ts +10 -0
  399. package/src/components/sidebar/index.ts +12 -0
  400. package/src/components/sidebar/sidebar.component.ts +98 -0
  401. package/src/components/sidebar/sidebar.scss +294 -0
  402. package/src/components/sidebar/sidebar.test.ts +10 -0
  403. package/src/components/simple-chart/index.ts +12 -0
  404. package/src/components/simple-chart/simple-chart.component.ts +204 -0
  405. package/src/components/simple-chart/simple-chart.scss +9 -0
  406. package/src/components/simple-chart/simple-chart.test.ts +10 -0
  407. package/src/components/skeleton/index.ts +12 -0
  408. package/src/components/skeleton/skeleton.component.ts +34 -0
  409. package/src/components/skeleton/skeleton.scss +39 -0
  410. package/src/components/skeleton/skeleton.test.ts +10 -0
  411. package/src/components/slideout/index.ts +12 -0
  412. package/src/components/slideout/slideout.component.ts +223 -0
  413. package/src/components/slideout/slideout.scss +96 -0
  414. package/src/components/slideout/slideout.test.ts +10 -0
  415. package/src/components/sp/index.ts +12 -0
  416. package/src/components/sp/sp.component.ts +86 -0
  417. package/src/components/sp/sp.scss +88 -0
  418. package/src/components/sp/sp.test.ts +10 -0
  419. package/src/components/split-button/index.ts +12 -0
  420. package/src/components/split-button/split-button.component.ts +154 -0
  421. package/src/components/split-button/split-button.scss +9 -0
  422. package/src/components/split-button/split-button.test.ts +10 -0
  423. package/src/components/split-pane/index.ts +12 -0
  424. package/src/components/split-pane/split-pane.component.ts +195 -0
  425. package/src/components/split-pane/split-pane.scss +303 -0
  426. package/src/components/split-pane/split-pane.test.ts +10 -0
  427. package/src/components/stat/index.ts +12 -0
  428. package/src/components/stat/stat.component.ts +117 -0
  429. package/src/components/stat/stat.scss +92 -0
  430. package/src/components/stat/stat.test.ts +10 -0
  431. package/src/components/status-indicator/index.ts +12 -0
  432. package/src/components/status-indicator/status-indicator.component.ts +31 -0
  433. package/src/components/status-indicator/status-indicator.scss +32 -0
  434. package/src/components/status-indicator/status-indicator.test.ts +10 -0
  435. package/src/components/stepper/index.ts +12 -0
  436. package/src/components/stepper/stepper.component.ts +80 -0
  437. package/src/components/stepper/stepper.scss +88 -0
  438. package/src/components/stepper/stepper.test.ts +10 -0
  439. package/src/components/style/index.ts +12 -0
  440. package/src/components/style/style.component.ts +150 -0
  441. package/src/components/style/style.scss +1 -0
  442. package/src/components/style/style.test.ts +10 -0
  443. package/src/components/table/index.ts +12 -0
  444. package/src/components/table/table.component.ts +297 -0
  445. package/src/components/table/table.scss +209 -0
  446. package/src/components/table/table.test.ts +10 -0
  447. package/src/components/tabs/index.ts +12 -0
  448. package/src/components/tabs/tabs.component.ts +496 -0
  449. package/src/components/tabs/tabs.scss +147 -0
  450. package/src/components/tabs/tabs.test.ts +10 -0
  451. package/src/components/textarea/index.ts +12 -0
  452. package/src/components/textarea/textarea.component.ts +417 -0
  453. package/src/components/textarea/textarea.scss +152 -0
  454. package/src/components/textarea/textarea.test.ts +10 -0
  455. package/src/components/tile/index.ts +12 -0
  456. package/src/components/tile/tile.component.ts +105 -0
  457. package/src/components/tile/tile.scss +144 -0
  458. package/src/components/tile/tile.test.ts +10 -0
  459. package/src/components/tile-property/index.ts +12 -0
  460. package/src/components/tile-property/tile-property.component.ts +43 -0
  461. package/src/components/tile-property/tile-property.scss +43 -0
  462. package/src/components/tile-property/tile-property.test.ts +10 -0
  463. package/src/components/timer/index.ts +12 -0
  464. package/src/components/timer/timer.component.ts +88 -0
  465. package/src/components/timer/timer.scss +40 -0
  466. package/src/components/timer/timer.test.ts +10 -0
  467. package/src/components/toggle/index.ts +12 -0
  468. package/src/components/toggle/toggle.component.ts +203 -0
  469. package/src/components/toggle/toggle.scss +93 -0
  470. package/src/components/toggle/toggle.test.ts +10 -0
  471. package/src/components/tooltip/index.ts +12 -0
  472. package/src/components/tooltip/tooltip.component.ts +215 -0
  473. package/src/components/tooltip/tooltip.scss +43 -0
  474. package/src/components/tooltip/tooltip.test.ts +10 -0
  475. package/src/components/vertical-stepper/index.ts +12 -0
  476. package/src/components/vertical-stepper/vertical-stepper.component.ts +53 -0
  477. package/src/components/vertical-stepper/vertical-stepper.scss +84 -0
  478. package/src/components/vertical-stepper/vertical-stepper.test.ts +10 -0
  479. package/src/components/well/index.ts +12 -0
  480. package/src/components/well/well.component.ts +43 -0
  481. package/src/components/well/well.scss +19 -0
  482. package/src/components/well/well.test.ts +10 -0
  483. package/src/declaration.d.ts +39 -0
  484. package/src/events/events.ts +7 -0
  485. package/src/events/zn-after-collapse.ts +7 -0
  486. package/src/events/zn-after-expand.ts +7 -0
  487. package/src/events/zn-after-hide.ts +7 -0
  488. package/src/events/zn-after-show.ts +7 -0
  489. package/src/events/zn-blur.ts +7 -0
  490. package/src/events/zn-cancel.ts +7 -0
  491. package/src/events/zn-change.ts +7 -0
  492. package/src/events/zn-clear.ts +7 -0
  493. package/src/events/zn-close.ts +7 -0
  494. package/src/events/zn-collapse.ts +7 -0
  495. package/src/events/zn-copy.ts +7 -0
  496. package/src/events/zn-element-added.ts +7 -0
  497. package/src/events/zn-error.ts +7 -0
  498. package/src/events/zn-expand.ts +7 -0
  499. package/src/events/zn-filter-change.ts +7 -0
  500. package/src/events/zn-finish.ts +7 -0
  501. package/src/events/zn-focus.ts +7 -0
  502. package/src/events/zn-hide.ts +7 -0
  503. package/src/events/zn-hover.ts +10 -0
  504. package/src/events/zn-initial-focus.ts +7 -0
  505. package/src/events/zn-input.ts +7 -0
  506. package/src/events/zn-invalid.ts +7 -0
  507. package/src/events/zn-load.ts +7 -0
  508. package/src/events/zn-menu-ready.ts +9 -0
  509. package/src/events/zn-menu-select.ts +9 -0
  510. package/src/events/zn-open.ts +7 -0
  511. package/src/events/zn-remove.ts +7 -0
  512. package/src/events/zn-request-close.ts +7 -0
  513. package/src/events/zn-select.ts +9 -0
  514. package/src/events/zn-show.ts +7 -0
  515. package/src/events/zn-sort-change.ts +7 -0
  516. package/src/events/zn-submit.ts +7 -0
  517. package/src/form-control.scss +123 -0
  518. package/src/internal/animate.ts +64 -0
  519. package/src/internal/default-value.ts +49 -0
  520. package/src/internal/event.ts +75 -0
  521. package/src/internal/form.ts +527 -0
  522. package/src/internal/offset.ts +13 -0
  523. package/src/internal/scroll.ts +69 -0
  524. package/src/internal/slot.ts +110 -0
  525. package/src/internal/storage.ts +70 -0
  526. package/src/internal/tabbable.ts +198 -0
  527. package/src/internal/theme.ts +54 -0
  528. package/src/internal/watch.ts +63 -0
  529. package/src/internal/zinc-element.ts +113 -0
  530. package/src/translations/en.ts +30 -0
  531. package/src/utilities/animation-registry.ts +74 -0
  532. package/src/utilities/base-path.ts +46 -0
  533. package/src/utilities/lit-to-html.ts +7 -0
  534. package/src/utilities/localize.ts +37 -0
  535. package/src/utilities/md5.ts +216 -0
  536. package/src/utilities/on.ts +29 -0
  537. package/src/utilities/query.ts +36 -0
  538. package/src/wc.scss +33 -0
  539. package/src/zinc-autoloader.ts +58 -0
  540. package/src/zinc.ts +83 -0
  541. package/tsconfig.json +41 -0
  542. package/tsconfig.prod.json +12 -0
  543. package/web-test-runner.config.js +50 -0
  544. package/.idea/.name +0 -1
  545. package/.idea/fusion.iml +0 -9
  546. package/.idea/modules.xml +0 -8
  547. package/.idea/php.xml +0 -4
  548. package/.idea/vcs.xml +0 -6
  549. package/.idea/watcherTasks.xml +0 -25
  550. package/components/Blank/demo/demo.html +0 -11
  551. package/components/Blank/dist/zn-blank.js +0 -39
  552. package/components/Blank/go/component.go +0 -18
  553. package/components/Blank/go/go.mod +0 -3
  554. package/components/Blank/package.json +0 -33
  555. package/components/Blank/php/composer.json +0 -25
  556. package/components/Blank/php/src/Blank.php +0 -15
  557. package/components/Blank/rollup.config.js +0 -32
  558. package/components/Blank/scss/Styles.scss +0 -6
  559. package/components/Blank/ts/Component.ts +0 -15
  560. package/components/Blank/tsconfig.json +0 -7
  561. package/components/Icon/demo/demo.html +0 -90
  562. package/components/Icon/dist/zn-icon.js +0 -55
  563. package/components/Icon/go/component.go +0 -56
  564. package/components/Icon/go/go.mod +0 -3
  565. package/components/Icon/package.json +0 -33
  566. package/components/Icon/php/composer.json +0 -26
  567. package/components/Icon/php/src/Icon.php +0 -38
  568. package/components/Icon/php/src/Library.php +0 -17
  569. package/components/Icon/php/src/Size.php +0 -42
  570. package/components/Icon/roadmap.md +0 -7
  571. package/components/Icon/rollup.config.js +0 -32
  572. package/components/Icon/scss/Styles.scss +0 -65
  573. package/components/Icon/ts/Component.ts +0 -108
  574. package/components/Icon/ts/md5.ts +0 -215
  575. package/components/Icon/tsconfig.json +0 -7
  576. package/components/MaxWidth/demo/demo.html +0 -11
  577. package/components/MaxWidth/dist/zn-max-width.js +0 -51
  578. package/components/MaxWidth/go/component.go +0 -24
  579. package/components/MaxWidth/go/go.mod +0 -3
  580. package/components/MaxWidth/package.json +0 -33
  581. package/components/MaxWidth/php/composer.json +0 -25
  582. package/components/MaxWidth/php/src/MaxWidth.php +0 -32
  583. package/components/MaxWidth/rollup.config.js +0 -32
  584. package/components/MaxWidth/scss/Styles.scss +0 -13
  585. package/components/MaxWidth/ts/Component.ts +0 -27
  586. package/components/MaxWidth/tsconfig.json +0 -7
  587. package/components/roadmap.md +0 -4
  588. package/layout/components/Columns/demo/demo.html +0 -16
  589. package/layout/components/Columns/ts/Component.ts +0 -59
  590. package/layout/demo/index.html +0 -26
  591. package/layout/dist/zn-layout.js +0 -93
  592. package/layout/package.json +0 -38
  593. package/layout/rollup.config.js +0 -38
  594. package/layout/scss/layout.scss +0 -24
  595. package/layout/tailwind.config.js +0 -42
  596. package/layout/ts/container.ts +0 -132
  597. package/layout/ts/import.ts +0 -2
  598. package/layout/tsconfig.json +0 -7
  599. /package/{layout/components/Columns/scss/Styles.scss → src/internal/zinc-element.test.ts} +0 -0
@@ -0,0 +1,129 @@
1
+ @use "../../wc";
2
+
3
+ :host {
4
+ @include wc.scrollbars;
5
+ flex-grow: 1;
6
+ overflow: visible;
7
+ display: flex;
8
+ max-width: 100%;
9
+ z-index: 1;
10
+ position: relative;
11
+ min-width: var(--zn-spacing-small-panel);
12
+ flex-basis: var(--zn-panel-basis);
13
+ }
14
+
15
+ .panel {
16
+ position: relative;
17
+ border: 1px solid rgb(var(--zn-border-color));
18
+ display: flex;
19
+ border-radius: var(--zn-border-radius-large);
20
+ flex-direction: column;
21
+ flex-grow: 1;
22
+ flex-basis: var(--zn-spacing-small-panel);
23
+ width: 100%;
24
+ background-color: rgba(var(--zn-panel), var(--zn-panel-opacity));
25
+ margin-bottom: 3px;
26
+
27
+ &__inner {
28
+ overflow: hidden;
29
+ display: flex;
30
+ border-radius: var(--zn-border-radius-large);
31
+ flex-direction: column;
32
+ flex-grow: 1;
33
+ }
34
+
35
+ &__header {
36
+ padding: var(--zn-spacing-x-small) var(--zn-spacing-medium);
37
+
38
+ &::part(base) {
39
+ border-bottom: 0;
40
+ }
41
+
42
+ &::part(content) {
43
+ padding: 0;
44
+ }
45
+ }
46
+
47
+ &__body {
48
+ display: flex;
49
+ flex-direction: column;
50
+ overflow-y: auto;
51
+ flex-grow: 1;
52
+ padding: 0 var(--zn-spacing-medium) var(--zn-spacing-medium);
53
+
54
+ > :not([hidden]) ~ :not([hidden]) {
55
+ border: 1px solid rgb(var(--zn-border-color));
56
+ }
57
+ }
58
+
59
+ &__footer {
60
+ font-size: var(--zn-font-size-small);
61
+ display: block;
62
+ padding: var(--zn-spacing-small) var(--zn-spacing-medium);
63
+ background: rgb(var(--zn-panel-secondary));
64
+ border-bottom-left-radius: var(--zn-border-radius-large);
65
+ border-bottom-right-radius: var(--zn-border-radius-large);
66
+ }
67
+
68
+ &--tabbed .panel__body {
69
+ padding: 0;
70
+ }
71
+
72
+ &--transparent {
73
+ background-color: transparent;
74
+ border: none;
75
+
76
+ &:before {
77
+ display: none;
78
+ }
79
+ }
80
+
81
+ &:not(.panel--flush, .panel--flush-x, .panel--flush-y) {
82
+ ::slotted(zn-sp) {
83
+ --zn-sp-padding: 0 !important
84
+ }
85
+ }
86
+
87
+ &:before {
88
+ position: absolute;
89
+ content: '';
90
+ bottom: -3px;
91
+ left: 0;
92
+ right: 0;
93
+ height: 20px;
94
+ background-color: rgb(var(--zn-shadow));
95
+ border-radius: var(--zn-border-radius-large);
96
+ z-index: -1;
97
+ }
98
+
99
+
100
+ &:not(.panel--has-header):not(.panel--flush, .panel--flush-y) &__body {
101
+ padding-top: var(--zn-spacing-medium);
102
+ }
103
+
104
+ &--flush {
105
+ .panel__body {
106
+ padding: 0;
107
+ }
108
+ }
109
+
110
+ &--flush-x {
111
+ .panel__body {
112
+ padding-inline: 0;
113
+ }
114
+ }
115
+
116
+ &--flush-y {
117
+ .panel__body {
118
+ padding-block: 0;
119
+ }
120
+ }
121
+
122
+ &--transparent {
123
+ .panel__header {
124
+ padding-left: 0;
125
+ padding-right: 0;
126
+ }
127
+ }
128
+ }
129
+
@@ -0,0 +1,10 @@
1
+ import '../../../dist/zn.min.js';
2
+ import { expect, fixture, html } from '@open-wc/testing';
3
+
4
+ describe('<zn-panel>', () => {
5
+ it('should render a component', async () => {
6
+ const el = await fixture(html` <zn-panel></zn-panel> `);
7
+
8
+ expect(el).to.exist;
9
+ });
10
+ });
@@ -0,0 +1,12 @@
1
+ import ZnPopup from './popup.component';
2
+
3
+ export * from './popup.component';
4
+ export default ZnPopup;
5
+
6
+ ZnPopup.define('zn-popup');
7
+
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'zn-popup': ZnPopup;
11
+ }
12
+ }
@@ -0,0 +1,543 @@
1
+ import {arrow, autoUpdate, computePosition, flip, offset, platform, shift, size} from '@floating-ui/dom';
2
+ import {classMap} from 'lit/directives/class-map.js';
3
+ import {html, unsafeCSS} from 'lit';
4
+ import {offsetParent} from 'composed-offset-position';
5
+ import {property, query} from 'lit/decorators.js';
6
+ import ZincElement from '../../internal/zinc-element';
7
+ import type {CSSResultGroup} from 'lit';
8
+
9
+ import styles from './popup.scss';
10
+
11
+ export interface VirtualElement {
12
+ getBoundingClientRect: () => DOMRect;
13
+ contextElement?: Element;
14
+ }
15
+
16
+ function isVirtualElement(e: unknown): e is VirtualElement {
17
+ return (
18
+ e !== null &&
19
+ typeof e === 'object' &&
20
+ 'getBoundingClientRect' in e &&
21
+ ('contextElement' in e ? e instanceof Element : true)
22
+ );
23
+ }
24
+
25
+ /**
26
+ * @summary Short summary of the component's intended use.
27
+ * @documentation https://zinc.style/components/popup
28
+ * @status experimental
29
+ * @since 1.0
30
+ *
31
+ * @dependency zn-example
32
+ *
33
+ * @event zn-event-name - Emitted as an example.
34
+ *
35
+ * @slot - The default slot.
36
+ * @slot example - An example slot.
37
+ *
38
+ * @csspart base - The component's base wrapper.
39
+ *
40
+ * @cssproperty --example - An example CSS custom property.
41
+ */
42
+ export default class ZnPopup extends ZincElement {
43
+ static styles: CSSResultGroup = unsafeCSS(styles);
44
+
45
+ private anchorEl: Element | VirtualElement | null;
46
+ private cleanup: ReturnType<typeof autoUpdate> | undefined;
47
+
48
+ /** A reference to the internal popup container. Useful for animating and styling the popup with JavaScript. */
49
+ @query('.popup') popup: HTMLElement;
50
+ @query('.popup__arrow') private arrowEl: HTMLElement;
51
+
52
+ /**
53
+ * The element the popup will be anchored to. If the anchor lives outside of the popup, you can provide the anchor
54
+ * element `id`, a DOM element reference, or a `VirtualElement`. If the anchor lives inside the popup, use the
55
+ * `anchor` slot instead.
56
+ */
57
+ @property() anchor: Element | string | VirtualElement;
58
+
59
+ /**
60
+ * Activates the positioning logic and shows the popup. When this attribute is removed, the positioning logic is torn
61
+ * down and the popup will be hidden.
62
+ */
63
+ @property({type: Boolean, reflect: true}) active = false;
64
+
65
+ /**
66
+ * The preferred placement of the popup. Note that the actual placement will vary as configured to keep the
67
+ * panel inside of the viewport.
68
+ */
69
+ @property({reflect: true}) placement:
70
+ | 'top'
71
+ | 'top-start'
72
+ | 'top-end'
73
+ | 'bottom'
74
+ | 'bottom-start'
75
+ | 'bottom-end'
76
+ | 'right'
77
+ | 'right-start'
78
+ | 'right-end'
79
+ | 'left'
80
+ | 'left-start'
81
+ | 'left-end' = 'top';
82
+
83
+ /**
84
+ * Determines how the popup is positioned. The `absolute` strategy works well in most cases, but if overflow is
85
+ * clipped, using a `fixed` position strategy can often workaround it.
86
+ */
87
+ @property({reflect: true}) strategy: 'absolute' | 'fixed' = 'fixed';
88
+
89
+ /** The distance in pixels from which to offset the panel away from its anchor. */
90
+ @property({type: Number}) distance = 0;
91
+
92
+ /** The distance in pixels from which to offset the panel along its anchor. */
93
+ @property({type: Number}) skidding = 0;
94
+
95
+ /**
96
+ * Attaches an arrow to the popup. The arrow's size and color can be customized using the `--arrow-size` and
97
+ * `--arrow-color` custom properties. For additional customizations, you can also target the arrow using
98
+ * `::part(arrow)` in your stylesheet.
99
+ */
100
+ @property({type: Boolean}) arrow = false;
101
+
102
+ /**
103
+ * The placement of the arrow. The default is `anchor`, which will align the arrow as close to the center of the
104
+ * anchor as possible, considering available space and `arrow-padding`. A value of `start`, `end`, or `center` will
105
+ * align the arrow to the start, end, or center of the popover instead.
106
+ */
107
+ @property({attribute: 'arrow-placement'}) arrowPlacement: 'start' | 'end' | 'center' | 'anchor' = 'anchor';
108
+
109
+ /**
110
+ * The amount of padding between the arrow and the edges of the popup. If the popup has a border-radius, for example,
111
+ * this will prevent it from overflowing the corners.
112
+ */
113
+ @property({attribute: 'arrow-padding', type: Number}) arrowPadding = 10;
114
+
115
+ /**
116
+ * When set, placement of the popup will flip to the opposite site to keep it in view. You can use
117
+ * `flipFallbackPlacements` to further configure how the fallback placement is determined.
118
+ */
119
+ @property({type: Boolean}) flip = false;
120
+
121
+ /**
122
+ * If the preferred placement doesn't fit, popup will be tested in these fallback placements until one fits. Must be a
123
+ * string of any number of placements separated by a space, e.g. "top bottom left". If no placement fits, the flip
124
+ * fallback strategy will be used instead.
125
+ * */
126
+ @property({
127
+ attribute: 'flip-fallback-placements',
128
+ converter: {
129
+ fromAttribute: (value: string) => {
130
+ return value
131
+ .split(' ')
132
+ .map(p => p.trim())
133
+ .filter(p => p !== '');
134
+ },
135
+ toAttribute: (value: []) => {
136
+ return value.join(' ');
137
+ }
138
+ }
139
+ })
140
+ flipFallbackPlacements = '';
141
+
142
+ /**
143
+ * When neither the preferred placement nor the fallback placements fit, this value will be used to determine whether
144
+ * the popup should be positioned using the best available fit based on available space or as it was initially
145
+ * preferred.
146
+ */
147
+ @property({attribute: 'flip-fallback-strategy'}) flipFallbackStrategy: 'best-fit' | 'initial' = 'best-fit';
148
+
149
+ /**
150
+ * The flip boundary describes clipping element(s) that overflow will be checked relative to when flipping. By
151
+ * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can
152
+ * change the boundary by passing a reference to one or more elements to this property.
153
+ */
154
+ @property({type: Object}) flipBoundary: Element | Element[];
155
+
156
+ /** The amount of padding, in pixels, to exceed before the flip behavior will occur. */
157
+ @property({attribute: 'flip-padding', type: Number}) flipPadding = 0;
158
+
159
+ /** Moves the popup along the axis to keep it in view when clipped. */
160
+ @property({type: Boolean}) shift = false;
161
+
162
+ /**
163
+ * The shift boundary describes clipping element(s) that overflow will be checked relative to when shifting. By
164
+ * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can
165
+ * change the boundary by passing a reference to one or more elements to this property.
166
+ */
167
+ @property({type: Object}) shiftBoundary: Element | Element[];
168
+
169
+ /** The amount of padding, in pixels, to exceed before the shift behavior will occur. */
170
+ @property({attribute: 'shift-padding', type: Number}) shiftPadding = 0;
171
+
172
+ /** When set, this will cause the popup to automatically resize itself to prevent it from overflowing. */
173
+ @property({attribute: 'auto-size'}) autoSize: 'horizontal' | 'vertical' | 'both';
174
+
175
+ /** Syncs the popup's width or height to that of the anchor element. */
176
+ @property() sync: 'width' | 'height' | 'both';
177
+
178
+ /**
179
+ * The auto-size boundary describes clipping element(s) that overflow will be checked relative to when resizing. By
180
+ * default, the boundary includes overflow ancestors that will cause the element to be clipped. If needed, you can
181
+ * change the boundary by passing a reference to one or more elements to this property.
182
+ */
183
+ @property({type: Object}) autoSizeBoundary: Element | Element[];
184
+
185
+ /** The amount of padding, in pixels, to exceed before the auto-size behavior will occur. */
186
+ @property({attribute: 'auto-size-padding', type: Number}) autoSizePadding = 0;
187
+
188
+ /**
189
+ * When a gap exists between the anchor and the popup element, this option will add a "hover bridge" that fills the
190
+ * gap using an invisible element. This makes listening for events such as `mouseenter` and `mouseleave` more sane
191
+ * because the pointer never technically leaves the element. The hover bridge will only be drawn when the popover is
192
+ * active.
193
+ */
194
+ @property({attribute: 'hover-bridge', type: Boolean}) hoverBridge = false;
195
+
196
+ async connectedCallback() {
197
+ super.connectedCallback();
198
+
199
+ // Start the positioner after the first update
200
+ await this.updateComplete;
201
+ this.start();
202
+ }
203
+
204
+ disconnectedCallback() {
205
+ super.disconnectedCallback();
206
+ this.stop();
207
+ }
208
+
209
+ async updated(changedProps: Map<string, unknown>) {
210
+ super.updated(changedProps);
211
+
212
+ // Start or stop the positioner when active changes
213
+ if (changedProps.has('active')) {
214
+ this.active ? this.start() : this.stop();
215
+ }
216
+
217
+ // Update the anchor when anchor changes
218
+ if (changedProps.has('anchor')) {
219
+ this.handleAnchorChange();
220
+ }
221
+
222
+ // All other properties will trigger a reposition when active
223
+ if (this.active) {
224
+ await this.updateComplete;
225
+ this.reposition();
226
+ }
227
+ }
228
+
229
+ private async handleAnchorChange() {
230
+ await this.stop();
231
+
232
+ if (this.anchor && typeof this.anchor === 'string') {
233
+ // Locate the anchor by id
234
+ const root = this.getRootNode() as Document | ShadowRoot;
235
+ this.anchorEl = root.getElementById(this.anchor);
236
+ } else if (this.anchor instanceof Element || isVirtualElement(this.anchor)) {
237
+ // Use the anchor's reference
238
+ this.anchorEl = this.anchor;
239
+ } else {
240
+ // Look for a slotted anchor
241
+ this.anchorEl = this.querySelector<HTMLElement>('[slot="anchor"]');
242
+ }
243
+
244
+ // If the anchor is a <slot>, we'll use the first assigned element as the target since slots use `display: contents`
245
+ // and positioning can't be calculated on them
246
+ if (this.anchorEl instanceof HTMLSlotElement) {
247
+ this.anchorEl = this.anchorEl.assignedElements({flatten: true})[0] as HTMLElement;
248
+ }
249
+
250
+ // If the anchor is valid, start it up
251
+ if (this.anchorEl) {
252
+ this.start();
253
+ }
254
+ }
255
+
256
+ private start() {
257
+ // We can't start the positioner without an anchor
258
+ if (!this.anchorEl) {
259
+ return;
260
+ }
261
+
262
+ this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
263
+ this.reposition();
264
+ });
265
+ }
266
+
267
+ private async stop(): Promise<void> {
268
+ return new Promise(resolve => {
269
+ if (this.cleanup) {
270
+ this.cleanup();
271
+ this.cleanup = undefined;
272
+ this.removeAttribute('data-current-placement');
273
+ this.style.removeProperty('--auto-size-available-width');
274
+ this.style.removeProperty('--auto-size-available-height');
275
+ this.popup.hidePopover();
276
+ requestAnimationFrame(() => resolve());
277
+ } else {
278
+ resolve();
279
+ }
280
+ });
281
+ }
282
+
283
+ /** Forces the popup to recalculate and reposition itself. */
284
+ reposition() {
285
+ // Nothing to do if the popup is inactive or the anchor doesn't exist
286
+ if (!this.active || !this.anchorEl) {
287
+ return;
288
+ }
289
+
290
+ const middleware = [
291
+ // The offset middleware goes first
292
+ offset({mainAxis: this.distance, crossAxis: this.skidding})
293
+ ];
294
+
295
+ // First we sync width/height
296
+ if (this.sync) {
297
+ middleware.push(
298
+ size({
299
+ apply: ({rects}: { rects: { reference: { width: number, height: number } } }) => {
300
+ const syncWidth = this.sync === 'width' || this.sync === 'both';
301
+ const syncHeight = this.sync === 'height' || this.sync === 'both';
302
+
303
+ this.popup.style.minWidth = syncWidth ? `${rects.reference.width}px` : '';
304
+ this.popup.style.minHeight = syncHeight ? `${rects.reference.height}px` : '';
305
+ }
306
+ })
307
+ );
308
+ } else {
309
+ // Cleanup styles if we're not matching width/height
310
+ this.popup.style.width = '';
311
+ this.popup.style.height = '';
312
+ }
313
+
314
+ // Then we flip
315
+ if (this.flip) {
316
+ middleware.push(
317
+ flip({
318
+ boundary: this.flipBoundary,
319
+ // @ts-expect-error String conversion into Placement[]
320
+ fallbackPlacements: this.flipFallbackPlacements,
321
+ fallbackStrategy: this.flipFallbackStrategy === 'best-fit' ? 'bestFit' : 'initialPlacement',
322
+ padding: this.flipPadding
323
+ })
324
+ );
325
+ }
326
+
327
+ // Then we shift
328
+ if (this.shift) {
329
+ middleware.push(
330
+ shift({
331
+ boundary: this.shiftBoundary,
332
+ padding: this.shiftPadding
333
+ })
334
+ );
335
+ }
336
+
337
+ // Now we adjust the size as needed
338
+ if (this.autoSize) {
339
+ middleware.push(
340
+ size({
341
+ boundary: this.autoSizeBoundary,
342
+ padding: this.autoSizePadding,
343
+ apply: ({availableWidth, availableHeight}: { availableWidth: number, availableHeight: number }) => {
344
+ if (this.autoSize === 'vertical' || this.autoSize === 'both') {
345
+ this.style.setProperty('--auto-size-available-height', `${availableHeight}px`);
346
+ } else {
347
+ this.style.removeProperty('--auto-size-available-height');
348
+ }
349
+
350
+ if (this.autoSize === 'horizontal' || this.autoSize === 'both') {
351
+ this.style.setProperty('--auto-size-available-width', `${availableWidth}px`);
352
+ } else {
353
+ this.style.removeProperty('--auto-size-available-width');
354
+ }
355
+ }
356
+ })
357
+ );
358
+ } else {
359
+ // Cleanup styles if we're no longer using auto-size
360
+ this.style.removeProperty('--auto-size-available-width');
361
+ this.style.removeProperty('--auto-size-available-height');
362
+ }
363
+
364
+ // Finally, we add an arrow
365
+ if (this.arrow) {
366
+ middleware.push(
367
+ arrow({
368
+ element: this.arrowEl,
369
+ padding: this.arrowPadding
370
+ })
371
+ );
372
+ }
373
+
374
+ const getOffsetParent =
375
+ this.strategy === 'absolute'
376
+ ? (element: Element) => platform.getOffsetParent(element, offsetParent)
377
+ : platform.getOffsetParent;
378
+
379
+ computePosition(this.anchorEl, this.popup, {
380
+ placement: this.placement,
381
+ middleware,
382
+ strategy: this.strategy,
383
+ platform: {
384
+ ...platform,
385
+ getOffsetParent
386
+ }
387
+ }).then(({x, y, middlewareData, placement}:
388
+ { x: number, y: number, middlewareData: any, placement: string }) => {
389
+ const staticSide = {top: 'bottom', right: 'left', bottom: 'top', left: 'right'}[placement.split('-')[0]]!;
390
+
391
+ this.setAttribute('data-current-placement', placement);
392
+
393
+ Object.assign(this.popup.style, {
394
+ left: `${x}px`,
395
+ top: `${y}px`
396
+ });
397
+
398
+ this.popup.showPopover();
399
+
400
+ if (this.arrow) {
401
+ const arrowX = middlewareData.arrow!.x;
402
+ const arrowY = middlewareData.arrow!.y;
403
+ let top: string = "";
404
+ let right: string = "";
405
+ let bottom: string = "";
406
+ let left: string;
407
+
408
+ if (this.arrowPlacement === 'start') {
409
+ // Start
410
+ top = typeof arrowY === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';
411
+ right = '';
412
+ left = typeof arrowX === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';
413
+ } else if (this.arrowPlacement === 'end') {
414
+ // End
415
+ right = typeof arrowX === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';
416
+ left = '';
417
+ bottom = typeof arrowY === 'number' ? `calc(${this.arrowPadding}px - var(--arrow-padding-offset))` : '';
418
+ } else if (this.arrowPlacement === 'center') {
419
+ // Center
420
+ left = typeof arrowX === 'number' ? `calc(50% - var(--arrow-size-diagonal))` : '';
421
+ top = typeof arrowY === 'number' ? `calc(50% - var(--arrow-size-diagonal))` : '';
422
+ } else {
423
+ // Anchor (default)
424
+ left = typeof arrowX === 'number' ? `${arrowX}px` : '';
425
+ top = typeof arrowY === 'number' ? `${arrowY}px` : '';
426
+ }
427
+
428
+ Object.assign(
429
+ this.arrowEl.style,
430
+ {top, right, bottom, left, [staticSide]: 'calc(var(--arrow-size-diagonal) * -1)'}
431
+ );
432
+ }
433
+ });
434
+
435
+ // Wait until the new position is drawn before updating the hover bridge, otherwise it can get out of sync
436
+ requestAnimationFrame(() => this.updateHoverBridge());
437
+ }
438
+
439
+ private updateHoverBridge = () => {
440
+ if (this.hoverBridge && this.anchorEl) {
441
+ const anchorRect = this.anchorEl.getBoundingClientRect();
442
+ const popupRect = this.popup.getBoundingClientRect();
443
+ const isVertical = this.placement.includes('top') || this.placement.includes('bottom');
444
+ let topLeftX: number;
445
+ let topLeftY: number;
446
+ let topRightX: number;
447
+ let topRightY: number;
448
+ let bottomLeftX: number;
449
+ let bottomLeftY: number;
450
+ let bottomRightX: number;
451
+ let bottomRightY: number;
452
+
453
+ if (isVertical) {
454
+ if (anchorRect.top < popupRect.top) {
455
+ // Anchor is above
456
+ topLeftX = anchorRect.left;
457
+ topLeftY = anchorRect.bottom;
458
+ topRightX = anchorRect.right;
459
+ topRightY = anchorRect.bottom;
460
+
461
+ bottomLeftX = popupRect.left;
462
+ bottomLeftY = popupRect.top;
463
+ bottomRightX = popupRect.right;
464
+ bottomRightY = popupRect.top;
465
+ } else {
466
+ // Anchor is below
467
+ topLeftX = popupRect.left;
468
+ topLeftY = popupRect.bottom;
469
+ topRightX = popupRect.right;
470
+ topRightY = popupRect.bottom;
471
+
472
+ bottomLeftX = anchorRect.left;
473
+ bottomLeftY = anchorRect.top;
474
+ bottomRightX = anchorRect.right;
475
+ bottomRightY = anchorRect.top;
476
+ }
477
+ } else {
478
+ if (anchorRect.left < popupRect.left) {
479
+ // Anchor is on the left
480
+ topLeftX = anchorRect.right;
481
+ topLeftY = anchorRect.top;
482
+ topRightX = popupRect.left;
483
+ topRightY = popupRect.top;
484
+
485
+ bottomLeftX = anchorRect.right;
486
+ bottomLeftY = anchorRect.bottom;
487
+ bottomRightX = popupRect.left;
488
+ bottomRightY = popupRect.bottom;
489
+ } else {
490
+ // Anchor is on the right
491
+ topLeftX = popupRect.right;
492
+ topLeftY = popupRect.top;
493
+ topRightX = anchorRect.left;
494
+ topRightY = anchorRect.top;
495
+
496
+ bottomLeftX = popupRect.right;
497
+ bottomLeftY = popupRect.bottom;
498
+ bottomRightX = anchorRect.left;
499
+ bottomRightY = anchorRect.bottom;
500
+ }
501
+ }
502
+
503
+ this.style.setProperty('--hover-bridge-top-left-x', `${topLeftX}px`);
504
+ this.style.setProperty('--hover-bridge-top-left-y', `${topLeftY}px`);
505
+ this.style.setProperty('--hover-bridge-top-right-x', `${topRightX}px`);
506
+ this.style.setProperty('--hover-bridge-top-right-y', `${topRightY}px`);
507
+ this.style.setProperty('--hover-bridge-bottom-left-x', `${bottomLeftX}px`);
508
+ this.style.setProperty('--hover-bridge-bottom-left-y', `${bottomLeftY}px`);
509
+ this.style.setProperty('--hover-bridge-bottom-right-x', `${bottomRightX}px`);
510
+ this.style.setProperty('--hover-bridge-bottom-right-y', `${bottomRightY}px`);
511
+ }
512
+ };
513
+
514
+ render() {
515
+ return html`
516
+ <slot class="anchor" name="anchor" @slotchange=${this.handleAnchorChange}></slot>
517
+
518
+ <span
519
+ part="hover-bridge"
520
+ class=${classMap({
521
+ 'popup-hover-bridge': true,
522
+ 'popup-hover-bridge--visible': this.hoverBridge && this.active
523
+ })}
524
+ ></span>
525
+
526
+ <div
527
+ id="popup"
528
+ part="popup"
529
+ popover
530
+ class=${classMap({
531
+ popup: true,
532
+ 'popup--active': this.active,
533
+ 'popup--fixed': this.strategy === 'fixed',
534
+ 'popup--has-arrow': this.arrow
535
+ })}
536
+ >
537
+ <slot></slot>
538
+ ${this.arrow ? html`
539
+ <div part="arrow" class="popup__arrow" role="presentation"></div>` : ''}
540
+ </div>
541
+ `;
542
+ }
543
+ }