@redvars/peacock 3.4.0 → 3.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/dist/BaseButton-DuASuVth.js +219 -0
  2. package/dist/BaseButton-DuASuVth.js.map +1 -0
  3. package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
  4. package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
  5. package/dist/assets/components.css +1 -1
  6. package/dist/assets/components.css.map +1 -1
  7. package/dist/assets/styles.css +1 -1
  8. package/dist/assets/styles.css.map +1 -1
  9. package/dist/banner.js +187 -0
  10. package/dist/banner.js.map +1 -0
  11. package/dist/bottom-sheet.js +2 -2
  12. package/dist/{button-COYCtuA8.js → button-DouvOfEU.js} +92 -283
  13. package/dist/button-DouvOfEU.js.map +1 -0
  14. package/dist/{button-group-DsXquZQn.js → button-group-CEdMwvJJ.js} +72 -48
  15. package/dist/button-group-CEdMwvJJ.js.map +1 -0
  16. package/dist/button-group.js +8 -5
  17. package/dist/button-group.js.map +1 -1
  18. package/dist/button.js +7 -4
  19. package/dist/button.js.map +1 -1
  20. package/dist/card.js +29 -74
  21. package/dist/card.js.map +1 -1
  22. package/dist/chart-bar.js +2 -2
  23. package/dist/chart-bar.js.map +1 -1
  24. package/dist/chart-doughnut.js +2 -2
  25. package/dist/chart-doughnut.js.map +1 -1
  26. package/dist/chart-pie.js +2 -2
  27. package/dist/chart-pie.js.map +1 -1
  28. package/dist/chart-stacked-bar.js +2 -2
  29. package/dist/chart-stacked-bar.js.map +1 -1
  30. package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
  31. package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
  32. package/dist/clock.js.map +1 -1
  33. package/dist/code-editor.js +4 -4
  34. package/dist/code-editor.js.map +1 -1
  35. package/dist/code-highlighter.js +5 -4
  36. package/dist/code-highlighter.js.map +1 -1
  37. package/dist/custom-elements-jsdocs.json +6627 -3477
  38. package/dist/custom-elements.json +10954 -7810
  39. package/dist/directive-ZPhl09Yt.js +9 -0
  40. package/dist/directive-ZPhl09Yt.js.map +1 -0
  41. package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
  42. package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
  43. package/dist/fab.js +423 -0
  44. package/dist/fab.js.map +1 -0
  45. package/dist/index.js +17 -9
  46. package/dist/index.js.map +1 -1
  47. package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
  48. package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
  49. package/dist/{select-C3XAzenC.js → navigation-rail-Lxetd5-Z.js} +2426 -898
  50. package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
  51. package/dist/notification.js +418 -0
  52. package/dist/notification.js.map +1 -0
  53. package/dist/number-counter.js +2 -2
  54. package/dist/number-counter.js.map +1 -1
  55. package/dist/observe-slot-change-BGJfgg2E.js +31 -0
  56. package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
  57. package/dist/peacock-loader.js +48 -13
  58. package/dist/peacock-loader.js.map +1 -1
  59. package/dist/search.js +456 -0
  60. package/dist/search.js.map +1 -0
  61. package/dist/side-sheet.js +2 -2
  62. package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
  63. package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
  64. package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
  65. package/dist/src/__utils/cache-fetch.d.ts +1 -0
  66. package/dist/src/__utils/is-dark-mode.d.ts +1 -0
  67. package/dist/src/__utils/is-in-viewport.d.ts +1 -0
  68. package/dist/src/__utils/observe-slot-change.d.ts +1 -0
  69. package/dist/src/__utils/sanitize-svg.d.ts +1 -0
  70. package/dist/src/__utils/throttle.d.ts +4 -0
  71. package/dist/src/accordion/accordion-item.d.ts +33 -9
  72. package/dist/src/accordion/accordion.d.ts +21 -5
  73. package/dist/src/banner/banner.d.ts +43 -0
  74. package/dist/src/banner/index.d.ts +1 -0
  75. package/dist/src/button/BaseButton.d.ts +7 -57
  76. package/dist/src/button/button/button.d.ts +32 -3
  77. package/dist/src/button/button-group/button-group.d.ts +4 -4
  78. package/dist/src/button/icon-button/icon-button.d.ts +33 -8
  79. package/dist/src/card/card.d.ts +4 -15
  80. package/dist/src/empty-state/empty-state.d.ts +1 -1
  81. package/dist/src/fab/fab.d.ts +80 -0
  82. package/dist/src/fab/index.d.ts +1 -0
  83. package/dist/src/focus-ring/focus-ring.d.ts +11 -5
  84. package/dist/src/index.d.ts +8 -1
  85. package/dist/src/link/link.d.ts +3 -10
  86. package/dist/src/menu/menu/menu.d.ts +3 -2
  87. package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
  88. package/dist/src/navigation-rail/index.d.ts +2 -0
  89. package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
  90. package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
  91. package/dist/src/notification/index.d.ts +1 -0
  92. package/dist/src/notification/notification.d.ts +69 -0
  93. package/dist/src/pagination/pagination.d.ts +8 -1
  94. package/dist/src/search/index.d.ts +1 -0
  95. package/dist/src/search/search.d.ts +76 -0
  96. package/dist/src/select/select.d.ts +3 -5
  97. package/dist/src/sidebar-menu/index.d.ts +3 -0
  98. package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
  99. package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
  100. package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
  101. package/dist/src/slider/slider.d.ts +4 -0
  102. package/dist/src/snackbar/snackbar.d.ts +14 -1
  103. package/dist/src/toolbar/index.d.ts +1 -0
  104. package/dist/src/toolbar/toolbar.d.ts +86 -0
  105. package/dist/src/tooltip/tooltip.d.ts +3 -0
  106. package/dist/src/url-field/index.d.ts +1 -0
  107. package/dist/src/url-field/url-field.d.ts +48 -0
  108. package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
  109. package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
  110. package/dist/test/banner.test.d.ts +1 -0
  111. package/dist/test/search.test.d.ts +1 -0
  112. package/dist/test/sidebar-menu.test.d.ts +1 -0
  113. package/dist/test/toolbar.test.d.ts +1 -0
  114. package/dist/toolbar.js +306 -0
  115. package/dist/toolbar.js.map +1 -0
  116. package/dist/tsconfig.tsbuildinfo +1 -1
  117. package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
  118. package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
  119. package/package.json +1 -1
  120. package/readme.md +73 -65
  121. package/scss/mixin.scss +16 -0
  122. package/scss/styles.scss +4 -0
  123. package/src/__mixins/BaseButtonMixin.ts +83 -0
  124. package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
  125. package/src/__mixins/MixinConstructor.ts +1 -0
  126. package/src/__mixins/README.md +19 -0
  127. package/src/__utils/cache-fetch.ts +65 -0
  128. package/src/__utils/is-dark-mode.ts +3 -0
  129. package/src/__utils/is-in-viewport.ts +6 -0
  130. package/src/__utils/observe-slot-change.ts +38 -0
  131. package/src/__utils/sanitize-svg.ts +27 -0
  132. package/src/__utils/throttle.ts +27 -0
  133. package/src/accordion/accordion-item.scss +136 -65
  134. package/src/accordion/accordion-item.ts +117 -44
  135. package/src/accordion/accordion.scss +24 -5
  136. package/src/accordion/accordion.ts +29 -23
  137. package/src/accordion/demo/index.html +74 -35
  138. package/src/banner/banner.scss +83 -0
  139. package/src/banner/banner.ts +101 -0
  140. package/src/banner/index.ts +1 -0
  141. package/src/button/BaseButton.ts +13 -115
  142. package/src/button/button/button-colors.scss +14 -14
  143. package/src/button/button/button-sizes.scss +4 -2
  144. package/src/button/button/button.ts +80 -26
  145. package/src/button/button-group/button-group.ts +5 -5
  146. package/src/button/icon-button/icon-button.ts +79 -44
  147. package/src/card/card.ts +50 -100
  148. package/src/chart-bar/chart-bar.ts +10 -15
  149. package/src/chart-bar/chart-stacked-bar.ts +15 -19
  150. package/src/chart-doughnut/chart-doughnut.ts +24 -28
  151. package/src/chart-pie/chart-pie.ts +20 -24
  152. package/src/checkbox/checkbox.scss +17 -34
  153. package/src/checkbox/checkbox.ts +4 -2
  154. package/src/clock/clock.ts +1 -1
  155. package/src/code-editor/code-editor.ts +4 -4
  156. package/src/code-highlighter/code-highlighter.scss +1 -0
  157. package/src/code-highlighter/code-highlighter.ts +3 -3
  158. package/src/date-picker/date-picker.ts +6 -3
  159. package/src/divider/divider.ts +3 -1
  160. package/src/elevation/elevation.scss +5 -5
  161. package/src/empty-state/empty-state.scss +7 -9
  162. package/src/empty-state/empty-state.ts +1 -1
  163. package/src/fab/fab-colors.scss +49 -0
  164. package/src/fab/fab-sizes.scss +47 -0
  165. package/src/fab/fab.scss +137 -0
  166. package/src/fab/fab.ts +214 -0
  167. package/src/fab/index.ts +1 -0
  168. package/src/field/field.ts +3 -1
  169. package/src/focus-ring/focus-ring.ts +47 -40
  170. package/src/icon/datasource.ts +1 -1
  171. package/src/icon/icon.ts +3 -1
  172. package/src/image/image.ts +3 -2
  173. package/src/index.ts +8 -1
  174. package/src/input/input.ts +8 -3
  175. package/src/link/link.ts +2 -15
  176. package/src/menu/menu/menu.scss +7 -0
  177. package/src/menu/menu/menu.ts +7 -4
  178. package/src/menu/menu-item/menu-item.ts +3 -1
  179. package/src/menu/sub-menu/sub-menu.ts +1 -0
  180. package/src/navigation-rail/index.ts +2 -0
  181. package/src/navigation-rail/navigation-rail-item.scss +216 -0
  182. package/src/navigation-rail/navigation-rail-item.ts +223 -0
  183. package/src/navigation-rail/navigation-rail.scss +72 -0
  184. package/src/navigation-rail/navigation-rail.ts +149 -0
  185. package/src/notification/index.ts +1 -0
  186. package/src/notification/notification.scss +201 -0
  187. package/src/notification/notification.ts +207 -0
  188. package/src/number-counter/number-counter.ts +3 -1
  189. package/src/number-field/number-field.ts +10 -6
  190. package/src/pagination/pagination.scss +33 -24
  191. package/src/pagination/pagination.ts +115 -60
  192. package/src/peacock-loader.ts +42 -5
  193. package/src/radio/radio.ts +3 -1
  194. package/src/search/index.ts +1 -0
  195. package/src/search/search-colors.scss +14 -0
  196. package/src/search/search.scss +204 -0
  197. package/src/search/search.ts +244 -0
  198. package/src/select/option.ts +1 -1
  199. package/src/select/select.scss +5 -0
  200. package/src/select/select.ts +71 -37
  201. package/src/sidebar-menu/demo/index.html +68 -0
  202. package/src/sidebar-menu/index.ts +3 -0
  203. package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
  204. package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
  205. package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
  206. package/src/sidebar-menu/sidebar-menu.ts +182 -0
  207. package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
  208. package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
  209. package/src/skeleton/skeleton.scss +18 -24
  210. package/src/slider/slider.scss +19 -0
  211. package/src/slider/slider.ts +30 -19
  212. package/src/snackbar/snackbar.scss +62 -31
  213. package/src/snackbar/snackbar.ts +91 -11
  214. package/src/switch/switch.ts +3 -1
  215. package/src/table/table.ts +3 -1
  216. package/src/tabs/tab.ts +10 -6
  217. package/src/text/text.css-component.scss +7 -1
  218. package/src/textarea/textarea.ts +4 -2
  219. package/src/time-picker/time-picker.ts +5 -3
  220. package/src/toolbar/index.ts +1 -0
  221. package/src/toolbar/toolbar-colors.scss +16 -0
  222. package/src/toolbar/toolbar.scss +165 -0
  223. package/src/toolbar/toolbar.ts +137 -0
  224. package/src/tooltip/tooltip.ts +24 -0
  225. package/src/url-field/index.ts +1 -0
  226. package/src/url-field/url-field.scss +50 -0
  227. package/src/url-field/url-field.ts +239 -0
  228. package/dist/button-COYCtuA8.js.map +0 -1
  229. package/dist/button-group-DsXquZQn.js.map +0 -1
  230. package/dist/directive-Cuw6h7YA.js +0 -9
  231. package/dist/directive-Cuw6h7YA.js.map +0 -1
  232. package/dist/dispatch-event-utils-B4odODQf.js +0 -277
  233. package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
  234. package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
  235. package/dist/select-C3XAzenC.js.map +0 -1
  236. package/dist/src/styleMixins.css.d.ts +0 -9
  237. package/dist/src/tree-view/index.d.ts +0 -2
  238. package/dist/src/tree-view/tree-node.d.ts +0 -69
  239. package/dist/src/tree-view/tree-view.d.ts +0 -40
  240. package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
  241. package/dist/src/utils.d.ts +0 -9
  242. package/dist/test/tree-view.test.d.ts +0 -1
  243. package/src/styleMixins.css.ts +0 -55
  244. package/src/tree-view/demo/index.html +0 -57
  245. package/src/tree-view/index.ts +0 -2
  246. package/src/tree-view/tree-node.scss +0 -101
  247. package/src/tree-view/tree-node.ts +0 -268
  248. package/src/tree-view/tree-view.ts +0 -182
  249. package/src/tree-view/wc-tree-view.ts +0 -9
  250. package/src/utils.ts +0 -193
  251. /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
  252. /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
  253. /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
  254. /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
  255. /package/src/{spread.ts → __directive/spread.ts} +0 -0
  256. /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
  257. /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
  258. /package/src/{utils → __utils}/observe-theme-change.ts +0 -0
