@redvars/peacock 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (314) hide show
  1. package/dist/BaseButton-BNFAYn-S.js +219 -0
  2. package/dist/BaseButton-BNFAYn-S.js.map +1 -0
  3. package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
  4. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
  5. package/dist/BaseInput-14YmcfK7.js +27 -0
  6. package/dist/BaseInput-14YmcfK7.js.map +1 -0
  7. package/dist/assets/components.css +1 -1
  8. package/dist/assets/components.css.map +1 -1
  9. package/dist/assets/styles.css +1 -1
  10. package/dist/assets/styles.css.map +1 -1
  11. package/dist/banner.js +14 -30
  12. package/dist/banner.js.map +1 -1
  13. package/dist/{button-DMN1dPAg.js → button-colors-Ccys3hvS.js} +5 -468
  14. package/dist/button-colors-Ccys3hvS.js.map +1 -0
  15. package/dist/button-group.js +228 -8
  16. package/dist/button-group.js.map +1 -1
  17. package/dist/button.js +294 -8
  18. package/dist/button.js.map +1 -1
  19. package/dist/calendar-column-view.js +634 -0
  20. package/dist/calendar-column-view.js.map +1 -0
  21. package/dist/calendar-event-BrQ_SEKD.js +199 -0
  22. package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
  23. package/dist/calendar-month-view.js +376 -0
  24. package/dist/calendar-month-view.js.map +1 -0
  25. package/dist/calendar.js +339 -0
  26. package/dist/calendar.js.map +1 -0
  27. package/dist/canvas.js +361 -0
  28. package/dist/canvas.js.map +1 -0
  29. package/dist/card.js +18 -73
  30. package/dist/card.js.map +1 -1
  31. package/dist/cb-compound-expression.js +125 -0
  32. package/dist/cb-compound-expression.js.map +1 -0
  33. package/dist/cb-divider.js +150 -0
  34. package/dist/cb-divider.js.map +1 -0
  35. package/dist/cb-expression.js +75 -0
  36. package/dist/cb-expression.js.map +1 -0
  37. package/dist/cb-predicate.js +137 -0
  38. package/dist/cb-predicate.js.map +1 -0
  39. package/dist/chart-bar.js.map +1 -1
  40. package/dist/chart-doughnut.js +2 -2
  41. package/dist/chart-doughnut.js.map +1 -1
  42. package/dist/chart-pie.js +2 -2
  43. package/dist/chart-pie.js.map +1 -1
  44. package/dist/chart-stacked-bar.js.map +1 -1
  45. package/dist/code-editor.js +2 -1
  46. package/dist/code-editor.js.map +1 -1
  47. package/dist/code-highlighter.js +2 -1
  48. package/dist/code-highlighter.js.map +1 -1
  49. package/dist/condition-builder.js +58 -0
  50. package/dist/condition-builder.js.map +1 -0
  51. package/dist/custom-elements-jsdocs.json +10860 -5567
  52. package/dist/custom-elements.json +16180 -7996
  53. package/dist/dropdown-button.js +216 -0
  54. package/dist/dropdown-button.js.map +1 -0
  55. package/dist/event-manager-D-QCmUgR.js +113 -0
  56. package/dist/event-manager-D-QCmUgR.js.map +1 -0
  57. package/dist/fab.js +421 -9
  58. package/dist/fab.js.map +1 -1
  59. package/dist/flow-designer-dZnLJOQT.js +1656 -0
  60. package/dist/flow-designer-dZnLJOQT.js.map +1 -0
  61. package/dist/flow-designer-node-XMe-jlKg.js +548 -0
  62. package/dist/flow-designer-node-XMe-jlKg.js.map +1 -0
  63. package/dist/flow-designer-node.js +4 -0
  64. package/dist/flow-designer-node.js.map +1 -0
  65. package/dist/flow-designer.js +16 -0
  66. package/dist/flow-designer.js.map +1 -0
  67. package/dist/html-editor.js +358 -0
  68. package/dist/html-editor.js.map +1 -0
  69. package/dist/icon-button-CK1ZuE-2.js +247 -0
  70. package/dist/icon-button-CK1ZuE-2.js.map +1 -0
  71. package/dist/index.js +31 -8
  72. package/dist/index.js.map +1 -1
  73. package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
  74. package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
  75. package/dist/modal.js +418 -0
  76. package/dist/modal.js.map +1 -0
  77. package/dist/{select-4pl4XBj7.js → navigation-rail-DyO0oAZU.js} +2000 -2767
  78. package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
  79. package/dist/notification-manager.js +268 -0
  80. package/dist/notification-manager.js.map +1 -0
  81. package/dist/notification.js +3 -2
  82. package/dist/notification.js.map +1 -1
  83. package/dist/peacock-loader.js +102 -14
  84. package/dist/peacock-loader.js.map +1 -1
  85. package/dist/popover-NC7b1lTq.js +1971 -0
  86. package/dist/popover-NC7b1lTq.js.map +1 -0
  87. package/dist/popover-content.js +125 -0
  88. package/dist/popover-content.js.map +1 -0
  89. package/dist/popover.js +4 -0
  90. package/dist/popover.js.map +1 -0
  91. package/dist/search.js +4 -0
  92. package/dist/search.js.map +1 -1
  93. package/dist/split-button.js +388 -0
  94. package/dist/split-button.js.map +1 -0
  95. package/dist/src/__controllers/floating-controller.d.ts +35 -0
  96. package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
  97. package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
  98. package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
  99. package/dist/src/banner/banner.d.ts +0 -4
  100. package/dist/src/button/BaseButton.d.ts +4 -47
  101. package/dist/src/button/button/button.d.ts +32 -3
  102. package/dist/src/button/button-group/button-group.d.ts +2 -2
  103. package/dist/src/button/icon-button/icon-button.d.ts +33 -8
  104. package/dist/src/calendar/base-event.d.ts +10 -0
  105. package/dist/src/calendar/calendar-column-view.d.ts +41 -0
  106. package/dist/src/calendar/calendar-event.d.ts +7 -0
  107. package/dist/src/calendar/calendar-month-view.d.ts +31 -0
  108. package/dist/src/calendar/calendar.d.ts +65 -0
  109. package/dist/src/calendar/event-manager.d.ts +17 -0
  110. package/dist/src/calendar/index.d.ts +4 -0
  111. package/dist/src/calendar/types.d.ts +13 -0
  112. package/dist/src/calendar/utils.d.ts +31 -0
  113. package/dist/src/canvas/canvas.d.ts +92 -0
  114. package/dist/src/canvas/index.d.ts +2 -0
  115. package/dist/src/card/card.d.ts +4 -15
  116. package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
  117. package/dist/src/condition-builder/cb-divider.d.ts +26 -0
  118. package/dist/src/condition-builder/cb-expression.d.ts +31 -0
  119. package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
  120. package/dist/src/condition-builder/condition-builder.d.ts +27 -0
  121. package/dist/src/condition-builder/index.d.ts +5 -0
  122. package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
  123. package/dist/src/dropdown-button/index.d.ts +1 -0
  124. package/dist/src/fab/fab.d.ts +4 -35
  125. package/dist/src/flow-designer/commands.d.ts +66 -0
  126. package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
  127. package/dist/src/flow-designer/flow-designer.d.ts +133 -0
  128. package/dist/src/flow-designer/index.d.ts +7 -0
  129. package/dist/src/flow-designer/layout.d.ts +30 -0
  130. package/dist/src/flow-designer/types.d.ts +142 -0
  131. package/dist/src/flow-designer/validation.d.ts +43 -0
  132. package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
  133. package/dist/src/focus-ring/focus-ring.d.ts +11 -5
  134. package/dist/src/html-editor/html-editor.d.ts +56 -0
  135. package/dist/src/html-editor/index.d.ts +2 -0
  136. package/dist/src/index.d.ts +16 -1
  137. package/dist/src/link/link.d.ts +1 -1
  138. package/dist/src/menu/menu/menu.d.ts +5 -7
  139. package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
  140. package/dist/src/modal/index.d.ts +1 -0
  141. package/dist/src/modal/modal.d.ts +63 -0
  142. package/dist/src/navigation-rail/index.d.ts +2 -0
  143. package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
  144. package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
  145. package/dist/src/notification-manager/index.d.ts +1 -0
  146. package/dist/src/notification-manager/notification-manager.d.ts +44 -0
  147. package/dist/src/popover/index.d.ts +2 -0
  148. package/dist/src/popover/popover-content.d.ts +29 -0
  149. package/dist/src/popover/popover.d.ts +62 -0
  150. package/dist/src/sidebar-menu/index.d.ts +3 -0
  151. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
  152. package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
  153. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
  154. package/dist/src/split-button/index.d.ts +1 -0
  155. package/dist/src/split-button/split-button.d.ts +72 -0
  156. package/dist/src/toolbar/toolbar.d.ts +10 -10
  157. package/dist/src/tooltip/tooltip.d.ts +5 -15
  158. package/dist/src/url-field/index.d.ts +1 -0
  159. package/dist/src/url-field/url-field.d.ts +48 -0
  160. package/dist/test/flow-designer.test.d.ts +1 -0
  161. package/dist/test/sidebar-menu.test.d.ts +1 -0
  162. package/dist/toolbar.js +10 -10
  163. package/dist/toolbar.js.map +1 -1
  164. package/dist/tsconfig.tsbuildinfo +1 -1
  165. package/package.json +4 -2
  166. package/readme.md +73 -65
  167. package/scss/mixin.scss +16 -0
  168. package/src/__controllers/floating-controller.ts +237 -0
  169. package/src/__mixins/BaseButtonMixin.ts +83 -0
  170. package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
  171. package/src/__mixins/MixinConstructor.ts +1 -0
  172. package/src/{__base_element → __mixins}/README.md +2 -2
  173. package/src/banner/banner.scss +20 -25
  174. package/src/banner/banner.ts +1 -7
  175. package/src/button/BaseButton.ts +11 -100
  176. package/src/button/button/button-sizes.scss +4 -2
  177. package/src/button/button/button.ts +77 -23
  178. package/src/button/button-group/button-group.ts +2 -2
  179. package/src/button/icon-button/icon-button.ts +75 -33
  180. package/src/calendar/base-event.ts +49 -0
  181. package/src/calendar/calendar-column-view.scss +326 -0
  182. package/src/calendar/calendar-column-view.ts +392 -0
  183. package/src/calendar/calendar-event.ts +20 -0
  184. package/src/calendar/calendar-month-view.scss +192 -0
  185. package/src/calendar/calendar-month-view.ts +244 -0
  186. package/src/calendar/calendar.scss +71 -0
  187. package/src/calendar/calendar.ts +298 -0
  188. package/src/calendar/event-manager.ts +117 -0
  189. package/src/calendar/index.ts +4 -0
  190. package/src/calendar/types.ts +14 -0
  191. package/src/calendar/utils.ts +180 -0
  192. package/src/canvas/canvas.scss +60 -0
  193. package/src/canvas/canvas.ts +391 -0
  194. package/src/canvas/index.ts +2 -0
  195. package/src/card/card.ts +11 -71
  196. package/src/chart-bar/chart-bar.ts +9 -14
  197. package/src/chart-bar/chart-stacked-bar.ts +12 -18
  198. package/src/chart-doughnut/chart-doughnut.ts +23 -27
  199. package/src/chart-pie/chart-pie.ts +19 -23
  200. package/src/checkbox/checkbox.scss +17 -34
  201. package/src/checkbox/checkbox.ts +3 -1
  202. package/src/code-highlighter/code-highlighter.scss +1 -0
  203. package/src/code-highlighter/code-highlighter.ts +1 -1
  204. package/src/condition-builder/cb-compound-expression.scss +37 -0
  205. package/src/condition-builder/cb-compound-expression.ts +80 -0
  206. package/src/condition-builder/cb-divider.scss +93 -0
  207. package/src/condition-builder/cb-divider.ts +56 -0
  208. package/src/condition-builder/cb-expression.scss +14 -0
  209. package/src/condition-builder/cb-expression.ts +49 -0
  210. package/src/condition-builder/cb-predicate.scss +35 -0
  211. package/src/condition-builder/cb-predicate.ts +102 -0
  212. package/src/condition-builder/condition-builder.scss +13 -0
  213. package/src/condition-builder/condition-builder.ts +38 -0
  214. package/src/condition-builder/index.ts +5 -0
  215. package/src/date-picker/date-picker.ts +1 -1
  216. package/src/dropdown-button/demo/index.html +110 -0
  217. package/src/dropdown-button/dropdown-button.scss +22 -0
  218. package/src/dropdown-button/dropdown-button.ts +206 -0
  219. package/src/dropdown-button/index.ts +1 -0
  220. package/src/elevation/elevation.scss +5 -5
  221. package/src/fab/fab.ts +29 -100
  222. package/src/flow-designer/DEMO.md +239 -0
  223. package/src/flow-designer/commands.ts +278 -0
  224. package/src/flow-designer/flow-designer-node.ts +172 -0
  225. package/src/flow-designer/flow-designer.scss +457 -0
  226. package/src/flow-designer/flow-designer.ts +611 -0
  227. package/src/flow-designer/index.ts +41 -0
  228. package/src/flow-designer/layout.ts +357 -0
  229. package/src/flow-designer/types.ts +166 -0
  230. package/src/flow-designer/validation.ts +284 -0
  231. package/src/flow-designer/workflow-utils.ts +282 -0
  232. package/src/focus-ring/focus-ring.ts +47 -40
  233. package/src/html-editor/html-editor.scss +146 -0
  234. package/src/html-editor/html-editor.ts +276 -0
  235. package/src/html-editor/index.ts +3 -0
  236. package/src/index.ts +28 -1
  237. package/src/input/input.ts +3 -1
  238. package/src/link/link.ts +2 -2
  239. package/src/menu/menu/menu.scss +2 -2
  240. package/src/menu/menu/menu.ts +91 -101
  241. package/src/menu/menu-item/menu-item.scss +4 -0
  242. package/src/menu/menu-item/menu-item.ts +85 -79
  243. package/src/modal/index.ts +1 -0
  244. package/src/modal/modal.scss +206 -0
  245. package/src/modal/modal.ts +201 -0
  246. package/src/navigation-rail/index.ts +2 -0
  247. package/src/navigation-rail/navigation-rail-item.scss +216 -0
  248. package/src/navigation-rail/navigation-rail-item.ts +223 -0
  249. package/src/navigation-rail/navigation-rail.scss +72 -0
  250. package/src/navigation-rail/navigation-rail.ts +149 -0
  251. package/src/notification/notification.ts +3 -2
  252. package/src/notification-manager/index.ts +1 -0
  253. package/src/notification-manager/notification-manager.scss +113 -0
  254. package/src/notification-manager/notification-manager.ts +199 -0
  255. package/src/number-field/number-field.ts +6 -4
  256. package/src/pagination/pagination.ts +6 -4
  257. package/src/peacock-loader.ts +93 -5
  258. package/src/popover/index.ts +2 -0
  259. package/src/popover/popover-content.scss +69 -0
  260. package/src/popover/popover-content.ts +51 -0
  261. package/src/popover/popover.scss +7 -0
  262. package/src/popover/popover.ts +170 -0
  263. package/src/search/search.ts +4 -0
  264. package/src/sidebar-menu/demo/index.html +68 -0
  265. package/src/sidebar-menu/index.ts +3 -0
  266. package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
  267. package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
  268. package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
  269. package/src/sidebar-menu/sidebar-menu.ts +182 -0
  270. package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
  271. package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
  272. package/src/skeleton/skeleton.scss +18 -24
  273. package/src/snackbar/snackbar.ts +1 -1
  274. package/src/split-button/index.ts +1 -0
  275. package/src/split-button/split-button-colors.scss +56 -0
  276. package/src/split-button/split-button-sizes.scss +28 -0
  277. package/src/split-button/split-button.scss +79 -0
  278. package/src/split-button/split-button.ts +236 -0
  279. package/src/table/table.ts +2 -2
  280. package/src/tabs/tab.ts +4 -3
  281. package/src/text/text.css-component.scss +7 -1
  282. package/src/time-picker/time-picker.ts +1 -1
  283. package/src/toolbar/toolbar.ts +10 -10
  284. package/src/tooltip/tooltip.scss +4 -3
  285. package/src/tooltip/tooltip.ts +64 -98
  286. package/src/url-field/index.ts +1 -0
  287. package/src/url-field/url-field.scss +50 -0
  288. package/src/url-field/url-field.ts +239 -0
  289. package/dist/button-DMN1dPAg.js.map +0 -1
  290. package/dist/button-group-CX9CUUXk.js +0 -435
  291. package/dist/button-group-CX9CUUXk.js.map +0 -1
  292. package/dist/fab-C5Nzxk0E.js +0 -497
  293. package/dist/fab-C5Nzxk0E.js.map +0 -1
  294. package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
  295. package/dist/select-4pl4XBj7.js.map +0 -1
  296. package/dist/spread-B5cgadZl.js +0 -32
  297. package/dist/spread-B5cgadZl.js.map +0 -1
  298. package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
  299. package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
  300. package/dist/src/tree-view/index.d.ts +0 -2
  301. package/dist/src/tree-view/tree-node.d.ts +0 -69
  302. package/dist/src/tree-view/tree-view.d.ts +0 -40
  303. package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
  304. package/dist/test/tree-view.test.d.ts +0 -1
  305. package/dist/throttle-C7ZAPqtu.js +0 -24
  306. package/dist/throttle-C7ZAPqtu.js.map +0 -1
  307. package/src/__base_element/BaseHyperlink.ts +0 -42
  308. package/src/menu/menu/MenuSurfaceController.ts +0 -61
  309. package/src/tree-view/demo/index.html +0 -57
  310. package/src/tree-view/index.ts +0 -2
  311. package/src/tree-view/tree-node.scss +0 -101
  312. package/src/tree-view/tree-node.ts +0 -268
  313. package/src/tree-view/tree-view.ts +0 -182
  314. package/src/tree-view/wc-tree-view.ts +0 -9
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.5.0",
5
+ "version": "3.6.0",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
@@ -17,7 +17,9 @@
17
17
  "private": false,
