@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
@@ -7,44 +7,48 @@
7
7
  }
8
8
 
9
9
  .pagination {
10
- background: var(--color-surface, #fff);
11
10
  display: flex;
12
11
  align-items: center;
12
+ justify-content: flex-end;
13
+ gap: var(--spacing-200, 1rem);
14
+ background: var(--color-surface, #fff);
15
+ padding: var(--spacing-150, 0.75rem) var(--spacing-200, 1rem);
13
16
 
14
- .page-sizes-select {
15
- margin-inline-start: var(--spacing-100, 0.5rem);
17
+ @media (max-width: 48rem) {
18
+ flex-wrap: wrap;
19
+ justify-content: space-between;
20
+ row-gap: var(--spacing-100, 0.5rem);
16
21
  }
17
22
 
18
- .page-size-label {
19
- display: flex;
23
+ .page-size {
24
+ display: inline-flex;
20
25
  align-items: center;
21
26
  gap: var(--spacing-100, 0.5rem);
22
- @include mixin.get-typography-not-important('body-medium');
27
+ min-inline-size: max-content;
28
+ }
29
+
30
+ .page-size-label {
31
+ @include mixin.get-typography-not-important('body-small');
23
32
  color: var(--color-on-surface-variant);
24
33
  white-space: nowrap;
25
34
  }
26
35
 
27
36
  .page-size-select {
28
- border: 1px solid var(--color-outline-variant);
29
- background: var(--color-surface, #fff);
30
- color: var(--color-on-surface);
31
- padding: var(--spacing-050, 0.25rem) var(--spacing-100, 0.5rem);
32
- cursor: pointer;
33
- outline: none;
34
- height: 2.5rem;
35
-
36
- @include mixin.get-typography-not-important('body-medium');
37
-
38
- &:focus {
39
- outline: 2px solid var(--color-primary);
40
- }
37
+ inline-size: 5.5rem;
38
+ min-inline-size: 5.5rem;
39
+ --field-container-height: 2.5rem;
41
40
  }
42
41
 
43
42
  .pagination-item-count {
44
- margin-inline-start: var(--spacing-150, 0.75rem);
45
- flex: 1;
43
+ margin-inline-start: auto;
46
44
  display: flex;
47
45
  align-items: center;
46
+
47
+ @media (max-width: 48rem) {
48
+ order: 3;
49
+ margin-inline-start: 0;
50
+ inline-size: 100%;
51
+ }
48
52
  }
49
53
 
50
54
  .pagination-text {
@@ -52,8 +56,13 @@
52
56
  color: var(--color-on-surface-variant);
53
57
  }
54
58
 
55
- .arrows {
56
- --border-radius: 0;
57
- --button-height: calc(2.5rem - 2px);
59
+ .pagination-actions {
60
+ display: inline-flex;
61
+ align-items: center;
62
+ gap: var(--spacing-025, 0.125rem);
63
+ }
64
+
65
+ .nav-button {
66
+ --button-container-shape: 999px;
58
67
  }
59
68
  }
@@ -1,4 +1,5 @@
1
1
  import { html, LitElement } from 'lit';
2
+ import type { PropertyValues } from 'lit';
2
3
  import { property } from 'lit/decorators.js';
3
4
  import styles from './pagination.scss';
4
5
 
@@ -16,7 +17,7 @@ const DEFAULT_PAGE_SIZES = [10, 25, 50, 100];
16
17
  *
17
18
  * @example
18
19
  * ```html
19
- * <wc-pagination page="1" page-size="10" total-items="100"></wc-pagination>
20
+ * <wc-pagination style="width: 100%;" page="1" page-size="10" total-items="100"></wc-pagination>
20
21
  * ```
21
22
  * @tags navigation, data
22
23
  */
@@ -47,6 +48,80 @@ export class Pagination extends LitElement {
47
48
  @property({ type: Array, attribute: 'page-sizes' })
48
49
  pageSizes: number[] = DEFAULT_PAGE_SIZES;
49
50
 
51
+ protected override willUpdate(
52
+ changedProperties: PropertyValues<Pagination>,
53
+ ): void {
54
+ // Normalize page-size options so the select always has valid numeric values.
55
+ const normalizedPageSizes = [...new Set(
56
+ this.pageSizes
57
+ .map(size => Number(size))
58
+ .filter(size => Number.isFinite(size) && size > 0)
59
+ .map(size => Math.trunc(size)),
60
+ )];
61
+
62
+ if (!normalizedPageSizes.length) {
63
+ normalizedPageSizes.push(...DEFAULT_PAGE_SIZES);
64
+ }
65
+
66
+ if (
67
+ changedProperties.has('pageSizes') &&
68
+ (this.pageSizes.length !== normalizedPageSizes.length ||
69
+ this.pageSizes.some((size, index) => size !== normalizedPageSizes[index]))
70
+ ) {
71
+ this.pageSizes = normalizedPageSizes;
72
+ }
73
+
74
+ if (!this.pageSizes.includes(this.pageSize)) {
75
+ this.pageSize = this.pageSizes[0] ?? DEFAULT_PAGE_SIZES[0];
76
+ }
77
+
78
+ if (!Number.isFinite(this.totalItems) || this.totalItems < 0) {
79
+ this.totalItems = 0;
80
+ }
81
+
82
+ if (!Number.isFinite(this.page) || this.page < 1) {
83
+ this.page = 1;
84
+ }
85
+
86
+ const maxPage = this.getTotalPages();
87
+ if (this.page > maxPage) {
88
+ this.page = maxPage;
89
+ }
90
+ }
91
+
92
+ private getTotalPages(): number {
93
+ if (this.totalItems <= 0) return 1;
94
+ return Math.max(1, Math.ceil(this.totalItems / this.pageSize));
95
+ }
96
+
97
+ private setPage(nextPage: number) {
98
+ const clampedPage = Math.min(Math.max(1, nextPage), this.getTotalPages());
99
+ if (clampedPage === this.page) return;
100
+ this.page = clampedPage;
101
+ this.dispatchPageEvent();
102
+ }
103
+
104
+ private handlePageSizeChange(event: CustomEvent<{ value?: string }>) {
105
+ const rawValue = event.detail?.value;
106
+ const parsedPageSize = Number.parseInt(rawValue ?? '', 10);
107
+
108
+ if (!Number.isFinite(parsedPageSize) || parsedPageSize <= 0) {
109
+ return;
110
+ }
111
+
112
+ this.pageSize = parsedPageSize;
113
+ this.page = 1;
114
+ this.dispatchPageEvent();
115
+ }
116
+
117
+ private handlePreviousPage = () => {
118
+ this.setPage(this.page - 1);
119
+ };
120
+
121
+ private handleNextPage = () => {
122
+ this.setPage(this.page + 1);
123
+ };
124
+
50
125
  private dispatchPageEvent() {
51
126
  this.dispatchEvent(
52
127
  new CustomEvent('page', {
@@ -58,76 +133,54 @@ export class Pagination extends LitElement {
58
133
  }
59
134
 
60
135
  render() {
61
- const startItem = this.pageSize * (this.page - 1);
136
+ const startItem = this.totalItems === 0 ? 0 : this.pageSize * (this.page - 1) + 1;
62
137
  const endItem = Math.min(this.pageSize * this.page, this.totalItems);
63
138
  const isFirstPage = this.page === 1;
64
139
  const isLastPage = this.pageSize * this.page >= this.totalItems;
65
140
 
66
141
  return html`
67
142
  <div class="pagination">
68
- <div class="page-sizes-select">
69
- <label class="page-size-label">
70
- Items per page:
71
- <select
72
- class="page-size-select"
73
- .value=${String(this.pageSize)}
74
- @change=${(e: Event) => {
75
- this.pageSize = parseInt(
76
- (e.target as HTMLSelectElement).value,
77
- 10,
78
- );
79
- this.page = 1;
80
- this.dispatchPageEvent();
81
- }}
82
- >
83
- ${this.pageSizes.map(
84
- size => html`
85
- <option value=${size} ?selected=${this.pageSize === size}>
86
- ${size}
87
- </option>
88
- `,
89
- )}
90
- </select>
91
- </label>
143
+ <div class="page-size">
144
+ <span class="page-size-label">Items per page:</span>
145
+ <wc-select
146
+ class="page-size-select"
147
+ .value=${String(this.pageSize)}
148
+ aria-label="Items per page"
149
+ @change=${this.handlePageSizeChange}
150
+ >
151
+ ${this.pageSizes.map(
152
+ size => html`<wc-option value=${String(size)}>${size}</wc-option>`,
153
+ )}
154
+ </wc-select>
92
155
  </div>
156
+
93
157
  <div class="pagination-item-count">
94
158
  <span class="pagination-text">
95
- ${startItem} - ${endItem} of ${this.totalItems} items
159
+ ${startItem} - ${endItem} of ${this.totalItems}
96
160
  </span>
97
161
  </div>
98
- <div class="pagination-right">
99
- <div class="table-footer-right-content">
100
- <div class="table-footer-right-content-pagination">
101
- <wc-button
102
- class="arrows"
103
- color="secondary"
104
- variant="text"
105
- ?disabled=${isFirstPage}
106
- @click=${() => {
107
- if (!isFirstPage) {
108
- this.page -= 1;
109
- this.dispatchPageEvent();
110
- }
111
- }}
112
- >
113
- <wc-icon slot="icon" name="arrow--left"></wc-icon>
114
- </wc-button>
115
- <wc-button
116
- color="secondary"
117
- variant="text"
118
- class="arrows"
119
- ?disabled=${isLastPage}
120
- @click=${() => {
121
- if (!isLastPage) {
122
- this.page += 1;
123
- this.dispatchPageEvent();
124
- }
125
- }}
126
- >
127
- <wc-icon slot="icon" name="arrow--right"></wc-icon>
128
- </wc-button>
129
- </div>
130
- </div>
162
+
163
+ <div class="pagination-actions">
164
+ <wc-icon-button
165
+ class="nav-button"
166
+ color="secondary"
167
+ variant="text"
168
+ size="sm"
169
+ name="keyboard_arrow_left"
170
+ title="Previous page"
171
+ ?disabled=${isFirstPage}
172
+ @click=${this.handlePreviousPage}
173
+ ></wc-icon-button>
174
+ <wc-icon-button
175
+ class="nav-button"
176
+ color="secondary"
177
+ variant="text"
178
+ size="sm"
179
+ name="keyboard_arrow_right"
180
+ title="Next page"
181
+ ?disabled=${isLastPage}
182
+ @click=${this.handleNextPage}
183
+ ></wc-icon-button>
131
184
  </div>
132
185
  </div>
133
186
  `;
@@ -11,6 +11,9 @@ import { Divider } from './divider/divider.js';
11
11
  import { Button } from './button/button/button.js';
12
12
  import { ButtonGroup } from './button/button-group/button-group.js';
13
13
  import { IconButton } from './button/icon-button/icon-button.js';
14
+ import { Fab } from './fab/fab.js';
15
+ import { SegmentedButton } from './segmented-button/segmented-button.js';
16
+ import { SegmentedButtonGroup } from './segmented-button/segmented-button-group.js';
14
17
  import { Input } from './input/input.js';
15
18
  import { Field } from './field/field.js';
16
19
  import { NumberField } from './number-field/number-field.js';
@@ -53,7 +56,16 @@ import { Table } from './table/table.js';
53
56
  import { Pagination } from './pagination/pagination.js';
54
57
  import { TreeView } from './tree-view/tree-view.js';
55
58
  import { Card } from './card/card.js';
59
+ import { CardContent } from './card/card-content.js';
60
+ import { Banner } from './banner/banner.js';
61
+ import { Notification } from './notification/notification.js';
56
62
  import { Snackbar } from './snackbar/snackbar.js';
63
+ import { BottomSheet } from './bottom-sheet/bottom-sheet.js';
64
+ import { SideSheet } from './side-sheet/side-sheet.js';
65
+ import { Select } from './select/select.js';
66
+ import { SelectOptionElement } from './select/option.js';
67
+ import { Search } from './search/search.js';
68
+ import { Toolbar } from './toolbar/toolbar.js';
57
69
 
58
70
  const distDirectory = `${import.meta.url}/..`;
59
71
  await loadCSS(`${distDirectory}/assets/styles.css`);
@@ -99,9 +111,18 @@ const loaderConfig: LoaderConfig = {
99
111
  'wc-icon-button': {
100
112
  CustomElementClass: IconButton,
101
113
  },
114
+ 'wc-fab': {
115
+ CustomElementClass: Fab,
116
+ },
102
117
  'wc-button-group': {
103
118
  CustomElementClass: ButtonGroup,
104
119
  },
120
+ 'wc-segmented-button': {
121
+ CustomElementClass: SegmentedButton,
122
+ },
123
+ 'wc-segmented-button-group': {
124
+ CustomElementClass: SegmentedButtonGroup,
125
+ },
105
126
  'wc-divider': {
106
127
  CustomElementClass: Divider,
107
128
  },
@@ -141,6 +162,15 @@ const loaderConfig: LoaderConfig = {
141
162
  'wc-card': {
142
163
  CustomElementClass: Card,
143
164
  },
165
+ 'wc-card-content': {
166
+ CustomElementClass: CardContent,
167
+ },
168
+ 'wc-banner': {
169
+ CustomElementClass: Banner,
170
+ },
171
+ 'wc-notification': {
172
+ CustomElementClass: Notification,
173
+ },
144
174
  'wc-tag': {
145
175
  CustomElementClass: Tag,
146
176
  },
@@ -238,6 +268,24 @@ const loaderConfig: LoaderConfig = {
238
268
  'wc-snackbar': {
239
269
  CustomElementClass: Snackbar,
240
270
  },
271
+ 'wc-bottom-sheet': {
272
+ CustomElementClass: BottomSheet,
273
+ },
274
+ 'wc-side-sheet': {
275
+ CustomElementClass: SideSheet,
276
+ },
277
+ 'wc-select': {
278
+ CustomElementClass: Select,
279
+ },
280
+ 'wc-option': {
281
+ CustomElementClass: SelectOptionElement,
282
+ },
283
+ 'wc-search': {
284
+ CustomElementClass: Search,
285
+ },
286
+ 'wc-toolbar': {
287
+ CustomElementClass: Toolbar,
288
+ },
241
289
  'wc-chart-doughnut': {
242
290
  importPath: `${distDirectory}/chart-doughnut.js`,
243
291
  },
@@ -1,7 +1,9 @@
1
1
  import { html, LitElement } 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
+
5
+ import { spread } from '@/__directive/spread.js';
6
+
5
7
  import styles from './radio.scss';
6
8
 
7
9
  /**
@@ -91,10 +91,26 @@ const FORCED_COLORS = window.matchMedia('(forced-colors: active)');
91
91
  *
92
92
  * @example
93
93
  * ```html
94
- * <button style="position: relative;">
94
+ * <style>
95
+ * .ripple-surface {
96
+ * position: relative;
97
+ * display: inline-flex;
98
+ * align-items: center;
99
+ * justify-content: center;
100
+ * width: 220px;
101
+ * height: 64px;
102
+ * border-radius: 12px;
103
+ * background: var(--color-surface-container-high);
104
+ * color: var(--color-on-surface);
105
+ * overflow: hidden;
106
+ * cursor: pointer;
107
+ * user-select: none;
108
+ * }
109
+ * </style>
110
+ * <div class="ripple-surface">
95
111
  * <wc-ripple></wc-ripple>
96
- * Click me
97
- * </button>
112
+ * Ripple Effect
113
+ * </div>
98
114
  * ```
99
115
  * @tags display
100
116
  */
@@ -0,0 +1 @@
1
+ export { Search } from './search.js';
@@ -0,0 +1,14 @@
1
+ :host {
2
+ /* Filled variant tokens */
3
+ --search-container-color: var(--color-surface-container-high);
4
+ --search-input-text-color: var(--color-on-surface);
5
+ --search-placeholder-color: var(--color-on-surface-variant);
6
+ --search-icon-color: var(--color-on-surface-variant);
7
+
8
+ /* Outlined variant tokens */
9
+ --search-outlined-container-color: var(--color-surface);
10
+ --search-outlined-input-text-color: var(--color-on-surface);
11
+ --search-outlined-placeholder-color: var(--color-on-surface-variant);
12
+ --search-outlined-icon-color: var(--color-on-surface-variant);
13
+ --search-outline-color: var(--color-outline);
14
+ }
@@ -0,0 +1,204 @@
1
+ @use '../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ --search-container-shape: var(--shape-corner-full);
8
+ --search-container-shape-start-start: unset;
9
+ --search-container-shape-start-end: unset;
10
+ --search-container-shape-end-start: unset;
11
+ --search-container-shape-end-end: unset;
12
+ }
13
+
14
+ .search {
15
+ position: relative;
16
+ display: flex;
17
+ align-items: center;
18
+ width: 100%;
19
+ gap: 0.25rem;
20
+
21
+ --_container-shape-start-start: var(--search-container-shape-start-start, var(--search-container-shape));
22
+ --_container-shape-start-end: var(--search-container-shape-start-end, var(--search-container-shape));
23
+ --_container-shape-end-start: var(--search-container-shape-end-start, var(--search-container-shape));
24
+ --_container-shape-end-end: var(--search-container-shape-end-end, var(--search-container-shape));
25
+
26
+ border-start-start-radius: var(--_container-shape-start-start);
27
+ border-start-end-radius: var(--_container-shape-start-end);
28
+ border-end-start-radius: var(--_container-shape-end-start);
29
+ border-end-end-radius: var(--_container-shape-end-end);
30
+
31
+ padding-inline: 1rem;
32
+
33
+ /* size-md default */
34
+ --_height: 3.5rem;
35
+
36
+ &.size-sm {
37
+ --_height: 2.5rem;
38
+ padding-inline: 0.75rem;
39
+ }
40
+
41
+ &.size-lg {
42
+ --_height: 4rem;
43
+ padding-inline: 1.25rem;
44
+ }
45
+
46
+ min-height: var(--_height);
47
+ }
48
+
49
+ /* Background layer */
50
+ .background {
51
+ position: absolute;
52
+ inset: 0;
53
+ background-color: var(--_container-color);
54
+ border-start-start-radius: var(--_container-shape-start-start);
55
+ border-start-end-radius: var(--_container-shape-start-end);
56
+ border-end-start-radius: var(--_container-shape-end-start);
57
+ border-end-end-radius: var(--_container-shape-end-end);
58
+ pointer-events: none;
59
+ z-index: 0;
60
+ }
61
+
62
+ /* Outline layer (outlined variant) */
63
+ .outline {
64
+ display: none;
65
+ position: absolute;
66
+ inset: 0;
67
+ border: var(--_outline-width, 0.0675rem) solid var(--_outline-color);
68
+ border-start-start-radius: var(--_container-shape-start-start);
69
+ border-start-end-radius: var(--_container-shape-start-end);
70
+ border-end-start-radius: var(--_container-shape-end-start);
71
+ border-end-end-radius: var(--_container-shape-end-end);
72
+ pointer-events: none;
73
+ z-index: 1;
74
+ }
75
+
76
+ /* Input element */
77
+ .search-input {
78
+ flex: 1;
79
+ min-width: 0;
80
+ background: transparent;
81
+ border: none;
82
+ outline: none;
83
+ padding: 0;
84
+ margin: 0;
85
+ z-index: 1;
86
+ position: relative;
87
+ color: var(--_input-text-color);
88
+ caret-color: var(--_caret-color, var(--color-primary));
89
+
90
+ @include mixin.get-typography-not-important(body-large);
91
+
92
+ &::placeholder {
93
+ color: var(--_placeholder-color);
94
+ }
95
+
96
+ /* Remove browser default search input styling */
97
+ &::-webkit-search-cancel-button,
98
+ &::-webkit-search-decoration {
99
+ appearance: none;
100
+ display: none;
101
+ }
102
+ }
103
+
104
+ /* Leading icon area */
105
+ .leading-icon {
106
+ display: flex;
107
+ align-items: center;
108
+ flex-shrink: 0;
109
+ z-index: 1;
110
+ position: relative;
111
+ color: var(--_icon-color);
112
+ --icon-color: var(--_icon-color);
113
+ margin-inline-end: 0.5rem;
114
+ }
115
+
116
+ /* Trailing actions area (clear button + trailing slot) */
117
+ .trailing-actions {
118
+ display: flex;
119
+ align-items: center;
120
+ gap: 0.25rem;
121
+ flex-shrink: 0;
122
+ z-index: 1;
123
+ position: relative;
124
+ color: var(--_icon-color);
125
+ --icon-color: var(--_icon-color);
126
+ }
127
+
128
+ /* Clear button */
129
+ .clear-button {
130
+ display: flex;
131
+ align-items: center;
132
+ justify-content: center;
133
+ background: transparent;
134
+ border: none;
135
+ cursor: pointer;
136
+ padding: 0.25rem;
137
+ border-radius: 50%;
138
+ color: var(--_icon-color);
139
+ --icon-color: var(--_icon-color);
140
+ outline: none;
141
+ transition: background-color 150ms;
142
+
143
+ &:hover:not([disabled]) {
144
+ background-color: color-mix(in srgb, var(--_icon-color) 8%, transparent);
145
+ }
146
+
147
+ &:focus-visible {
148
+ outline: 2px solid var(--color-primary);
149
+ outline-offset: 1px;
150
+ }
151
+
152
+ &[disabled] {
153
+ cursor: default;
154
+ opacity: 0.38;
155
+ pointer-events: none;
156
+ }
157
+ }
158
+
159
+ /* ---- Variants ---- */
160
+
161
+ .search.variant-filled {
162
+ --_container-color: var(--search-container-color);
163
+ --_input-text-color: var(--search-input-text-color);
164
+ --_placeholder-color: var(--search-placeholder-color);
165
+ --_icon-color: var(--search-icon-color);
166
+
167
+ &.focused {
168
+ --_outline-color: var(--color-primary);
169
+ .outline {
170
+ display: block;
171
+ border-width: 2px;
172
+ }
173
+ }
174
+ }
175
+
176
+ .search.variant-outlined {
177
+ --_container-color: var(--search-outlined-container-color);
178
+ --_input-text-color: var(--search-outlined-input-text-color);
179
+ --_placeholder-color: var(--search-outlined-placeholder-color);
180
+ --_icon-color: var(--search-outlined-icon-color);
181
+ --_outline-color: var(--search-outline-color);
182
+
183
+ .outline {
184
+ display: block;
185
+ }
186
+
187
+ &.focused {
188
+ --_outline-color: var(--color-primary);
189
+ .outline {
190
+ border-width: 2px;
191
+ }
192
+ }
193
+ }
194
+
195
+ /* ---- Disabled state ---- */
196
+
197
+ .search.disabled {
198
+ pointer-events: none;
199
+ opacity: 0.38;
200
+
201
+ .search-input {
202
+ cursor: not-allowed;
203
+ }
204
+ }