@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
@@ -0,0 +1,236 @@
1
+ import { html, LitElement } from 'lit';
2
+ import { property, query, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
+ import styles from './split-button.scss';
6
+ import colorStyles from './split-button-colors.scss';
7
+ import sizeStyles from './split-button-sizes.scss';
8
+
9
+ /**
10
+ * @label Split Button
11
+ * @tag wc-split-button
12
+ * @rawTag split-button
13
+ *
14
+ * @summary A split button lets users perform a default action or choose from a set of related actions via a dropdown menu.
15
+ * @overview
16
+ * <p>A split button combines a primary action button with a dropdown arrow that opens a menu. Following M3 Material Design, the split button provides a default action alongside a set of secondary options, reducing clutter while keeping alternative actions accessible.</p>
17
+ *
18
+ * @cssprop --split-button-container-shape: Defines the border radius of the split button container shape.
19
+ *
20
+ * @cssprop --filled-split-button-container-color: Color of the filled split button container.
21
+ * @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.
22
+ *
23
+ * @cssprop --outlined-split-button-container-color: Color of the outlined split button container.
24
+ * @cssprop --outlined-split-button-label-text-color: Text color of the outlined split button label.
25
+ *
26
+ * @cssprop --tonal-split-button-container-color: Color of the tonal split button container.
27
+ * @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.
28
+ *
29
+ * @fires {MouseEvent} click - Dispatched when the primary action button is clicked.
30
+ * @fires {CustomEvent} toggle-menu - Dispatched when the dropdown menu is opened or closed.
31
+ *
32
+ * @example
33
+ * ```html
34
+ * <wc-split-button>
35
+ * Save
36
+ * <wc-menu-item slot="menu">Save as draft</wc-menu-item>
37
+ * <wc-menu-item slot="menu">Save and publish</wc-menu-item>
38
+ * </wc-split-button>
39
+ * ```
40
+ * @tags controls
41
+ */
42
+ @IndividualComponent
43
+ export class SplitButton extends LitElement {
44
+ static override styles = [styles, colorStyles, sizeStyles];
45
+
46
+ /**
47
+ * Button size.
48
+ * Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
49
+ */
50
+ @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
51
+
52
+ /**
53
+ * The visual style of the split button.
54
+ *
55
+ * Possible variant values:
56
+ * `"filled"` is a filled button.
57
+ * `"outlined"` is an outlined button.
58
+ * `"tonal"` is a light color button.
59
+ */
60
+ @property({ reflect: true }) variant: 'filled' | 'tonal' | 'outlined' =
61
+ 'filled';
62
+
63
+ /**
64
+ * Defines the primary color of the split button.
65
+ */
66
+ @property({ reflect: true }) color:
67
+ | 'primary'
68
+ | 'secondary'
69
+ | 'tertiary'
70
+ | 'success'
71
+ | 'danger'
72
+ | 'warning'
73
+ | 'surface'
74
+ | 'on-surface' = 'primary';
75
+
76
+ /**
77
+ * Whether the split button is disabled.
78
+ */
79
+ @property({ type: Boolean, reflect: true }) disabled = false;
80
+
81
+ @state() private _menuOpen = false;
82
+
83
+ @query('.dropdown-trigger') private readonly _dropdownButton!: HTMLElement;
84
+
85
+ @query('wc-menu') private readonly _menu!: HTMLElement & {
86
+ open: boolean;
87
+ anchorElement: HTMLElement | null;
88
+ show: () => void;
89
+ close: () => void;
90
+ };
91
+
92
+ private _menuId = `split-menu-${Math.random().toString(36).slice(2, 9)}`;
93
+
94
+ override focus() {
95
+ const btn =
96
+ this.shadowRoot?.querySelector<HTMLElement>('.action-button');
97
+ btn?.focus();
98
+ }
99
+
100
+ private _onActionClick(event: MouseEvent) {
101
+ if (this.disabled) {
102
+ event.stopImmediatePropagation();
103
+ event.preventDefault();
104
+ return;
105
+ }
106
+
107
+ // Close menu if open
108
+ if (this._menuOpen) {
109
+ this._menu?.close();
110
+ }
111
+ }
112
+
113
+ private _onDropdownClick(event: MouseEvent) {
114
+ event.stopPropagation();
115
+ if (this.disabled) return;
116
+
117
+ if (this._menuOpen) {
118
+ this._menu?.close();
119
+ } else {
120
+ this._menu.anchorElement = this;
121
+ this._menu?.show();
122
+ }
123
+ }
124
+
125
+ private _onMenuOpened = () => {
126
+ this._menuOpen = true;
127
+ this.dispatchEvent(
128
+ new CustomEvent('toggle-menu', {
129
+ detail: { open: true },
130
+ bubbles: true,
131
+ composed: true,
132
+ }),
133
+ );
134
+ };
135
+
136
+ private _onMenuClosed = () => {
137
+ this._menuOpen = false;
138
+ this.dispatchEvent(
139
+ new CustomEvent('toggle-menu', {
140
+ detail: { open: false },
141
+ bubbles: true,
142
+ composed: true,
143
+ }),
144
+ );
145
+ };
146
+
147
+ private _onKeyDown = (event: KeyboardEvent) => {
148
+ if (this.disabled) return;
149
+
150
+ if (
151
+ event.key === 'ArrowDown' &&
152
+ event.target === this._dropdownButton
153
+ ) {
154
+ event.preventDefault();
155
+ if (!this._menuOpen) {
156
+ this._menu.anchorElement = this;
157
+ this._menu?.show();
158
+ }
159
+ // Focus the menu so keyboard nav works
160
+ requestAnimationFrame(() => this._menu?.focus());
161
+ }
162
+
163
+ if (event.key === 'Escape' && this._menuOpen) {
164
+ this._menu?.close();
165
+ this._dropdownButton?.focus();
166
+ }
167
+ };
168
+
169
+ override connectedCallback() {
170
+ super.connectedCallback();
171
+ this.addEventListener('keydown', this._onKeyDown);
172
+ }
173
+
174
+ override disconnectedCallback() {
175
+ this.removeEventListener('keydown', this._onKeyDown);
176
+ super.disconnectedCallback();
177
+ }
178
+
179
+ override render() {
180
+ const actionClasses = {
181
+ 'action-button': true,
182
+ disabled: this.disabled,
183
+ };
184
+
185
+ const dropdownClasses = {
186
+ 'dropdown-trigger': true,
187
+ active: this._menuOpen,
188
+ disabled: this.disabled,
189
+ };
190
+
191
+ const containerClasses = {
192
+ 'split-button': true,
193
+ [`variant-${this.variant}`]: true,
194
+ disabled: this.disabled,
195
+ };
196
+
197
+ return html`
198
+ <div class=${classMap(containerClasses)}>
199
+ <wc-button
200
+ class=${classMap(actionClasses)}
201
+ size=${this.size}
202
+ variant=${this.variant}
203
+ ?disabled=${this.disabled}
204
+ @click=${this._onActionClick}
205
+ >
206
+ <slot></slot>
207
+ </wc-button>
208
+
209
+ <wc-icon-button
210
+ class=${classMap(dropdownClasses)}
211
+ size=${this.size}
212
+ variant=${this.variant}
213
+ ?disabled=${this.disabled}
214
+ .configAria=${{
215
+ 'aria-haspopup': 'menu',
216
+ 'aria-expanded': String(this._menuOpen),
217
+ 'aria-controls': this._menuId,
218
+ 'aria-label': 'Open split button menu',
219
+ }}
220
+ @click=${this._onDropdownClick}
221
+ >
222
+ <wc-icon class="dropdown-icon" name="arrow_drop_down" aria-hidden="true"></wc-icon>
223
+ </wc-icon-button>
224
+ </div>
225
+
226
+ <wc-menu
227
+ id=${this._menuId}
228
+ placement="bottom-end"
229
+ @opened=${this._onMenuOpened}
230
+ @closed=${this._onMenuClosed}
231
+ >
232
+ <slot name="menu"></slot>
233
+ </wc-menu>
234
+ `;
235
+ }
236
+ }
@@ -218,7 +218,7 @@ export class Table extends LitElement {
218
218
  }
219
219
 
220
220
  private getTotalItems(): number {
221
- if (this.paginate && !this.managed) return this.data.length;
221
+ if (this.paginate && !this.managed && this.data) return this.data.length;
222
222
  return this.totalItems ?? 0;
223
223
  }
224
224
 
@@ -468,7 +468,7 @@ export class Table extends LitElement {
468
468
  <div class=${classMap(tableClasses)}>
469
469
  <div class="table-scroll-container" @scroll=${this.onScrollContainer}>
470
470
  ${this.renderHeader()}
471
- ${this.data.length ? this.renderBody() : this.renderEmptyState()}
471
+ ${this.data && this.data.length ? this.renderBody() : this.renderEmptyState()}
472
472
  </div>
473
473
  <div class="table-footer">${this.renderPagination()}</div>
474
474
  </div>
package/src/tabs/tab.ts CHANGED
@@ -193,6 +193,7 @@ export class Tab extends LitElement {
193
193
 
194
194
  if (!isLink) {
195
195
  return html`<button
196
+ id="button"
196
197
  class=${classMap(cssClasses)}
197
198
  tabindex="0"
198
199
  @mousedown=${this.__handlePress}
@@ -241,7 +242,7 @@ export class Tab extends LitElement {
241
242
 
242
243
  renderPrimaryTabContent() {
243
244
  return html`
244
- <wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.tabElement}></wc-focus-ring>
245
+ <wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
245
246
  <wc-elevation class="elevation"></wc-elevation>
246
247
  <div class="background"></div>
247
248
  <div class="outline"></div>
@@ -267,7 +268,7 @@ export class Tab extends LitElement {
267
268
 
268
269
  renderSecondaryTabContent() {
269
270
  return html`
270
- <wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.tabElement}></wc-focus-ring>
271
+ <wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
271
272
  <wc-elevation class="elevation"></wc-elevation>
272
273
  <div class="background"></div>
273
274
  <div class="outline"></div>
@@ -300,7 +301,7 @@ export class Tab extends LitElement {
300
301
 
301
302
  renderSegmentedTabContent() {
302
303
  return html`
303
- <wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.tabElement}></wc-focus-ring>
304
+ <wc-focus-ring class="focus-ring" for='button'></wc-focus-ring>
304
305
  <wc-elevation class="elevation"></wc-elevation>
305
306
  <div class="background"></div>
306
307
  <div class="outline"></div>
@@ -49,11 +49,17 @@ $sizes: "large", "medium", 'small';
49
49
  }
50
50
 
51
51
  .text-code-block {
52
- display: inline-flex;
53
52
  background-color: var(--color-surface-variant);
54
53
  text-shadow: 0 1px 1px var(--color-surface-variant);
55
54
  color: var(--color-on-surface);
56
55
  border-radius: var(--shape-corner-extra-small);
57
56
  padding: var(--spacing-050);
58
57
  font-family: var(--font-family-monospace);
58
+
59
+ display: inline-block;
60
+ max-width: 100%;
61
+ white-space: pre-wrap;
62
+ word-break: break-word;
63
+ overflow-wrap: anywhere;
64
+ vertical-align: middle;
59
65
  }
@@ -167,7 +167,6 @@ export class TimePicker extends BaseInput {
167
167
  slot="field-end"
168
168
  color="secondary"
169
169
  variant="text"
170
- name="calendar_today"
171
170
  ?disabled=${this.disabled}
172
171
  @click=${() => {
173
172
  setTimeout(() => {
@@ -176,6 +175,7 @@ export class TimePicker extends BaseInput {
176
175
  });
177
176
  }}
178
177
  >
178
+ <wc-icon name="calendar_today"></wc-icon>
179
179
  </wc-icon-button>
180
180
  </wc-field>
181
181
  `;
@@ -33,10 +33,10 @@ import colorStyles from './toolbar-colors.scss';
33
33
  * ```html
34
34
  * <!-- Docked toolbar -->
35
35
  * <wc-toolbar>
36
- * <wc-icon-button variant="text" name="home"></wc-icon-button>
37
- * <wc-icon-button variant="tonal" name="search"></wc-icon-button>
38
- * <wc-icon-button variant="text" name="favorite"></wc-icon-button>
39
- * <wc-icon-button variant="text" name="account_circle"></wc-icon-button>
36
+ * <wc-icon-button variant="text"><wc-icon name="home"></wc-icon></wc-icon-button>
37
+ * <wc-icon-button variant="tonal"><wc-icon name="search"></wc-icon></wc-icon-button>
38
+ * <wc-icon-button variant="text"><wc-icon name="favorite"></wc-icon></wc-icon-button>
39
+ * <wc-icon-button variant="text"><wc-icon name="account_circle"></wc-icon></wc-icon-button>
40
40
  * </wc-toolbar>
41
41
  * ```
42
42
  *
@@ -44,9 +44,9 @@ import colorStyles from './toolbar-colors.scss';
44
44
  * ```html
45
45
  * <!-- Floating horizontal toolbar -->
46
46
  * <wc-toolbar variant="floating" orientation="horizontal">
47
- * <wc-icon-button variant="tonal" name="home"></wc-icon-button>
48
- * <wc-icon-button variant="text" name="search"></wc-icon-button>
49
- * <wc-icon-button variant="text" name="favorite"></wc-icon-button>
47
+ * <wc-icon-button variant="tonal"><wc-icon name="home"></wc-icon></wc-icon-button>
48
+ * <wc-icon-button variant="text"><wc-icon name="search"></wc-icon></wc-icon-button>
49
+ * <wc-icon-button variant="text"><wc-icon name="favorite"></wc-icon></wc-icon-button>
50
50
  * </wc-toolbar>
51
51
  * ```
52
52
  *
@@ -54,9 +54,9 @@ import colorStyles from './toolbar-colors.scss';
54
54
  * ```html
55
55
  * <!-- Floating vertical toolbar -->
56
56
  * <wc-toolbar variant="floating" orientation="vertical">
57
- * <wc-icon-button variant="tonal" name="home"></wc-icon-button>
58
- * <wc-icon-button variant="text" name="search"></wc-icon-button>
59
- * <wc-icon-button variant="text" name="favorite"></wc-icon-button>
57
+ * <wc-icon-button variant="tonal"><wc-icon name="home"></wc-icon></wc-icon-button>
58
+ * <wc-icon-button variant="text"><wc-icon name="search"></wc-icon></wc-icon-button>
59
+ * <wc-icon-button variant="text"><wc-icon name="favorite"></wc-icon></wc-icon-button>
60
60
  * </wc-toolbar>
61
61
  * ```
62
62
  * @tags display navigation
@@ -5,13 +5,14 @@
5
5
 
6
6
 
7
7
  :host(:not([preview])) {
8
+ position: absolute;
9
+ top: 0;
10
+ left: 0;
11
+
8
12
  .tooltip {
9
13
  pointer-events: none;
10
14
  transition: transform var(--duration-short2) ease-in-out, opacity var(--duration-short2) ease-in-out;
11
15
  transform: scale(0);
12
- position: absolute;
13
- top: 0;
14
- left: 0;
15
16
  opacity: 0;
16
17
  }
17
18
 
@@ -1,8 +1,8 @@
1
1
  import { html, LitElement } from 'lit';
2
- import { property, query } from 'lit/decorators.js';
2
+ import { property } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import styles from './tooltip.scss';
5
- import { PopoverController } from '../popover/PopoverController.js';
5
+ import { FloatingController } from '../__controllers/floating-controller.js';
6
6
 
7
7
  // Define a type for valid trigger combinations
8
8
  export type TooltipTrigger = 'hover' | 'focus' | 'click';
@@ -39,102 +39,59 @@ export class Tooltip extends LitElement {
39
39
 
40
40
  @property({ type: Boolean, reflect: true }) preview = false;
41
41
 
42
- @query('#tooltip') floatingEl!: HTMLElement;
43
-
44
42
  private _target: HTMLElement | null = null;
45
43
 
46
- private _popover = new PopoverController(this, {
47
- placement: 'top',
48
- offset: 8,
49
- });
50
-
51
- private static CLOSE_OTHERS_EVENT = 'tooltip--open';
44
+ private _floating: FloatingController | null = null;
52
45
 
53
- private hasTrigger(type: TooltipTrigger): boolean {
54
- return this.trigger.split(' ').includes(type);
55
- }
46
+ private resolveTrigger(): 'hover' | 'click' | 'focus' | 'manual' | 'hover-focus' {
47
+ if (this.preview) return 'manual';
56
48
 
57
- // Define listeners as arrow functions to maintain 'this' context
58
- private _onMouseEnter = () => {
59
- if (this.preview || !this.hasTrigger('hover')) return;
60
- window.clearTimeout(this._hideTimeout); // Cancel any pending close
61
- this.show();
62
- };
63
-
64
- private _onMouseLeave = () => {
65
- if (this.preview || !this.hasTrigger('hover')) return;
66
-
67
- // Small delay allows the mouse to move from target -> tooltip
68
- // without the tooltip vanishing instantly.
69
- this._hideTimeout = window.setTimeout(() => {
70
- // Only hide if the mouse isn't currently hovering the target OR the tooltip
71
- const isHoveringTarget = this._target?.matches(':hover');
72
- const isHoveringTooltip = this.floatingEl?.matches(':hover');
73
-
74
- if (!isHoveringTarget && !isHoveringTooltip) {
75
- this.hide();
76
- }
77
- }, 100); // 100ms is usually enough for a smooth transition
78
- };
49
+ const triggerTokens = this.trigger.split(' ');
50
+ const hasHover = triggerTokens.includes('hover');
51
+ const hasFocus = triggerTokens.includes('focus');
52
+ const hasClick = triggerTokens.includes('click');
79
53
 
80
- private _onFocusIn = () => this.preview && this.hasTrigger('focus') && this.show();
54
+ if (hasClick) return 'click';
55
+ if (hasHover && hasFocus) return 'hover-focus';
56
+ if (hasFocus) return 'focus';
57
+ if (hasHover) return 'hover';
58
+ return 'manual';
59
+ }
81
60
 
82
- private _onFocusOut = (e: FocusEvent) => {
83
- if (this.preview || !this.hasTrigger('focus')) return;
84
- if (this._target && !this._target.contains(e.relatedTarget as Node)) {
85
- this.hide();
61
+ private detachListeners() {
62
+ if (this._floating) {
63
+ this._floating.close();
64
+ this._floating = null;
86
65
  }
87
- };
88
-
89
- private _onClick = (e: MouseEvent) => {
90
- if (this.preview || !this.hasTrigger('click')) return;
91
- e.stopPropagation();
92
- this.toggle();
93
- };
94
-
95
- private show() {
96
- if (this.open) return;
97
- window.dispatchEvent(
98
- new CustomEvent(Tooltip.CLOSE_OTHERS_EVENT, {
99
- detail: { invoker: this },
100
- }),
101
- );
102
- this.open = true;
66
+ this._target = null;
103
67
  }
104
68
 
105
- private hide() {
106
- if (!this.open) return;
107
- this.open = false;
108
- }
69
+ _focusTarget?: HTMLElement;
109
70
 
110
- private toggle() {
111
- // eslint-disable-next-line no-unused-expressions
112
- this.open ? this.hide() : this.show();
71
+ set forElement(value: HTMLElement | null) {
72
+ if (value) {
73
+ this._focusTarget = value;
74
+ } else {
75
+ this._focusTarget = undefined;
76
+ }
113
77
  }
114
78
 
115
- private _handleGlobalOpen = (e: any) => {
116
- if (e.detail.invoker !== this) this.hide();
117
- };
79
+ __getFocusTarget(): HTMLElement | null {
118
80
 
119
- private _handleDocumentClick = (e: MouseEvent) => {
120
- const path = e.composedPath();
121
- if (this._target && !path.includes(this._target)) {
122
- this.hide();
81
+ if (this._focusTarget) {
82
+ return this._focusTarget;
123
83
  }
124
- };
125
84
 
126
- private detachListeners() {
127
- if (!this._target) return;
128
- this._target.removeEventListener('mouseenter', this._onMouseEnter);
129
- this._target.removeEventListener('mouseleave', this._onMouseLeave);
130
- this._target.removeEventListener('focusin', this._onFocusIn);
131
- this._target.removeEventListener('focusout', this._onFocusOut);
132
- this._target.removeEventListener('click', this._onClick);
133
- this._target = null;
85
+ const focusTarget = document.getElementById(this.for);
86
+ if (focusTarget) {
87
+ return focusTarget
88
+ }
89
+
90
+ return this.parentElement;
134
91
  }
135
92
 
136
93
  private attachListeners() {
137
- this.detachListeners(); // Cleanup old target if it exists
94
+ this.detachListeners();
138
95
 
139
96
  // Resolve target: ID-based lookup or fallback to parent
140
97
  const root = this.getRootNode() as ShadowRoot | Document;
@@ -144,27 +101,28 @@ export class Tooltip extends LitElement {
144
101
 
145
102
  if (!this._target) return;
146
103
 
147
- this._target.addEventListener('mouseenter', this._onMouseEnter);
148
- this._target.addEventListener('mouseleave', this._onMouseLeave);
149
- this._target.addEventListener('focusin', this._onFocusIn);
150
- this._target.addEventListener('focusout', this._onFocusOut);
151
- this._target.addEventListener('click', this._onClick);
104
+ this._floating = new FloatingController(this, {
105
+ placement: 'top',
106
+ strategy: 'fixed',
107
+ offset: 0,
108
+ trigger: this.resolveTrigger(),
109
+ closeOnClickOutside: true,
110
+ onOpenChange: (isOpen) => {
111
+ if (this.open === isOpen) return;
112
+ this.open = isOpen;
113
+ },
114
+ });
115
+
116
+ this._floating.setElements(this._target, this);
152
117
  }
153
118
 
154
119
  connectedCallback() {
155
120
  super.connectedCallback();
156
121
  this.attachListeners();
157
- window.addEventListener(Tooltip.CLOSE_OTHERS_EVENT, this._handleGlobalOpen);
158
- window.addEventListener('click', this._handleDocumentClick);
159
122
  }
160
123
 
161
124
  disconnectedCallback() {
162
125
  this.detachListeners();
163
- window.removeEventListener(
164
- Tooltip.CLOSE_OTHERS_EVENT,
165
- this._handleGlobalOpen,
166
- );
167
- window.removeEventListener('click', this._handleDocumentClick);
168
126
  super.disconnectedCallback();
169
127
  }
170
128
 
@@ -174,12 +132,22 @@ export class Tooltip extends LitElement {
174
132
  this.attachListeners();
175
133
  }
176
134
 
177
- if (changedProps.has('open') && this.open && this._target) {
178
- this._popover.updatePosition(this._target, this.floatingEl);
135
+ if (changedProps.has('trigger') || changedProps.has('preview')) {
136
+ this.attachListeners();
179
137
  }
180
- }
181
138
 
182
- private _hideTimeout?: number;
139
+ if (this._floating && this._target) {
140
+ this._floating.setElements(this._target, this);
141
+
142
+ if (changedProps.has('open') && this.open && !this._floating.isOpen) {
143
+ this._floating.open();
144
+ }
145
+
146
+ if (changedProps.has('open') && !this.open && this._floating.isOpen) {
147
+ this._floating.close();
148
+ }
149
+ }
150
+ }
183
151
 
184
152
  render() {
185
153
  return html` <div
@@ -190,8 +158,6 @@ export class Tooltip extends LitElement {
190
158
  })}
191
159
  id="tooltip"
192
160
  role="tooltip"
193
- @mouseenter=${this._onMouseEnter}
194
- @mouseleave=${this._onMouseLeave}
195
161
  aria-hidden=${!this.open}
196
162
  aria-labelledby="tooltip-labelledby"
197
163
  >
@@ -0,0 +1 @@
1
+ export { UrlField } from './url-field.js';
@@ -0,0 +1,50 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ width: 100%;
8
+ }
9
+
10
+ .url-input {
11
+ flex: 1;
12
+ width: 100%;
13
+ border: none;
14
+ outline: none;
15
+ margin: 0;
16
+ padding: 0;
17
+ background: none;
18
+ cursor: inherit;
19
+ font: inherit;
20
+ color: inherit;
21
+ }
22
+
23
+ .url-display {
24
+ flex: 1;
25
+ display: flex;
26
+ align-items: center;
27
+ overflow: hidden;
28
+ }
29
+
30
+ .url-link {
31
+ flex: 1;
32
+ overflow: hidden;
33
+ text-overflow: ellipsis;
34
+ white-space: nowrap;
35
+ color: var(--color-primary);
36
+ text-decoration: none;
37
+
38
+ &:hover {
39
+ text-decoration: underline;
40
+ }
41
+ }
42
+
43
+ .url-placeholder {
44
+ color: var(--color-on-surface-variant);
45
+ opacity: 0.6;
46
+ }
47
+
48
+ .edit-button {
49
+ --button-container-shape: var(--shape-corner-full);
50
+ }