@registrucentras/rc-ses-angular-components 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.editorconfig +17 -0
  2. package/.gitattributes +1 -0
  3. package/.github/workflows/build-and-publish.yml +50 -0
  4. package/.vscode/extensions.json +4 -0
  5. package/.vscode/launch.json +20 -0
  6. package/.vscode/tasks.json +42 -0
  7. package/README.md +31 -0
  8. package/RELEASE_NOTES.md +29 -0
  9. package/angular.json +173 -0
  10. package/karma.conf.js +53 -0
  11. package/package.json +48 -0
  12. package/projects/app/public/favicon.ico +0 -0
  13. package/projects/app/src/app/app.component.html +3 -0
  14. package/projects/app/src/app/app.component.scss +0 -0
  15. package/projects/app/src/app/app.component.ts +20 -0
  16. package/projects/app/src/app/app.config.ts +33 -0
  17. package/projects/app/src/app/app.routes.ts +16 -0
  18. package/projects/app/src/app/landing-page/landing-page.html +20 -0
  19. package/projects/app/src/app/landing-page/landing-page.scss +0 -0
  20. package/projects/app/src/app/landing-page/landing-page.ts +37 -0
  21. package/projects/app/src/app/sample-form-multiple-steps/sample-form-multiple-steps.html +283 -0
  22. package/projects/app/src/app/sample-form-multiple-steps/sample-form-multiple-steps.scss +0 -0
  23. package/projects/app/src/app/sample-form-multiple-steps/sample-form-multiple-steps.ts +223 -0
  24. package/projects/app/src/app/sample-form-single-step/sample-form-single-step.html +271 -0
  25. package/projects/app/src/app/sample-form-single-step/sample-form-single-step.scss +0 -0
  26. package/projects/app/src/app/sample-form-single-step/sample-form-single-step.ts +142 -0
  27. package/projects/app/src/index.html +18 -0
  28. package/projects/app/src/main.ts +6 -0
  29. package/projects/app/tsconfig.app.json +15 -0
  30. package/projects/app/tsconfig.spec.json +15 -0
  31. package/projects/rc-ses/angular-components/README.md +31 -0
  32. package/projects/rc-ses/angular-components/ng-package.json +13 -0
  33. package/projects/rc-ses/angular-components/package-lock.json +224 -0
  34. package/projects/rc-ses/angular-components/package.json +40 -0
  35. package/projects/rc-ses/angular-components/src/lib/components/accordion/accordion.scss +71 -0
  36. package/projects/rc-ses/angular-components/src/lib/components/accordion/accordion.ts +31 -0
  37. package/projects/rc-ses/angular-components/src/lib/components/breadcrumbs/breadcrumbs.html +7 -0
  38. package/projects/rc-ses/angular-components/src/lib/components/breadcrumbs/breadcrumbs.scss +54 -0
  39. package/projects/rc-ses/angular-components/src/lib/components/breadcrumbs/breadcrumbs.ts +40 -0
  40. package/projects/rc-ses/angular-components/src/lib/components/button/button.scss +248 -0
  41. package/projects/rc-ses/angular-components/src/lib/components/button/button.spec.ts +46 -0
  42. package/projects/rc-ses/angular-components/src/lib/components/button/button.ts +34 -0
  43. package/projects/rc-ses/angular-components/src/lib/components/divider/divider.scss +18 -0
  44. package/projects/rc-ses/angular-components/src/lib/components/divider/divider.ts +16 -0
  45. package/projects/rc-ses/angular-components/src/lib/components/form/form-field/form-field.html +11 -0
  46. package/projects/rc-ses/angular-components/src/lib/components/form/form-field/form-field.scss +149 -0
  47. package/projects/rc-ses/angular-components/src/lib/components/form/form-field/form-field.ts +87 -0
  48. package/projects/rc-ses/angular-components/src/lib/components/form/input/agreement-checkbox/agreement-checkbox.html +10 -0
  49. package/projects/rc-ses/angular-components/src/lib/components/form/input/agreement-checkbox/agreement-checkbox.scss +36 -0
  50. package/projects/rc-ses/angular-components/src/lib/components/form/input/agreement-checkbox/agreement-checkbox.ts +89 -0
  51. package/projects/rc-ses/angular-components/src/lib/components/form/input/checkbox/checkbox.scss +132 -0
  52. package/projects/rc-ses/angular-components/src/lib/components/form/input/datepicker/datepicker.scss +18 -0
  53. package/projects/rc-ses/angular-components/src/lib/components/form/input/input/input.scss +66 -0
  54. package/projects/rc-ses/angular-components/src/lib/components/form/input/input/input.ts +31 -0
  55. package/projects/rc-ses/angular-components/src/lib/components/form/input/number-stepper/number-stepper.html +30 -0
  56. package/projects/rc-ses/angular-components/src/lib/components/form/input/number-stepper/number-stepper.scss +88 -0
  57. package/projects/rc-ses/angular-components/src/lib/components/form/input/number-stepper/number-stepper.ts +103 -0
  58. package/projects/rc-ses/angular-components/src/lib/components/form/input/radio/radio.scss +85 -0
  59. package/projects/rc-ses/angular-components/src/lib/components/form/input/radio-button-group/radio-button-group.html +7 -0
  60. package/projects/rc-ses/angular-components/src/lib/components/form/input/radio-button-group/radio-button-group.scss +87 -0
  61. package/projects/rc-ses/angular-components/src/lib/components/form/input/radio-button-group/radio-button-group.ts +101 -0
  62. package/projects/rc-ses/angular-components/src/lib/components/form/input/select/select.html +40 -0
  63. package/projects/rc-ses/angular-components/src/lib/components/form/input/select/select.scss +153 -0
  64. package/projects/rc-ses/angular-components/src/lib/components/form/input/select/select.ts +155 -0
  65. package/projects/rc-ses/angular-components/src/lib/components/icons/icons.module.ts +61 -0
  66. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-actions/service-form-actions.html +19 -0
  67. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-actions/service-form-actions.scss +64 -0
  68. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-actions/service-form-actions.ts +45 -0
  69. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-container/service-form-container.html +16 -0
  70. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-container/service-form-container.scss +32 -0
  71. package/projects/rc-ses/angular-components/src/lib/components/layout/service-form-container/service-form-container.ts +43 -0
  72. package/projects/rc-ses/angular-components/src/lib/components/layout/service-header/service-header.html +5 -0
  73. package/projects/rc-ses/angular-components/src/lib/components/layout/service-header/service-header.scss +35 -0
  74. package/projects/rc-ses/angular-components/src/lib/components/layout/service-header/service-header.ts +48 -0
  75. package/projects/rc-ses/angular-components/src/lib/components/layout/service-page/service-page.html +14 -0
  76. package/projects/rc-ses/angular-components/src/lib/components/layout/service-page/service-page.scss +38 -0
  77. package/projects/rc-ses/angular-components/src/lib/components/layout/service-page/service-page.ts +37 -0
  78. package/projects/rc-ses/angular-components/src/lib/components/layout/service-wizard-steps/service-wizard-steps.html +18 -0
  79. package/projects/rc-ses/angular-components/src/lib/components/layout/service-wizard-steps/service-wizard-steps.scss +93 -0
  80. package/projects/rc-ses/angular-components/src/lib/components/layout/service-wizard-steps/service-wizard-steps.ts +41 -0
  81. package/projects/rc-ses/angular-components/src/lib/components/message/message.html +39 -0
  82. package/projects/rc-ses/angular-components/src/lib/components/message/message.scss +141 -0
  83. package/projects/rc-ses/angular-components/src/lib/components/message/message.ts +52 -0
  84. package/projects/rc-ses/angular-components/src/lib/theme/index.scss +65 -0
  85. package/projects/rc-ses/angular-components/src/lib/theme/palette.scss +183 -0
  86. package/projects/rc-ses/angular-components/src/lib/theme/theme.scss +24 -0
  87. package/projects/rc-ses/angular-components/src/lib/theme/typography.scss +63 -0
  88. package/projects/rc-ses/angular-components/src/public-api.ts +22 -0
  89. package/projects/rc-ses/angular-components/src/styles.scss +40 -0
  90. package/projects/rc-ses/angular-components/src/test.ts +14 -0
  91. package/projects/rc-ses/angular-components/tsconfig.lib.json +15 -0
  92. package/projects/rc-ses/angular-components/tsconfig.lib.prod.json +11 -0
  93. package/tsconfig.json +37 -0
  94. package/tsconfig.spec.json +18 -0