@@ -1,8 +1,8 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
5
- import * as d3 from 'd3';
4
+ import { select, max, scaleBand, scaleLinear, scaleOrdinal, axisLeft, axisBottom, ScaleOrdinal } from 'd3';
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
6
  import styles from './chart-bar.scss';
7
7
 
8
8
  export type ChartBarItem = {
@@ -94,8 +94,7 @@ export class ChartBar extends LitElement {
94
94
  }
95
95
 
96
96
  private _getPaletteScale() {
97
- return d3
98
- .scaleOrdinal<string, string>()
97
+ return scaleOrdinal<string, string>()
99
98
  .domain(this.data.map(d => d.name))
100
99
  .range(chartColors);
101
100
  }
@@ -103,7 +102,7 @@ export class ChartBar extends LitElement {
103
102
  private _resolveColor(
104
103
  name: string,
105
104
  override: string | undefined,
106
- scale: d3.ScaleOrdinal<string, string>,
105
+ scale: ScaleOrdinal<string, string>,
107
106
  ) {
108
107
  return override || scale(name);
109
108
  }
@@ -116,7 +115,7 @@ export class ChartBar extends LitElement {
116
115
  const margin = Math.max(this.margin, 12);
117
116
  const data = this.data ?? [];
118
117
 
119
- const svg = d3.select(this.svgElement);
118
+ const svg = select(this.svgElement);
120
119
  svg.attr('width', width).attr('height', height);
121
120
 
122
121
  const innerWidth = Math.max(width - margin * 2, 0);
@@ -134,15 +133,13 @@ export class ChartBar extends LitElement {
134
133
  return;
135
134
  }
136
135
 
137
- const xScale = d3
138
- .scaleBand<string>()
136
+ const xScale = scaleBand<string>()
139
137
  .domain(data.map(d => d.name))
140
138
  .range([0, innerWidth])
141
139
  .padding(0.28);
142
140
 
143
- const maxValue = d3.max(data, d => d.value) ?? 0;
144
- const yScale = d3
145
- .scaleLinear()
141
+ const maxValue = max(data, d => d.value) ?? 0;
142
+ const yScale = scaleLinear()
146
143
  .domain([0, maxValue || 1])
147
144
  .nice()
148
145
  .range([innerHeight, 0]);
@@ -150,8 +147,7 @@ export class ChartBar extends LitElement {
150
147
  const yGrid = container.select<SVGGElement>('.y-grid');
151
148
  yGrid
152
149
  .call(
153
- d3
154
- .axisLeft(yScale)
150
+ axisLeft(yScale)
155
151
  .ticks(5)
156
152
  .tickSize(-innerWidth)
157
153
  .tickFormat(() => ''),
@@ -165,8 +161,7 @@ export class ChartBar extends LitElement {
165
161
  xAxis
166
162
  .attr('transform', `translate(0,${innerHeight})`)
167
163
  .call(
168
- d3
169
- .axisBottom(xScale)
164
+ axisBottom(xScale)
170
165
  .tickSizeOuter(0)
171
166
  .tickFormat(name => {
172
167
  const entry = data.find(d => d.name === name);
@@ -1,8 +1,10 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
3
  import { styleMap } from 'lit/directives/style-map.js';
4
- import IndividualComponent from 'src/IndividualComponent.js';
5
- import * as d3 from 'd3';
4
+ import { select, max, scaleBand, scaleLinear, scaleOrdinal, axisLeft, axisBottom, stack, Series, SeriesPoint, ScaleOrdinal } from 'd3';
5
+
6
+ import IndividualComponent from '@/IndividualComponent.js';
7
+
6
8
  import styles from './chart-bar.scss';
7
9
 
8
10
  export type ChartStackedSegment = {
@@ -133,15 +135,14 @@ export class ChartStackedBar extends LitElement {
133
135
  }
134
136
 
135
137
  private _getColorScale(keys: string[]) {
136
- return d3
137
- .scaleOrdinal<string, string>()
138
+ return scaleOrdinal<string, string>()
138
139
  .domain(keys)
139
140
  .range(chartColors);
140
141
  }
141
142
 
142
143
  private _getColorMap(
143
144
  keys: string[],
144
- scale: d3.ScaleOrdinal<string, string>,
145
+ scale: ScaleOrdinal<string, string>,
145
146
  ) {
146
147
  const map = new Map<string, string>();
147
148
  keys.forEach(key => {
@@ -174,7 +175,7 @@ export class ChartStackedBar extends LitElement {
174
175
  const margin = Math.max(this.margin, 16);
175
176
  const data = this.data ?? [];
176
177
 
177
- const svg = d3.select(this.svgElement);
178
+ const svg = select(this.svgElement);
178
179
  svg.attr('width', width).attr('height', height);
179
180
 
180
181
  const innerWidth = Math.max(width - margin * 2, 0);
@@ -196,20 +197,17 @@ export class ChartStackedBar extends LitElement {
196
197
  const colorMap = this._getColorMap(keys, colorScale);
197
198
 
198
199
  const totals = this._getTotals();
199
- const xScale = d3
200
- .scaleBand<string>()
200
+ const xScale = scaleBand<string>()
201
201
  .domain(data.map(d => d.name))
202
202
  .range([0, innerWidth])
203
203
  .padding(0.3);
204
- const maxValue = d3.max(totals) ?? 0;
205
- const yScale = d3
206
- .scaleLinear()
204
+ const maxValue = max(totals) ?? 0;
205
+ const yScale = scaleLinear()
207
206
  .domain([0, maxValue || 1])
208
207
  .nice()
209
208
  .range([innerHeight, 0]);
210
209
 
211
- const stackedSeries = d3
212
- .stack<ChartStackedBarItem, string>()
210
+ const stackedSeries = stack<ChartStackedBarItem, string>()
213
211
  .keys(keys)
214
212
  .value(
215
213
  (d, key) => d.segments.find(segment => segment.name === key)?.value ?? 0,
@@ -218,8 +216,7 @@ export class ChartStackedBar extends LitElement {
218
216
  const yGrid = container.select<SVGGElement>('.y-grid');
219
217
  yGrid
220
218
  .call(
221
- d3
222
- .axisLeft(yScale)
219
+ axisLeft(yScale)
223
220
  .ticks(5)
224
221
  .tickSize(-innerWidth)
225
222
  .tickFormat(() => ''),
@@ -233,8 +230,7 @@ export class ChartStackedBar extends LitElement {
233
230
  xAxis
234
231
  .attr('transform', `translate(0,${innerHeight})`)
235
232
  .call(
236
- d3
237
- .axisBottom(xScale)
233
+ axisBottom(xScale)
238
234
  .tickSizeOuter(0)
239
235
  .tickFormat(name => {
240
236
  const entry = data.find(d => d.name === name);
@@ -250,7 +246,7 @@ export class ChartStackedBar extends LitElement {
250
246
 
251
247
  const barGroups = container
252
248
  .select('.bars')
253
- .selectAll<SVGGElement, d3.Series<ChartStackedBarItem, string>>(
249
+ .selectAll<SVGGElement, Series<ChartStackedBarItem, string>>(
254
250
  '.bar-group',
255
251
  )
256
252
  .data(stackedSeries, series => series.key)
@@ -266,7 +262,7 @@ export class ChartStackedBar extends LitElement {
266
262
  .style('fill', series => colorMap.get(series.key) ?? colorScale(series.key));
267
263
 
268
264
  const segmentJoin = barGroups
269
- .selectAll<SVGRectElement, d3.SeriesPoint<ChartStackedBarItem>>('rect')
265
+ .selectAll<SVGRectElement, SeriesPoint<ChartStackedBarItem>>('rect')
270
266
  .data(series => series, d => d.data.name)
271
267
  .join(
272
268
  enter =>
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
4
- import * as d3 from 'd3';
3
+ import { select, arc, pie, scaleOrdinal, easeCubicInOut, interpolateNumber, PieArcDatum, BaseType } from 'd3';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
5
  import styles from './chart-donut.scss';
6
6
 
7
7
  export type ChartDoughnutColor = {
@@ -24,7 +24,7 @@ const chartColors: ChartDoughnutColor[] = [];
24
24
 
25
25
  /** SVGPathElement augmented with the last rendered arc datum for smooth tween interpolation. */
26
26
  interface ArcPathElement extends SVGPathElement {
27
- _prevDatum?: d3.PieArcDatum<ChartDoughnutItem>;
27
+ _prevDatum?: PieArcDatum<ChartDoughnutItem>;
28
28
  }
29
29
 
30
30
  function debounce<T extends (...args: any[]) => void>(fn: T, wait: number): T {
@@ -108,16 +108,14 @@ export class ChartDoughnut extends LitElement {
108
108
  }
109
109
 
110
110
  private _getPieData() {
111
- const pie = d3
112
- .pie<ChartDoughnutItem>()
111
+ const pieGenerator = pie<ChartDoughnutItem>()
113
112
  .sort(null)
114
113
  .value(d => d.value);
115
- return pie(this.data);
114
+ return pieGenerator(this.data);
116
115
  }
117
116
 
118
117
  private _getColorScale() {
119
- return d3
120
- .scaleOrdinal<string, ChartDoughnutColor>()
118
+ return scaleOrdinal<string, ChartDoughnutColor>()
121
119
  .domain(this.data.map(d => d.name))
122
120
  .range(chartColors);
123
121
  }
@@ -131,15 +129,13 @@ export class ChartDoughnut extends LitElement {
131
129
  const colorScale = this._getColorScale();
132
130
  const total = this._getTotal();
133
131
 
134
- const svg = d3.select(this.svgElement);
132
+ const svg = select(this.svgElement);
135
133
 
136
- const doughnutArc = d3
137
- .arc<d3.PieArcDatum<ChartDoughnutItem>>()
134
+ const doughnutArc = arc<PieArcDatum<ChartDoughnutItem>>()
138
135
  .innerRadius(radius * 0.72)
139
136
  .outerRadius(radius);
140
137
 
141
- const labelsArc = d3
142
- .arc<d3.PieArcDatum<ChartDoughnutItem>>()
138
+ const labelsArc = arc<PieArcDatum<ChartDoughnutItem>>()
143
139
  .innerRadius(radius + 10)
144
140
  .outerRadius(radius + 10);
145
141
 
@@ -152,7 +148,7 @@ export class ChartDoughnut extends LitElement {
152
148
  // Arc paths — keyed by name so D3 matches elements across updates
153
149
  const $paths = svg
154
150
  .select('.arc-container')
155
- .selectAll<SVGPathElement, d3.PieArcDatum<ChartDoughnutItem>>('.arc')
151
+ .selectAll<SVGPathElement, PieArcDatum<ChartDoughnutItem>>('.arc')
156
152
  .data(pieData, d => d.data.name)
157
153
  .join('path')
158
154
  .attr('class', 'arc')
@@ -162,7 +158,7 @@ export class ChartDoughnut extends LitElement {
162
158
  $paths
163
159
  .transition()
164
160
  .duration(DURATION)
165
- .ease(d3.easeCubicInOut)
161
+ .ease(easeCubicInOut)
166
162
  .attrTween('d', function (this: SVGPathElement, d) {
167
163
  const self = this as ArcPathElement;
168
164
  // Interpolate from the last rendered angles to the new ones.
@@ -173,8 +169,8 @@ export class ChartDoughnut extends LitElement {
173
169
  endAngle: d.startAngle,
174
170
  };
175
171
  self._prevDatum = d;
176
- const iStart = d3.interpolateNumber(prev.startAngle, d.startAngle);
177
- const iEnd = d3.interpolateNumber(prev.endAngle, d.endAngle);
172
+ const iStart = interpolateNumber(prev.startAngle, d.startAngle);
173
+ const iEnd = interpolateNumber(prev.endAngle, d.endAngle);
178
174
  return (t: number) =>
179
175
  doughnutArc({ ...d, startAngle: iStart(t), endAngle: iEnd(t) }) ??
180
176
  '';
@@ -194,11 +190,11 @@ export class ChartDoughnut extends LitElement {
194
190
  $title
195
191
  .transition()
196
192
  .duration(DURATION)
197
- .ease(d3.easeCubicInOut)
198
- .tween('text', function (this: d3.BaseType) {
199
- const sel = d3.select(this as SVGTextElement);
193
+ .ease(easeCubicInOut)
194
+ .tween('text', function (this: BaseType) {
195
+ const sel = select(this as SVGTextElement);
200
196
  const start = parseFloat(sel.text()) || 0;
201
- const interp = d3.interpolateNumber(start, total);
197
+ const interp = interpolateNumber(start, total);
202
198
  return function (t: number) {
203
199
  sel.text(Math.round(interp(t)));
204
200
  };
@@ -211,7 +207,7 @@ export class ChartDoughnut extends LitElement {
211
207
  const $chartContainer = svg.select('.chart-container');
212
208
 
213
209
  if (this.showLabels) {
214
- const pointsFn = (d: d3.PieArcDatum<ChartDoughnutItem>) => {
210
+ const pointsFn = (d: PieArcDatum<ChartDoughnutItem>) => {
215
211
  const posA = doughnutArc.centroid(d);
216
212
  const posB = labelsArc.centroid(d);
217
213
  const posC = posB.slice() as [number, number];
@@ -220,20 +216,20 @@ export class ChartDoughnut extends LitElement {
220
216
  return [posA, posB, posC].map(p => p.join(',')).join(' ');
221
217
  };
222
218
 
223
- const transformFn = (d: d3.PieArcDatum<ChartDoughnutItem>) => {
219
+ const transformFn = (d: PieArcDatum<ChartDoughnutItem>) => {
224
220
  const pos = labelsArc.centroid(d);
225
221
  const midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
226
222
  pos[0] = radius * (midAngle < Math.PI ? 1 : -1);
227
223
  return `translate(${pos})`;
228
224
  };
229
225
 
230
- const anchorFn = (d: d3.PieArcDatum<ChartDoughnutItem>) => {
226
+ const anchorFn = (d: PieArcDatum<ChartDoughnutItem>) => {
231
227
  const midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
232
228
  return midAngle < Math.PI ? 'start' : 'end';
233
229
  };
234
230
 
235
231
  const $polylines = $chartContainer
236
- .selectAll<SVGPolylineElement, d3.PieArcDatum<ChartDoughnutItem>>(
232
+ .selectAll<SVGPolylineElement, PieArcDatum<ChartDoughnutItem>>(
237
233
  '.item-polyline',
238
234
  )
239
235
  .data(pieData, d => d.data.name)
@@ -241,7 +237,7 @@ export class ChartDoughnut extends LitElement {
241
237
  .attr('class', 'item-polyline');
242
238
 
243
239
  const $labels = $chartContainer
244
- .selectAll<SVGTextElement, d3.PieArcDatum<ChartDoughnutItem>>('.item-label')
240
+ .selectAll<SVGTextElement, PieArcDatum<ChartDoughnutItem>>('.item-label')
245
241
  .data(pieData, d => d.data.name)
246
242
  .join('text')
247
243
  .attr('class', 'item-label')
@@ -251,12 +247,12 @@ export class ChartDoughnut extends LitElement {
251
247
  $polylines
252
248
  .transition()
253
249
  .duration(DURATION)
254
- .ease(d3.easeCubicInOut)
250
+ .ease(easeCubicInOut)
255
251
  .attr('points', pointsFn);
256
252
  $labels
257
253
  .transition()
258
254
  .duration(DURATION)
259
- .ease(d3.easeCubicInOut)
255
+ .ease(easeCubicInOut)
260
256
  .attr('transform', transformFn)
261
257
  .style('text-anchor', anchorFn);
262
258
  } else {
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, PropertyValues } from 'lit';
2
2
  import { property, query } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
4
- import * as d3 from 'd3';
3
+ import { select, arc, pie, scaleOrdinal, PieArcDatum, easeCubicInOut, interpolateNumber } from 'd3';
4
+ import IndividualComponent from '@/IndividualComponent.js';
5
5
  import styles from './chart-pie.scss';
6
6
 
7
7
  export type ChartPieColor = {
@@ -24,7 +24,7 @@ const chartColors: ChartPieColor[] = [];
24
24
 
25
25
  /** SVGPathElement augmented with the last rendered arc datum for smooth tween interpolation. */
26
26
  interface ArcPathElement extends SVGPathElement {
27
- _prevDatum?: d3.PieArcDatum<ChartPieItem>;
27
+ _prevDatum?: PieArcDatum<ChartPieItem>;
28
28
  }
29
29
 
30
30
  function debounce<T extends (...args: any[]) => void>(fn: T, wait: number): T {
@@ -102,16 +102,14 @@ export class ChartPie extends LitElement {
102
102
  }
103
103
 
104
104
  private _getPieData() {
105
- const pie = d3
106
- .pie<ChartPieItem>()
105
+ const pieGenerator = pie<ChartPieItem>()
107
106
  .sort(null)
108
107
  .value(d => d.value);
109
- return pie(this.data);
108
+ return pieGenerator(this.data);
110
109
  }
111
110
 
112
111
  private _getColorScale() {
113
- return d3
114
- .scaleOrdinal<string, ChartPieColor>()
112
+ return scaleOrdinal<string, ChartPieColor>()
115
113
  .domain(this.data.map(d => d.name))
116
114
  .range(chartColors);
117
115
  }
@@ -124,15 +122,13 @@ export class ChartPie extends LitElement {
124
122
  const pieData = this._getPieData();
125
123
  const colorScale = this._getColorScale();
126
124
 
127
- const svg = d3.select(this.svgElement);
125
+ const svg = select(this.svgElement);
128
126
 
129
- const pieArc = d3
130
- .arc<d3.PieArcDatum<ChartPieItem>>()
127
+ const pieArc = arc<PieArcDatum<ChartPieItem>>()
131
128
  .innerRadius(0)
132
129
  .outerRadius(radius);
133
130
 
134
- const labelsArc = d3
135
- .arc<d3.PieArcDatum<ChartPieItem>>()
131
+ const labelsArc = arc<PieArcDatum<ChartPieItem>>()
136
132
  .innerRadius(radius + 10)
137
133
  .outerRadius(radius + 10);
138
134
 
@@ -145,7 +141,7 @@ export class ChartPie extends LitElement {
145
141
  // Arc paths — keyed by name so D3 matches elements across updates
146
142
  const $paths = svg
147
143
  .select('.arc-container')
148
- .selectAll<SVGPathElement, d3.PieArcDatum<ChartPieItem>>('.arc')
144
+ .selectAll<SVGPathElement, PieArcDatum<ChartPieItem>>('.arc')
149
145
  .data(pieData, d => d.data.name)
150
146
  .join('path')
151
147
  .attr('class', 'arc')
@@ -155,7 +151,7 @@ export class ChartPie extends LitElement {
155
151
  $paths
156
152
  .transition()
157
153
  .duration(DURATION)
158
- .ease(d3.easeCubicInOut)
154
+ .ease(easeCubicInOut)
159
155
  .attrTween('d', function (this: SVGPathElement, d) {
160
156
  const self = this as ArcPathElement;
161
157
  // Interpolate from the last rendered angles to the new ones.
@@ -166,8 +162,8 @@ export class ChartPie extends LitElement {
166
162
  endAngle: d.startAngle,
167
163
  };
168
164
  self._prevDatum = d;
169
- const iStart = d3.interpolateNumber(prev.startAngle, d.startAngle);
170
- const iEnd = d3.interpolateNumber(prev.endAngle, d.endAngle);
165
+ const iStart = interpolateNumber(prev.startAngle, d.startAngle);
166
+ const iEnd = interpolateNumber(prev.endAngle, d.endAngle);
171
167
  return (t: number) =>
172
168
  pieArc({ ...d, startAngle: iStart(t), endAngle: iEnd(t) }) ?? '';
173
169
  });
@@ -184,7 +180,7 @@ export class ChartPie extends LitElement {
184
180
  const $chartContainer = svg.select('.chart-container');
185
181
 
186
182
  if (this.showLabels) {
187
- const pointsFn = (d: d3.PieArcDatum<ChartPieItem>) => {
183
+ const pointsFn = (d: PieArcDatum<ChartPieItem>) => {
188
184
  const posA = pieArc.centroid(d);
189
185
  const posB = labelsArc.centroid(d);
190
186
  const posC = posB.slice() as [number, number];
@@ -193,20 +189,20 @@ export class ChartPie extends LitElement {
193
189
  return [posA, posB, posC].map(p => p.join(',')).join(' ');
194
190
  };
195
191
 
196
- const transformFn = (d: d3.PieArcDatum<ChartPieItem>) => {
192
+ const transformFn = (d: PieArcDatum<ChartPieItem>) => {
197
193
  const pos = labelsArc.centroid(d);
198
194
  const midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
199
195
  pos[0] = radius * (midAngle < Math.PI ? 1 : -1);
200
196
  return `translate(${pos})`;
201
197
  };
202
198
 
203
- const anchorFn = (d: d3.PieArcDatum<ChartPieItem>) => {
199
+ const anchorFn = (d: PieArcDatum<ChartPieItem>) => {
204
200
  const midAngle = d.startAngle + (d.endAngle - d.startAngle) / 2;
205
201
  return midAngle < Math.PI ? 'start' : 'end';
206
202
  };
207
203
 
208
204
  const $polylines = $chartContainer
209
- .selectAll<SVGPolylineElement, d3.PieArcDatum<ChartPieItem>>(
205
+ .selectAll<SVGPolylineElement, PieArcDatum<ChartPieItem>>(
210
206
  '.item-polyline',
211
207
  )
212
208
  .data(pieData, d => d.data.name)
@@ -214,7 +210,7 @@ export class ChartPie extends LitElement {
214
210
  .attr('class', 'item-polyline');
215
211
 
216
212
  const $labels = $chartContainer
217
- .selectAll<SVGTextElement, d3.PieArcDatum<ChartPieItem>>('.item-label')
213
+ .selectAll<SVGTextElement, PieArcDatum<ChartPieItem>>('.item-label')
218
214
  .data(pieData, d => d.data.name)
219
215
  .join('text')
220
216
  .attr('class', 'item-label')
@@ -224,12 +220,12 @@ export class ChartPie extends LitElement {
224
220
  $polylines
225
221
  .transition()
226
222
  .duration(DURATION)
227
- .ease(d3.easeCubicInOut)
223
+ .ease(easeCubicInOut)
228
224
  .attr('points', pointsFn);
229
225
  $labels
230
226
  .transition()
231
227
  .duration(DURATION)
232
- .ease(d3.easeCubicInOut)
228
+ .ease(easeCubicInOut)
233
229
  .attr('transform', transformFn)
234
230
  .style('text-anchor', anchorFn);
235
231
  } else {
@@ -51,12 +51,9 @@
51
51
  flex-shrink: 0;
52
52
  }
53
53
 
54
- .state-layer {
55
- position: absolute;
56
- inset: 0;
54
+ .ripple {
57
55
  border-radius: 50%;
58
- opacity: 0;
59
- transition: opacity var(--duration-short2) var(--easing-standard);
56
+ --ripple-pressed-color: var(--color-on-surface);
60
57
  }
61
58
 
62
59
  .outline {
@@ -115,46 +112,32 @@
115
112
 
116
113
  // Hover state
117
114
  &:hover:not(.disabled):not(.readonly) {
118
- .state-layer {
119
- opacity: 0.08;
120
- background: var(--color-on-surface);
115
+ &.state-checked .ripple,
116
+ &.state-indeterminate .ripple {
117
+ --ripple-pressed-color: var(--checkbox-selected-color);
121
118
  }
119
+ }
122
120
 
123
- &.state-checked .state-layer,
124
- &.state-indeterminate .state-layer {
125
- background: var(--checkbox-selected-color);
126
- }
121
+ .focus-ring {
122
+ --focus-ring-container-shape-start-start: 50%;
123
+ --focus-ring-container-shape-start-end: 50%;
124
+ --focus-ring-container-shape-end-start: 50%;
125
+ --focus-ring-container-shape-end-end: 50%;
127
126
  }
128
127
 
129
128
  // Focus state
130
129
  &.has-focus:not(.active):not(.disabled):not(.readonly) {
131
- .state-layer {
132
- opacity: 0.12;
133
- background: var(--color-on-surface);
134
- }
135
-
136
- .container {
137
- outline: 3px solid var(--color-primary);
138
- outline-offset: 2px;
139
- border-radius: 50%;
140
- }
141
-
142
- &.state-checked .state-layer,
143
- &.state-indeterminate .state-layer {
144
- background: var(--checkbox-selected-color);
130
+ &.state-checked .ripple,
131
+ &.state-indeterminate .ripple {
132
+ --ripple-pressed-color: var(--checkbox-selected-color);
145
133
  }
146
134
  }
147
135
 
148
136
  // Active/pressed state
149
137
  &.active:not(.disabled):not(.readonly) {
150
- .state-layer {
151
- opacity: 0.12;
152
- background: var(--color-on-surface);
153
- }
154
-
155
- &.state-checked .state-layer,
156
- &.state-indeterminate .state-layer {
157
- background: var(--checkbox-selected-color);
138
+ &.state-checked .ripple,
139
+ &.state-indeterminate .ripple {
140
+ --ripple-pressed-color: var(--checkbox-selected-color);
158
141
  }
159
142
  }
160
143
 
@@ -1,7 +1,7 @@
1
1
  import { html, LitElement, svg } from 'lit';
2
2
  import { property, query, state } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { spread } from '../spread.js';
4
+ import { spread } from '@/__directive/spread.js';
5
5
  import styles from './checkbox.scss';
6
6
 
7
7
  /**
@@ -238,6 +238,7 @@ export class Checkbox extends LitElement {
238
238
  return html`
239
239
  <label class=${classMap(cssClasses)}>
240
240
  <div
241
+ id="container"
241
242
  class="container"
242
243
  tabindex=${this.tabindex || 0}
243
244
  @keyup=${this.handleKeyUp}
@@ -255,7 +256,8 @@ export class Checkbox extends LitElement {
255
256
  : 'false'}
256
257
  ${spread(this.configAria)}
257
258
  >
258
- <div class="state-layer"></div>
259
+ <wc-ripple class="ripple"></wc-ripple>
260
+ <wc-focus-ring class="focus-ring" for='container'></wc-focus-ring>
259
261
  <div class="outline"></div>
260
262
  <div class="background"></div>
261
263
  <svg class="icon" viewBox="0 0 12 12">
@@ -1,6 +1,6 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
- import IndividualComponent from 'src/IndividualComponent.js';
3
+ import IndividualComponent from '@/IndividualComponent.js';
4
4
  import { ClockController } from './ClockController.js';
5
5
 
6
6
  import styles from './clock.scss';
@@ -2,13 +2,13 @@ import { html, nothing } from 'lit';
2
2
  import { property, state, query } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import {init} from 'modern-monaco';
5
- import IndividualComponent from 'src/IndividualComponent.js';
5
+ import IndividualComponent from '@/IndividualComponent.js';
6
6
  import BaseInput from '../input/BaseInput.js';
7
- import { observeThemeChange } from '../utils/observe-theme-change.js';
8
- import { redispatchEvent } from '../utils/dispatch-event-utils.js';
7
+ import { observeThemeChange } from '../__utils/observe-theme-change.js';
8
+ import { redispatchEvent } from '../__utils/dispatch-event-utils.js';
9
9
  import {
10
10
  isDarkMode,
11
- } from '../utils.js';
11
+ } from '@/__utils/is-dark-mode.js';
12
12
 
13
13
  import styles from './code-editor.scss';
14
14
 
@@ -58,6 +58,7 @@
58
58
  padding: var(--spacing-200);
59
59
  width: fit-content;
60
60
  background: transparent !important;
61
+ font-family: var(--font-family-monospace);
61
62
  --shiki-dark-bg: transparent !important;
62
63
 
63
64
  code {
@@ -12,8 +12,8 @@ import * as prettierPluginEstree from 'prettier/plugins/estree';
12
12
 
13
13
  import { BundledLanguage, codeToHtml, ShikiTransformer } from 'shiki';
14
14
 
15
- import IndividualComponent from 'src/IndividualComponent.js';
16
- import { copyToClipboard } from '../utils/copy-to-clipboard.js';
15
+ import IndividualComponent from '@/IndividualComponent.js';
16
+ import { copyToClipboard } from '@/__utils/copy-to-clipboard.js';
17
17
  import styles from './code-highlighter.scss';
18
18
 
19
19
  const locale = {
@@ -175,10 +175,10 @@ export class CodeHighlighter extends LitElement {
175
175
  variant="text"
176
176
  size="xs"
177
177
  aria-label=${locale.copyToClipboard}
178
- name="content_copy"
179
178
  tooltip=${locale.copyToClipboard}
180
179
  @click=${this.__handleCopyClick}
181
180
  >
181
+ <wc-icon name="content_copy"></wc-icon>
182
182
  </wc-icon-button>
183
183
  </div>
184
184
  </div>
@@ -1,9 +1,12 @@
1
1
  import { html } 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 '../input/BaseInput.js';
5
8
  import styles from './date-picker.scss';
6
- import { spread } from '../spread.js';
9
+
7
10
 
8
11
  /**
9
12
  * @label Date Picker
@@ -165,7 +168,6 @@ export class DatePicker extends BaseInput {
165
168
  slot="field-end"
166
169
  color="secondary"
167
170
  variant="text"
168
- name="calendar_today"
169
171
  ?disabled=${this.disabled}
170
172
  @click=${() => {
171
173
  setTimeout(() => {
@@ -174,6 +176,7 @@ export class DatePicker extends BaseInput {
174
176
  });
175
177
  }}
176
178
  >
179
+ <wc-icon name="calendar_today"></wc-icon>
177
180
  </wc-icon-button>
178
181
  </wc-field>
179
182
  `;