18
18
  "exports": {
19
19
  ".": "./dist/src/index.js",
20
- "./icon.js": "./dist/src/index.js"
20
+ "./icon.js": "./dist/src/index.js",
21
+ "./flow-designer.js": "./dist/src/flow-designer/flow-designer.js",
22
+ "./flow-designer-node.js": "./dist/src/flow-designer/flow-designer-node.js"
21
23
  },
22
24
  "files": [
23
25
  "src",
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.5.0/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.0/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.5.0/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.0/dist/peacock-loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
@@ -65,24 +65,25 @@ Input controls are UI design elements that allow users to input information into
65
65
  collecting data and enabling user interactions. Some common examples of input controls include text fields, dropdown
66
66
  menus, checkboxes, and radio buttons.
67
67
 
68
- | Name | Component | State |
69
- |---------------------------------------------------------------------|-------------------|-------|
68
+ | Name | Component | State |
69
+ |---------------------------------------------------------------------|-----------------|-------|
70
+ | [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
70
71
  | [Code editor](https://peacock.redvars.com/components/code-editor) | wc-code-editor | 🟢 |
71
72
  | Color picker | color-picker | 🔴 |
72
- | [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
73
73
  | [Date picker](https://peacock.redvars.com/components/date-picker) | wc-date-picker | 🟡 |
74
- | Date Time picker | datetime-picker | 🔴 |
75
- | [Form control](https://peacock.redvars.com/components/form-control) | wc-field | 🟡 |
74
+ | Date time picker | datetime-picker | 🔴 |
75
+ | [Field / Form control](https://peacock.redvars.com/components/field) | wc-field | 🟡 |
76
76
  | File picker | file-picker | 🔴 |
77
- | [HTML editor](https://peacock.redvars.com/components/html-editor) | html-editor | 🟢 |
77
+ | HTML editor | html-editor | 🔴 |
78
78
  | [Input](https://peacock.redvars.com/components/input) | wc-input | 🟢 |
79
- | [Input URL](https://peacock.redvars.com/components/input-url) | input-url | 🟢 |
79
+ | Input URL | input-url | 🔴 |
80
80
  | Month picker | month-picker | 🔴 |
81
- | [Number](https://peacock.redvars.com/components/number) | wc-number-field | 🟢 |
82
- | [Select](https://peacock.redvars.com/components/select) | base-select | 🟢 |
81
+ | [Number field](https://peacock.redvars.com/components/number) | wc-number-field | 🟢 |
82
+ | [Radio](https://peacock.redvars.com/components/radio) | wc-radio | 🟢 |
83
+ | [Search](https://peacock.redvars.com/components/search) | wc-search | 🟡 |
84
+ | [Select](https://peacock.redvars.com/components/select) | wc-select | 🟢 |
83
85
  | [Textarea](https://peacock.redvars.com/components/textarea) | wc-textarea | 🟢 |
84
86
  | [Time picker](https://peacock.redvars.com/components/time-picker) | wc-time-picker | 🟡 |
85
- | [URL input](https://peacock.redvars.com/components/url-input) | url-input | 🔴 |
86
87
  | Week picker | week-picker | 🔴 |
87
88
 
88
89
  ## Navigation
@@ -91,12 +92,13 @@ Navigational components are UI elements that help users move around the app or w
91
92
  and intuitive way to navigate through different sections and pages. Some common examples of navigational components
92
93
  include menus, tabs, and breadcrumbs.
93
94
 
94
- | Name | Component | State |
95
- |--------------------------------------------------------|-----------------|-------|
96
- | [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | wc-breadcrumb | 🟢 |
97
- | [Dropdown](https://peacock.redvars.com/components/dropdown) | base-dropdown | 🟡 |
98
- | [Menu](https://peacock.redvars.com/components/menu) | wc-base-menu | 🟡 |
99
- | [Tabs](https://peacock.redvars.com/components/tabs) | wc-tabs | 🟢 |
95
+ | Name | Component | State |
96
+ |-------------------------------------------------------------------------|---------------|-------|
97
+ | [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | wc-breadcrumb | 🟢 |
98
+ | Dropdown | wc-dropdown | 🔴 |
99
+ | [Menu](https://peacock.redvars.com/components/menu) | wc-menu | 🟡 |
100
+ | [Tabs](https://peacock.redvars.com/components/tabs) | wc-tabs | 🟢 |
101
+ | [Toolbar](https://peacock.redvars.com/components/toolbar) | wc-toolbar | 🟡 |
100
102
 
101
103
  ## Informational
102
104
 
@@ -104,15 +106,17 @@ Informational components are UI elements that provide information to users. They
104
106
  updates, or instructions within the app or website. Some common examples of informational components
105
107
  include notifications, tooltips, and progress bars.
106
108
 
107
- | Name | Component | State |
108
- |-------------------------------------------------------------------------------------|------------------------|-------|
109
- | [Badge](https://peacock.redvars.com/components/badge) | wc-badge | 🟢 |
110
- | [Linear Progress](https://peacock.redvars.com/components/linear-progress) | wc-linear-progress | 🟢 |
111
- | [Circular Progress](https://peacock.redvars.com/components/circular-progress) | wc-circular-progress | 🟢 |
112
- | [Spinner](https://peacock.redvars.com/components/spinner) | wc-spinner | 🟢 |
113
- | [Tooltip](https://peacock.redvars.com/components/tooltip) | wc-tooltip | 🟢 |
114
- | [Notification](https://peacock.redvars.com/components/notification) | base-notification | 🟢 |
115
- | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | base-notification-manager | 🟢 |
109
+ | Name | Component | State |
110
+ |-------------------------------------------------------------------------------|----------------------|-------|
111
+ | [Badge](https://peacock.redvars.com/components/badge) | wc-badge | 🟢 |
112
+ | [Banner](https://peacock.redvars.com/components/banner) | wc-banner | 🟡 |
113
+ | [Circular Progress](https://peacock.redvars.com/components/circular-progress) | wc-circular-progress | 🟢 |
114
+ | [Linear Progress](https://peacock.redvars.com/components/linear-progress) | wc-linear-progress | 🟢 |
115
+ | [Notification](https://peacock.redvars.com/components/notification) | wc-notification | 🟢 |
116
+ | [Skeleton](https://peacock.redvars.com/components/skeleton) | wc-skeleton | 🟢 |
117
+ | [Snackbar](https://peacock.redvars.com/components/snackbar) | wc-snackbar | 🟡 |
118
+ | [Spinner](https://peacock.redvars.com/components/spinner) | wc-spinner | 🟢 |
119
+ | [Tooltip](https://peacock.redvars.com/components/tooltip) | wc-tooltip | 🟢 |
116
120
 
117
121
 
118
122
  ## Containers
@@ -121,54 +125,58 @@ Containers are UI elements that group similar content together, making it easier
121
125
  the interface. Examples of common containers include cards, carousels, and accordions, which provide structure and
122
126
  organization to the content.
123
127
 
124
- | Name | Component | State |
125
- |---------------------------------------------------------------|----------------|-------|
126
- | [Accordion](https://peacock.redvars.com/components/accordion) | wc-accordion | 🟢 |
127
- | Card | base-card | 🟡 |
128
+ | Name | Component | State |
129
+ |-----------------------------------------------------------------------|------------------|-------|
130
+ | [Accordion](https://peacock.redvars.com/components/accordion) | wc-accordion | 🟢 |
131
+ | [Bottom Sheet](https://peacock.redvars.com/components/bottom-sheet) | wc-bottom-sheet | 🟡 |
132
+ | [Card](https://peacock.redvars.com/components/card) | wc-card | 🟢 |
133
+ | Container | wc-container | 🟡 |
134
+ | [Side Sheet](https://peacock.redvars.com/components/side-sheet) | wc-side-sheet | 🟡 |
128
135
 
129
136
  ## General
130
137
 
131
138
  These components are used for general purpose. They include
132
139
 
133
- | Name | Component | State |
134
- |-------------------------------------------------------------------------------------|---------------------------|-------|
135
- | [Avatar](https://peacock.redvars.com/components/avatar) | wc-avatar | 🟢 |
136
- | [Button](https://peacock.redvars.com/components/button) | wc-button | 🟢 |
137
- | [Button Group](https://peacock.redvars.com/components/button-group) | wc-button-group | 🟢 |
138
- | [Calendar](https://peacock.redvars.com/components/calendar) | base-calendar | 🟢 |
139
- | Card Select | base-cardselect | 🔴 |
140
- | [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | wc-code-highlighter | 🟢 |
141
- | Column | base-col | 🔴 |
142
- | [Empty State](https://peacock.redvars.com/components/empty-state) | wc-empty-state | 🟡 |
143
- | [Flow Designer ](https://peacock.redvars.com/components/flow-designer) | flow-designer | 🔵 |
144
- | Grid | base-grid | 🔴 |
145
- | Group | base-group | 🔴 |
146
- | [Header](https://peacock.redvars.com/components/header) | base-header | 🟢 |
147
- | [Icon](https://peacock.redvars.com/components/icon) | wc-icon | 🟢 |
148
- | [Link](https://peacock.redvars.com/components/link) | wc-link | 🟢 |
149
- | [Modal](https://peacock.redvars.com/components/modal) | base-modal | 🟢 |
150
- | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | notification-manager | 🟡 |
151
- | Observer | base-observer | 🔴 |
152
- | Pagination | wc-pagination | 🔴 |
153
- | Radio Group | base-radiogroup | 🔴 |
154
- | Row | base-row | 🔴 |
155
- | [Slider](https://peacock.redvars.com/components/slider) | wc-slider | 🟡 |
156
- | Spoiler | base-spoiler | 🔴 |
157
- | Stepper | base-stepper | 🔴 |
158
- | [Table](https://peacock.redvars.com/components/table) | wc-table | 🟡 |
159
- | [Tag](https://peacock.redvars.com/components/tag) / Chip | wc-tag | 🟢 |
160
- | [Text](https://peacock.redvars.com/components/text) | base-text | 🟢 |
161
- | [Tree View](https://peacock.redvars.com/components/tree-view) | wc-tree-view | 🟡 |
162
- | [Switch](https://peacock.redvars.com/components/switch) | wc-switch | 🟢 |
140
+ | Name | Component | State |
141
+ |-----------------------------------------------------------------------------|-----------------------|-------|
142
+ | [Avatar](https://peacock.redvars.com/components/avatar) | wc-avatar | 🟢 |
143
+ | [Button](https://peacock.redvars.com/components/button) | wc-button | 🟢 |
144
+ | [Button Group](https://peacock.redvars.com/components/button-group) | wc-button-group | 🟢 |
145
+ | Calendar | calendar | 🔴 |
146
+ | Card Select | card-select | 🔴 |
147
+ | [Chip](https://peacock.redvars.com/components/chip) | wc-chip | 🟢 |
148
+ | [Clock](https://peacock.redvars.com/components/clock) | wc-clock | 🟡 |
149
+ | [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | wc-code-highlighter | 🟢 |
150
+ | [Divider](https://peacock.redvars.com/components/divider) | wc-divider | 🟢 |
151
+ | [Empty State](https://peacock.redvars.com/components/empty-state) | wc-empty-state | 🟡 |
152
+ | [FAB](https://peacock.redvars.com/components/fab) | wc-fab | 🟢 |
153
+ | [Flow Designer](https://peacock.redvars.com/components/flow-designer) | flow-designer | 🔵 |
154
+ | Header | header | 🔴 |
155
+ | [Icon](https://peacock.redvars.com/components/icon) | wc-icon | 🟢 |
156
+ | [Icon Button](https://peacock.redvars.com/components/icon-button) | wc-icon-button | 🟢 |
157
+ | [Image](https://peacock.redvars.com/components/image) | wc-image | 🟡 |
158
+ | [Link](https://peacock.redvars.com/components/link) | wc-link | 🟢 |
159
+ | Modal | modal | 🔴 |
160
+ | [Number Counter](https://peacock.redvars.com/components/number-counter) | wc-number-counter | 🟡 |
161
+ | [Pagination](https://peacock.redvars.com/components/pagination) | wc-pagination | 🟡 |
162
+ | [Segmented Button](https://peacock.redvars.com/components/segmented-button) | wc-segmented-button | 🟡 |
163
+ | [Slider](https://peacock.redvars.com/components/slider) | wc-slider | 🟡 |
164
+ | [Switch](https://peacock.redvars.com/components/switch) | wc-switch | 🟢 |
165
+ | [Table](https://peacock.redvars.com/components/table) | wc-table | 🟡 |
166
+ | [Tag](https://peacock.redvars.com/components/tag) | wc-tag | 🟢 |
167
+ | Text | text | 🔴 |
168
+ | [Sidebar Menu](https://peacock.redvars.com/components/sidebar-menu) | wc-sidebar-menu | 🟡 |
163
169
 
164
170
  ## Charts
165
171
 
166
172
  These components are used to display data in a graphical format. They include
167
173
 
168
- | Name | Component | State |
169
- |----------------------------------------------------------------|---------------------|-------|
170
- | [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | wc-chart-doughnut | 🟢 |
171
- | [Pie Chart ](https://peacock.redvars.com/components/chart-pie) | wc-chart-pie | 🟢 |
174
+ | Name | Component | State |
175
+ |---------------------------------------------------------------------------------|------------------------|-------|
176
+ | [Bar Chart](https://peacock.redvars.com/components/chart-bar) | wc-chart-bar | 🟢 |
177
+ | [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | wc-chart-doughnut | 🟢 |
178
+ | [Pie Chart](https://peacock.redvars.com/components/chart-pie) | wc-chart-pie | 🟢 |
179
+ | [Stacked Bar Chart](https://peacock.redvars.com/components/chart-bar) | wc-chart-stacked-bar | 🟢 |
172
180
 
173
181
 
174
182
  ## 📄 License
package/scss/mixin.scss CHANGED
@@ -57,3 +57,19 @@
57
57
  @content;
58
58
  }
59
59
  }
60
+
61
+ @mixin apply-container-shape($name) {
62
+ border-start-start-radius: var(--#{$name}-container-shape-start-start, var(--#{$name}-container-shape));
63
+ border-start-end-radius: var(--#{$name}-container-shape-start-end, var(--#{$name}-container-shape));
64
+ border-end-start-radius: var(--#{$name}-container-shape-end-start, var(--#{$name}-container-shape));
65
+ border-end-end-radius: var(--#{$name}-container-shape-end-end, var(--#{$name}-container-shape));
66
+ corner-shape: var(--#{$name}-container-shape-variant);
67
+ }
68
+
69
+ @mixin copy-container-shape($from, $to) {
70
+ --#{$to}-container-shape-start-start: var(--#{$from}-container-shape-start-start, var(--#{$from}-container-shape));
71
+ --#{$to}-container-shape-start-end: var(--#{$from}-container-shape-start-end, var(--#{$from}-container-shape));
72
+ --#{$to}-container-shape-end-start: var(--#{$from}-container-shape-end-start, var(--#{$from}-container-shape));
73
+ --#{$to}-container-shape-end-end: var(--#{$from}-container-shape-end-end, var(--#{$from}-container-shape));
74
+ --#{$to}-container-shape-variant: var(--#{$from}-container-shape-variant);
75
+ }
@@ -0,0 +1,237 @@
1
+ import {
2
+ computePosition,
3
+ autoUpdate,
4
+ offset,
5
+ flip,
6
+ shift,
7
+ arrow,
8
+ Placement,
9
+ Strategy,
10
+ Middleware,
11
+ } from '@floating-ui/dom';
12
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
13
+
14
+ export type TriggerType =
15
+ | 'hover'
16
+ | 'click'
17
+ | 'context-menu'
18
+ | 'manual'
19
+ | 'focus'
20
+ | 'hover-focus';
21
+
22
+ export interface FloatingOptions {
23
+ placement?: Placement;
24
+ strategy?: Strategy;
25
+ offset?: number;
26
+ trigger?: TriggerType;
27
+ closeOnClickOutside?: boolean;
28
+ onOpenChange?: (isOpen: boolean) => void;
29
+ }
30
+
31
+ export class FloatingController implements ReactiveController {
32
+ private host: ReactiveControllerHost;
33
+
34
+ private reference: HTMLElement | null = null;
35
+
36
+ private floating: HTMLElement | null = null;
37
+
38
+ private arrowElement: HTMLElement | null = null;
39
+
40
+ private cleanup: (() => void) | null = null;
41
+
42
+ private options: Required<FloatingOptions>;
43
+
44
+ private isHostConnected = false;
45
+
46
+ public isOpen = false;
47
+
48
+ constructor(host: ReactiveControllerHost, options: FloatingOptions = {}) {
49
+ this.options = {
50
+ placement: options.placement || 'bottom',
51
+ strategy: options.strategy || 'absolute',
52
+ offset: options.offset ?? 8,
53
+ trigger: options.trigger || 'hover',
54
+ closeOnClickOutside: options.closeOnClickOutside ?? true,
55
+ onOpenChange: options.onOpenChange ?? (() => undefined),
56
+ };
57
+ this.host = host;
58
+ this.host.addController(this);
59
+ }
60
+
61
+ hostConnected() {
62
+ this.isHostConnected = true;
63
+ if (this.options.closeOnClickOutside) {
64
+ document.addEventListener('mousedown', this.handleOutsideClick);
65
+ }
66
+ }
67
+
68
+ hostDisconnected() {
69
+ this.isHostConnected = false;
70
+ this.cleanup?.();
71
+ this.removeEventListeners();
72
+ document.removeEventListener('mousedown', this.handleOutsideClick);
73
+ }
74
+
75
+ setElements(reference: HTMLElement, floating: HTMLElement, arrowElement?: HTMLElement) {
76
+ this.cleanup?.();
77
+ this.cleanup = null;
78
+ this.removeEventListeners();
79
+ this.reference = reference;
80
+ this.floating = floating;
81
+ this.arrowElement = arrowElement || null;
82
+ this.setupEventListeners();
83
+ if (this.isOpen) {
84
+ this.updatePosition();
85
+ }
86
+ }
87
+
88
+ setOptions(options: Partial<FloatingOptions>) {
89
+ const previousTrigger = this.options.trigger;
90
+ const previousCloseOnClickOutside = this.options.closeOnClickOutside;
91
+
92
+ this.options = {
93
+ ...this.options,
94
+ ...options,
95
+ onOpenChange: options.onOpenChange ?? this.options.onOpenChange,
96
+ };
97
+
98
+ if (this.reference && previousTrigger !== this.options.trigger) {
99
+ this.removeEventListeners();
100
+ this.setupEventListeners();
101
+ }
102
+
103
+ if (this.isHostConnected && previousCloseOnClickOutside !== this.options.closeOnClickOutside) {
104
+ document.removeEventListener('mousedown', this.handleOutsideClick);
105
+ if (this.options.closeOnClickOutside) {
106
+ document.addEventListener('mousedown', this.handleOutsideClick);
107
+ }
108
+ }
109
+
110
+ if (this.isOpen) {
111
+ this.updatePosition();
112
+ }
113
+ }
114
+
115
+ private setupEventListeners() {
116
+ if (!this.reference) return;
117
+
118
+ if (this.options.trigger === 'hover' || this.options.trigger === 'hover-focus') {
119
+ this.reference.addEventListener('mouseenter', this.open);
120
+ this.reference.addEventListener('mouseleave', this.close);
121
+ }
122
+
123
+ if (this.options.trigger === 'click') {
124
+ this.reference.addEventListener('click', this.toggle);
125
+ }
126
+
127
+ if (this.options.trigger === 'context-menu') {
128
+ this.reference.addEventListener('contextmenu', this.handleContextMenu);
129
+ }
130
+
131
+ if (this.options.trigger === 'focus' || this.options.trigger === 'hover-focus') {
132
+ this.reference.addEventListener('focusin', this.open);
133
+ this.reference.addEventListener('focusout', this.handleFocusOut);
134
+ }
135
+ }
136
+
137
+ private removeEventListeners() {
138
+ if (!this.reference) return;
139
+ this.reference.removeEventListener('mouseenter', this.open);
140
+ this.reference.removeEventListener('mouseleave', this.close);
141
+ this.reference.removeEventListener('click', this.toggle);
142
+ this.reference.removeEventListener('contextmenu', this.handleContextMenu);
143
+ this.reference.removeEventListener('focusin', this.open);
144
+ this.reference.removeEventListener('focusout', this.handleFocusOut);
145
+ }
146
+
147
+ private toggle = () => (this.isOpen ? this.close() : this.open());
148
+
149
+ private handleContextMenu = (e: MouseEvent) => {
150
+ e.preventDefault();
151
+ this.open();
152
+ };
153
+
154
+ private handleFocusOut = (e: FocusEvent) => {
155
+ if (!this.reference || this.reference.contains(e.relatedTarget as Node)) return;
156
+ this.close();
157
+ };
158
+
159
+ private handleOutsideClick = (e: MouseEvent) => {
160
+ if (
161
+ this.isOpen &&
162
+ this.reference &&
163
+ this.floating &&
164
+ !this.reference.contains(e.target as Node) &&
165
+ !this.floating.contains(e.target as Node)
166
+ ) {
167
+ this.close();
168
+ }
169
+ };
170
+
171
+ open = () => {
172
+ if (this.isOpen) return;
173
+ this.isOpen = true;
174
+ this.options.onOpenChange(this.isOpen);
175
+ this.host.requestUpdate();
176
+ this.updatePosition();
177
+ };
178
+
179
+ close = () => {
180
+ if (!this.isOpen) return;
181
+ this.isOpen = false;
182
+ this.options.onOpenChange(this.isOpen);
183
+ this.cleanup?.();
184
+ this.cleanup = null;
185
+ this.host.requestUpdate();
186
+ };
187
+
188
+ private updatePosition() {
189
+ if (!this.reference || !this.floating) return;
190
+
191
+ this.cleanup = autoUpdate(this.reference, this.floating, () => {
192
+ if (!this.reference || !this.floating) return;
193
+
194
+ const middleware: Middleware[] = [
195
+ offset(this.options.offset),
196
+ flip(),
197
+ shift({ padding: 5 }),
198
+ ];
199
+
200
+ if (this.arrowElement) {
201
+ middleware.push(arrow({ element: this.arrowElement }));
202
+ }
203
+
204
+ computePosition(this.reference, this.floating, {
205
+ placement: this.options.placement,
206
+ strategy: this.options.strategy,
207
+ middleware,
208
+ }).then(({ x, y, placement, middlewareData }) => {
209
+ if (!this.floating) return;
210
+
211
+ Object.assign(this.floating.style, {
212
+ left: `${x}px`,
213
+ top: `${y}px`,
214
+ position: this.options.strategy,
215
+ });
216
+
217
+ if (this.arrowElement && middlewareData.arrow) {
218
+ const { x: ax, y: ay } = middlewareData.arrow;
219
+ const staticSide = {
220
+ top: 'bottom',
221
+ right: 'left',
222
+ bottom: 'top',
223
+ left: 'right',
224
+ }[placement.split('-')[0]]!;
225
+
226
+ Object.assign(this.arrowElement.style, {
227
+ left: ax != null ? `${ax}px` : '',
228
+ top: ay != null ? `${ay}px` : '',
229
+ right: '',
230
+ bottom: '',
231
+ [staticSide]: '-4px',
232
+ });
233
+ }
234
+ });
235
+ });
236
+ }
237
+ }
@@ -0,0 +1,83 @@
1
+ import { LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import type { MixinConstructor } from './MixinConstructor.js';
4
+
5
+
6
+ /**
7
+ * 1. Define an interface for the members the mixin adds.
8
+ * This makes the type annotation much cleaner.
9
+ */
10
+ export interface BaseButtonInterface {
11
+ htmlType: 'button' | 'submit' | 'reset';
12
+ disabled: boolean;
13
+ softDisabled: boolean;
14
+ disabledReason: string;
15
+ form: string;
16
+ name: string;
17
+ value: string;
18
+ }
19
+
20
+ /**
21
+ * 2. Apply the type annotation to the variable.
22
+ */
23
+ const BaseButtonMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseButtonInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {
24
+ // Naming the class (BaseButtonElement) instead of using 'Mixin' or anonymous
25
+ // prevents the "__childPart" visibility error.
26
+ class BaseButtonElement extends superclass implements BaseButtonInterface {
27
+
28
+ /**
29
+ * The type of the underlying `<button>` element. Maps to the native `type` attribute.
30
+ * Possible values are `"button"`, `"submit"`, `"reset"`. Defaults to `"button"`.
31
+ */
32
+ @property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
33
+ 'button';
34
+
35
+ /**
36
+ * When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.
37
+ */
38
+ @property({ type: Boolean, reflect: true })
39
+ disabled: boolean = false;
40
+
41
+ /**
42
+ * When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.
43
+ * Use this in combination with `disabledReason` to communicate why the button is unavailable.
44
+ * Reflects to the `soft-disabled` attribute. Defaults to `false`.
45
+ */
46
+ @property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
47
+ softDisabled: boolean = false;
48
+
49
+ /**
50
+ * A human-readable explanation of why the button is disabled or soft-disabled.
51
+ * Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.
52
+ * Maps to the `disabled-reason` attribute.
53
+ */
54
+ @property({ attribute: 'disabled-reason' })
55
+ disabledReason: string = '';
56
+
57
+ /**
58
+ * The `id` of the `<form>` element to associate the button with.
59
+ * If omitted, the button is associated with its nearest ancestor form.
60
+ * Maps to the native `form` attribute.
61
+ */
62
+ @property()
63
+ form: string = '';
64
+
65
+ /**
66
+ * The name of the button, submitted as part of a name/value pair when the associated form is submitted.
67
+ * Maps to the native `name` attribute.
68
+ */
69
+ @property()
70
+ name: string = '';
71
+
72
+ /**
73
+ * The value of the button, submitted as part of a name/value pair when the associated form is submitted.
74
+ * Maps to the native `value` attribute.
75
+ */
76
+ @property()
77
+ value: string = '';
78
+ }
79
+
80
+ return BaseButtonElement as T & MixinConstructor<BaseButtonInterface>;
81
+ };
82
+
83
+ export default BaseButtonMixin;
@@ -0,0 +1,68 @@
1
+ import { LitElement } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import type { MixinConstructor } from './MixinConstructor.js';
4
+
5
+
6
+ /**
7
+ * 1. Define an interface for the members the mixin adds.
8
+ * This makes the type annotation much cleaner.
9
+ */
10
+ export interface BaseHyperlinkInterface {
11
+ href?: string;
12
+ target: '_self' | '_parent' | '_blank' | '_top' | string;
13
+ rel?: string;
14
+ download?: string;
15
+ __isLink(): boolean;
16
+ }
17
+
18
+ /**
19
+ * 2. Apply the type annotation to the variable.
20
+ */
21
+ const BaseHyperlinkMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseHyperlinkInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {
22
+ // Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous
23
+ // prevents the "__childPart" visibility error.
24
+ class BaseHyperlinkElement extends superclass implements BaseHyperlinkInterface {
25
+ /**
26
+ * The URL that the hyperlink points to. When set, the component renders as an `<a>` element.
27
+ * Maps to the native `href` attribute.
28
+ */
29
+ @property({ reflect: true })
30
+ href?: string;
31
+
32
+ /**
33
+ * Where to display the linked URL. Maps to the native `target` attribute.
34
+ * Possible values are `"_self"`, `"_blank"`, `"_parent"`, `"_top"`, or a custom frame name.
35
+ * When using `"_blank"`, consider setting `rel="noopener noreferrer"` for security. Defaults to `"_self"`.
36
+ */
37
+ @property()
38
+ target: '_self' | '_parent' | '_blank' | '_top' | string = '_self';
39
+
40
+ /**
41
+ * The relationship between the current document and the linked URL.
42
+ * Maps to the native `rel` attribute on the rendered `<a>` element.
43
+ * When `target="_blank"`, use `"noopener noreferrer"` to prevent tab-napping attacks.
44
+ */
45
+ @property()
46
+ rel?: string;
47
+
48
+ /**
49
+ * Causes the browser to download the linked URL instead of navigating to it.
50
+ * If a string value is provided, it is used as the suggested filename.
51
+ * Omit or leave undefined to preserve normal navigation behaviour.
52
+ * Maps to the native `download` attribute. Only applies when `href` is set.
53
+ */
54
+ @property()
55
+ download?: string;
56
+
57
+ /**
58
+ * Returns `true` when `href` is set, indicating the component should render as a link.
59
+ */
60
+ __isLink(): boolean {
61
+ return !!this.href;
62
+ }
63
+ }
64
+
65
+ return BaseHyperlinkElement as T & MixinConstructor<BaseHyperlinkInterface>;
66
+ };
67
+
68
+ export default BaseHyperlinkMixin;
@@ -0,0 +1 @@
1
+ export type MixinConstructor<T = {}> = new (...args: any[]) => T;
@@ -1,6 +1,6 @@
1
- # Base Element
1
+ # Mixins
2
2
 
3
- The base element is an abstract foundation for component families.
3
+ The mixin element is an abstract foundation for component families.
4
4
 
5
5
  It defines shared component contracts such as:
6
6