@@ -0,0 +1,87 @@
1
+ @use 'sass:color';
2
+ @use '@angular/material' as mat;
3
+
4
+ @mixin bootstrap($theme, $typography) {
5
+ @layer rc-ses {
6
+ .rc-ses-radio-button-group {
7
+ border: 1px solid #{mat.get-theme-color($theme, neutral, 50)};
8
+ border-radius: .1875rem;
9
+ display: block;
10
+ padding: .375rem;
11
+
12
+ &--has-background {
13
+ background-color: mat.get-theme-color($theme, neutral, 98);
14
+ border: none !important;
15
+ }
16
+
17
+ &--radio-as-buttons {
18
+ background-color: transparent !important;
19
+ border: none !important;
20
+ padding: 0;
21
+
22
+ .mat-mdc-radio-group {
23
+ display: flex;
24
+ flex-wrap: wrap;
25
+ justify-content: stretch;
26
+ margin: -.25rem;
27
+ }
28
+
29
+ .mat-mdc-radio-button {
30
+ background-color: var(--mdc-outlined-button-container-color);
31
+ border-color: var(--mdc-outlined-text-field-outline-color);
32
+ border-style: solid;
33
+ border-radius: var(--mdc-outlined-button-container-shape);
34
+ border-width: 1px;
35
+ display: flex;
36
+ flex: 0 0 0%;
37
+ justify-content: center;
38
+ margin: .25rem;
39
+ padding: 0 !important;
40
+
41
+ .mdc-radio {
42
+ position: absolute !important;
43
+ opacity: 0 !important;
44
+ padding: 0 !important;
45
+ z-index: -1;
46
+ }
47
+
48
+ .mdc-label {
49
+ cursor: pointer;
50
+ font-size: var(--mdc-text-button-label-text-size);
51
+ font-weight: 600;
52
+ line-height: 1.125rem;
53
+ padding: .8125rem 1rem !important;
54
+ text-wrap: nowrap;
55
+ }
56
+
57
+ &:hover {
58
+ border-color: mat.get-theme-color($theme, neutral, 25);
59
+ background-color: mat.get-theme-color($theme, neutral, 98);
60
+ }
61
+
62
+ &:active {
63
+ border-color: mat.get-theme-color($theme, neutral, 20);
64
+ background-color: mat.get-theme-color($theme, neutral, 95);
65
+ }
66
+
67
+ &:focus-within:not(:hover) {
68
+ outline: 2px solid #{mat.get-theme-color($theme, neutral, 0)} !important;
69
+ outline-offset: 2px;
70
+ }
71
+
72
+ &.mat-mdc-radio-checked {
73
+ border-color: mat.get-theme-color($theme, primary, 90);
74
+ background-color: mat.get-theme-color($theme, primary, 95);
75
+ }
76
+ }
77
+ }
78
+
79
+ }
80
+ }
81
+
82
+ @layer rc-ses-variables {
83
+ :root {
84
+
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,101 @@
1
+ import { CommonModule, DOCUMENT } from "@angular/common";
2
+ import { Component, AfterViewInit, OnDestroy, ElementRef, Inject, Renderer2, Input, ContentChildren, QueryList, OnChanges, SimpleChanges, OnInit, forwardRef, ViewChild, Injector, booleanAttribute } from "@angular/core";
3
+ import { ControlContainer, ControlValueAccessor, FormControl, FormControlDirective, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule } from "@angular/forms";
4
+ import { MatButtonModule } from "@angular/material/button";
5
+ import { MatCommonModule } from "@angular/material/core";
6
+ import { MatFormFieldModule } from "@angular/material/form-field";
7
+ import { MatRadioButton, MatRadioModule } from "@angular/material/radio";
8
+ import { RcSesButtonDirective } from "../../../button/button";
9
+
10
+ type Option = { value: string, label: string };
11
+ type Options = Option[];
12
+
13
+ @Component({
14
+ selector: 'rc-ses-radio-button-group',
15
+ standalone: true,
16
+ templateUrl: 'radio-button-group.html',
17
+ imports: [
18
+ CommonModule,
19
+ FormsModule,
20
+ ReactiveFormsModule,
21
+
22
+ MatButtonModule,
23
+ MatCommonModule,
24
+ MatFormFieldModule,
25
+ MatRadioModule,
26
+
27
+ RcSesButtonDirective,
28
+ ],
29
+ host: {
30
+ class: 'rc-ses-element rc-ses-radio-button-group'
31
+ },
32
+ providers: [
33
+ {
34
+ provide: NG_VALUE_ACCESSOR,
35
+ useExisting: forwardRef(() => RcSesRadioButtonGroupComponent),
36
+ multi: true
37
+ }
38
+ ]
39
+ })
40
+ export class RcSesRadioButtonGroupComponent implements ControlValueAccessor, AfterViewInit, OnChanges, OnInit, OnDestroy {
41
+ @ContentChildren(MatRadioButton)
42
+ queryOptions!: QueryList<MatRadioButton>;
43
+
44
+ @ViewChild(FormControlDirective, {static: true})
45
+ formControlDirective: FormControlDirective | undefined;
46
+
47
+ @Input() formControl!: FormControl;
48
+ @Input() formControlName: string | undefined;
49
+ @Input() options!: Options;
50
+
51
+ @Input({ transform: booleanAttribute }) displayAsButtons: boolean = false;
52
+ @Input({ transform: booleanAttribute }) hasBackground: boolean = false;
53
+
54
+ initialized: boolean = false;
55
+
56
+ constructor(
57
+ @Inject(DOCUMENT) private _document: Document,
58
+ public _element: ElementRef,
59
+ private _renderer: Renderer2,
60
+ private injector: Injector,
61
+ ) {}
62
+
63
+ get controlContainer() {
64
+ return this.injector.get(ControlContainer);
65
+ }
66
+
67
+ get control() {
68
+ return this.formControl ||
69
+ (this.formControlName && this.controlContainer.control?.get(this.formControlName));
70
+ }
71
+
72
+ writeValue(obj: any): void {
73
+ this.formControlDirective?.valueAccessor?.writeValue(obj);
74
+ }
75
+
76
+ registerOnChange(fn: any): void {
77
+ this.formControlDirective?.valueAccessor?.registerOnChange(fn);
78
+ }
79
+
80
+ registerOnTouched(fn: any): void {
81
+ this.formControlDirective?.valueAccessor?.registerOnTouched(fn);
82
+ }
83
+
84
+ ngOnChanges(_changes: SimpleChanges): void {}
85
+
86
+ ngOnInit() {
87
+ if (this.displayAsButtons)
88
+ this._renderer.addClass(this._element.nativeElement, 'rc-ses-radio-button-group--radio-as-buttons');
89
+
90
+ if (this.hasBackground)
91
+ this._renderer.addClass(this._element.nativeElement, 'rc-ses-radio-button-group--has-background');
92
+ }
93
+
94
+ ngAfterViewInit() {
95
+ this.initialized = true;
96
+ }
97
+
98
+ ngOnDestroy() {
99
+ this.initialized = false;
100
+ }
101
+ }
@@ -0,0 +1,40 @@
1
+ <mat-form-field>
2
+ <mat-select
3
+ [formControl]="control"
4
+ [placeholder]="placeholder"
5
+ [multiple]="multiple"
6
+ [panelWidth]="panelWidth"
7
+ hideSingleSelectionIndicator
8
+ disableRipple
9
+ >
10
+ @if (searchable) {
11
+ <div class="rc-ses-select-search-wrapper">
12
+ @if (multiple) {
13
+ <mat-checkbox
14
+ [checked]="isFullSelection()"
15
+ [indeterminate]="isPartialSelection()"
16
+ (change)="handleSelectAllChange($event.checked)"
17
+ />
18
+ }
19
+ <mat-form-field>
20
+ <mat-icon matPrefix>search</mat-icon>
21
+ <input
22
+ rc-ses-input
23
+ matInput
24
+ type="text"
25
+ placeholder="Ieškoti"
26
+ (keyup)="filterOptions($event)"
27
+ />
28
+ </mat-form-field>
29
+ </div>
30
+ }
31
+ @for (option of filteredOptions; track option.value) {
32
+ <mat-option [value]="option.value">
33
+ {{ option.label }}
34
+ @if (option.description) {
35
+ <div class="description">{{ option.description }}</div>
36
+ }
37
+ </mat-option>
38
+ }
39
+ </mat-select>
40
+ </mat-form-field>
@@ -0,0 +1,153 @@
1
+ @use 'sass:color';
2
+ @use '@angular/material' as mat;
3
+
4
+ @mixin bootstrap($theme, $typography) {
5
+ @layer rc-ses {
6
+ .rc-ses-select {
7
+ display: block;
8
+ flex-grow: 1;
9
+
10
+ .mat-mdc-form-field {
11
+ width: 100%;
12
+ }
13
+
14
+ .mat-mdc-select-arrow-wrapper {
15
+ height: #{map-get($typography, 'body-2', 'line-height')} !important;
16
+ }
17
+ }
18
+
19
+ .cdk-overlay-pane {
20
+
21
+ .rc-ses-select-search-wrapper {
22
+ background-color: mat.get-theme-color($theme, neutral, 100);
23
+ border-bottom: 1px solid mat.get-theme-color($theme, neutral, 90);
24
+ border-top-left-radius: .25rem;
25
+ border-top-right-radius: .25rem;
26
+ display: flex;
27
+ margin-bottom: .375rem;
28
+ margin-top: -.375rem;
29
+ padding: .75rem 1rem;
30
+ position: sticky;
31
+ top: -.375rem;
32
+ z-index: 1;
33
+
34
+ .mat-mdc-checkbox {
35
+ margin-left: -.375rem;
36
+ margin-right: .5rem;
37
+ margin-top: .125rem;
38
+ vertical-align: top;
39
+ }
40
+
41
+ .mat-mdc-form-field {
42
+ flex-grow: 1;
43
+ }
44
+ }
45
+
46
+ div.mat-mdc-select-panel {
47
+ --mdc-list-list-item-container-shape: .1875rem !important;
48
+
49
+ border-radius: .25rem !important;
50
+ padding-bottom: .375rem !important;
51
+ padding-top: .375rem !important;
52
+ scrollbar-width: thin;
53
+
54
+ .mat-mdc-optgroup-label {
55
+ padding-left: .75rem !important;
56
+ padding-right: .75rem !important;
57
+
58
+ .mdc-list-item__primary-text {
59
+ color: mat.get-theme-color($theme, primary, 40) !important;
60
+ letter-spacing: .01em !important;
61
+ text-transform: uppercase !important;
62
+ }
63
+ }
64
+
65
+ .mdc-list-item {
66
+ margin-left: .375rem;
67
+ margin-right: .375rem;
68
+ padding: .8125rem .75rem !important;
69
+
70
+ &--disabled {
71
+ background-color: transparent !important;
72
+
73
+ &:before {
74
+ background-color: transparent !important;
75
+ }
76
+
77
+ .mat-pseudo-checkbox {
78
+ display: none !important;
79
+ }
80
+ }
81
+
82
+ &--selected {
83
+
84
+ &.mat-mdc-option-active:not(.mdc-list-item--disabled):not(.mat-mdc-option-multiple) {
85
+ background-color: mat.get-theme-color($theme, neutral, 98) !important;
86
+ }
87
+ }
88
+ }
89
+
90
+ .mat-mdc-option {
91
+ min-height: 1.125rem !important;
92
+
93
+ &-multiple {
94
+
95
+ .mat-pseudo-checkbox {
96
+ margin-bottom: -.25rem;
97
+ margin-top: -.25rem;
98
+ }
99
+ }
100
+
101
+ .description {
102
+ color: mat.get-theme-color($theme, neutral, 40) !important;
103
+ font-size: map-get($typography, 'body-2', 'font-size');
104
+ font-style: italic;
105
+ }
106
+
107
+ .mat-pseudo-checkbox-checked::after {
108
+ content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none"><path fill="%23087fb2" d="m14.533 5.031-8 8a.751.751 0 0 1-1.063 0l-3.5-3.5A.751.751 0 0 1 3.033 8.47l2.969 2.97 7.47-7.469a.751.751 0 0 1 1.062 1.063l-.001-.002Z"/></svg>') !important;
109
+ }
110
+ }
111
+
112
+ .mat-mdc-form-field-icon-prefix .mat-icon {
113
+ padding: 0 !important;
114
+ }
115
+ }
116
+
117
+ &:not(.mat-mdc-select-panel-above) {
118
+
119
+ div.mat-mdc-select-panel {
120
+ margin-top: .25rem;
121
+ }
122
+ }
123
+ }
124
+ }
125
+
126
+ @layer rc-ses-variables {
127
+ :root {
128
+ --mdc-list-list-item-label-text-color: #{mat.get-theme-color($theme, neutral, 20)};
129
+ --mdc-list-list-item-label-text-line-height: #{map-get($typography, 'body-2', 'line-height')};
130
+ --mdc-list-list-item-label-text-size: #{map-get($typography, 'body-2', 'font-size')};
131
+
132
+ --mat-optgroup-label-text-color: #{mat.get-theme-color($theme, primary, 40)};
133
+ --mat-optgroup-label-text-line-height: 1.0625rem;
134
+ --mat-optgroup-label-text-size: .75rem;
135
+ --mat-optgroup-label-text-weight: 500;
136
+
137
+ --mat-option-hover-state-layer-color: #{mat.get-theme-color($theme, neutral, 98)};
138
+ --mat-option-focus-state-layer-color: #{mat.get-theme-color($theme, neutral, 98)};
139
+ --mat-option-label-text-line-height: #{map-get($typography, 'body-2', 'line-height')};
140
+ --mat-option-label-text-size: #{map-get($typography, 'body-2', 'font-size')};
141
+ --mat-option-selected-state-layer-color: transparent;
142
+ --mat-option-selected-state-label-text-color: #{mat.get-theme-color($theme, neutral, 20)};
143
+
144
+ --mat-select-container-elevation-shadow:
145
+ 0px 4px 16px 0px #{color.adjust(#091e42, $alpha: -0.76)},
146
+ 0px 8px 16px 0px #{color.adjust(#091e42, $alpha: -0.90)};
147
+ --mat-select-trigger-text-size: #{map-get($typography, 'body-2', 'font-size')};
148
+ --mat-select-trigger-text-line-height: #{map-get($typography, 'body-2', 'line-height')};
149
+ --mat-select-panel-background-color: white;
150
+ --mat-select-placeholder-text-color: #{mat.get-theme-color($theme, neutral, 40)};
151
+ }
152
+ }
153
+ }
@@ -0,0 +1,155 @@
1
+ import { CommonModule, DOCUMENT } from "@angular/common";
2
+ import { Component, AfterViewInit, OnDestroy, ElementRef, Inject, Renderer2, Input, ContentChildren, QueryList, ChangeDetectorRef, model, OnChanges, SimpleChanges, OnInit, forwardRef, ViewChild, Injector, booleanAttribute } from "@angular/core";
3
+ import { ControlContainer, ControlValueAccessor, FormControl, FormControlDirective, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule } from "@angular/forms";
4
+ import { MatButtonModule } from "@angular/material/button";
5
+ import { MatCheckboxModule } from "@angular/material/checkbox";
6
+ import { MatCommonModule, MatOption, MatOptionModule } from "@angular/material/core";
7
+ import { MatExpansionModule } from "@angular/material/expansion";
8
+ import { MatFormFieldModule } from "@angular/material/form-field";
9
+ import { MatIconModule } from "@angular/material/icon";
10
+ import { MatInputModule } from "@angular/material/input";
11
+ import { MatSelectModule } from "@angular/material/select";
12
+
13
+ type Option = { value: string, label: string, description?: string };
14
+ type Options = Option[];
15
+
16
+ @Component({
17
+ selector: 'rc-ses-select',
18
+ standalone: true,
19
+ templateUrl: 'select.html',
20
+ imports: [
21
+ CommonModule,
22
+ FormsModule,
23
+ ReactiveFormsModule,
24
+
25
+ MatButtonModule,
26
+ MatCheckboxModule,
27
+ MatCommonModule,
28
+ MatExpansionModule,
29
+ MatFormFieldModule,
30
+ MatIconModule,
31
+ MatInputModule,
32
+ MatOptionModule,
33
+ MatSelectModule,
34
+ ],
35
+ host: {
36
+ class: 'rc-ses-element rc-ses-select'
37
+ },
38
+ providers: [
39
+ {
40
+ provide: NG_VALUE_ACCESSOR,
41
+ useExisting: forwardRef(() => RcSesSelectComponent),
42
+ multi: true
43
+ }
44
+ ]
45
+ })
46
+ export class RcSesSelectComponent implements ControlValueAccessor, AfterViewInit, OnChanges, OnInit, OnDestroy {
47
+ @ContentChildren(MatOption)
48
+ queryOptions!: QueryList<MatOption>;
49
+
50
+ @ViewChild(FormControlDirective, {static: true})
51
+ formControlDirective: FormControlDirective | undefined;
52
+
53
+ @Input() formControl!: FormControl;
54
+ @Input() formControlName: string | undefined;
55
+
56
+ @Input() options!: Options;
57
+
58
+ @Input({ transform: booleanAttribute }) multiple: boolean = false;
59
+ @Input({ transform: booleanAttribute }) searchable: boolean | '' = false;
60
+ @Input() panelWidth: 'auto' | 'dynamic' | null = 'auto';
61
+ @Input() placeholder: string = '';
62
+
63
+ filteredOptions: Options = [];
64
+
65
+ initialized: boolean = false;
66
+
67
+ readonly selectAll = model(false);
68
+
69
+ constructor(
70
+ @Inject(DOCUMENT) private _document: Document,
71
+ public _element: ElementRef,
72
+ private _renderer: Renderer2,
73
+ private injector: Injector,
74
+ ) {}
75
+
76
+ get controlContainer() {
77
+ return this.injector.get(ControlContainer);
78
+ }
79
+
80
+ get control() {
81
+ return this.formControl ||
82
+ (this.formControlName && this.controlContainer.control?.get(this.formControlName));
83
+ }
84
+
85
+ writeValue(obj: any): void {
86
+ this.formControlDirective?.valueAccessor?.writeValue(obj);
87
+ }
88
+
89
+ registerOnChange(fn: any): void {
90
+ this.formControlDirective?.valueAccessor?.registerOnChange(fn);
91
+ }
92
+
93
+ registerOnTouched(fn: any): void {
94
+ this.formControlDirective?.valueAccessor?.registerOnTouched(fn);
95
+ }
96
+
97
+ ngOnChanges(changes: SimpleChanges): void {
98
+ this.filteredOptions = changes['options'].currentValue
99
+ ? changes['options'].currentValue
100
+ : []
101
+ }
102
+
103
+ ngOnInit() {
104
+ if (this.searchable)
105
+ this._renderer.addClass(this._element.nativeElement, 'rc-ses-select-searchable');
106
+
107
+ if (this.multiple)
108
+ this._renderer.addClass(this._element.nativeElement, 'rc-ses-select-multiple');
109
+ }
110
+
111
+ ngAfterViewInit() {
112
+ this.initialized = true;
113
+ }
114
+
115
+ ngOnDestroy() {
116
+ this.initialized = false;
117
+ }
118
+
119
+ filterOptions = ($event: KeyboardEvent) => {
120
+ $event.stopPropagation();
121
+ const query = ($event.target as HTMLInputElement).value;
122
+
123
+ this.filteredOptions = !query?.length
124
+ ? this.options
125
+ : this.options.filter((o) => o.label.indexOf(query) !== -1);
126
+ }
127
+
128
+ handleSelectAllChange = (checked: boolean) => {
129
+ const filteredOptionValues: Option['value'][] = this.filteredOptions.map((o) => o.value) || [];
130
+
131
+ if (checked) {
132
+ this.control.setValue(filteredOptionValues)
133
+ } else {
134
+ const currentSelection: Option['value'][] = this.control.value || [];
135
+ this.control.setValue(currentSelection.filter((c) => !filteredOptionValues.includes(c)))
136
+ }
137
+ }
138
+
139
+ isFullSelection = () => {
140
+ const currentSelection: Option['value'][] = this.control.value || [];
141
+
142
+ if (this.filteredOptions.length === 0 || currentSelection.length === 0)
143
+ return false;
144
+
145
+ return this.filteredOptions.every((o) => currentSelection.includes(o.value));
146
+ }
147
+
148
+ isPartialSelection = () => {
149
+ if (!this.filteredOptions.length || !this.control.value.length)
150
+ return false;
151
+
152
+ const currentSelection: Option['value'][] = this.control.value || [];
153
+ return !this.isFullSelection() && this.filteredOptions.some((o) => currentSelection.includes(o.value));
154
+ }
155
+ }
@@ -0,0 +1,61 @@
1
+ import { DomSanitizer } from '@angular/platform-browser';
2
+ import { NgModule } from '@angular/core';
3
+ import { MatIconModule, MatIconRegistry } from "@angular/material/icon";
4
+
5
+ @NgModule({
6
+ imports: [
7
+ MatIconModule,
8
+ MatIconModule,
9
+ ],
10
+ })
11
+ export class RcSesIconsModule {
12
+ constructor(
13
+ iconRegistry: MatIconRegistry,
14
+ sanitizer: DomSanitizer,
15
+ ) {
16
+ iconRegistry.addSvgIconLiteral(
17
+ 'rc-ses-arrow-right',
18
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#1F2733" d="m20.78 12.531-6.75 6.75a.75.75 0 1 1-1.06-1.061l5.47-5.47H3.75a.75.75 0 1 1 0-1.5h14.69l-5.47-5.469a.75.75 0 1 1 1.06-1.061l6.75 6.75a.748.748 0 0 1 0 1.061Z"/></svg>`)
19
+ );
20
+
21
+ iconRegistry.addSvgIconLiteral(
22
+ 'rc-ses-caret-left',
23
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#0E6790" d="M10.354 12.646a.501.501 0 0 1-.707.708l-5-5a.5.5 0 0 1 0-.707l5-5a.5.5 0 1 1 .707.707L5.707 8l4.647 4.646Z"/></svg>`)
24
+ );
25
+
26
+ iconRegistry.addSvgIconLiteral(
27
+ 'rc-ses-circle',
28
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" fill="#1f2733"/></svg>`)
29
+ );
30
+
31
+ iconRegistry.addSvgIconLiteral(
32
+ 'rc-ses-check-circle',
33
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><circle cx="12" cy="12" r="12" fill="#00a879"/><path fill="#fff" d="m18.533 9.03-8 8a.751.751 0 0 1-1.063 0l-3.5-3.5a.751.751 0 1 1 1.063-1.062l2.969 2.97 7.47-7.469a.751.751 0 0 1 1.062 1.063l-.001-.002Z"/></svg>`)
34
+ );
35
+
36
+ iconRegistry.addSvgIconLiteral(
37
+ 'rc-ses-check-circle-fill',
38
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M12 2.25A9.75 9.75 0 1 0 21.75 12 9.76 9.76 0 0 0 12 2.25Zm4.28 8.03-5.25 5.25a.747.747 0 0 1-1.06 0l-2.25-2.25a.75.75 0 1 1 1.06-1.06l1.72 1.72 4.72-4.72a.751.751 0 0 1 1.06 1.06Z"/></svg>`)
39
+ );
40
+
41
+ iconRegistry.addSvgIconLiteral(
42
+ 'rc-ses-info-fill',
43
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M12 2.25A9.75 9.75 0 1 0 21.75 12 9.76 9.76 0 0 0 12 2.25Zm-.375 4.5a1.125 1.125 0 1 1 0 2.25 1.125 1.125 0 0 1 0-2.25Zm1.125 10.5a1.5 1.5 0 0 1-1.5-1.5V12a.75.75 0 1 1 0-1.5 1.5 1.5 0 0 1 1.5 1.5v3.75a.75.75 0 1 1 0 1.5Z"/></svg>`)
44
+ );
45
+
46
+ iconRegistry.addSvgIconLiteral(
47
+ 'rc-ses-scroll',
48
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M9 9.75A.75.75 0 0 1 9.75 9h6a.75.75 0 1 1 0 1.5h-6A.75.75 0 0 1 9 9.75Zm.75 3.75h6a.75.75 0 1 0 0-1.5h-6a.75.75 0 1 0 0 1.5Zm12 4.5a3 3 0 0 1-3 3H8.25a3 3 0 0 1-3-3V6a1.5 1.5 0 0 0-3 0c0 .538.453.902.458.906A.75.75 0 0 1 1.8 8.099C1.692 8.02.75 7.276.75 6a3 3 0 0 1 3-3H16.5a3 3 0 0 1 3 3v9.75h.75a.75.75 0 0 1 .45.15c.113.08 1.05.824 1.05 2.1ZM9.024 16.264a.757.757 0 0 1 .726-.514H18V6a1.5 1.5 0 0 0-1.5-1.5H6.346c.265.455.405.973.404 1.5v12a1.5 1.5 0 0 0 3 0c0-.538-.453-.902-.457-.906a.733.733 0 0 1-.269-.83ZM20.25 18a1.18 1.18 0 0 0-.303-.75h-8.812c.075.243.113.496.113.75 0 .527-.138 1.044-.402 1.5h7.904a1.5 1.5 0 0 0 1.5-1.5Z"/></svg>`)
49
+ );
50
+
51
+ iconRegistry.addSvgIconLiteral(
52
+ 'rc-ses-warning-diamond-fill',
53
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="m22.064 10.942-9.005-9.006a1.5 1.5 0 0 0-2.115 0l-9 9.006a1.5 1.5 0 0 0 0 2.115l9.005 9.005a1.5 1.5 0 0 0 2.115 0l9.004-9.005a1.5 1.5 0 0 0 0-2.115h-.004ZM11.25 7.499a.75.75 0 1 1 1.5 0v5.25a.75.75 0 1 1-1.5 0V7.5Zm.75 9.75a1.125 1.125 0 1 1 0-2.25 1.125 1.125 0 0 1 0 2.25Z"/></svg>`)
54
+ );
55
+
56
+ iconRegistry.addSvgIconLiteral(
57
+ 'rc-ses-warning-fill',
58
+ sanitizer.bypassSecurityTrustHtml(`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M22.201 17.634 14.003 3.396a2.322 2.322 0 0 0-4.004 0L1.801 17.634a2.204 2.204 0 0 0 0 2.223A2.282 2.282 0 0 0 3.803 21h16.396a2.284 2.284 0 0 0 2-1.143 2.205 2.205 0 0 0 .002-2.223ZM11.251 9.75a.75.75 0 1 1 1.5 0v3.75a.75.75 0 0 1-1.5 0V9.75Zm.75 8.25a1.125 1.125 0 1 1 0-2.25 1.125 1.125 0 0 1 0 2.25Z"/></svg>`)
59
+ );
60
+ }
61
+ }
@@ -0,0 +1,19 @@
1
+ <mat-card appearance="outlined">
2
+ <mat-card-content>
3
+ <button rc-ses-button mat-button type="button">
4
+ <mat-icon matListItemIcon svgIcon="rc-ses-caret-left" aria-hidden="false" />
5
+ Baigti pildyti vėliau
6
+ </button>
7
+
8
+ <button rc-ses-button mat-flat-button type="submit">
9
+ Baigti pildyti ir pridėti į krepšelį
10
+ <mat-icon matListItemIcon svgIcon="rc-ses-arrow-right" aria-hidden="false" />
11
+ </button>
12
+ </mat-card-content>
13
+ </mat-card>
14
+
15
+ <div class="rc-ses-footer-actions">
16
+ <button rc-ses-button mat-button color="neutral" type="button">
17
+ Atšaukti pildymą ir ištrinti formos duomenis
18
+ </button>
19
+ </div>
@@ -0,0 +1,64 @@
1
+ @use '@angular/material' as mat;
2
+
3
+ @mixin bootstrap($theme, $typography) {
4
+ @layer rc-ses {
5
+ .rc-ses-service-form-actions {
6
+ color: mat.get-theme-color($theme, primary, 30);
7
+
8
+ .mat-mdc-card-content {
9
+ align-items: center;
10
+ display: flex !important;
11
+ justify-content: space-between;
12
+ padding: 2rem !important;
13
+ }
14
+
15
+ button[type="submit"] {
16
+ --mdc-filled-button-container-height: 3.375rem;
17
+ --mat-filled-button-horizontal-padding: 2.25rem;
18
+ display: flex !important;
19
+ flex-direction: row-reverse;
20
+ flex-wrap: nowrap;
21
+
22
+ .mat-icon {
23
+ margin-left: .5rem !important;
24
+ margin-right: 0 !important;
25
+ }
26
+ }
27
+
28
+ .rc-ses-footer-actions {
29
+ display: flex;
30
+ justify-content: center;
31
+ margin-top: 1rem;
32
+ padding: .875rem 0;
33
+
34
+ .mdc-button {
35
+ text-decoration: underline !important;
36
+
37
+ &__label {
38
+ color: mat.get-theme-color($theme, neutral, 40) !important;
39
+ }
40
+
41
+ &:hover {
42
+ text-decoration: none !important;
43
+
44
+ .mdc-button__label {
45
+ color: mat.get-theme-color($theme, primary, 30) !important;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+
53
+ @layer rc-ses-variables {
54
+ :root {
55
+
56
+ .rc-ses-service-form-actions {
57
+ --mdc-outlined-card-container-shape: .375rem;
58
+ --mdc-outlined-card-container-color: #{mat.get-theme-color($theme, primary, 100)};
59
+ --mdc-outlined-card-outline-color: #{mat.get-theme-color($theme, primary, 90)};
60
+ --mdc-outlined-card-container-elevation: unset;
61
+ }
62
+ }
63
+ }
64
+ }