@redvars/peacock 3.3.3 → 3.5.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 (280) hide show
  1. package/dist/IndividualComponent-DUINtMGK.js +67 -0
  2. package/dist/IndividualComponent-DUINtMGK.js.map +1 -0
  3. package/dist/assets/images/empty-state/no-document.svg +11 -12
  4. package/dist/assets/images/empty-state/page.svg +15 -9
  5. package/dist/assets/styles.css +1 -1
  6. package/dist/assets/styles.css.map +1 -1
  7. package/dist/banner.js +202 -0
  8. package/dist/banner.js.map +1 -0
  9. package/dist/bottom-sheet.js +238 -0
  10. package/dist/bottom-sheet.js.map +1 -0
  11. package/dist/{button-ClzS8JLq.js → button-DMN1dPAg.js} +358 -218
  12. package/dist/button-DMN1dPAg.js.map +1 -0
  13. package/dist/button-group-CX9CUUXk.js +435 -0
  14. package/dist/button-group-CX9CUUXk.js.map +1 -0
  15. package/dist/button-group.js +11 -6
  16. package/dist/button-group.js.map +1 -1
  17. package/dist/button.js +10 -5
  18. package/dist/button.js.map +1 -1
  19. package/dist/card-content.js +29 -0
  20. package/dist/card-content.js.map +1 -0
  21. package/dist/card.js +428 -44
  22. package/dist/card.js.map +1 -1
  23. package/dist/{chart-bar-DbnXQgvS.js → chart-bar-cn6rrna-.js} +2 -2
  24. package/dist/{chart-bar-DbnXQgvS.js.map → chart-bar-cn6rrna-.js.map} +1 -1
  25. package/dist/chart-bar.js +5 -4
  26. package/dist/chart-bar.js.map +1 -1
  27. package/dist/chart-doughnut.js +2 -1
  28. package/dist/chart-doughnut.js.map +1 -1
  29. package/dist/chart-pie.js +2 -1
  30. package/dist/chart-pie.js.map +1 -1
  31. package/dist/chart-stacked-bar.js +5 -4
  32. package/dist/chart-stacked-bar.js.map +1 -1
  33. package/dist/{class-map-59YGWLnx.js → class-map-YU7g0o3B.js} +4 -10
  34. package/dist/class-map-YU7g0o3B.js.map +1 -0
  35. package/dist/clock.js +2 -1
  36. package/dist/clock.js.map +1 -1
  37. package/dist/code-editor.js +8 -6
  38. package/dist/code-editor.js.map +1 -1
  39. package/dist/code-highlighter.js +6 -4
  40. package/dist/code-highlighter.js.map +1 -1
  41. package/dist/custom-elements-jsdocs.json +6270 -5026
  42. package/dist/custom-elements.json +5763 -2049
  43. package/dist/directive-ZPhl09Yt.js +9 -0
  44. package/dist/directive-ZPhl09Yt.js.map +1 -0
  45. package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
  46. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
  47. package/dist/fab-C5Nzxk0E.js +497 -0
  48. package/dist/fab-C5Nzxk0E.js.map +1 -0
  49. package/dist/fab.js +11 -0
  50. package/dist/fab.js.map +1 -0
  51. package/dist/index.js +24 -12
  52. package/dist/index.js.map +1 -1
  53. package/dist/{observe-theme-change-pALI5fmV.js → is-dark-mode-DicqGkCJ.js} +8 -3
  54. package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
  55. package/dist/notification.js +417 -0
  56. package/dist/notification.js.map +1 -0
  57. package/dist/number-counter.js +4 -3
  58. package/dist/number-counter.js.map +1 -1
  59. package/dist/observe-slot-change-BGJfgg2E.js +31 -0
  60. package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
  61. package/dist/peacock-loader.js +59 -10
  62. package/dist/peacock-loader.js.map +1 -1
  63. package/dist/property-1psGvXOq.js +10 -0
  64. package/dist/property-1psGvXOq.js.map +1 -0
  65. package/dist/search.js +452 -0
  66. package/dist/search.js.map +1 -0
  67. package/dist/{radio-b70_Ie9n.js → select-4pl4XBj7.js} +2439 -521
  68. package/dist/select-4pl4XBj7.js.map +1 -0
  69. package/dist/side-sheet.js +186 -0
  70. package/dist/side-sheet.js.map +1 -0
  71. package/dist/spread-B5cgadZl.js +32 -0
  72. package/dist/spread-B5cgadZl.js.map +1 -0
  73. package/dist/src/__base_element/BaseHyperlink.d.ts +20 -0
  74. package/dist/src/__utils/cache-fetch.d.ts +1 -0
  75. package/dist/src/__utils/is-dark-mode.d.ts +1 -0
  76. package/dist/src/__utils/is-in-viewport.d.ts +1 -0
  77. package/dist/src/__utils/observe-slot-change.d.ts +1 -0
  78. package/dist/src/__utils/sanitize-svg.d.ts +1 -0
  79. package/dist/src/__utils/throttle.d.ts +4 -0
  80. package/dist/src/accordion/accordion-item.d.ts +33 -9
  81. package/dist/src/accordion/accordion.d.ts +21 -5
  82. package/dist/src/banner/banner.d.ts +47 -0
  83. package/dist/src/banner/index.d.ts +1 -0
  84. package/dist/src/bottom-sheet/bottom-sheet.d.ts +42 -0
  85. package/dist/src/bottom-sheet/index.d.ts +1 -0
  86. package/dist/src/button/BaseButton.d.ts +7 -13
  87. package/dist/src/button/button/button.d.ts +4 -0
  88. package/dist/src/button/button-group/button-group.d.ts +32 -3
  89. package/dist/src/button/icon-button/icon-button.d.ts +4 -0
  90. package/dist/src/card/card-content.d.ts +15 -0
  91. package/dist/src/card/card.d.ts +37 -3
  92. package/dist/src/card/index.d.ts +1 -0
  93. package/dist/src/container/container.d.ts +1 -1
  94. package/dist/src/empty-state/empty-state.d.ts +1 -1
  95. package/dist/src/fab/fab.d.ts +111 -0
  96. package/dist/src/fab/index.d.ts +1 -0
  97. package/dist/src/focus-ring/focus-ring.d.ts +4 -1
  98. package/dist/src/index.d.ts +11 -1
  99. package/dist/src/link/link.d.ts +3 -10
  100. package/dist/src/menu/menu/menu.d.ts +4 -2
  101. package/dist/src/menu/menu-item/menu-item.d.ts +0 -1
  102. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
  103. package/dist/src/notification/index.d.ts +1 -0
  104. package/dist/src/notification/notification.d.ts +69 -0
  105. package/dist/src/pagination/pagination.d.ts +8 -1
  106. package/dist/src/ripple/ripple.d.ts +19 -3
  107. package/dist/src/search/index.d.ts +1 -0
  108. package/dist/src/search/search.d.ts +76 -0
  109. package/dist/src/segmented-button/index.d.ts +2 -0
  110. package/dist/src/segmented-button/segmented-button-group.d.ts +46 -0
  111. package/dist/src/segmented-button/segmented-button.d.ts +65 -0
  112. package/dist/src/select/index.d.ts +3 -0
  113. package/dist/src/select/option.d.ts +55 -0
  114. package/dist/src/select/select.d.ts +114 -0
  115. package/dist/src/side-sheet/index.d.ts +1 -0
  116. package/dist/src/side-sheet/side-sheet.d.ts +41 -0
  117. package/dist/src/slider/slider.d.ts +4 -0
  118. package/dist/src/snackbar/snackbar.d.ts +14 -1
  119. package/dist/src/tabs/tab-group.d.ts +0 -1
  120. package/dist/src/tabs/tab.d.ts +8 -2
  121. package/dist/src/tabs/tabs.d.ts +13 -1
  122. package/dist/src/toolbar/index.d.ts +1 -0
  123. package/dist/src/toolbar/toolbar.d.ts +86 -0
  124. package/dist/state-DwbEjqVk.js +10 -0
  125. package/dist/state-DwbEjqVk.js.map +1 -0
  126. package/dist/{style-map-DcB52w-l.js → style-map-DVmWOuYy.js} +3 -3
  127. package/dist/{style-map-DcB52w-l.js.map → style-map-DVmWOuYy.js.map} +1 -1
  128. package/dist/test/search.test.d.ts +1 -0
  129. package/dist/test/toolbar.test.d.ts +1 -0
  130. package/dist/throttle-C7ZAPqtu.js +24 -0
  131. package/dist/throttle-C7ZAPqtu.js.map +1 -0
  132. package/dist/toolbar.js +306 -0
  133. package/dist/toolbar.js.map +1 -0
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/dist/{unsafe-html-C2r3PyzF.js → unsafe-html-BsGUjx94.js} +3 -3
  136. package/dist/{unsafe-html-C2r3PyzF.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
  137. package/package.json +1 -1
  138. package/readme.md +2 -2
  139. package/scss/styles.scss +4 -0
  140. package/src/__base_element/BaseHyperlink.ts +42 -0
  141. package/src/__base_element/README.md +19 -0
  142. package/src/__utils/cache-fetch.ts +65 -0
  143. package/src/{utils → __utils}/dispatch-event-utils.ts +1 -0
  144. package/src/__utils/is-dark-mode.ts +3 -0
  145. package/src/__utils/is-in-viewport.ts +6 -0
  146. package/src/__utils/observe-slot-change.ts +38 -0
  147. package/src/__utils/sanitize-svg.ts +27 -0
  148. package/src/__utils/throttle.ts +27 -0
  149. package/src/accordion/accordion-item.scss +136 -65
  150. package/src/accordion/accordion-item.ts +117 -44
  151. package/src/accordion/accordion.scss +24 -5
  152. package/src/accordion/accordion.ts +29 -23
  153. package/src/accordion/demo/index.html +74 -35
  154. package/src/banner/banner.scss +87 -0
  155. package/src/banner/banner.ts +107 -0
  156. package/src/banner/index.ts +1 -0
  157. package/src/bottom-sheet/bottom-sheet.scss +88 -0
  158. package/src/bottom-sheet/bottom-sheet.ts +135 -0
  159. package/src/bottom-sheet/index.ts +1 -0
  160. package/src/button/BaseButton.ts +26 -30
  161. package/src/button/button/button-colors.scss +90 -19
  162. package/src/button/button/button-sizes.scss +39 -19
  163. package/src/button/button/button.scss +117 -116
  164. package/src/button/button/button.ts +29 -6
  165. package/src/button/button-group/button-group.scss +25 -22
  166. package/src/button/button-group/button-group.ts +122 -5
  167. package/src/button/icon-button/icon-button-sizes.scss +35 -15
  168. package/src/button/icon-button/icon-button.ts +25 -12
  169. package/src/card/card-colors.scss +10 -0
  170. package/src/card/card-content.ts +26 -0
  171. package/src/card/card.scss +221 -41
  172. package/src/card/card.ts +251 -8
  173. package/src/card/index.ts +1 -0
  174. package/src/chart-bar/chart-bar.ts +1 -1
  175. package/src/chart-bar/chart-stacked-bar.ts +3 -1
  176. package/src/chart-doughnut/chart-doughnut.ts +1 -1
  177. package/src/chart-pie/chart-pie.ts +1 -1
  178. package/src/checkbox/checkbox.ts +1 -1
  179. package/src/clock/clock.ts +1 -1
  180. package/src/code-editor/code-editor.ts +5 -5
  181. package/src/code-highlighter/code-highlighter.ts +2 -2
  182. package/src/container/container.ts +1 -1
  183. package/src/date-picker/date-picker.ts +5 -2
  184. package/src/divider/divider.ts +3 -1
  185. package/src/empty-state/empty-state.scss +9 -3
  186. package/src/empty-state/empty-state.ts +2 -2
  187. package/src/fab/fab-colors.scss +49 -0
  188. package/src/fab/fab-sizes.scss +47 -0
  189. package/src/fab/fab.scss +137 -0
  190. package/src/fab/fab.ts +285 -0
  191. package/src/fab/index.ts +1 -0
  192. package/src/field/field.ts +3 -1
  193. package/src/focus-ring/focus-ring.ts +37 -19
  194. package/src/icon/datasource.ts +1 -1
  195. package/src/icon/icon.ts +3 -1
  196. package/src/image/image.ts +3 -2
  197. package/src/index.ts +12 -1
  198. package/src/input/input.ts +5 -2
  199. package/src/link/link.ts +2 -15
  200. package/src/menu/menu/menu.scss +31 -3
  201. package/src/menu/menu/menu.ts +30 -6
  202. package/src/menu/menu-item/menu-item.scss +1 -0
  203. package/src/menu/menu-item/menu-item.ts +1 -9
  204. package/src/menu/sub-menu/sub-menu.ts +1 -0
  205. package/src/notification/index.ts +1 -0
  206. package/src/notification/notification.scss +201 -0
  207. package/src/notification/notification.ts +206 -0
  208. package/src/number-counter/number-counter.ts +3 -1
  209. package/src/number-field/number-field.ts +4 -2
  210. package/src/pagination/pagination.scss +33 -24
  211. package/src/pagination/pagination.ts +113 -60
  212. package/src/peacock-loader.ts +48 -0
  213. package/src/radio/radio.ts +3 -1
  214. package/src/ripple/ripple.ts +19 -3
  215. package/src/search/index.ts +1 -0
  216. package/src/search/search-colors.scss +14 -0
  217. package/src/search/search.scss +204 -0
  218. package/src/search/search.ts +240 -0
  219. package/src/segmented-button/index.ts +2 -0
  220. package/src/segmented-button/segmented-button-group.scss +21 -0
  221. package/src/segmented-button/segmented-button-group.ts +110 -0
  222. package/src/segmented-button/segmented-button.scss +115 -0
  223. package/src/segmented-button/segmented-button.ts +175 -0
  224. package/src/select/index.ts +3 -0
  225. package/src/select/option.ts +109 -0
  226. package/src/select/select.scss +125 -0
  227. package/src/select/select.ts +520 -0
  228. package/src/side-sheet/index.ts +1 -0
  229. package/src/side-sheet/side-sheet.scss +79 -0
  230. package/src/side-sheet/side-sheet.ts +100 -0
  231. package/src/slider/slider.scss +19 -1
  232. package/src/slider/slider.ts +30 -19
  233. package/src/snackbar/snackbar.scss +62 -31
  234. package/src/snackbar/snackbar.ts +92 -12
  235. package/src/switch/switch.ts +3 -1
  236. package/src/table/table.ts +3 -1
  237. package/src/tabs/demo/index.html +90 -0
  238. package/src/tabs/tab-group.ts +0 -3
  239. package/src/tabs/tab.scss +237 -25
  240. package/src/tabs/tab.ts +91 -14
  241. package/src/tabs/tabs.scss +37 -3
  242. package/src/tabs/tabs.ts +118 -2
  243. package/src/textarea/textarea.ts +4 -2
  244. package/src/time-picker/time-picker.ts +4 -2
  245. package/src/toolbar/index.ts +1 -0
  246. package/src/toolbar/toolbar-colors.scss +16 -0
  247. package/src/toolbar/toolbar.scss +165 -0
  248. package/src/toolbar/toolbar.ts +137 -0
  249. package/dist/IndividualComponent-Dt5xirYG.js +0 -73
  250. package/dist/IndividualComponent-Dt5xirYG.js.map +0 -1
  251. package/dist/button-ClzS8JLq.js.map +0 -1
  252. package/dist/button-group-BMS5WvaF.js +0 -292
  253. package/dist/button-group-BMS5WvaF.js.map +0 -1
  254. package/dist/chart-donut.js +0 -309
  255. package/dist/chart-donut.js.map +0 -1
  256. package/dist/class-map-59YGWLnx.js.map +0 -1
  257. package/dist/directive-Cuw6h7YA.js +0 -9
  258. package/dist/directive-Cuw6h7YA.js.map +0 -1
  259. package/dist/dispatch-event-utils-B4odODQf.js +0 -277
  260. package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
  261. package/dist/observe-theme-change-pALI5fmV.js.map +0 -1
  262. package/dist/radio-b70_Ie9n.js.map +0 -1
  263. package/dist/src/chart-donut/chart-donut.d.ts +0 -53
  264. package/dist/src/chart-donut/index.d.ts +0 -1
  265. package/dist/src/styleMixins.css.d.ts +0 -9
  266. package/dist/src/utils.d.ts +0 -9
  267. package/src/chart-donut/chart-donut.scss +0 -37
  268. package/src/chart-donut/chart-donut.ts +0 -287
  269. package/src/chart-donut/demo/index.html +0 -51
  270. package/src/chart-donut/index.ts +0 -1
  271. package/src/styleMixins.css.ts +0 -55
  272. package/src/utils.ts +0 -193
  273. /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
  274. /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
  275. /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
  276. /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
  277. /package/dist/test/{card.test.d.ts → banner.test.d.ts} +0 -0
  278. /package/src/{spread.ts → __directive/spread.ts} +0 -0
  279. /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
  280. /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
@@ -0,0 +1,137 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: inline-flex;
7
+
8
+ --fab-container-shape: var(--shape-corner-large);
9
+ --fab-container-elevation-level: 3;
10
+ }
11
+
12
+ /*
13
+ * Reset native button/link styles
14
+ */
15
+ .fab-element {
16
+ background: transparent;
17
+ border: none;
18
+ appearance: none;
19
+ margin: 0;
20
+ outline: none;
21
+ text-decoration: none;
22
+ cursor: pointer;
23
+ }
24
+
25
+ .fab {
26
+ position: relative;
27
+ display: inline-flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ border-radius: var(--fab-container-shape);
31
+ font-family: var(--font-family-sans) !important;
32
+
33
+ .fab-content {
34
+ display: flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ pointer-events: none;
38
+ z-index: 0;
39
+ gap: 0.75rem;
40
+
41
+ color: var(--_fab-label-text-color);
42
+ --icon-size: var(--_fab-icon-size);
43
+ --icon-color: var(--_fab-label-text-color);
44
+ }
45
+
46
+ .fab-label {
47
+ font-size: 0.875rem;
48
+ font-weight: var(--font-weight-medium);
49
+ line-height: 1.25rem;
50
+ letter-spacing: 0.00625em;
51
+ white-space: nowrap;
52
+ }
53
+
54
+ &.disabled {
55
+ cursor: not-allowed;
56
+ }
57
+
58
+ /*
59
+ Background layers
60
+ */
61
+ .focus-ring {
62
+ z-index: 2;
63
+ --focus-ring-container-shape-start-start: var(--fab-container-shape);
64
+ --focus-ring-container-shape-start-end: var(--fab-container-shape);
65
+ --focus-ring-container-shape-end-start: var(--fab-container-shape);
66
+ --focus-ring-container-shape-end-end: var(--fab-container-shape);
67
+ }
68
+
69
+ .ripple {
70
+ border-radius: var(--fab-container-shape);
71
+ --ripple-state-opacity: var(--_fab-container-state-opacity, 0);
72
+ --ripple-pressed-color: var(--_fab-label-text-color);
73
+ }
74
+
75
+ .background {
76
+ display: block;
77
+ position: absolute;
78
+ inset: 0;
79
+ background-color: var(--_fab-container-color);
80
+ opacity: var(--_fab-container-opacity, 1);
81
+ border-radius: var(--fab-container-shape);
82
+ pointer-events: none;
83
+ }
84
+
85
+ .elevation {
86
+ --elevation-level: var(--_fab-container-elevation-level, var(--fab-container-elevation-level));
87
+ transition-duration: 280ms;
88
+ --elevation-container-shape-start-start: var(--fab-container-shape);
89
+ --elevation-container-shape-start-end: var(--fab-container-shape);
90
+ --elevation-container-shape-end-start: var(--fab-container-shape);
91
+ --elevation-container-shape-end-end: var(--fab-container-shape);
92
+ }
93
+
94
+ &:hover:not(.disabled) {
95
+ --_fab-container-elevation-level: 4;
96
+ --_fab-container-state-opacity: 0.08;
97
+ }
98
+
99
+ &.pressed:not(.disabled) {
100
+ --_fab-container-elevation-level: 3;
101
+ --_fab-container-state-opacity: 0.12;
102
+ }
103
+
104
+ &.lowered {
105
+ --fab-container-elevation-level: 1;
106
+
107
+ &:hover:not(.disabled) {
108
+ --_fab-container-elevation-level: 2;
109
+ }
110
+
111
+ &.pressed:not(.disabled) {
112
+ --_fab-container-elevation-level: 1;
113
+ }
114
+ }
115
+
116
+ &.disabled {
117
+ --_fab-container-color: var(--color-on-surface);
118
+ --_fab-container-opacity: 0.12;
119
+ --_fab-label-text-color: var(--color-on-surface);
120
+ --_fab-label-text-opacity: 0.38;
121
+ --_fab-container-elevation-level: 0;
122
+
123
+ .ripple {
124
+ display: none;
125
+ }
126
+
127
+ .fab-content {
128
+ opacity: 0.38;
129
+ }
130
+ }
131
+ }
132
+
133
+ /* Extended FAB */
134
+ .fab.extended {
135
+ padding: 0 1rem;
136
+ border-radius: var(--fab-container-shape);
137
+ }
package/src/fab/fab.ts ADDED
@@ -0,0 +1,285 @@
1
+ import { html, LitElement, nothing } from 'lit';
2
+ import { property, query, state } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
5
+
6
+ import IndividualComponent from '@/IndividualComponent.js';
7
+ import { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';
8
+ import { throttle } from '@/__utils/throttle.js';
9
+ import { spread } from '@/__directive/spread.js';
10
+
11
+ import { IconProvider } from '../icon/icon.js';
12
+ import styles from './fab.scss';
13
+ import colorStyles from './fab-colors.scss';
14
+ import sizeStyles from './fab-sizes.scss';
15
+
16
+ /**
17
+ * @label FAB
18
+ * @tag wc-fab
19
+ * @rawTag fab
20
+ *
21
+ * @summary The FAB (Floating Action Button) represents the primary action on a screen.
22
+ * @overview
23
+ * <p>A Floating Action Button (FAB) is a circular button that represents the primary action on a screen. It follows the Material Design 3 specification and supports four color roles and two variants.</p>
24
+ *
25
+ * @cssprop --fab-container-color: Background color of the FAB container.
26
+ * @cssprop --fab-label-text-color: Text and icon color of the FAB label.
27
+ * @cssprop --fab-container-shape: Corner radius of the FAB. Defaults to var(--shape-corner-large).
28
+ * @cssprop --fab-container-elevation-level: Elevation level of the FAB. Defaults to 3.
29
+ *
30
+ * @fires {MouseEvent} click - Dispatched when the FAB is clicked.
31
+ *
32
+ * @example
33
+ * ```html
34
+ * <wc-fab name="add"></wc-fab>
35
+ * ```
36
+ * @tags controls
37
+ */
38
+ @IndividualComponent
39
+ export class Fab extends LitElement {
40
+ static override styles = [styles, colorStyles, sizeStyles];
41
+
42
+ #id = crypto.randomUUID();
43
+
44
+ #tabindex?: number = 0;
45
+
46
+ /**
47
+ * Name of the icon to display inside the FAB.
48
+ */
49
+ @property({ type: String, reflect: true }) name?: string;
50
+
51
+ /**
52
+ * Source URL for a custom icon.
53
+ */
54
+ @property({ type: String, reflect: true }) src?: string;
55
+
56
+ /**
57
+ * Icon provider. Defaults to `"material-symbols"`.
58
+ */
59
+ @property({ type: String }) provider: IconProvider = 'material-symbols';
60
+
61
+ /**
62
+ * Optional label text for the extended FAB variant.
63
+ * When set, the FAB displays both the icon and a text label.
64
+ */
65
+ @property({ type: String }) label?: string;
66
+
67
+ /**
68
+ * The color role of the FAB.
69
+ * `"surface"` uses the surface color role.
70
+ * `"primary"` uses the primary color role.
71
+ * `"secondary"` uses the secondary color role.
72
+ * `"tertiary"` uses the tertiary color role.
73
+ */
74
+ @property({ reflect: true }) color: 'surface' | 'primary' | 'secondary' | 'tertiary' = 'surface';
75
+
76
+ /**
77
+ * The style variant of the FAB.
78
+ * `"tonal"` uses container colors.
79
+ * `"filled"` uses solid role colors.
80
+ */
81
+ @property({ reflect: true }) variant: 'tonal' | 'filled' = 'tonal';
82
+
83
+ /**
84
+ * The size of the FAB.
85
+ * `"sm"` renders a small FAB (40×40dp).
86
+ * `"md"` renders a standard FAB (56×56dp). This is the default.
87
+ * `"lg"` renders a large FAB (96×96dp).
88
+ */
89
+ @property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
90
+
91
+ /**
92
+ * If `true`, the FAB is in a lowered (resting) state with reduced elevation.
93
+ */
94
+ @property({ type: Boolean, reflect: true }) lowered: boolean = false;
95
+
96
+ /**
97
+ * If `true`, the user cannot interact with the FAB.
98
+ */
99
+ @property({ type: Boolean, reflect: true }) disabled: boolean = false;
100
+
101
+ /**
102
+ * Hyperlink to navigate to on click.
103
+ */
104
+ @property({ reflect: true }) href?: string;
105
+
106
+ /**
107
+ * Sets or retrieves the window or frame at which to target content.
108
+ */
109
+ @property() target: string = '_self';
110
+
111
+ /**
112
+ * Additional ARIA attributes to pass to the inner button/anchor element.
113
+ */
114
+ @property({ reflect: true })
115
+ configAria?: { [key: string]: any };
116
+
117
+ /**
118
+ * Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
119
+ */
120
+ @property() throttleDelay = 200;
121
+
122
+ /**
123
+ * Tooltip text shown on hover.
124
+ */
125
+ @property() tooltip?: string;
126
+
127
+ @state()
128
+ isPressed = false;
129
+
130
+ @query('.fab') readonly fabElement!: HTMLElement | null;
131
+
132
+ override focus() {
133
+ this.fabElement?.focus();
134
+ }
135
+
136
+ override blur() {
137
+ this.fabElement?.blur();
138
+ }
139
+
140
+ override connectedCallback() {
141
+ super.connectedCallback();
142
+ this.addEventListener('click', this.__dispatchClickWithThrottle);
143
+ window.addEventListener('mouseup', this.__handlePress);
144
+ }
145
+
146
+ override disconnectedCallback() {
147
+ window.removeEventListener('mouseup', this.__handlePress);
148
+ this.removeEventListener('click', this.__dispatchClickWithThrottle);
149
+ super.disconnectedCallback();
150
+ }
151
+
152
+ override firstUpdated() {
153
+ this.__dispatchClickWithThrottle = throttle(
154
+ this.__dispatchClick,
155
+ this.throttleDelay,
156
+ );
157
+ }
158
+
159
+ __handlePress = (event: KeyboardEvent | MouseEvent) => {
160
+ if (this.disabled) return;
161
+ if (
162
+ event instanceof KeyboardEvent &&
163
+ event.type === 'keydown' &&
164
+ (event.key === 'Enter' || event.key === ' ')
165
+ ) {
166
+ this.isPressed = true;
167
+ } else if (event.type === 'mousedown') {
168
+ this.isPressed = true;
169
+ } else {
170
+ this.isPressed = false;
171
+ }
172
+ };
173
+
174
+ __isLink() {
175
+ return !!this.href;
176
+ }
177
+
178
+ __dispatchClickWithThrottle: (event: MouseEvent | KeyboardEvent) => void =
179
+ event => {
180
+ this.__dispatchClick(event);
181
+ };
182
+
183
+ __dispatchClick = (event: MouseEvent | KeyboardEvent) => {
184
+ if (this.disabled && this.href) {
185
+ event.stopImmediatePropagation();
186
+ event.preventDefault();
187
+ return;
188
+ }
189
+
190
+ if (!isActivationClick(event) || !this.fabElement) {
191
+ return;
192
+ }
193
+
194
+ this.focus();
195
+ dispatchActivationClick(this.fabElement);
196
+ };
197
+
198
+ __getDisabledReasonID() {
199
+ return this.disabled ? `disabled-reason-${this.#id}` : nothing;
200
+ }
201
+
202
+ override render() {
203
+ const isLink = this.__isLink();
204
+ const isExtended = !!this.label;
205
+
206
+ const cssClasses = {
207
+ fab: true,
208
+ 'fab-element': true,
209
+ [`size-${this.size}`]: true,
210
+ [`color-${this.color}`]: true,
211
+ [`variant-${this.variant}`]: true,
212
+ extended: isExtended,
213
+ lowered: this.lowered,
214
+ disabled: this.disabled,
215
+ pressed: this.isPressed,
216
+ };
217
+
218
+ if (!isLink) {
219
+ return html`<button
220
+ class=${classMap(cssClasses)}
221
+ id="fab"
222
+ tabindex=${this.#tabindex}
223
+ type="button"
224
+ @click=${this.__dispatchClickWithThrottle}
225
+ @mousedown=${this.__handlePress}
226
+ @keydown=${this.__handlePress}
227
+ @keyup=${this.__handlePress}
228
+ aria-label=${this.label ?? this.name ?? nothing}
229
+ aria-disabled=${`${this.disabled}`}
230
+ ?disabled=${this.disabled}
231
+ ${spread(this.configAria)}
232
+ >
233
+ ${this.__renderFabContent(isExtended)}
234
+ </button>
235
+ ${this.__renderTooltip()}`;
236
+ }
237
+
238
+ return html`<a
239
+ class=${classMap(cssClasses)}
240
+ id="fab"
241
+ tabindex=${this.#tabindex}
242
+ href=${ifDefined(this.href)}
243
+ target=${this.target}
244
+ @click=${this.__dispatchClickWithThrottle}
245
+ @mousedown=${this.__handlePress}
246
+ @keydown=${this.__handlePress}
247
+ @keyup=${this.__handlePress}
248
+ role="button"
249
+ aria-label=${this.label ?? this.name ?? nothing}
250
+ aria-disabled=${`${this.disabled}`}
251
+ ${spread(this.configAria)}
252
+ >
253
+ ${this.__renderFabContent(isExtended)}
254
+ </a>
255
+ ${this.__renderTooltip()}`;
256
+ }
257
+
258
+ __renderFabContent(isExtended: boolean) {
259
+ return html`
260
+ <wc-focus-ring class="focus-ring" .control=${this} .forElement=${this.fabElement}></wc-focus-ring>
261
+ <wc-elevation class="elevation"></wc-elevation>
262
+ <div class="background"></div>
263
+ <wc-ripple class="ripple"></wc-ripple>
264
+
265
+ <div class="fab-content">
266
+ <wc-icon
267
+ class="fab-icon"
268
+ name=${ifDefined(this.name)}
269
+ src=${ifDefined(this.src)}
270
+ provider=${this.provider}
271
+ ></wc-icon>
272
+ ${isExtended
273
+ ? html`<span class="fab-label">${this.label}</span>`
274
+ : nothing}
275
+ </div>
276
+ `;
277
+ }
278
+
279
+ __renderTooltip() {
280
+ if (this.tooltip) {
281
+ return html`<wc-tooltip for="fab">${this.tooltip}</wc-tooltip>`;
282
+ }
283
+ return nothing;
284
+ }
285
+ }
@@ -0,0 +1 @@
1
+ export { Fab } from './fab.js';
@@ -1,8 +1,10 @@
1
1
  import { html, LitElement, nothing } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
+
5
+ import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
6
+
4
7
  import styles from './field.scss';
5
- import { observerSlotChangesWithCallback } from '../utils.js';
6
8
 
7
9
  /**
8
10
  * @label Field
@@ -18,7 +18,7 @@ export class FocusRing extends LitElement {
18
18
 
19
19
  @property({ type: Boolean, reflect: true }) visible: boolean = false;
20
20
 
21
- @property({ type: String}) element = '';
21
+ @property({ type: String }) for = '';
22
22
 
23
23
 
24
24
  render() {
@@ -27,6 +27,8 @@ export class FocusRing extends LitElement {
27
27
 
28
28
  _control?: HTMLElement;
29
29
 
30
+ _focusTarget?: HTMLElement;
31
+
30
32
  get control() {
31
33
  return this._control || null;
32
34
  }
@@ -39,6 +41,15 @@ export class FocusRing extends LitElement {
39
41
  }
40
42
  }
41
43
 
44
+ set forElement(value: HTMLElement | null) {
45
+ if (value) {
46
+ this._focusTarget = value;
47
+ this.attach();
48
+ } else {
49
+ this.detach();
50
+ }
51
+ }
52
+
42
53
  connectedCallback() {
43
54
  super.connectedCallback();
44
55
  this.attach();
@@ -50,8 +61,8 @@ export class FocusRing extends LitElement {
50
61
  }
51
62
 
52
63
  __focusin() {
53
- // @ts-ignore
54
- this.visible = this._control[this.element].matches(':focus-visible') ?? false;
64
+ const focusTarget = this.__getFocusTarget();
65
+ this.visible = focusTarget?.matches(':focus-visible') ?? false;
55
66
  }
56
67
 
57
68
  __focusout() {
@@ -62,27 +73,34 @@ export class FocusRing extends LitElement {
62
73
  this.visible = false;
63
74
  }
64
75
 
76
+ __getFocusTarget(): HTMLElement | undefined {
77
+
78
+ if (this._focusTarget) {
79
+ return this._focusTarget;
80
+ }
81
+
82
+ const focusTarget = document.getElementById(this.for);
83
+ if (focusTarget) {
84
+ return focusTarget
85
+ }
86
+ return undefined;
87
+ }
88
+
65
89
  attach() {
66
- // @ts-ignore
67
- if (this._control && this._control[this.element]) {
68
- // @ts-ignore
69
- this._control[this.element].addEventListener('focusin', this.__focusin.bind(this));
70
- // @ts-ignore
71
- this._control[this.element].addEventListener('focusout', this.__focusin.bind(this));
72
- // @ts-ignore
73
- this._control[this.element].addEventListener('pointerdown', this.__focusin.bind(this));
90
+ const focusTarget = this.__getFocusTarget();
91
+ if (focusTarget) {
92
+ focusTarget.addEventListener('focusin', this.__focusin.bind(this));
93
+ focusTarget.addEventListener('focusout', this.__focusout.bind(this));
94
+ focusTarget.addEventListener('pointerdown', this.__pointerdown.bind(this));
74
95
  }
75
96
  }
76
97
 
77
98
  detach() {
78
- // @ts-ignore
79
- if (this._control && this._control[this.element]) {
80
- // @ts-ignore
81
- this._control[this.element].removeEventListener('focusin', this.__focusin);
82
- // @ts-ignore
83
- this._control[this.element].removeEventListener('focusout', this.__focusout);
84
- // @ts-ignore
85
- this._control[this.element].removeEventListener('pointerdown', this.__pointerdown);
99
+ const focusTarget = this.__getFocusTarget();
100
+ if (focusTarget) {
101
+ focusTarget.removeEventListener('focusin', this.__focusin.bind(this));
102
+ focusTarget.removeEventListener('focusout', this.__focusout.bind(this));
103
+ focusTarget.removeEventListener('pointerdown', this.__pointerdown.bind(this));
86
104
  }
87
105
  this._control = undefined;
88
106
  }
@@ -1,4 +1,4 @@
1
- import { createCacheFetch } from '../utils.js';
1
+ import { createCacheFetch } from '@/__utils/cache-fetch.js';
2
2
 
3
3
  const PROVIDERS: Record<string, (name: string) => string> = {
4
4
  'material-symbols': (name: string) =>
package/src/icon/icon.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
3
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
4
+
5
+ import { sanitizeSvg } from '@/__utils/sanitize-svg.js';
6
+
4
7
  import { fetchIcon, fetchSVG } from './datasource.js';
5
- import { sanitizeSvg } from '../utils.js';
6
8
  import styles from './icon.scss';
7
9
 
8
10
  export type IconProvider = 'material-symbols' | 'material-icons';
@@ -1,7 +1,8 @@
1
1
  import { LitElement, html } from 'lit';
2
2
  import { property, state } from 'lit/decorators.js';
3
- import { isDarkMode } from '../utils.js';
4
- import { observeThemeChange } from '../utils/observe-theme-change.js';
3
+
4
+ import { isDarkMode } from '@/__utils/is-dark-mode.js';
5
+ import { observeThemeChange } from '@/__utils/observe-theme-change.js';
5
6
 
6
7
  import styles from './image.scss';
7
8
 
package/src/index.ts CHANGED
@@ -5,6 +5,8 @@ export { Divider } from './divider/index.js';
5
5
  export { Clock } from './clock/index.js';
6
6
  export { Elevation } from './elevation/index.js';
7
7
  export { Button, ButtonGroup, IconButton } from './button/index.js';
8
+ export { Fab } from './fab/index.js';
9
+ export { SegmentedButton, SegmentedButtonGroup } from './segmented-button/index.js';
8
10
 
9
11
  export { FocusRing } from './focus-ring/index.js';
10
12
  export { Ripple } from './ripple/index.js';
@@ -37,7 +39,6 @@ export { CodeEditor } from './code-editor/index.js';
37
39
  export { Image } from './image/index.js';
38
40
  export { Tab, TabGroup, TabPanel, Tabs } from './tabs/index.js';
39
41
  export { Slider } from './slider/index.js';
40
- export { ChartDonut } from './chart-donut/index.js';
41
42
  export { ChartDoughnut } from './chart-doughnut/index.js';
42
43
  export { ChartPie } from './chart-pie/index.js';
43
44
  export { ChartBar, ChartStackedBar } from './chart-bar/index.js';
@@ -45,5 +46,15 @@ export { Table } from './table/index.js';
45
46
  export { Pagination } from './pagination/index.js';
46
47
  export { TreeView, TreeNode } from './tree-view/index.js';
47
48
  export { Card } from './card/index.js';
49
+ export { Banner } from './banner/index.js';
50
+ export { Notification } from './notification/index.js';
48
51
  export { Snackbar } from './snackbar/index.js';
49
52
  export { Radio } from './radio/index.js';
53
+ export { BottomSheet } from './bottom-sheet/index.js';
54
+ export { SideSheet } from './side-sheet/index.js';
55
+ export { Select } from './select/index.js';
56
+ export type { SelectOption } from './select/index.js';
57
+ export { SelectOptionElement } from './select/index.js';
58
+ export { Search } from './search/index.js';
59
+ export { Toolbar } from './toolbar/index.js';
60
+
@@ -1,9 +1,12 @@
1
1
  import { html, nothing } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
- import { redispatchEvent } from 'src/utils/dispatch-event-utils.js';
3
+
4
+ import { redispatchEvent } from '@/__utils/dispatch-event-utils.js';
5
+ import { spread } from '@/__directive/spread.js';
6
+
4
7
  import BaseInput from './BaseInput.js';
5
8
  import styles from './input.scss';
6
- import { spread } from '../spread.js';
9
+
7
10
  /**
8
11
  * @label Input
9
12
  * @tag wc-input
package/src/link/link.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { html, LitElement } from 'lit';
2
- import { property, state } from 'lit/decorators.js';
3
2
  import { classMap } from 'lit/directives/class-map.js';
3
+ import BaseHyperlink from '../__base_element/BaseHyperlink.js';
4
4
  import styles from './link.scss';
5
5
 
6
6
  /**
@@ -16,22 +16,9 @@ import styles from './link.scss';
16
16
  * <wc-link href="#">Link</wc-link>
17
17
  * ```
18
18
  */
19
- export class Link extends LitElement {
19
+ export class Link extends BaseHyperlink(LitElement) {
20
20
  static styles = [styles];
21
21
 
22
- /**
23
- * Hyperlink to navigate to on click.
24
- */
25
- @property({ reflect: true }) href?: string;
26
-
27
- /**
28
- * Sets or retrieves the window or frame at which to target content.
29
- */
30
- @property() target: '_self' | '_parent' | '_blank' | '_top' | string =
31
- '_self';
32
-
33
- @state() tabIndexValue?: number;
34
-
35
22
  render() {
36
23
  return html`<a
37
24
  class=${classMap({