@updevs/components 1.0.0-alpha.1 → 1.0.0-alpha.3
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/README.md +5 -22
- package/assets/styles/_bootstrap-components.scss +38 -0
- package/assets/styles/_bootstrap-config.scss +7 -0
- package/assets/styles/_bootstrap-override.scss +78 -0
- package/assets/styles/_config.scss +9 -0
- package/assets/styles/_core.scss +71 -0
- package/assets/styles/_mixins.scss +2 -0
- package/assets/styles/_updevs.scss +9 -0
- package/assets/styles/_utilities.scss +98 -0
- package/assets/styles/_variables-dark.scss +17 -0
- package/assets/styles/_variables.scss +934 -0
- package/assets/styles/fonts/_webfonts.scss +15 -0
- package/assets/styles/layout/_animations.scss +62 -0
- package/assets/styles/layout/_core.scss +61 -0
- package/assets/styles/layout/_dark.scss +72 -0
- package/assets/styles/layout/_footer.scss +12 -0
- package/assets/styles/layout/_navbar.scss +380 -0
- package/assets/styles/layout/_page.scss +169 -0
- package/assets/styles/layout/_root.scss +72 -0
- package/assets/styles/mixins/_functions.scss +43 -0
- package/assets/styles/mixins/_mixins.scss +68 -0
- package/assets/styles/ui/_accordion.scss +24 -0
- package/assets/styles/ui/_alerts.scss +59 -0
- package/assets/styles/ui/_avatars.scss +118 -0
- package/assets/styles/ui/_badges.scss +79 -0
- package/assets/styles/ui/_breadcrumbs.scss +50 -0
- package/assets/styles/ui/_button-group.scss +16 -0
- package/assets/styles/ui/_buttons.scss +265 -0
- package/assets/styles/ui/_calendars.scss +104 -0
- package/assets/styles/ui/_cards.scss +586 -0
- package/assets/styles/ui/_carousel.scss +68 -0
- package/assets/styles/ui/_charts.scss +61 -0
- package/assets/styles/ui/_chips.scss +0 -0
- package/assets/styles/ui/_close.scss +7 -0
- package/assets/styles/ui/_datagrid.scss +17 -0
- package/assets/styles/ui/_dropdowns.scss +117 -0
- package/assets/styles/ui/_empty.scss +65 -0
- package/assets/styles/ui/_flags.scss +31 -0
- package/assets/styles/ui/_forms.scss +224 -0
- package/assets/styles/ui/_grid.scss +115 -0
- package/assets/styles/ui/_icons.scss +72 -0
- package/assets/styles/ui/_images.scss +15 -0
- package/assets/styles/ui/_legend.scss +12 -0
- package/assets/styles/ui/_lists.scss +127 -0
- package/assets/styles/ui/_loaders.scss +72 -0
- package/assets/styles/ui/_login.scss +3 -0
- package/assets/styles/ui/_markdown.scss +42 -0
- package/assets/styles/ui/_modals.scss +67 -0
- package/assets/styles/ui/_nav.scss +92 -0
- package/assets/styles/ui/_offcanvas.scss +17 -0
- package/assets/styles/ui/_pagination.scss +56 -0
- package/assets/styles/ui/_payments.scss +28 -0
- package/assets/styles/ui/_placeholder.scss +9 -0
- package/assets/styles/ui/_popovers.scss +2 -0
- package/assets/styles/ui/_progress.scss +107 -0
- package/assets/styles/ui/_ribbons.scss +156 -0
- package/assets/styles/ui/_stars.scss +13 -0
- package/assets/styles/ui/_status.scss +163 -0
- package/assets/styles/ui/_steps.scss +152 -0
- package/assets/styles/ui/_switch-icon.scss +211 -0
- package/assets/styles/ui/_tables.scss +150 -0
- package/assets/styles/ui/_tags.scss +57 -0
- package/assets/styles/ui/_timeline.scss +61 -0
- package/assets/styles/ui/_toasts.scss +19 -0
- package/assets/styles/ui/_toolbar.scss +10 -0
- package/assets/styles/ui/_tracking.scss +29 -0
- package/assets/styles/ui/_type.scss +169 -0
- package/assets/styles/ui/forms/_form-check.scss +91 -0
- package/assets/styles/ui/forms/_form-colorinput.scss +54 -0
- package/assets/styles/ui/forms/_form-custom.scss +28 -0
- package/assets/styles/ui/forms/_form-icon.scss +35 -0
- package/assets/styles/ui/forms/_form-imagecheck.scss +104 -0
- package/assets/styles/ui/forms/_form-selectgroup.scss +153 -0
- package/assets/styles/ui/forms/_validation.scss +13 -0
- package/assets/styles/ui/typo/_hr.scss +74 -0
- package/assets/styles/utils/_background.scss +15 -0
- package/assets/styles/utils/_colors.scss +40 -0
- package/assets/styles/utils/_opacity.scss +7 -0
- package/assets/styles/utils/_scroll.scss +47 -0
- package/assets/styles/utils/_shadow.scss +17 -0
- package/assets/styles/utils/_sizing.scss +10 -0
- package/assets/styles/utils/_text.scss +15 -0
- package/button/ng-package.json +7 -0
- package/button/src/button.component.html +8 -0
- package/button/src/button.component.scss +5 -0
- package/button/src/button.component.spec.ts +23 -0
- package/button/src/button.component.ts +154 -0
- package/button/src/index.ts +1 -0
- package/button/src/public-api.ts +2 -0
- package/button/src/upd-button.module.ts +17 -0
- package/card/ng-package.json +7 -0
- package/card/src/card.component.html +105 -0
- package/card/src/card.component.scss +47 -0
- package/card/src/card.component.spec.ts +23 -0
- package/card/src/card.component.ts +112 -0
- package/card/src/directives/card-actions.directive.spec.ts +8 -0
- package/card/src/directives/card-actions.directive.ts +11 -0
- package/card/src/directives/card-footer.directive.spec.ts +8 -0
- package/card/src/directives/card-footer.directive.ts +11 -0
- package/card/src/directives/card-header.directive.spec.ts +8 -0
- package/card/src/directives/card-header.directive.ts +11 -0
- package/card/src/directives/card-image.directive.spec.ts +8 -0
- package/card/src/directives/card-image.directive.ts +11 -0
- package/card/src/directives/public-api.ts +4 -0
- package/card/src/index.ts +1 -0
- package/card/src/public-api.ts +3 -0
- package/card/src/types/card-state.type.ts +1 -0
- package/card/src/types/card-style.type.ts +1 -0
- package/card/src/types/hover-effect.type.ts +1 -0
- package/card/src/types/public-api.ts +5 -0
- package/card/src/types/ribbon-style.type.ts +1 -0
- package/card/src/types/status-position.type.ts +1 -0
- package/card/src/upd-card.module.ts +32 -0
- package/dropdown/ng-package.json +7 -0
- package/dropdown/src/dropdown.component.html +32 -0
- package/dropdown/src/dropdown.component.scss +19 -0
- package/dropdown/src/dropdown.component.spec.ts +23 -0
- package/dropdown/src/dropdown.component.ts +182 -0
- package/dropdown/src/index.ts +1 -0
- package/dropdown/src/models/dropdown-item.ts +22 -0
- package/dropdown/src/models/dropdown-item.type.ts +1 -0
- package/dropdown/src/models/public-api.ts +2 -0
- package/dropdown/src/public-api.ts +3 -0
- package/dropdown/src/upd-dropdown.module.ts +25 -0
- package/form/ng-package.json +7 -0
- package/form/src/form.module.ts +10 -0
- package/form/src/index.ts +1 -0
- package/form/src/public-api.ts +1 -0
- package/form-controls/checkbox/ng-package.json +7 -0
- package/form-controls/checkbox/src/checkbox.component.html +7 -0
- package/form-controls/checkbox/src/checkbox.component.scss +0 -0
- package/form-controls/checkbox/src/checkbox.component.spec.ts +23 -0
- package/form-controls/checkbox/src/checkbox.component.ts +48 -0
- package/form-controls/checkbox/src/index.ts +1 -0
- package/form-controls/checkbox/src/public-api.ts +3 -0
- package/form-controls/checkbox/src/upd-checkbox.module.ts +19 -0
- package/form-controls/input/ng-package.json +7 -0
- package/form-controls/input/src/directives/input-append.directive.spec.ts +8 -0
- package/form-controls/input/src/directives/input-append.directive.ts +11 -0
- package/form-controls/input/src/directives/input-prepend.directive.spec.ts +8 -0
- package/form-controls/input/src/directives/input-prepend.directive.ts +11 -0
- package/form-controls/input/src/directives/public-api.ts +2 -0
- package/form-controls/input/src/index.ts +1 -0
- package/form-controls/input/src/input.component.html +82 -0
- package/form-controls/input/src/input.component.scss +13 -0
- package/form-controls/input/src/input.component.spec.ts +23 -0
- package/form-controls/input/src/input.component.ts +124 -0
- package/form-controls/input/src/public-api.ts +4 -0
- package/form-controls/input/src/types/input.type.ts +1 -0
- package/form-controls/input/src/types/loader-position.type.ts +1 -0
- package/form-controls/input/src/types/public-api.ts +2 -0
- package/form-controls/input/src/upd-input.module.ts +29 -0
- package/form-controls/radio/ng-package.json +7 -0
- package/form-controls/radio/src/index.ts +1 -0
- package/form-controls/radio/src/public-api.ts +2 -0
- package/form-controls/radio/src/radio.component.html +7 -0
- package/form-controls/radio/src/radio.component.scss +0 -0
- package/form-controls/radio/src/radio.component.spec.ts +23 -0
- package/form-controls/radio/src/radio.component.ts +47 -0
- package/form-controls/radio/src/upd-radio.module.ts +17 -0
- package/form-controls/select/ng-package.json +7 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.html +41 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.scss +6 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.spec.ts +21 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.ts +69 -0
- package/form-controls/select/src/components/shared.scss +40 -0
- package/form-controls/select/src/components/single/select.component.html +53 -0
- package/form-controls/select/src/components/single/select.component.scss +3 -0
- package/form-controls/select/src/components/single/select.component.spec.ts +23 -0
- package/form-controls/select/src/components/single/select.component.ts +58 -0
- package/form-controls/select/src/index.ts +1 -0
- package/form-controls/select/src/models/abstractions/base-select.component.ts +259 -0
- package/form-controls/select/src/models/public-api.ts +1 -0
- package/form-controls/select/src/models/select-item.ts +26 -0
- package/form-controls/select/src/public-api.ts +4 -0
- package/form-controls/select/src/upd-select.module.ts +32 -0
- package/form-controls/textarea/ng-package.json +7 -0
- package/form-controls/textarea/src/index.ts +1 -0
- package/form-controls/textarea/src/public-api.ts +2 -0
- package/form-controls/textarea/src/textarea.component.html +8 -0
- package/form-controls/textarea/src/textarea.component.scss +0 -0
- package/form-controls/textarea/src/textarea.component.spec.ts +23 -0
- package/form-controls/textarea/src/textarea.component.ts +47 -0
- package/form-controls/textarea/src/upd-textarea.module.ts +17 -0
- package/form-controls/time-picker/ng-package.json +7 -0
- package/form-controls/time-picker/src/assets/i18n/en.json +5 -0
- package/form-controls/time-picker/src/assets/i18n/pt.json +5 -0
- package/form-controls/time-picker/src/index.ts +1 -0
- package/form-controls/time-picker/src/public-api.ts +3 -0
- package/form-controls/time-picker/src/time-picker.component.html +17 -0
- package/form-controls/time-picker/src/time-picker.component.scss +10 -0
- package/form-controls/time-picker/src/time-picker.component.spec.ts +21 -0
- package/form-controls/time-picker/src/time-picker.component.ts +110 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.html +44 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.scss +47 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.spec.ts +21 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.ts +107 -0
- package/form-controls/time-picker/src/upd-time-picker.module.ts +39 -0
- package/layout/ng-package.json +7 -0
- package/layout/src/abstractions/base-page.component.ts +21 -0
- package/layout/src/abstractions/public-api.ts +1 -0
- package/layout/src/assets/i18n/en.json +5 -0
- package/layout/src/assets/i18n/pt.json +5 -0
- package/layout/src/index.ts +1 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.html +1 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.scss +0 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.spec.ts +23 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.ts +10 -0
- package/layout/src/layouts/blank-layout/blank-layout.module.ts +17 -0
- package/layout/src/layouts/public-api.ts +4 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.html +14 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.scss +0 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.spec.ts +23 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.ts +31 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.module.ts +52 -0
- package/layout/src/models/public-api.ts +1 -0
- package/layout/src/models/upd-layout-config.model.ts +71 -0
- package/layout/src/models/upd-layout.config.ts +37 -0
- package/layout/src/pages/auth-flow/auth-flow-routing.module.ts +21 -0
- package/layout/src/pages/auth-flow/auth-flow.module.ts +29 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.html +1 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.scss +0 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.ts +10 -0
- package/layout/src/pages/auth-flow/login/login.component.html +96 -0
- package/layout/src/pages/auth-flow/login/login.component.scss +0 -0
- package/layout/src/pages/auth-flow/login/login.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/login/login.component.ts +26 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.html +1 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.scss +0 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.ts +10 -0
- package/layout/src/pages/auth-flow/public-api.ts +5 -0
- package/layout/src/pages/public-api.ts +1 -0
- package/layout/src/partials/footer/footer-copyright.directive.spec.ts +8 -0
- package/layout/src/partials/footer/footer-copyright.directive.ts +9 -0
- package/layout/src/partials/footer/footer.component.html +30 -0
- package/layout/src/partials/footer/footer.component.scss +0 -0
- package/{src/lib/components.component.spec.ts → layout/src/partials/footer/footer.component.spec.ts} +6 -6
- package/layout/src/partials/footer/footer.component.ts +73 -0
- package/layout/src/partials/footer/public-api.ts +2 -0
- package/layout/src/partials/header/header-style.type.ts +1 -0
- package/layout/src/partials/header/header.component.html +163 -0
- package/layout/src/partials/header/header.component.scss +0 -0
- package/layout/src/partials/header/header.component.spec.ts +23 -0
- package/layout/src/partials/header/header.component.ts +86 -0
- package/layout/src/partials/header/public-api.ts +2 -0
- package/layout/src/partials/page-header/page-header.component.html +19 -0
- package/layout/src/partials/page-header/page-header.component.scss +0 -0
- package/layout/src/partials/page-header/page-header.component.spec.ts +23 -0
- package/layout/src/partials/page-header/page-header.component.ts +11 -0
- package/layout/src/partials/page-header/public-api.ts +1 -0
- package/layout/src/partials/public-api.ts +4 -0
- package/layout/src/partials/sidebar/public-api.ts +1 -0
- package/layout/src/partials/sidebar/sidebar.component.html +62 -0
- package/layout/src/partials/sidebar/sidebar.component.scss +0 -0
- package/layout/src/partials/sidebar/sidebar.component.spec.ts +23 -0
- package/layout/src/partials/sidebar/sidebar.component.ts +161 -0
- package/layout/src/public-api.ts +7 -0
- package/layout/src/services/public-api.ts +1 -0
- package/{src/lib/components.service.spec.ts → layout/src/services/upd-layout-config.service.spec.ts} +4 -4
- package/layout/src/services/upd-layout-config.service.ts +20 -0
- package/layout/src/tools/layout.constants.ts +18 -0
- package/layout/src/upd-layout.module.ts +34 -0
- package/link/ng-package.json +7 -0
- package/link/src/index.ts +1 -0
- package/link/src/link.component.html +3 -0
- package/link/src/link.component.scss +3 -0
- package/link/src/link.component.spec.ts +23 -0
- package/link/src/link.component.ts +48 -0
- package/link/src/public-api.ts +3 -0
- package/link/src/target.type.ts +1 -0
- package/link/src/upd-link.module.ts +17 -0
- package/list/ng-package.json +7 -0
- package/list/src/assets/i18n/en.json +5 -0
- package/list/src/assets/i18n/pt.json +5 -0
- package/list/src/index.ts +1 -0
- package/list/src/list.component.html +58 -0
- package/list/src/list.component.scss +21 -0
- package/list/src/list.component.spec.ts +23 -0
- package/list/src/list.component.ts +147 -0
- package/list/src/models/badge-position.type.ts +1 -0
- package/list/src/models/list-item.model.ts +35 -0
- package/list/src/models/list-item.ts +21 -0
- package/list/src/models/public-api.ts +2 -0
- package/list/src/public-api.ts +3 -0
- package/list/src/upd-list.module.ts +30 -0
- package/ng-package.json +9 -6
- package/package.json +8 -5
- package/popover/ng-package.json +7 -0
- package/popover/src/index.ts +1 -0
- package/popover/src/popover.component.html +20 -0
- package/popover/src/popover.component.scss +8 -0
- package/popover/src/popover.component.spec.ts +23 -0
- package/popover/src/popover.component.ts +53 -0
- package/popover/src/popover.directive.spec.ts +8 -0
- package/popover/src/popover.directive.ts +128 -0
- package/popover/src/public-api.ts +3 -0
- package/popover/src/upd-popover.module.ts +20 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/public-api.ts +2 -0
- package/src/lib/types/component-size.type.ts +1 -0
- package/src/lib/types/public-api.ts +2 -0
- package/src/lib/types/validation-status.type.ts +1 -0
- package/src/lib/upd-components.module.ts +6 -0
- package/src/public-api.ts +1 -7
- package/tsconfig.lib.json +11 -11
- package/src/lib/components.component.ts +0 -14
- package/src/lib/components.module.ts +0 -17
- package/src/lib/components.service.ts +0 -9
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
ViewEncapsulation,
|
|
5
|
+
Output,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
OnInit,
|
|
8
|
+
OnChanges,
|
|
9
|
+
SimpleChanges,
|
|
10
|
+
HostBinding,
|
|
11
|
+
HostListener
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { ColorStyleType, BrandType, ButtonModel } from '@updevs/sdk/layout';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'upd-button',
|
|
17
|
+
templateUrl: './button.component.html',
|
|
18
|
+
styleUrls: ['./button.component.scss'],
|
|
19
|
+
encapsulation: ViewEncapsulation.None
|
|
20
|
+
})
|
|
21
|
+
export class ButtonComponent implements OnInit, OnChanges {
|
|
22
|
+
@HostBinding('class') classes: string[] = [];
|
|
23
|
+
|
|
24
|
+
@Input() text?: string;
|
|
25
|
+
@Input() model?: ButtonModel;
|
|
26
|
+
@Input() colorStyle?: ColorStyleType;
|
|
27
|
+
@Input() brandColorStyle?: BrandType;
|
|
28
|
+
@Input() customClasses?: string;
|
|
29
|
+
@Input() isActive = false;
|
|
30
|
+
@Input() isDisabled = false;
|
|
31
|
+
@Input() isOutline = false;
|
|
32
|
+
@Input() isGhost = false;
|
|
33
|
+
@Input() isSquare = false;
|
|
34
|
+
@Input() isPill = false;
|
|
35
|
+
@Input() isIcon = false;
|
|
36
|
+
@Input() isLoading = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the button should act as a list (top-bottom alignment instead of left-right related to neighbors).
|
|
39
|
+
*/
|
|
40
|
+
@Input() isList = false;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the button should be floating in the bottom right corner.
|
|
43
|
+
*/
|
|
44
|
+
@Input() isFloating = false;
|
|
45
|
+
@Input() isAction = false;
|
|
46
|
+
@Input() isNavigationLink = false;
|
|
47
|
+
@Input() shouldIgnoreBtnClass = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Emitted when the button is clicked.
|
|
51
|
+
* **NOTE:** The name of the event can not be 'click'. It would generate a conflict with the HTML event of same name.
|
|
52
|
+
* That would cause strange behaviors like preventing `isDisabled` from working correctly.
|
|
53
|
+
*/
|
|
54
|
+
@Output() readonly clicked = new EventEmitter<any>();
|
|
55
|
+
|
|
56
|
+
ngOnInit(): void {
|
|
57
|
+
this.setupFromModel();
|
|
58
|
+
this.updateClasses();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
62
|
+
if (!!changes['model']) {
|
|
63
|
+
this.setupFromModel();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
this.updateClasses();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@HostListener('click', ['$event'])
|
|
70
|
+
onClick(event: MouseEvent): void {
|
|
71
|
+
if (!!this.model && !!this.model.clickFunction) {
|
|
72
|
+
this.model.clickFunction(event);
|
|
73
|
+
} else {
|
|
74
|
+
this.clicked.emit(undefined);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private updateClasses(): void {
|
|
81
|
+
const outlineCls = this.isOutline ? 'outline-' : '';
|
|
82
|
+
const ghostCls = this.isGhost ? 'ghost-' : '';
|
|
83
|
+
const lClasses: string[] = this.shouldIgnoreBtnClass ? [] : ['btn'];
|
|
84
|
+
|
|
85
|
+
if (!!outlineCls || !!ghostCls || !!this.colorStyle || !!this.brandColorStyle) {
|
|
86
|
+
lClasses.push(`btn-${outlineCls || ghostCls}${this.colorStyle || this.brandColorStyle}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (this.isSquare) {
|
|
90
|
+
lClasses.push('btn-square');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.isPill) {
|
|
94
|
+
lClasses.push('btn-pill');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.isIcon) {
|
|
98
|
+
lClasses.push('btn-icon');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.isLoading) {
|
|
102
|
+
lClasses.push('btn-loading');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.isList) {
|
|
106
|
+
lClasses.push('btn-list');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.isFloating) {
|
|
110
|
+
lClasses.push('btn-floating');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (this.isAction) {
|
|
114
|
+
lClasses.push('btn-action');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (this.isNavigationLink) {
|
|
118
|
+
lClasses.push('nav-link');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (this.isActive) {
|
|
122
|
+
lClasses.push('active');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (this.isDisabled) {
|
|
126
|
+
lClasses.push('disabled');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.classes = [...lClasses, ...(this.customClasses?.split(' ') || [])];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private setupFromModel(): void {
|
|
133
|
+
if (!this.model) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
this.text = this.model.text;
|
|
138
|
+
this.colorStyle = this.model.colorStyle;
|
|
139
|
+
this.brandColorStyle = this.model.brandColorStyle;
|
|
140
|
+
this.customClasses += this.model.customClasses || '';
|
|
141
|
+
this.isActive = this.model.isActive;
|
|
142
|
+
this.isDisabled = this.model.isDisabled;
|
|
143
|
+
this.isOutline = this.model.isOutline;
|
|
144
|
+
this.isGhost = this.model.isGhost;
|
|
145
|
+
this.isSquare = this.model.isSquare;
|
|
146
|
+
this.isPill = this.model.isPill;
|
|
147
|
+
this.isIcon = this.model.isIcon;
|
|
148
|
+
this.isLoading = this.model.isLoading;
|
|
149
|
+
this.isList = this.model.isList;
|
|
150
|
+
this.isFloating = this.model.isFloating;
|
|
151
|
+
this.isAction = this.model.isAction;
|
|
152
|
+
this.isNavigationLink = this.model.isNavigationLink;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
|
|
4
|
+
import { ButtonComponent } from './button.component';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
imports: [
|
|
8
|
+
CommonModule
|
|
9
|
+
],
|
|
10
|
+
declarations: [
|
|
11
|
+
ButtonComponent
|
|
12
|
+
],
|
|
13
|
+
exports: [
|
|
14
|
+
ButtonComponent
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
export class UpdButtonModule {}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<ng-template *ngIf="!hoverEffect; else linkTpl" [ngTemplateOutlet]="structureTpl"></ng-template>
|
|
2
|
+
|
|
3
|
+
<!-- Template for cards that are links -->
|
|
4
|
+
<ng-template #linkTpl>
|
|
5
|
+
<a href="#" class="card" [ngClass]="classes">
|
|
6
|
+
<ng-template [ngTemplateOutlet]="structureTpl"></ng-template>
|
|
7
|
+
</a>
|
|
8
|
+
</ng-template>
|
|
9
|
+
|
|
10
|
+
<ng-template #structureTpl>
|
|
11
|
+
<!-- Ribbon -->
|
|
12
|
+
<div *ngIf="!!ribbonBackground" class="ribbon {{ribbonStyle === 'default' ? '' : 'ribbon-' + ribbonStyle}} bg-{{ribbonBackground}}">
|
|
13
|
+
<span *ngIf="!!ribbonText; else ribbonIconTpl">{{ribbonText}}</span>
|
|
14
|
+
<ng-template #ribbonIconTpl>
|
|
15
|
+
<upd-icon [model]="ribbonIcon" wrapperClasses="icon" [removeDefaultClasses]="true"></upd-icon>
|
|
16
|
+
</ng-template>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<!-- Status -->
|
|
20
|
+
<div *ngIf="!!statusBackground" class="card-status-{{statusPosition}} bg-{{statusBackground}}"></div>
|
|
21
|
+
|
|
22
|
+
<!-- Stamp -->
|
|
23
|
+
<div *ngIf="!!stampIcon" class="card-stamp">
|
|
24
|
+
<div class="card-stamp-icon bg-{{stampBackground}}">
|
|
25
|
+
<upd-icon [model]="stampIcon" wrapperClasses="icon" [removeDefaultClasses]="true"></upd-icon>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<!-- Header section -->
|
|
30
|
+
<div *ngIf="showHeader && (!!title || !!headerTemplate?.templateRef)" class="card-header" [class.card-header-light]="useLightHeader">
|
|
31
|
+
<ng-container *ngIf="!headerTemplate?.templateRef; else customHeaderTpl">
|
|
32
|
+
<h3 class="card-title">{{title}} <span *ngIf="!!subtitle" class="card-subtitle">{{subtitle}}</span></h3>
|
|
33
|
+
</ng-container>
|
|
34
|
+
<ng-template #customHeaderTpl [ngTemplateOutlet]="headerTemplate?.templateRef || null"></ng-template>
|
|
35
|
+
|
|
36
|
+
<!-- Actions -->
|
|
37
|
+
<div *ngIf="!!actionsTemplate || actions.length > 0" class="card-actions">
|
|
38
|
+
<ng-container *ngIf="actions.length > 0; else customActionsTpl">
|
|
39
|
+
<upd-button *ngFor="let btn of actions" [model]="btn" customClasses="me-1"></upd-button>
|
|
40
|
+
</ng-container>
|
|
41
|
+
<ng-template #customActionsTpl [ngTemplateOutlet]="actionsTemplate?.templateRef || null"></ng-template>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<!-- Body -->
|
|
46
|
+
<ng-container *ngIf="!!imageTemplate; else bodyTpl">
|
|
47
|
+
<ng-template *ngIf="imagePosition === 'left' || imagePosition === 'right'; else bodyWithTopBottomImageTpl"
|
|
48
|
+
[ngTemplateOutlet]="bodyWithSideImageTpl"></ng-template>
|
|
49
|
+
</ng-container>
|
|
50
|
+
|
|
51
|
+
<!-- Footer -->
|
|
52
|
+
<div *ngIf="!!footerText || !!footerTemplate" class="card-footer" [class.card-footer-transparent]="isFooterTransparent">
|
|
53
|
+
<ng-container *ngIf="!footerTemplate?.templateRef; else customFooterTpl">
|
|
54
|
+
<span *ngIf="!!footerText">{{footerText}}</span>
|
|
55
|
+
</ng-container>
|
|
56
|
+
<ng-template #customFooterTpl [ngTemplateOutlet]="footerTemplate?.templateRef || null"></ng-template>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<!-- Progress bar -->
|
|
60
|
+
<div *ngIf="showProgressBar" class="progress progress-sm card-progress">
|
|
61
|
+
<div class="progress-bar" [style.width.%]="progress" role="progressbar" [attr.aria-valuenow]="progress" aria-valuemin="0"
|
|
62
|
+
aria-valuemax="100">
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</ng-template>
|
|
66
|
+
|
|
67
|
+
<!-- Body with an image on either side -->
|
|
68
|
+
<ng-template #bodyWithSideImageTpl>
|
|
69
|
+
<div class="row row-0">
|
|
70
|
+
<div class="col-3" [class.order-md-last]="imagePosition === 'right'">
|
|
71
|
+
<div class="card-image-{{imagePosition}}">
|
|
72
|
+
<ng-template [ngTemplateOutlet]="imageTemplate!.templateRef"></ng-template>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="col">
|
|
76
|
+
<ng-template [ngTemplateOutlet]="bodyTpl"></ng-template>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</ng-template>
|
|
80
|
+
|
|
81
|
+
<!-- Body with an image on top or bottom -->
|
|
82
|
+
<ng-template #bodyWithTopBottomImageTpl>
|
|
83
|
+
<div *ngIf="imagePosition === 'top'" class="img-responsive-21x9 card-img-top">
|
|
84
|
+
<div class="card-image-{{imagePosition}}">
|
|
85
|
+
<ng-template [ngTemplateOutlet]="imageTemplate!.templateRef"></ng-template>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
<ng-template [ngTemplateOutlet]="bodyTpl"></ng-template>
|
|
89
|
+
<div *ngIf="imagePosition === 'bottom'" class="img-responsive-21x9 card-img-bottom">
|
|
90
|
+
<div class="card-image-{{imagePosition}}">
|
|
91
|
+
<ng-template [ngTemplateOutlet]="imageTemplate!.templateRef"></ng-template>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</ng-template>
|
|
95
|
+
|
|
96
|
+
<!-- Body -->
|
|
97
|
+
<ng-template #bodyTpl>
|
|
98
|
+
<div class="card-body">
|
|
99
|
+
<!-- If title was set, but the header section is hidden, we add the title to the body -->
|
|
100
|
+
<ng-container *ngIf="!showHeader && !!title">
|
|
101
|
+
<h3 class="card-title">{{title}} <span *ngIf="!!subtitle" class="card-subtitle">{{subtitle}}</span></h3>
|
|
102
|
+
</ng-container>
|
|
103
|
+
<ng-content></ng-content>
|
|
104
|
+
</div>
|
|
105
|
+
</ng-template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.card-image-right {
|
|
2
|
+
@extend .w-100 !optional;
|
|
3
|
+
@extend .h-100 !optional;
|
|
4
|
+
|
|
5
|
+
> img {
|
|
6
|
+
@extend .w-100 !optional;
|
|
7
|
+
@extend .h-100 !optional;
|
|
8
|
+
@extend .object-cover !optional;
|
|
9
|
+
@extend .card-img-end !optional;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.card-image-left {
|
|
14
|
+
@extend .w-100 !optional;
|
|
15
|
+
@extend .h-100 !optional;
|
|
16
|
+
|
|
17
|
+
> img {
|
|
18
|
+
@extend .w-100 !optional;
|
|
19
|
+
@extend .h-100 !optional;
|
|
20
|
+
@extend .object-cover !optional;
|
|
21
|
+
@extend .card-img-start !optional;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.card-image-top {
|
|
26
|
+
@extend .w-100 !optional;
|
|
27
|
+
@extend .h-100 !optional;
|
|
28
|
+
|
|
29
|
+
> img {
|
|
30
|
+
@extend .w-100 !optional;
|
|
31
|
+
@extend .h-100 !optional;
|
|
32
|
+
@extend .object-cover !optional;
|
|
33
|
+
@extend .card-img-top !optional;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.card-image-bottom {
|
|
38
|
+
@extend .w-100 !optional;
|
|
39
|
+
@extend .h-100 !optional;
|
|
40
|
+
|
|
41
|
+
> img {
|
|
42
|
+
@extend .w-100 !optional;
|
|
43
|
+
@extend .h-100 !optional;
|
|
44
|
+
@extend .object-cover !optional;
|
|
45
|
+
@extend .card-img-bottom !optional;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { CardComponent } from './card.component';
|
|
4
|
+
|
|
5
|
+
describe('CardComponent', () => {
|
|
6
|
+
let component: CardComponent;
|
|
7
|
+
let fixture: ComponentFixture<CardComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ CardComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(CardComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
ContentChild,
|
|
5
|
+
SimpleChanges,
|
|
6
|
+
OnInit,
|
|
7
|
+
OnChanges,
|
|
8
|
+
ViewEncapsulation, HostBinding
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { BgColorStyleType, ButtonModel } from '@updevs/sdk/layout';
|
|
11
|
+
import { TopBottomLeftRightType } from '@updevs/sdk/types';
|
|
12
|
+
import { IconModel } from '@updevs/icons';
|
|
13
|
+
|
|
14
|
+
import { CardFooterDirective } from './directives/card-footer.directive';
|
|
15
|
+
import { CardHeaderDirective } from './directives/card-header.directive';
|
|
16
|
+
import { HoverEffectType } from './types/hover-effect.type';
|
|
17
|
+
import { CardStateType } from './types/card-state.type';
|
|
18
|
+
import { StatusPositionType } from './types/status-position.type';
|
|
19
|
+
import { RibbonStyleType } from './types/ribbon-style.type';
|
|
20
|
+
import { CardStyleType } from './types/card-style.type';
|
|
21
|
+
import { CardImageDirective } from './directives/card-image.directive';
|
|
22
|
+
import { CardActionsDirective } from './directives/card-actions.directive';
|
|
23
|
+
|
|
24
|
+
@Component({
|
|
25
|
+
selector: 'upd-card',
|
|
26
|
+
templateUrl: './card.component.html',
|
|
27
|
+
styleUrls: ['./card.component.scss'],
|
|
28
|
+
encapsulation: ViewEncapsulation.None
|
|
29
|
+
})
|
|
30
|
+
export class CardComponent implements OnInit, OnChanges {
|
|
31
|
+
@HostBinding('class') @Input() wrapperClasses = '';
|
|
32
|
+
@ContentChild(CardHeaderDirective) headerTemplate?: CardHeaderDirective;
|
|
33
|
+
@ContentChild(CardFooterDirective) footerTemplate?: CardFooterDirective;
|
|
34
|
+
@ContentChild(CardImageDirective) imageTemplate?: CardImageDirective;
|
|
35
|
+
@ContentChild(CardActionsDirective) actionsTemplate?: CardActionsDirective;
|
|
36
|
+
|
|
37
|
+
@Input() title?: string;
|
|
38
|
+
@Input() subtitle?: string;
|
|
39
|
+
@Input() hoverEffect?: HoverEffectType;
|
|
40
|
+
@Input() state?: CardStateType;
|
|
41
|
+
@Input() type?: CardStyleType;
|
|
42
|
+
@Input() imagePosition?: TopBottomLeftRightType;
|
|
43
|
+
@Input() bgColor?: BgColorStyleType;
|
|
44
|
+
@Input() stampIcon?: IconModel;
|
|
45
|
+
@Input() stampBackground: BgColorStyleType = 'primary';
|
|
46
|
+
@Input() statusBackground?: BgColorStyleType;
|
|
47
|
+
@Input() statusPosition: StatusPositionType = 'top';
|
|
48
|
+
@Input() ribbonBackground?: BgColorStyleType;
|
|
49
|
+
@Input() ribbonStyle: RibbonStyleType = 'default';
|
|
50
|
+
@Input() ribbonIcon?: IconModel = { tablerIcon: 'star' };
|
|
51
|
+
@Input() ribbonText?: string;
|
|
52
|
+
@Input() rotate?: 'right' | 'left';
|
|
53
|
+
@Input() removeBorder = false;
|
|
54
|
+
@Input() useLightHeader = false;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the header should be displayed.
|
|
57
|
+
*/
|
|
58
|
+
@Input() showHeader = true;
|
|
59
|
+
@Input() isFooterTransparent = false;
|
|
60
|
+
@Input() footerText?: string;
|
|
61
|
+
@Input() showProgressBar = false;
|
|
62
|
+
@Input() progress?: number;
|
|
63
|
+
@Input() actions: ButtonModel[] = [];
|
|
64
|
+
|
|
65
|
+
classes: string[] = [];
|
|
66
|
+
|
|
67
|
+
ngOnInit(): void {
|
|
68
|
+
this.updateClasses();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
72
|
+
this.updateClasses();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
private updateClasses(): void {
|
|
76
|
+
const lClasses: string[] = [];
|
|
77
|
+
|
|
78
|
+
if (this.removeBorder) {
|
|
79
|
+
lClasses.push('card-borderless');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!!this.hoverEffect) {
|
|
83
|
+
lClasses.push('card-link');
|
|
84
|
+
|
|
85
|
+
if (this.hoverEffect !== 'default') {
|
|
86
|
+
lClasses.push(`card-link-${this.hoverEffect}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!!this.state) {
|
|
91
|
+
lClasses.push(`card-${this.state}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!!this.bgColor) {
|
|
95
|
+
lClasses.push(`bg-${this.bgColor}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (!!this.rotate) {
|
|
99
|
+
lClasses.push(`card-rotate-${this.rotate}`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!!this.type) {
|
|
103
|
+
lClasses.push(`card-${this.type}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (!!this.hoverEffect) {
|
|
107
|
+
this.classes = [...lClasses];
|
|
108
|
+
} else {
|
|
109
|
+
this.wrapperClasses = 'card ' + lClasses.join(' ');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CardStateType = 'active' | 'inactive';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CardStyleType = 'stacked';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type HoverEffectType = 'default' | 'rotate' | 'pop';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RibbonStyleType = 'default' | 'top' | 'bottom' | 'bookmark' | 'start';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StatusPositionType = 'top' | 'bottom' | 'start';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { UpdIconsModule } from '@updevs/icons';
|
|
4
|
+
import { UpdButtonModule } from '@updevs/components/button';
|
|
5
|
+
|
|
6
|
+
import { CardComponent } from './card.component';
|
|
7
|
+
import { CardHeaderDirective } from './directives/card-header.directive';
|
|
8
|
+
import { CardFooterDirective } from './directives/card-footer.directive';
|
|
9
|
+
import { CardImageDirective } from './directives/card-image.directive';
|
|
10
|
+
import { CardActionsDirective } from './directives/card-actions.directive';
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [
|
|
14
|
+
CommonModule,
|
|
15
|
+
UpdIconsModule,
|
|
16
|
+
UpdButtonModule
|
|
17
|
+
],
|
|
18
|
+
declarations: [
|
|
19
|
+
CardComponent,
|
|
20
|
+
CardHeaderDirective,
|
|
21
|
+
CardFooterDirective,
|
|
22
|
+
CardImageDirective,
|
|
23
|
+
CardActionsDirective
|
|
24
|
+
],
|
|
25
|
+
exports: [
|
|
26
|
+
CardComponent,
|
|
27
|
+
CardHeaderDirective,
|
|
28
|
+
CardFooterDirective,
|
|
29
|
+
CardImageDirective
|
|
30
|
+
]
|
|
31
|
+
})
|
|
32
|
+
export class UpdCardModule {}
|