crdx-components 1.0.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.
- package/.github/workflows/publish.yml +38 -0
- package/bun.lock +491 -0
- package/crdx-components-1.0.0.tgz +0 -0
- package/crdx-components-tokenized-components-1.0.1.tgz +0 -0
- package/ng-package.json +12 -0
- package/npm +0 -0
- package/package.json +33 -0
- package/src/index.ts +45 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.css +206 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +15 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +47 -0
- package/src/lib/components/button/button.css +371 -0
- package/src/lib/components/button/button.html +187 -0
- package/src/lib/components/button/button.ts +103 -0
- package/src/lib/components/card/card.css +285 -0
- package/src/lib/components/card/card.html +69 -0
- package/src/lib/components/card/card.ts +93 -0
- package/src/lib/components/checkbox/checkbox-showcase.component.css +42 -0
- package/src/lib/components/checkbox/checkbox-showcase.component.html +36 -0
- package/src/lib/components/checkbox/checkbox-showcase.component.ts +13 -0
- package/src/lib/components/checkbox/checkbox.css +10 -0
- package/src/lib/components/checkbox/checkbox.html +13 -0
- package/src/lib/components/checkbox/checkbox.ts +64 -0
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.css +89 -0
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.html +23 -0
- package/src/lib/components/circular-progress-stepper/circular-progress-stepper.ts +40 -0
- package/src/lib/components/dialogs/alert-modal/alert-modal.css +118 -0
- package/src/lib/components/dialogs/alert-modal/alert-modal.html +29 -0
- package/src/lib/components/dialogs/alert-modal/alert-modal.ts +28 -0
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.css +219 -0
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.html +60 -0
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.store.ts +139 -0
- package/src/lib/components/dialogs/confirm-modal/confirm-modal.ts +63 -0
- package/src/lib/components/dialogs/container-custom/container-custom.css +11 -0
- package/src/lib/components/dialogs/container-custom/container-custom.html +3 -0
- package/src/lib/components/dialogs/container-custom/container-custom.ts +37 -0
- package/src/lib/components/dialogs/container-custom/custom-modal.state.ts +57 -0
- package/src/lib/components/dialogs/error-modal/error-modal.css +53 -0
- package/src/lib/components/dialogs/error-modal/error-modal.html +17 -0
- package/src/lib/components/dialogs/error-modal/error-modal.ts +20 -0
- package/src/lib/components/dialogs/side-modal/side-modal.css +80 -0
- package/src/lib/components/dialogs/side-modal/side-modal.html +30 -0
- package/src/lib/components/dialogs/side-modal/side-modal.state.ts +78 -0
- package/src/lib/components/dialogs/side-modal/side-modal.ts +50 -0
- package/src/lib/components/divider/divider.css +24 -0
- package/src/lib/components/divider/divider.html +7 -0
- package/src/lib/components/divider/divider.ts +13 -0
- package/src/lib/components/footer-actions/footer/footer-flow.store.ts +30 -0
- package/src/lib/components/footer-actions/footer/footer.html +14 -0
- package/src/lib/components/footer-actions/footer/footer.ts +50 -0
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.css +44 -0
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.html +7 -0
- package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.ts +12 -0
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.css +31 -0
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.html +7 -0
- package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.ts +12 -0
- package/src/lib/components/form-field/select-field.css +178 -0
- package/src/lib/components/form-field/select-field.html +94 -0
- package/src/lib/components/form-field/select-field.ts +324 -0
- package/src/lib/components/form-field/text-field.css +41 -0
- package/src/lib/components/form-field/text-field.html +38 -0
- package/src/lib/components/form-field/text-field.ts +102 -0
- package/src/lib/components/header/header.css +142 -0
- package/src/lib/components/header/header.html +36 -0
- package/src/lib/components/header/header.ts +101 -0
- package/src/lib/components/icon-button/icon-button.css +445 -0
- package/src/lib/components/icon-button/icon-button.html +15 -0
- package/src/lib/components/icon-button/icon-button.ts +49 -0
- package/src/lib/components/list-item/list-item.css +122 -0
- package/src/lib/components/list-item/list-item.html +79 -0
- package/src/lib/components/list-item/list-item.ts +104 -0
- package/src/lib/components/menu/menu.css +39 -0
- package/src/lib/components/menu/menu.html +57 -0
- package/src/lib/components/menu/menu.ts +159 -0
- package/src/lib/components/shared-table/shared-table-cell-template.directive.ts +25 -0
- package/src/lib/components/shared-table/shared-table.component.css +223 -0
- package/src/lib/components/shared-table/shared-table.component.html +96 -0
- package/src/lib/components/shared-table/shared-table.component.ts +172 -0
- package/src/lib/components/sidebar/sidebar.css +234 -0
- package/src/lib/components/sidebar/sidebar.html +67 -0
- package/src/lib/components/sidebar/sidebar.ts +92 -0
- package/src/lib/components/slide-toggle/slide-toggle.css +0 -0
- package/src/lib/components/slide-toggle/slide-toggle.html +3 -0
- package/src/lib/components/slide-toggle/slide-toggle.ts +18 -0
- package/src/lib/components/spinner/spinner.css +9 -0
- package/src/lib/components/spinner/spinner.html +9 -0
- package/src/lib/components/spinner/spinner.ts +17 -0
- package/src/lib/components/tooltip/tooltip.css +32 -0
- package/src/lib/components/tooltip/tooltip.html +3 -0
- package/src/lib/components/tooltip/tooltip.ts +31 -0
- package/src/lib/icons/configuration-countable.svg +8 -0
- package/src/lib/icons/edit-table.svg +3 -0
- package/src/lib/icons/edit.svg +3 -0
- package/src/lib/icons/error-circle.svg +8 -0
- package/src/lib/icons/hub.svg +3 -0
- package/src/lib/icons/icon-menu.svg +8 -0
- package/src/lib/icons/info-error.svg +8 -0
- package/src/lib/icons/keyboard_arrow_down.svg +1 -0
- package/src/lib/icons/logo.svg +0 -0
- package/src/lib/icons/logout.svg +0 -0
- package/src/lib/icons/notifications.svg +0 -0
- package/src/lib/icons/profile-user-menu.svg +0 -0
- package/src/lib/icons/profile.svg +0 -0
- package/src/lib/icons/register-icons.ts +101 -0
- package/src/lib/icons/visibility.svg +0 -0
- package/src/lib/lib-ui/lib-ui.html +1 -0
- package/src/lib/lib-ui/lib-ui.scss +0 -0
- package/src/lib/lib-ui/lib-ui.ts +9 -0
- package/src/lib/styles/generated/_app-tokens.scss +2757 -0
- package/src/lib/styles/generated/_md3-tokens.scss +179 -0
- package/src/lib/styles/generated/_tokens-avatars.scss +4 -0
- package/src/lib/styles/global-material-theme.scss +69 -0
- package/src/lib/styles/index.scss +16 -0
- package/src/lib/styles/layout.scss +29 -0
- package/src/lib/styles/overrides/_index.scss +11 -0
- package/src/lib/styles/overrides/_mat-button-overrides.scss +105 -0
- package/src/lib/styles/overrides/_mat-checkbox-overrides.scss +49 -0
- package/src/lib/styles/overrides/_mat-form-field-overrides.scss +148 -0
- package/src/lib/styles/overrides/_mat-icon-button-overrides.scss +20 -0
- package/src/lib/styles/overrides/_mat-list-overrides.scss +59 -0
- package/src/lib/styles/overrides/_mat-slide-toggle-overrides.scss +33 -0
- package/src/lib/styles/overrides/_mat-table-overrides.scss +259 -0
- package/src/lib/styles/overrides/_mat-tabs-overrides.scss +116 -0
- package/src/lib/styles/scrollbar.scss +40 -0
- package/src/lib/styles/text-classes.scss +116 -0
- package/src/lib/styles/typography.scss +14 -0
- package/tsconfig.json +30 -0
- package/tsconfig.lib.json +20 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
.lib-mat-btn {
|
|
2
|
+
display: flex !important;
|
|
3
|
+
align-items: center !important;
|
|
4
|
+
justify-content: center !important;
|
|
5
|
+
box-sizing: border-box !important;
|
|
6
|
+
overflow: hidden !important;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.lib-mat-btn ::ng-deep .mdc-button__label {
|
|
10
|
+
overflow: visible !important;
|
|
11
|
+
position: static !important;
|
|
12
|
+
display: flex !important;
|
|
13
|
+
align-items: center !important;
|
|
14
|
+
justify-content: center !important;
|
|
15
|
+
gap: var(--lib-mat-btn-gap) !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.lib-mat-btn ::ng-deep .mdc-button__label > .mat-icon {
|
|
19
|
+
display: inline-flex !important;
|
|
20
|
+
align-items: center !important;
|
|
21
|
+
justify-content: center !important;
|
|
22
|
+
align-self: center !important;
|
|
23
|
+
margin: 0 !important;
|
|
24
|
+
line-height: 1 !important;
|
|
25
|
+
vertical-align: middle !important;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.lib-mat-btn ::ng-deep .mdc-button__label > span {
|
|
29
|
+
display: inline-flex !important;
|
|
30
|
+
align-items: center !important;
|
|
31
|
+
line-height: var(--lib-mat-btn-line-height) !important;
|
|
32
|
+
vertical-align: middle !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.lib-mat-btn:focus-visible {
|
|
36
|
+
outline: none;
|
|
37
|
+
box-shadow:
|
|
38
|
+
0 0 0 calc(var(--buttons-wip-button-enabled-button-focus-ring-outline-offset, 2) * 1px) var(--buttons-wip-button-enabled-button-focus-ring-indicator-color, #5b5f61),
|
|
39
|
+
0 0 0 calc((var(--buttons-wip-button-enabled-button-focus-ring-indicator-thickness, 3) + var(--buttons-wip-button-enabled-button-focus-ring-outline-offset, 2)) * 1px) var(--buttons-wip-button-enabled-button-focus-ring-indicator-color, #5b5f61);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.lib-mat-btn.lib-mat-btn--pressed:not([disabled]) {
|
|
43
|
+
border-radius: calc(var(--lib-mat-btn-pressed-radius, var(--buttons-wip-size-medium-button-medium-shape-pressed-morph, 8)) * 1px);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lib-mat-btn.lib-mat-btn--debug-padding {
|
|
47
|
+
box-shadow:
|
|
48
|
+
inset var(--lib-mat-btn-padding-x) 0 0 0 rgba(255, 0, 0, 0.6),
|
|
49
|
+
inset calc(100% - var(--lib-mat-btn-padding-x-right) - 2px) 0 0 0 rgba(0, 100, 255, 0.6);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.lib-mat-btn__content {
|
|
53
|
+
position: relative;
|
|
54
|
+
z-index: 0;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
gap: var(--lib-mat-btn-gap);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.lib-mat-btn--align-start .lib-mat-btn__content,
|
|
62
|
+
.lib-mat-btn--align-center .lib-mat-btn__content,
|
|
63
|
+
.lib-mat-btn--align-end .lib-mat-btn__content {
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.lib-mat-btn--align-start .lib-mat-btn__content {
|
|
68
|
+
justify-content: flex-start;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.lib-mat-btn--align-center .lib-mat-btn__content {
|
|
72
|
+
justify-content: center;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.lib-mat-btn--align-end .lib-mat-btn__content {
|
|
76
|
+
justify-content: flex-end;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host .lib-mat-btn--align-start .mdc-button__label,
|
|
80
|
+
:host ::ng-deep .lib-mat-btn--align-start .mdc-button__label {
|
|
81
|
+
width: 100% !important;
|
|
82
|
+
justify-content: flex-start !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
:host .lib-mat-btn--align-center .mdc-button__label,
|
|
86
|
+
:host ::ng-deep .lib-mat-btn--align-center .mdc-button__label {
|
|
87
|
+
width: 100% !important;
|
|
88
|
+
justify-content: center !important;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
:host .lib-mat-btn--align-end .mdc-button__label,
|
|
92
|
+
:host ::ng-deep .lib-mat-btn--align-end .mdc-button__label {
|
|
93
|
+
width: 100% !important;
|
|
94
|
+
justify-content: flex-end !important;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Variables base (medium) */
|
|
98
|
+
.lib-mat-btn {
|
|
99
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-medium-button-medium-container-height) * 1px);
|
|
100
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-medium-button-medium-leading-space) * 1px);
|
|
101
|
+
--lib-mat-btn-padding-x-right: calc(var(--buttons-wip-size-medium-button-medium-leading-space) * 1px);
|
|
102
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-medium-button-medium-between-icon-label-space) * 1px);
|
|
103
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-medium-button-medium-shape-round, 1000) * 1px);
|
|
104
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-medium-button-medium-shape-square, 12) * 1px);
|
|
105
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
106
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-medium-button-medium-label-text-size) * 1px);
|
|
107
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-medium-button-medium-label-text-line-height) * 1px);
|
|
108
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-medium-button-medium-label-text-tracking) * 1px);
|
|
109
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-medium-button-medium-icon-size) * 1px);
|
|
110
|
+
|
|
111
|
+
min-height: var(--lib-mat-btn-height);
|
|
112
|
+
height: var(--lib-mat-btn-height);
|
|
113
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
114
|
+
padding-right: var(--lib-mat-btn-padding-x) !important;
|
|
115
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
116
|
+
font-family: var(--buttons-wip-size-medium-button-medium-label-text-font, Heebo);
|
|
117
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
118
|
+
font-style: normal;
|
|
119
|
+
font-weight: var(--buttons-wip-size-medium-button-medium-label-text-weight, 500);
|
|
120
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
121
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
122
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.lib-mat-btn--variant-outlined {
|
|
126
|
+
color: var(--buttons-wip-color-outlined-enabled-button-outlined-label-color, #434749) !important;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.lib-mat-btn--variant-outlined:focus-visible {
|
|
130
|
+
color: var(--buttons-wip-color-outlined-focused-button-outlined-focused-label-color, #434749) !important;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.lib-mat-btn--variant-outlined .lib-mat-btn__content,
|
|
134
|
+
.lib-mat-btn--variant-outlined .mdc-button__label {
|
|
135
|
+
color: inherit !important;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.lib-mat-btn--variant-tonal {
|
|
139
|
+
background-color: var(--buttons-wip-color-tonal-enabled-button-tonal-container-color, #e0e3e5) !important;
|
|
140
|
+
color: var(--buttons-wip-color-tonal-enabled-button-tonal-label-color, #434749) !important;
|
|
141
|
+
--mat-button-tonal-ripple-color: var(--buttons-wip-color-tonal-pressed-button-tonal-pressed-ripple-color, rgba(67, 71, 73, 0.1));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
:host ::ng-deep .lib-mat-btn--variant-tonal:hover:not([disabled]) .mat-mdc-button-persistent-ripple::before {
|
|
145
|
+
background-color: var(--buttons-wip-color-tonal-hovered-button-tonal-hovered-container-state-layer-color, rgba(67, 71, 73, 0.08)) !important;
|
|
146
|
+
opacity: 1 !important;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host ::ng-deep .lib-mat-btn--variant-tonal.cdk-program-focused .mat-mdc-button-persistent-ripple::before,
|
|
150
|
+
:host ::ng-deep .lib-mat-btn--variant-tonal.cdk-keyboard-focused .mat-mdc-button-persistent-ripple::before {
|
|
151
|
+
background-color: var(--buttons-wip-color-tonal-focused-button-tonal-focused-container-state-layer-color, rgba(67, 71, 73, 0.1)) !important;
|
|
152
|
+
opacity: 1 !important;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
:host ::ng-deep .lib-mat-btn--variant-tonal:active:not([disabled]) .mat-mdc-button-persistent-ripple::before {
|
|
156
|
+
background-color: var(--buttons-wip-color-tonal-pressed-button-tonal-pressed-container-state-layer-color, rgba(67, 71, 73, 0.1)) !important;
|
|
157
|
+
opacity: 1 !important;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
:host ::ng-deep .lib-mat-btn--variant-tonal .mat-ripple-element {
|
|
161
|
+
background-color: var(--buttons-wip-color-tonal-pressed-button-tonal-pressed-ripple-color, rgba(67, 71, 73, 0.1)) !important;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.lib-mat-btn--full {
|
|
165
|
+
width: 100%;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* xsmall */
|
|
169
|
+
.lib-mat-btn--xsmall {
|
|
170
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-xsmall-button-xsmall-container-height) * 1px);
|
|
171
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-xsmall-button-xsmall-leading-space) * 1px);
|
|
172
|
+
--lib-mat-btn-padding-x-right: calc(var(--buttons-wip-size-xsmall-button-xsmall-trailing-space) * 1px);
|
|
173
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-xsmall-button-xsmall-between-icon-label-space) * 1px);
|
|
174
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-xsmall-button-xsmall-shape-round, 1000) * 1px);
|
|
175
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-xsmall-button-xsmall-shape-square, 8) * 1px);
|
|
176
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
177
|
+
--lib-mat-btn-pressed-radius: var(--buttons-wip-size-xsmall-button-xsmall-shape-pressed-morph);
|
|
178
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-xsmall-button-xsmall-label-text-size) * 1px);
|
|
179
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-xsmall-button-xsmall-label-text-line-height) * 1px);
|
|
180
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-xsmall-button-xsmall-label-text-tracking) * 1px);
|
|
181
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-xsmall-button-xsmall-icon-size) * 1px);
|
|
182
|
+
|
|
183
|
+
min-height: var(--lib-mat-btn-height);
|
|
184
|
+
height: var(--lib-mat-btn-height);
|
|
185
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
186
|
+
padding-right: var(--lib-mat-btn-padding-x-right) !important;
|
|
187
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
188
|
+
font-family: var(--buttons-wip-size-xsmall-button-xsmall-label-text-font, Heebo);
|
|
189
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
190
|
+
font-style: normal;
|
|
191
|
+
font-weight: var(--buttons-wip-size-xsmall-button-xsmall-label-text-weight, 500);
|
|
192
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
193
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
194
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.lib-mat-btn--xsmall .mat-icon,
|
|
198
|
+
.lib-mat-btn--xsmall .mat-mdc-button-touch-target {
|
|
199
|
+
width: var(--lib-mat-btn-icon-size);
|
|
200
|
+
height: var(--lib-mat-btn-icon-size);
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* small */
|
|
207
|
+
.lib-mat-btn--small {
|
|
208
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-small-button-small-container-height) * 1px);
|
|
209
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-small-button-small-leading-space) * 1px);
|
|
210
|
+
--lib-mat-btn-padding-x-right: calc(var(--buttons-wip-size-small-button-small-trailing-space) * 1px);
|
|
211
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-small-button-small-between-icon-label-space) * 1px);
|
|
212
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-small-button-small-shape-round, 1000) * 1px);
|
|
213
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-small-button-small-shape-square, 8) * 1px);
|
|
214
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
215
|
+
--lib-mat-btn-pressed-radius: var(--buttons-wip-size-small-button-small-shape-pressed-morph);
|
|
216
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-small-button-small-label-text-size) * 1px);
|
|
217
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-small-button-small-label-text-line-height) * 1px);
|
|
218
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-small-button-small-label-text-tracking) * 1px);
|
|
219
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-small-button-small-icon-size) * 1px);
|
|
220
|
+
|
|
221
|
+
min-height: var(--lib-mat-btn-height);
|
|
222
|
+
height: var(--lib-mat-btn-height);
|
|
223
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
224
|
+
padding-right: var(--lib-mat-btn-padding-x-right) !important;
|
|
225
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
226
|
+
font-family: var(--buttons-wip-size-small-button-small-label-text-font, Heebo);
|
|
227
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
228
|
+
font-style: normal;
|
|
229
|
+
font-weight: var(--buttons-wip-size-small-button-small-label-text-weight, 500) !important;
|
|
230
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
231
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
232
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.lib-mat-btn--small .mat-icon,
|
|
236
|
+
.lib-mat-btn--small .mat-mdc-button-touch-target {
|
|
237
|
+
width: var(--lib-mat-btn-icon-size);
|
|
238
|
+
height: var(--lib-mat-btn-icon-size);
|
|
239
|
+
font-size: var(--lib-mat-btn-icon-size);
|
|
240
|
+
line-height: 1;
|
|
241
|
+
display: flex;
|
|
242
|
+
align-items: center;
|
|
243
|
+
justify-content: center;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/* medium */
|
|
247
|
+
.lib-mat-btn--medium {
|
|
248
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-medium-button-medium-container-height) * 1px);
|
|
249
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-medium-button-medium-leading-space) * 1px);
|
|
250
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-medium-button-medium-between-icon-label-space) * 1px);
|
|
251
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-medium-button-medium-shape-round, 1000) * 1px);
|
|
252
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-medium-button-medium-shape-square, 12) * 1px);
|
|
253
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
254
|
+
--lib-mat-btn-pressed-radius: var(--buttons-wip-size-medium-button-medium-shape-pressed-morph);
|
|
255
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-medium-button-medium-label-text-size) * 1px);
|
|
256
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-medium-button-medium-label-text-line-height) * 1px);
|
|
257
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-medium-button-medium-label-text-tracking) * 1px);
|
|
258
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-medium-button-medium-icon-size) * 1px);
|
|
259
|
+
|
|
260
|
+
min-height: var(--lib-mat-btn-height);
|
|
261
|
+
height: var(--lib-mat-btn-height);
|
|
262
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
263
|
+
padding-right: var(--lib-mat-btn-padding-x-right) !important;
|
|
264
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
265
|
+
font-family: var(--buttons-wip-size-medium-button-medium-label-text-font, Heebo);
|
|
266
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
267
|
+
font-style: normal;
|
|
268
|
+
font-weight: var(--buttons-wip-size-medium-button-medium-label-text-weight, 500) !important;
|
|
269
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
270
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
271
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.lib-mat-btn--medium .mat-icon,
|
|
275
|
+
.lib-mat-btn--medium .mat-mdc-button-touch-target {
|
|
276
|
+
width: var(--lib-mat-btn-icon-size);
|
|
277
|
+
height: var(--lib-mat-btn-icon-size);
|
|
278
|
+
font-size: var(--lib-mat-btn-icon-size);
|
|
279
|
+
line-height: 1;
|
|
280
|
+
display: flex;
|
|
281
|
+
align-items: center;
|
|
282
|
+
justify-content: center;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/* large */
|
|
286
|
+
.lib-mat-btn--large {
|
|
287
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-large-button-large-container-height) * 1px);
|
|
288
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-large-button-large-leading-space) * 1px);
|
|
289
|
+
--lib-mat-btn-padding-x-right: calc(var(--buttons-wip-size-large-button-large-trailing-space) * 1px);
|
|
290
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-large-button-large-between-icon-label-space) * 1px);
|
|
291
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-large-button-large-shape-round, 1000) * 1px);
|
|
292
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-large-button-large-shape-square, 16) * 1px);
|
|
293
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
294
|
+
--lib-mat-btn-pressed-radius: var(--buttons-wip-size-large-button-large-shape-pressed-morph);
|
|
295
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-large-button-large-label-text-size) * 1px);
|
|
296
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-large-button-large-label-text-line-height) * 1px);
|
|
297
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-large-button-large-label-text-tracking) * 1px);
|
|
298
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-large-button-large-icon-size) * 1px);
|
|
299
|
+
|
|
300
|
+
min-height: var(--lib-mat-btn-height);
|
|
301
|
+
height: var(--lib-mat-btn-height);
|
|
302
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
303
|
+
padding-right: var(--lib-mat-btn-padding-x-right) !important;
|
|
304
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
305
|
+
font-family: var(--buttons-wip-size-large-button-large-label-text-font, Heebo);
|
|
306
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
307
|
+
font-style: normal;
|
|
308
|
+
font-weight: var(--buttons-wip-size-large-button-large-label-text-weight, 400) !important;
|
|
309
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
310
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
311
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.lib-mat-btn--large .mat-icon,
|
|
315
|
+
.lib-mat-btn--large .mat-mdc-button-touch-target {
|
|
316
|
+
width: var(--lib-mat-btn-icon-size);
|
|
317
|
+
height: var(--lib-mat-btn-icon-size);
|
|
318
|
+
font-size: var(--lib-mat-btn-icon-size);
|
|
319
|
+
line-height: 1;
|
|
320
|
+
display: flex;
|
|
321
|
+
align-items: center;
|
|
322
|
+
justify-content: center;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/* xlarge */
|
|
326
|
+
.lib-mat-btn--xlarge {
|
|
327
|
+
--lib-mat-btn-height: calc(var(--buttons-wip-size-xlarge-button-xlarge-container-height) * 1px);
|
|
328
|
+
--lib-mat-btn-padding-x: calc(var(--buttons-wip-size-xlarge-button-xlarge-leading-space) * 1px);
|
|
329
|
+
--lib-mat-btn-padding-x-right: calc(var(--buttons-wip-size-xlarge-button-xlarge-trailing-space) * 1px);
|
|
330
|
+
--lib-mat-btn-gap: calc(var(--buttons-wip-size-xlarge-button-xlarge-between-icon-label-space) * 1px);
|
|
331
|
+
--lib-mat-btn-radius-round: calc(var(--buttons-wip-size-xlarge-button-xlarge-shape-round, 1000) * 1px);
|
|
332
|
+
--lib-mat-btn-radius-square: calc(var(--buttons-wip-size-xlarge-button-xlarge-shape-square, 16) * 1px);
|
|
333
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
334
|
+
--lib-mat-btn-pressed-radius: var(--buttons-wip-size-xlarge-button-xlarge-shape-pressed-morph);
|
|
335
|
+
--lib-mat-btn-font-size: calc(var(--buttons-wip-size-xlarge-button-xlarge-label-text-size) * 1px);
|
|
336
|
+
--lib-mat-btn-line-height: calc(var(--buttons-wip-size-xlarge-button-xlarge-label-text-line-height) * 1px);
|
|
337
|
+
--lib-mat-btn-tracking: calc(var(--buttons-wip-size-xlarge-button-xlarge-label-text-tracking) * 1px);
|
|
338
|
+
--lib-mat-btn-icon-size: calc(var(--buttons-wip-size-xlarge-button-xlarge-icon-size) * 1px);
|
|
339
|
+
|
|
340
|
+
min-height: var(--lib-mat-btn-height);
|
|
341
|
+
height: var(--lib-mat-btn-height);
|
|
342
|
+
padding-left: var(--lib-mat-btn-padding-x) !important;
|
|
343
|
+
padding-right: var(--lib-mat-btn-padding-x-right) !important;
|
|
344
|
+
color: var(--buttons-wip-color-filled-enabled-button-filled-label-color, #fff);
|
|
345
|
+
font-family: var(--buttons-wip-size-xlarge-button-xlarge-label-text-font, Heebo);
|
|
346
|
+
font-size: var(--lib-mat-btn-font-size);
|
|
347
|
+
font-style: normal;
|
|
348
|
+
font-weight: var(--buttons-wip-size-xlarge-button-xlarge-label-text-weight, 400) !important;
|
|
349
|
+
line-height: var(--lib-mat-btn-line-height);
|
|
350
|
+
letter-spacing: var(--lib-mat-btn-tracking);
|
|
351
|
+
border-radius: var(--lib-mat-btn-radius);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.lib-mat-btn--xlarge .mat-icon,
|
|
355
|
+
.lib-mat-btn--xlarge .mat-mdc-button-touch-target {
|
|
356
|
+
width: var(--lib-mat-btn-icon-size);
|
|
357
|
+
height: var(--lib-mat-btn-icon-size);
|
|
358
|
+
font-size: var(--lib-mat-btn-icon-size);
|
|
359
|
+
line-height: 1;
|
|
360
|
+
display: flex;
|
|
361
|
+
align-items: center;
|
|
362
|
+
justify-content: center;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.lib-mat-btn--shape-round {
|
|
366
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-round);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.lib-mat-btn--shape-square {
|
|
370
|
+
--lib-mat-btn-radius: var(--lib-mat-btn-radius-square);
|
|
371
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
@switch (variant()) {
|
|
2
|
+
@case ('filled') {
|
|
3
|
+
<button
|
|
4
|
+
mat-flat-button
|
|
5
|
+
class="lib-mat-btn"
|
|
6
|
+
[attr.type]="type()"
|
|
7
|
+
[disabled]="disabled()"
|
|
8
|
+
[ngClass]="classes()"
|
|
9
|
+
[attr.aria-pressed]="toggle() ? selected() : null"
|
|
10
|
+
(pointerdown)="onPressStart()"
|
|
11
|
+
(pointerup)="onPressEnd()"
|
|
12
|
+
(pointerleave)="onPressCancel()"
|
|
13
|
+
(pointercancel)="onPressCancel()"
|
|
14
|
+
(keydown)="onKeyDown($event)"
|
|
15
|
+
(keyup)="onKeyUp()"
|
|
16
|
+
(blur)="onPressEnd()"
|
|
17
|
+
>
|
|
18
|
+
@if (hasInputContent()) {
|
|
19
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
20
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
21
|
+
}
|
|
22
|
+
@if (label()) {
|
|
23
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
24
|
+
}
|
|
25
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
26
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
27
|
+
}
|
|
28
|
+
} @else {
|
|
29
|
+
<ng-content></ng-content>
|
|
30
|
+
}
|
|
31
|
+
</button>
|
|
32
|
+
}
|
|
33
|
+
@case ('outlined') {
|
|
34
|
+
<button
|
|
35
|
+
mat-stroked-button
|
|
36
|
+
class="lib-mat-btn"
|
|
37
|
+
[attr.type]="type()"
|
|
38
|
+
[disabled]="disabled()"
|
|
39
|
+
[ngClass]="classes()"
|
|
40
|
+
[attr.aria-pressed]="toggle() ? selected() : null"
|
|
41
|
+
(pointerdown)="onPressStart()"
|
|
42
|
+
(pointerup)="onPressEnd()"
|
|
43
|
+
(pointerleave)="onPressCancel()"
|
|
44
|
+
(pointercancel)="onPressCancel()"
|
|
45
|
+
(keydown)="onKeyDown($event)"
|
|
46
|
+
(keyup)="onKeyUp()"
|
|
47
|
+
(blur)="onPressEnd()"
|
|
48
|
+
>
|
|
49
|
+
@if (hasInputContent()) {
|
|
50
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
51
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
52
|
+
}
|
|
53
|
+
@if (label()) {
|
|
54
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
55
|
+
}
|
|
56
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
57
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
58
|
+
}
|
|
59
|
+
} @else {
|
|
60
|
+
<ng-content></ng-content>
|
|
61
|
+
}
|
|
62
|
+
</button>
|
|
63
|
+
}
|
|
64
|
+
@case ('tonal') {
|
|
65
|
+
<button
|
|
66
|
+
matButton
|
|
67
|
+
appearance="tonal"
|
|
68
|
+
class="lib-mat-btn lib-mat-btn--variant-tonal"
|
|
69
|
+
[attr.type]="type()"
|
|
70
|
+
[disabled]="disabled()"
|
|
71
|
+
[ngClass]="classes()"
|
|
72
|
+
[attr.aria-pressed]="toggle() ? selected() : null"
|
|
73
|
+
(pointerdown)="onPressStart()"
|
|
74
|
+
(pointerup)="onPressEnd()"
|
|
75
|
+
(pointerleave)="onPressCancel()"
|
|
76
|
+
(pointercancel)="onPressCancel()"
|
|
77
|
+
(keydown)="onKeyDown($event)"
|
|
78
|
+
(keyup)="onKeyUp()"
|
|
79
|
+
(blur)="onPressEnd()"
|
|
80
|
+
>
|
|
81
|
+
@if (hasInputContent()) {
|
|
82
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
83
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
84
|
+
}
|
|
85
|
+
@if (label()) {
|
|
86
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
87
|
+
}
|
|
88
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
89
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
90
|
+
}
|
|
91
|
+
} @else {
|
|
92
|
+
<ng-content></ng-content>
|
|
93
|
+
}
|
|
94
|
+
</button>
|
|
95
|
+
}
|
|
96
|
+
@case ('text') {
|
|
97
|
+
<button
|
|
98
|
+
mat-button
|
|
99
|
+
class="lib-mat-btn"
|
|
100
|
+
[attr.type]="type()"
|
|
101
|
+
[disabled]="disabled()"
|
|
102
|
+
[ngClass]="classes()"
|
|
103
|
+
(pointerdown)="onPressStart()"
|
|
104
|
+
(pointerup)="onPressEnd()"
|
|
105
|
+
(pointerleave)="onPressCancel()"
|
|
106
|
+
(pointercancel)="onPressCancel()"
|
|
107
|
+
(keydown)="onKeyDown($event)"
|
|
108
|
+
(keyup)="onKeyUp()"
|
|
109
|
+
(blur)="onPressEnd()"
|
|
110
|
+
>
|
|
111
|
+
@if (hasInputContent()) {
|
|
112
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
113
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
114
|
+
}
|
|
115
|
+
@if (label()) {
|
|
116
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
117
|
+
}
|
|
118
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
119
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
120
|
+
}
|
|
121
|
+
} @else {
|
|
122
|
+
<ng-content></ng-content>
|
|
123
|
+
}
|
|
124
|
+
</button>
|
|
125
|
+
}
|
|
126
|
+
@case ('elevated') {
|
|
127
|
+
<button
|
|
128
|
+
mat-raised-button
|
|
129
|
+
class="lib-mat-btn"
|
|
130
|
+
[attr.type]="type()"
|
|
131
|
+
[disabled]="disabled()"
|
|
132
|
+
[ngClass]="classes()"
|
|
133
|
+
[attr.aria-pressed]="toggle() ? selected() : null"
|
|
134
|
+
(pointerdown)="onPressStart()"
|
|
135
|
+
(pointerup)="onPressEnd()"
|
|
136
|
+
(pointerleave)="onPressCancel()"
|
|
137
|
+
(pointercancel)="onPressCancel()"
|
|
138
|
+
(keydown)="onKeyDown($event)"
|
|
139
|
+
(keyup)="onKeyUp()"
|
|
140
|
+
(blur)="onPressEnd()"
|
|
141
|
+
>
|
|
142
|
+
@if (hasInputContent()) {
|
|
143
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
144
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
145
|
+
}
|
|
146
|
+
@if (label()) {
|
|
147
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
148
|
+
}
|
|
149
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
150
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
151
|
+
}
|
|
152
|
+
} @else {
|
|
153
|
+
<ng-content></ng-content>
|
|
154
|
+
}
|
|
155
|
+
</button>
|
|
156
|
+
}
|
|
157
|
+
@default {
|
|
158
|
+
<button
|
|
159
|
+
mat-flat-button
|
|
160
|
+
class="lib-mat-btn"
|
|
161
|
+
[attr.type]="type()"
|
|
162
|
+
[disabled]="disabled()"
|
|
163
|
+
[ngClass]="classes()"
|
|
164
|
+
(pointerdown)="onPressStart()"
|
|
165
|
+
(pointerup)="onPressEnd()"
|
|
166
|
+
(pointerleave)="onPressCancel()"
|
|
167
|
+
(pointercancel)="onPressCancel()"
|
|
168
|
+
(keydown)="onKeyDown($event)"
|
|
169
|
+
(keyup)="onKeyUp()"
|
|
170
|
+
(blur)="onPressEnd()"
|
|
171
|
+
>
|
|
172
|
+
@if (hasInputContent()) {
|
|
173
|
+
@if (iconPosition() === 'leading' && icon()) {
|
|
174
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
175
|
+
}
|
|
176
|
+
@if (label()) {
|
|
177
|
+
<span [class]="labelClass()">{{ label() }}</span>
|
|
178
|
+
}
|
|
179
|
+
@if (iconPosition() === 'trailing' && icon()) {
|
|
180
|
+
<mat-icon [svgIcon]="icon()">{{ icon() }}</mat-icon>
|
|
181
|
+
}
|
|
182
|
+
} @else {
|
|
183
|
+
<ng-content></ng-content>
|
|
184
|
+
}
|
|
185
|
+
</button>
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
input,
|
|
6
|
+
signal,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import { NgClass } from '@angular/common';
|
|
9
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
+
|
|
12
|
+
export type LibButtonSize = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
|
|
13
|
+
|
|
14
|
+
export type LibButtonVariant = 'filled' | 'outlined' | 'tonal' | 'text' | 'elevated';
|
|
15
|
+
|
|
16
|
+
export type LibButtonShape = 'round' | 'square';
|
|
17
|
+
|
|
18
|
+
export type LibButtonIconPosition = 'leading' | 'trailing';
|
|
19
|
+
|
|
20
|
+
export type LibButtonContentAlign = 'start' | 'center' | 'end';
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'lib-button',
|
|
24
|
+
standalone: true,
|
|
25
|
+
imports: [MatButtonModule, MatIconModule, NgClass],
|
|
26
|
+
templateUrl: './button.html',
|
|
27
|
+
styleUrl: './button.css',
|
|
28
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
29
|
+
host: {
|
|
30
|
+
'[class.lib-mat-btn-host--full]': 'fullWidth()',
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
export class LibButtonComponent {
|
|
34
|
+
size = input<LibButtonSize>('medium');
|
|
35
|
+
disabled = input(false);
|
|
36
|
+
type = input<'button' | 'submit' | 'reset'>('button');
|
|
37
|
+
fullWidth = input(false);
|
|
38
|
+
variant = input<LibButtonVariant>('filled');
|
|
39
|
+
shape = input<LibButtonShape>('round');
|
|
40
|
+
toggle = input(false);
|
|
41
|
+
selected = input(false);
|
|
42
|
+
label = input<string>('');
|
|
43
|
+
icon = input<string>('');
|
|
44
|
+
iconPosition = input<LibButtonIconPosition>('leading');
|
|
45
|
+
contentAlign = input<LibButtonContentAlign>('center');
|
|
46
|
+
labelClass = input<string>('');
|
|
47
|
+
pressed = input<boolean>(false);
|
|
48
|
+
debugPadding = input<boolean>(false);
|
|
49
|
+
readonly isPressed = signal(false);
|
|
50
|
+
|
|
51
|
+
/** Si hay label o icon por input, se usa contenido interno; si no, ng-content. */
|
|
52
|
+
readonly hasInputContent = computed(
|
|
53
|
+
() => this.label().length > 0 || this.icon().length > 0
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
/** contentAlign ya es 'start' | 'center' | 'end'; se usa directo para las clases CSS. */
|
|
57
|
+
private readonly contentAlignNormalized = computed(() => this.contentAlign());
|
|
58
|
+
|
|
59
|
+
readonly classes = computed(() => ({
|
|
60
|
+
'lib-mat-btn': true,
|
|
61
|
+
'lib-mat-btn--xsmall': this.size() === 'xsmall',
|
|
62
|
+
'lib-mat-btn--small': this.size() === 'small',
|
|
63
|
+
'lib-mat-btn--medium': this.size() === 'medium',
|
|
64
|
+
'lib-mat-btn--large': this.size() === 'large',
|
|
65
|
+
'lib-mat-btn--xlarge': this.size() === 'xlarge',
|
|
66
|
+
'lib-mat-btn--full': this.fullWidth(),
|
|
67
|
+
'lib-mat-btn--variant-filled': this.variant() === 'filled',
|
|
68
|
+
'lib-mat-btn--variant-outlined': this.variant() === 'outlined',
|
|
69
|
+
'lib-mat-btn--variant-tonal': this.variant() === 'tonal',
|
|
70
|
+
'lib-mat-btn--variant-text': this.variant() === 'text',
|
|
71
|
+
'lib-mat-btn--variant-elevated': this.variant() === 'elevated',
|
|
72
|
+
'lib-mat-btn--shape-round': this.shape() === 'round',
|
|
73
|
+
'lib-mat-btn--shape-square': this.shape() === 'square',
|
|
74
|
+
'lib-mat-btn--toggle': this.toggle(),
|
|
75
|
+
'lib-mat-btn--selected': this.toggle() && this.selected(),
|
|
76
|
+
'lib-mat-btn--pressed': this.isPressed() || this.pressed(),
|
|
77
|
+
'lib-mat-btn--debug-padding': this.debugPadding(),
|
|
78
|
+
'lib-mat-btn--align-start': this.contentAlignNormalized() === 'start',
|
|
79
|
+
'lib-mat-btn--align-center': this.contentAlignNormalized() === 'center',
|
|
80
|
+
'lib-mat-btn--align-end': this.contentAlignNormalized() === 'end',
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
onPressStart(): void {
|
|
84
|
+
if (!this.disabled()) this.isPressed.set(true);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onPressEnd(): void {
|
|
88
|
+
this.isPressed.set(false);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
onPressCancel(): void {
|
|
92
|
+
this.isPressed.set(false);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onKeyDown(event: KeyboardEvent): void {
|
|
96
|
+
if (this.disabled()) return;
|
|
97
|
+
if (event.code === 'Space' || event.code === 'Enter') this.isPressed.set(true);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
onKeyUp(): void {
|
|
101
|
+
this.isPressed.set(false);
|
|
102
|
+
}
|
|
103
|
+
}
|