@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.
- package/dist/BaseButton-DuASuVth.js +219 -0
- package/dist/BaseButton-DuASuVth.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +187 -0
- package/dist/banner.js.map +1 -0
- package/dist/bottom-sheet.js +2 -2
- package/dist/{button-COYCtuA8.js → button-DouvOfEU.js} +92 -283
- package/dist/button-DouvOfEU.js.map +1 -0
- package/dist/{button-group-DsXquZQn.js → button-group-CEdMwvJJ.js} +72 -48
- package/dist/button-group-CEdMwvJJ.js.map +1 -0
- package/dist/button-group.js +8 -5
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +7 -4
- package/dist/button.js.map +1 -1
- package/dist/card.js +29 -74
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js +2 -2
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js +2 -2
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/{class-map-3TAnCMAX.js → class-map-YU7g0o3B.js} +2 -2
- package/dist/{class-map-3TAnCMAX.js.map → class-map-YU7g0o3B.js.map} +1 -1
- package/dist/clock.js.map +1 -1
- package/dist/code-editor.js +4 -4
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +5 -4
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +6627 -3477
- package/dist/custom-elements.json +10954 -7810
- package/dist/directive-ZPhl09Yt.js +9 -0
- package/dist/directive-ZPhl09Yt.js.map +1 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js +127 -0
- package/dist/dispatch-event-utils-CuEqjlPT.js.map +1 -0
- package/dist/fab.js +423 -0
- package/dist/fab.js.map +1 -0
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{observe-theme-change-DKAIv5BB.js → is-dark-mode-DicqGkCJ.js} +6 -2
- package/dist/is-dark-mode-DicqGkCJ.js.map +1 -0
- package/dist/{select-C3XAzenC.js → navigation-rail-Lxetd5-Z.js} +2426 -898
- package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
- package/dist/notification.js +418 -0
- package/dist/notification.js.map +1 -0
- package/dist/number-counter.js +2 -2
- package/dist/number-counter.js.map +1 -1
- package/dist/observe-slot-change-BGJfgg2E.js +31 -0
- package/dist/observe-slot-change-BGJfgg2E.js.map +1 -0
- package/dist/peacock-loader.js +48 -13
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +456 -0
- package/dist/search.js.map +1 -0
- package/dist/side-sheet.js +2 -2
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/__utils/cache-fetch.d.ts +1 -0
- package/dist/src/__utils/is-dark-mode.d.ts +1 -0
- package/dist/src/__utils/is-in-viewport.d.ts +1 -0
- package/dist/src/__utils/observe-slot-change.d.ts +1 -0
- package/dist/src/__utils/sanitize-svg.d.ts +1 -0
- package/dist/src/__utils/throttle.d.ts +4 -0
- package/dist/src/accordion/accordion-item.d.ts +33 -9
- package/dist/src/accordion/accordion.d.ts +21 -5
- package/dist/src/banner/banner.d.ts +43 -0
- package/dist/src/banner/index.d.ts +1 -0
- package/dist/src/button/BaseButton.d.ts +7 -57
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +4 -4
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/empty-state/empty-state.d.ts +1 -1
- package/dist/src/fab/fab.d.ts +80 -0
- package/dist/src/fab/index.d.ts +1 -0
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/index.d.ts +8 -1
- package/dist/src/link/link.d.ts +3 -10
- package/dist/src/menu/menu/menu.d.ts +3 -2
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/notification/index.d.ts +1 -0
- package/dist/src/notification/notification.d.ts +69 -0
- package/dist/src/pagination/pagination.d.ts +8 -1
- package/dist/src/search/index.d.ts +1 -0
- package/dist/src/search/search.d.ts +76 -0
- package/dist/src/select/select.d.ts +3 -5
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/slider/slider.d.ts +4 -0
- package/dist/src/snackbar/snackbar.d.ts +14 -1
- package/dist/src/toolbar/index.d.ts +1 -0
- package/dist/src/toolbar/toolbar.d.ts +86 -0
- package/dist/src/tooltip/tooltip.d.ts +3 -0
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/{style-map-CRFEoCEg.js → style-map-DVmWOuYy.js} +2 -2
- package/dist/{style-map-CRFEoCEg.js.map → style-map-DVmWOuYy.js.map} +1 -1
- package/dist/test/banner.test.d.ts +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/test/toolbar.test.d.ts +1 -0
- package/dist/toolbar.js +306 -0
- package/dist/toolbar.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{unsafe-html-D3GHRaGQ.js → unsafe-html-BsGUjx94.js} +2 -2
- package/dist/{unsafe-html-D3GHRaGQ.js.map → unsafe-html-BsGUjx94.js.map} +1 -1
- package/package.json +1 -1
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/scss/styles.scss +4 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/__mixins/README.md +19 -0
- package/src/__utils/cache-fetch.ts +65 -0
- package/src/__utils/is-dark-mode.ts +3 -0
- package/src/__utils/is-in-viewport.ts +6 -0
- package/src/__utils/observe-slot-change.ts +38 -0
- package/src/__utils/sanitize-svg.ts +27 -0
- package/src/__utils/throttle.ts +27 -0
- package/src/accordion/accordion-item.scss +136 -65
- package/src/accordion/accordion-item.ts +117 -44
- package/src/accordion/accordion.scss +24 -5
- package/src/accordion/accordion.ts +29 -23
- package/src/accordion/demo/index.html +74 -35
- package/src/banner/banner.scss +83 -0
- package/src/banner/banner.ts +101 -0
- package/src/banner/index.ts +1 -0
- package/src/button/BaseButton.ts +13 -115
- package/src/button/button/button-colors.scss +14 -14
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +80 -26
- package/src/button/button-group/button-group.ts +5 -5
- package/src/button/icon-button/icon-button.ts +79 -44
- package/src/card/card.ts +50 -100
- package/src/chart-bar/chart-bar.ts +10 -15
- package/src/chart-bar/chart-stacked-bar.ts +15 -19
- package/src/chart-doughnut/chart-doughnut.ts +24 -28
- package/src/chart-pie/chart-pie.ts +20 -24
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +4 -2
- package/src/clock/clock.ts +1 -1
- package/src/code-editor/code-editor.ts +4 -4
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +3 -3
- package/src/date-picker/date-picker.ts +6 -3
- package/src/divider/divider.ts +3 -1
- package/src/elevation/elevation.scss +5 -5
- package/src/empty-state/empty-state.scss +7 -9
- package/src/empty-state/empty-state.ts +1 -1
- package/src/fab/fab-colors.scss +49 -0
- package/src/fab/fab-sizes.scss +47 -0
- package/src/fab/fab.scss +137 -0
- package/src/fab/fab.ts +214 -0
- package/src/fab/index.ts +1 -0
- package/src/field/field.ts +3 -1
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/icon/datasource.ts +1 -1
- package/src/icon/icon.ts +3 -1
- package/src/image/image.ts +3 -2
- package/src/index.ts +8 -1
- package/src/input/input.ts +8 -3
- package/src/link/link.ts +2 -15
- package/src/menu/menu/menu.scss +7 -0
- package/src/menu/menu/menu.ts +7 -4
- package/src/menu/menu-item/menu-item.ts +3 -1
- package/src/menu/sub-menu/sub-menu.ts +1 -0
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/index.ts +1 -0
- package/src/notification/notification.scss +201 -0
- package/src/notification/notification.ts +207 -0
- package/src/number-counter/number-counter.ts +3 -1
- package/src/number-field/number-field.ts +10 -6
- package/src/pagination/pagination.scss +33 -24
- package/src/pagination/pagination.ts +115 -60
- package/src/peacock-loader.ts +42 -5
- package/src/radio/radio.ts +3 -1
- package/src/search/index.ts +1 -0
- package/src/search/search-colors.scss +14 -0
- package/src/search/search.scss +204 -0
- package/src/search/search.ts +244 -0
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +5 -0
- package/src/select/select.ts +71 -37
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/slider/slider.scss +19 -0
- package/src/slider/slider.ts +30 -19
- package/src/snackbar/snackbar.scss +62 -31
- package/src/snackbar/snackbar.ts +91 -11
- package/src/switch/switch.ts +3 -1
- package/src/table/table.ts +3 -1
- package/src/tabs/tab.ts +10 -6
- package/src/text/text.css-component.scss +7 -1
- package/src/textarea/textarea.ts +4 -2
- package/src/time-picker/time-picker.ts +5 -3
- package/src/toolbar/index.ts +1 -0
- package/src/toolbar/toolbar-colors.scss +16 -0
- package/src/toolbar/toolbar.scss +165 -0
- package/src/toolbar/toolbar.ts +137 -0
- package/src/tooltip/tooltip.ts +24 -0
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-COYCtuA8.js.map +0 -1
- package/dist/button-group-DsXquZQn.js.map +0 -1
- package/dist/directive-Cuw6h7YA.js +0 -9
- package/dist/directive-Cuw6h7YA.js.map +0 -1
- package/dist/dispatch-event-utils-B4odODQf.js +0 -277
- package/dist/dispatch-event-utils-B4odODQf.js.map +0 -1
- package/dist/observe-theme-change-DKAIv5BB.js.map +0 -1
- package/dist/select-C3XAzenC.js.map +0 -1
- package/dist/src/styleMixins.css.d.ts +0 -9
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/src/utils.d.ts +0 -9
- package/dist/test/tree-view.test.d.ts +0 -1
- package/src/styleMixins.css.ts +0 -55
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
- package/src/utils.ts +0 -193
- /package/dist/src/{spread.d.ts → __directive/spread.d.ts} +0 -0
- /package/dist/src/{utils → __utils}/copy-to-clipboard.d.ts +0 -0
- /package/dist/src/{utils → __utils}/dispatch-event-utils.d.ts +0 -0
- /package/dist/src/{utils → __utils}/observe-theme-change.d.ts +0 -0
- /package/src/{spread.ts → __directive/spread.ts} +0 -0
- /package/src/{utils → __utils}/copy-to-clipboard.ts +0 -0
- /package/src/{utils → __utils}/dispatch-event-utils.ts +0 -0
- /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
|
-
|
|
15
|
-
|
|
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
|
|
19
|
-
display: flex;
|
|
23
|
+
.page-size {
|
|
24
|
+
display: inline-flex;
|
|
20
25
|
align-items: center;
|
|
21
26
|
gap: var(--spacing-100, 0.5rem);
|
|
22
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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:
|
|
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
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
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,56 @@ 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-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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}
|
|
159
|
+
${startItem} - ${endItem} of ${this.totalItems}
|
|
96
160
|
</span>
|
|
97
161
|
</div>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
title="Previous page"
|
|
170
|
+
?disabled=${isFirstPage}
|
|
171
|
+
@click=${this.handlePreviousPage}
|
|
172
|
+
>
|
|
173
|
+
<wc-icon name="keyboard_arrow_left"></wc-icon>
|
|
174
|
+
</wc-icon-button>
|
|
175
|
+
<wc-icon-button
|
|
176
|
+
class="nav-button"
|
|
177
|
+
color="secondary"
|
|
178
|
+
variant="text"
|
|
179
|
+
size="sm"
|
|
180
|
+
title="Next page"
|
|
181
|
+
?disabled=${isLastPage}
|
|
182
|
+
@click=${this.handleNextPage}
|
|
183
|
+
>
|
|
184
|
+
<wc-icon name="keyboard_arrow_right"></wc-icon>
|
|
185
|
+
</wc-icon-button>
|
|
131
186
|
</div>
|
|
132
187
|
</div>
|
|
133
188
|
`;
|
package/src/peacock-loader.ts
CHANGED
|
@@ -11,9 +11,11 @@ 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';
|
|
14
15
|
import { SegmentedButton } from './segmented-button/segmented-button.js';
|
|
15
16
|
import { SegmentedButtonGroup } from './segmented-button/segmented-button-group.js';
|
|
16
17
|
import { Input } from './input/input.js';
|
|
18
|
+
import { UrlField } from './url-field/url-field.js';
|
|
17
19
|
import { Field } from './field/field.js';
|
|
18
20
|
import { NumberField } from './number-field/number-field.js';
|
|
19
21
|
import { DatePicker } from './date-picker/date-picker.js';
|
|
@@ -53,14 +55,22 @@ import { TabPanel } from './tabs/tab-panel.js';
|
|
|
53
55
|
import { Slider } from './slider/slider.js';
|
|
54
56
|
import { Table } from './table/table.js';
|
|
55
57
|
import { Pagination } from './pagination/pagination.js';
|
|
56
|
-
import {
|
|
58
|
+
import { SidebarMenu } from './sidebar-menu/sidebar-menu.js';
|
|
59
|
+
import { SidebarMenuItem } from './sidebar-menu/sidebar-menu-item.js';
|
|
60
|
+
import { SidebarSubMenu } from './sidebar-menu/sidebar-sub-menu.js';
|
|
57
61
|
import { Card } from './card/card.js';
|
|
58
62
|
import { CardContent } from './card/card-content.js';
|
|
63
|
+
import { Banner } from './banner/banner.js';
|
|
64
|
+
import { Notification } from './notification/notification.js';
|
|
59
65
|
import { Snackbar } from './snackbar/snackbar.js';
|
|
60
66
|
import { BottomSheet } from './bottom-sheet/bottom-sheet.js';
|
|
61
67
|
import { SideSheet } from './side-sheet/side-sheet.js';
|
|
62
68
|
import { Select } from './select/select.js';
|
|
63
69
|
import { SelectOptionElement } from './select/option.js';
|
|
70
|
+
import { Search } from './search/search.js';
|
|
71
|
+
import { Toolbar } from './toolbar/toolbar.js';
|
|
72
|
+
import { NavigationRail } from './navigation-rail/navigation-rail.js';
|
|
73
|
+
import { NavigationRailItem } from './navigation-rail/navigation-rail-item.js';
|
|
64
74
|
|
|
65
75
|
const distDirectory = `${import.meta.url}/..`;
|
|
66
76
|
await loadCSS(`${distDirectory}/assets/styles.css`);
|
|
@@ -106,6 +116,9 @@ const loaderConfig: LoaderConfig = {
|
|
|
106
116
|
'wc-icon-button': {
|
|
107
117
|
CustomElementClass: IconButton,
|
|
108
118
|
},
|
|
119
|
+
'wc-fab': {
|
|
120
|
+
CustomElementClass: Fab,
|
|
121
|
+
},
|
|
109
122
|
'wc-button-group': {
|
|
110
123
|
CustomElementClass: ButtonGroup,
|
|
111
124
|
},
|
|
@@ -157,6 +170,12 @@ const loaderConfig: LoaderConfig = {
|
|
|
157
170
|
'wc-card-content': {
|
|
158
171
|
CustomElementClass: CardContent,
|
|
159
172
|
},
|
|
173
|
+
'wc-banner': {
|
|
174
|
+
CustomElementClass: Banner,
|
|
175
|
+
},
|
|
176
|
+
'wc-notification': {
|
|
177
|
+
CustomElementClass: Notification,
|
|
178
|
+
},
|
|
160
179
|
'wc-tag': {
|
|
161
180
|
CustomElementClass: Tag,
|
|
162
181
|
},
|
|
@@ -176,6 +195,9 @@ const loaderConfig: LoaderConfig = {
|
|
|
176
195
|
'wc-input': {
|
|
177
196
|
CustomElementClass: Input,
|
|
178
197
|
},
|
|
198
|
+
'wc-url-field': {
|
|
199
|
+
CustomElementClass: UrlField,
|
|
200
|
+
},
|
|
179
201
|
'wc-number-field': {
|
|
180
202
|
CustomElementClass: NumberField,
|
|
181
203
|
},
|
|
@@ -245,11 +267,14 @@ const loaderConfig: LoaderConfig = {
|
|
|
245
267
|
'wc-pagination': {
|
|
246
268
|
CustomElementClass: Pagination,
|
|
247
269
|
},
|
|
248
|
-
'wc-
|
|
249
|
-
CustomElementClass:
|
|
270
|
+
'wc-sidebar-menu': {
|
|
271
|
+
CustomElementClass: SidebarMenu,
|
|
272
|
+
},
|
|
273
|
+
'wc-sidebar-menu-item': {
|
|
274
|
+
CustomElementClass: SidebarMenuItem,
|
|
250
275
|
},
|
|
251
|
-
'wc-
|
|
252
|
-
CustomElementClass:
|
|
276
|
+
'wc-sidebar-sub-menu': {
|
|
277
|
+
CustomElementClass: SidebarSubMenu,
|
|
253
278
|
},
|
|
254
279
|
'wc-snackbar': {
|
|
255
280
|
CustomElementClass: Snackbar,
|
|
@@ -266,6 +291,18 @@ const loaderConfig: LoaderConfig = {
|
|
|
266
291
|
'wc-option': {
|
|
267
292
|
CustomElementClass: SelectOptionElement,
|
|
268
293
|
},
|
|
294
|
+
'wc-search': {
|
|
295
|
+
CustomElementClass: Search,
|
|
296
|
+
},
|
|
297
|
+
'wc-toolbar': {
|
|
298
|
+
CustomElementClass: Toolbar,
|
|
299
|
+
},
|
|
300
|
+
'wc-navigation-rail': {
|
|
301
|
+
CustomElementClass: NavigationRail,
|
|
302
|
+
},
|
|
303
|
+
'wc-navigation-rail-item': {
|
|
304
|
+
CustomElementClass: NavigationRailItem,
|
|
305
|
+
},
|
|
269
306
|
'wc-chart-doughnut': {
|
|
270
307
|
importPath: `${distDirectory}/chart-doughnut.js`,
|
|
271
308
|
},
|
package/src/radio/radio.ts
CHANGED
|
@@ -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
|
-
|
|
4
|
+
|
|
5
|
+
import { spread } from '@/__directive/spread.js';
|
|
6
|
+
|
|
5
7
|
import styles from './radio.scss';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -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
|
+
}
|