platformcommons-web-lib 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/commons-shared-web-ui-1.0.0.tgz +0 -0
- package/documentation/alert.md +123 -0
- package/documentation/button-dropdown.md +126 -0
- package/documentation/button.md +184 -0
- package/documentation/cards-usage-guidelines.md +131 -0
- package/documentation/configurable-form.md +605 -0
- package/documentation/confirmation-modal.md +250 -0
- package/documentation/filter-sidebar.md +178 -0
- package/documentation/filter-table-selector.md +228 -0
- package/documentation/form-builder.md +597 -0
- package/documentation/form-components.md +384 -0
- package/documentation/nav.md +427 -0
- package/documentation/pagination.md +181 -0
- package/documentation/side-nav-documentation.md +169 -0
- package/documentation/smart-form.md +2177 -0
- package/documentation/smart-table.md +1198 -0
- package/documentation/snackbar.md +118 -0
- package/documentation/style-externalization.md +88 -0
- package/documentation/summary-card.md +279 -0
- package/ng-package.json +28 -0
- package/package.json +54 -0
- package/src/lib/modules/alert/alert.models.ts +6 -0
- package/src/lib/modules/alert/alert.module.ts +16 -0
- package/src/lib/modules/alert/alert.theme.scss +85 -0
- package/src/lib/modules/alert/components/alert/alert.component.html +27 -0
- package/src/lib/modules/alert/components/alert/alert.component.scss +92 -0
- package/src/lib/modules/alert/components/alert/alert.component.ts +81 -0
- package/src/lib/modules/button/button.models.ts +13 -0
- package/src/lib/modules/button/button.module.ts +16 -0
- package/src/lib/modules/button/button.theme.scss +121 -0
- package/src/lib/modules/button/components/button/button.component.html +22 -0
- package/src/lib/modules/button/components/button/button.component.scss +88 -0
- package/src/lib/modules/button/components/button/button.component.ts +67 -0
- package/src/lib/modules/button-dropdown/button-dropdown.models.ts +26 -0
- package/src/lib/modules/button-dropdown/button-dropdown.module.ts +22 -0
- package/src/lib/modules/button-dropdown/button-dropdown.theme.scss +87 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.html +41 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.scss +135 -0
- package/src/lib/modules/button-dropdown/components/button-dropdown/button-dropdown.component.ts +160 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.html +294 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.scss +503 -0
- package/src/lib/modules/configurable-form/component/configurable-form.component.ts +628 -0
- package/src/lib/modules/configurable-form/configurable-form.examples.ts +154 -0
- package/src/lib/modules/configurable-form/configurable-form.model.ts +131 -0
- package/src/lib/modules/configurable-form/configurable-form.module.ts +19 -0
- package/src/lib/modules/configurable-form/configurable-form.theme.scss +78 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.html +77 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.scss +395 -0
- package/src/lib/modules/confirmation-modal/components/confirmation-modal/confirmation-modal.component.ts +266 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.models.ts +71 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.module.ts +20 -0
- package/src/lib/modules/confirmation-modal/confirmation-modal.theme.scss +87 -0
- package/src/lib/modules/filter/components/filter/filter.component.html +131 -0
- package/src/lib/modules/filter/components/filter/filter.component.scss +245 -0
- package/src/lib/modules/filter/components/filter/filter.component.ts +216 -0
- package/src/lib/modules/filter/filter.models.ts +88 -0
- package/src/lib/modules/filter/filter.module.ts +24 -0
- package/src/lib/modules/filter/filter.theme.scss +92 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.html +112 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.scss +186 -0
- package/src/lib/modules/filter-sidebar/components/filter-sidebar/filter-sidebar.component.ts +163 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.models.ts +95 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.module.ts +24 -0
- package/src/lib/modules/filter-sidebar/filter-sidebar.theme.scss +38 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.html +73 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.scss +321 -0
- package/src/lib/modules/filter-table-selector/components/filter-table-selector/filter-table-selector.component.ts +361 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.models.ts +91 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.module.ts +22 -0
- package/src/lib/modules/filter-table-selector/filter-table-selector.theme.scss +36 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.html +63 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.scss +496 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-config-panel/configurator-config-panel.component.ts +445 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.html +75 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.scss +210 -0
- package/src/lib/modules/form-builder/components/field-configurator/configurator-tree/configurator-tree.component.ts +55 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.html +25 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.scss +82 -0
- package/src/lib/modules/form-builder/components/field-configurator/field-configurator.component.ts +95 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.html +20 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.scss +37 -0
- package/src/lib/modules/form-builder/components/field-selection/field-selection.component.ts +94 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.html +46 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.scss +102 -0
- package/src/lib/modules/form-builder/components/field-selection/group-node/group-node.component.ts +50 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.html +35 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.scss +67 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-field-node/selection-field-node.component.ts +34 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.html +68 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.scss +113 -0
- package/src/lib/modules/form-builder/components/field-selection/selection-section-node/selection-section-node.component.ts +74 -0
- package/src/lib/modules/form-builder/configs/field-type-schema.map.ts +533 -0
- package/src/lib/modules/form-builder/form-builder.module.ts +36 -0
- package/src/lib/modules/form-builder/form-builder.theme.scss +212 -0
- package/src/lib/modules/form-builder/index.ts +9 -0
- package/src/lib/modules/form-builder/models/builder.models.ts +7 -0
- package/src/lib/modules/form-builder/models/field-configurator.models.ts +38 -0
- package/src/lib/modules/form-builder/models/field-selection.models.ts +51 -0
- package/src/lib/modules/form-builder/services/field-configurator.service.ts +258 -0
- package/src/lib/modules/form-builder/services/field-selection.service.ts +300 -0
- package/src/lib/modules/form-builder/services/form-schema-tree.service.ts +652 -0
- package/src/lib/modules/form-builder/tokens/builder.tokens.ts +10 -0
- package/src/lib/modules/form-builder/utils/constants.ts +43 -0
- package/src/lib/modules/form-components/components/checkbox/_theme.scss +63 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.html +29 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.scss +111 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.component.ts +207 -0
- package/src/lib/modules/form-components/components/checkbox/checkbox.models.ts +35 -0
- package/src/lib/modules/form-components/components/datepicker/_theme.scss +82 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.html +42 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.scss +115 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.component.ts +267 -0
- package/src/lib/modules/form-components/components/datepicker/datepicker.models.ts +45 -0
- package/src/lib/modules/form-components/components/dropdown/_theme.scss +91 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.html +74 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.scss +252 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.component.ts +377 -0
- package/src/lib/modules/form-components/components/dropdown/dropdown.models.ts +53 -0
- package/src/lib/modules/form-components/components/input/_theme.scss +77 -0
- package/src/lib/modules/form-components/components/input/input.component.html +51 -0
- package/src/lib/modules/form-components/components/input/input.component.scss +128 -0
- package/src/lib/modules/form-components/components/input/input.component.ts +250 -0
- package/src/lib/modules/form-components/components/input/input.models.ts +55 -0
- package/src/lib/modules/form-components/components/radio/_theme.scss +61 -0
- package/src/lib/modules/form-components/components/radio/radio.component.html +22 -0
- package/src/lib/modules/form-components/components/radio/radio.component.scss +107 -0
- package/src/lib/modules/form-components/components/radio/radio.component.ts +181 -0
- package/src/lib/modules/form-components/components/radio/radio.models.ts +39 -0
- package/src/lib/modules/form-components/components/search/_theme.scss +73 -0
- package/src/lib/modules/form-components/components/search/search.component.html +15 -0
- package/src/lib/modules/form-components/components/search/search.component.scss +87 -0
- package/src/lib/modules/form-components/components/search/search.component.ts +213 -0
- package/src/lib/modules/form-components/components/search/search.models.ts +40 -0
- package/src/lib/modules/form-components/components/toggle/_theme.scss +45 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.html +15 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.scss +81 -0
- package/src/lib/modules/form-components/components/toggle/toggle.component.ts +166 -0
- package/src/lib/modules/form-components/components/toggle/toggle.models.ts +27 -0
- package/src/lib/modules/form-components/directives/click-outside.directive.ts +22 -0
- package/src/lib/modules/form-components/form-components.module.ts +41 -0
- package/src/lib/modules/form-components/form-components.theme.scss +25 -0
- package/src/lib/modules/material/material.module.ts +94 -0
- package/src/lib/modules/nav/components/nav/nav.component.html +34 -0
- package/src/lib/modules/nav/components/nav/nav.component.scss +171 -0
- package/src/lib/modules/nav/components/nav/nav.component.ts +82 -0
- package/src/lib/modules/nav/nav.models.ts +31 -0
- package/src/lib/modules/nav/nav.module.ts +17 -0
- package/src/lib/modules/nav/nav.theme.scss +86 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.html +52 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.scss +155 -0
- package/src/lib/modules/pagination/components/pagination/pagination.component.ts +109 -0
- package/src/lib/modules/pagination/pagination.module.ts +17 -0
- package/src/lib/modules/pagination/pagination.theme.scss +66 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.html +56 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.scss +342 -0
- package/src/lib/modules/side-nav/components/side-nav/side-nav.component.ts +135 -0
- package/src/lib/modules/side-nav/side-nav.models.ts +38 -0
- package/src/lib/modules/side-nav/side-nav.module.ts +16 -0
- package/src/lib/modules/side-nav/side-nav.theme.scss +111 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.html +1109 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.scss +1860 -0
- package/src/lib/modules/smart-form/components/form-field/form-field.component.ts +2232 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.html +64 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.scss +209 -0
- package/src/lib/modules/smart-form/components/form-section/form-section.component.ts +119 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.html +253 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.scss +689 -0
- package/src/lib/modules/smart-form/components/smart-form/smart-form.component.ts +1087 -0
- package/src/lib/modules/smart-form/index.ts +10 -0
- package/src/lib/modules/smart-form/models/form-schema.model.ts +700 -0
- package/src/lib/modules/smart-form/models/hierarchy-config.model.ts +21 -0
- package/src/lib/modules/smart-form/services/expression.service.ts +75 -0
- package/src/lib/modules/smart-form/services/smart-form-controller.service.ts +65 -0
- package/src/lib/modules/smart-form/smart-form.examples.ts +1324 -0
- package/src/lib/modules/smart-form/smart-form.module.ts +36 -0
- package/src/lib/modules/smart-form/smart-form.theme.scss +890 -0
- package/src/lib/modules/smart-form/utils/translation.utils.ts +82 -0
- package/src/lib/modules/smart-form/utils/trusted-url.pipe.ts +25 -0
- package/src/lib/modules/smart-form/utils/validation.utils.ts +98 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.html +283 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.scss +685 -0
- package/src/lib/modules/smart-table/components/smart-table/smart-table.component.ts +1118 -0
- package/src/lib/modules/smart-table/models/table-config.model.ts +202 -0
- package/src/lib/modules/smart-table/smart-table.module.ts +30 -0
- package/src/lib/modules/smart-table/smart-table.theme.scss +335 -0
- package/src/lib/modules/smart-table/utils/safe-html.pipe.ts +22 -0
- package/src/lib/modules/smart-table/utils/smart-table.utils.ts +18 -0
- package/src/lib/modules/snackbar/components/snackbar.component.html +41 -0
- package/src/lib/modules/snackbar/components/snackbar.component.scss +99 -0
- package/src/lib/modules/snackbar/components/snackbar.component.ts +18 -0
- package/src/lib/modules/snackbar/models/snackbar.models.ts +10 -0
- package/src/lib/modules/snackbar/services/snackbar.service.ts +40 -0
- package/src/lib/modules/snackbar/snackbar.module.ts +11 -0
- package/src/lib/modules/snackbar/snackbar.theme.scss +93 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.html +47 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.scss +199 -0
- package/src/lib/modules/summary-card/components/summary-card/summary-card.component.ts +126 -0
- package/src/lib/modules/summary-card/summary-card.module.ts +18 -0
- package/src/lib/modules/summary-card/summary-card.theme.scss +176 -0
- package/src/lib/shared-ui.module.ts +44 -0
- package/src/lib/styles/global.scss +152 -0
- package/src/lib/styles/utilities.scss +250 -0
- package/src/lib/utils/constants.ts +11 -0
- package/src/lib/utils/storage.utils.ts +37 -0
- package/src/lib/utils/string.utils.ts +23 -0
- package/src/lib/utils/translation.utils.ts +87 -0
- package/src/public-api.ts +104 -0
- package/tsconfig.lib.json +15 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$default-input-config: (
|
|
4
|
+
// Layout
|
|
5
|
+
height: 2.5rem,
|
|
6
|
+
padding: 0.375rem 1rem,
|
|
7
|
+
label-gap: 0.5rem,
|
|
8
|
+
|
|
9
|
+
// Borders
|
|
10
|
+
border-radius: 0.4375rem,
|
|
11
|
+
border-color: #BDC1C6,
|
|
12
|
+
border-width: 1px,
|
|
13
|
+
|
|
14
|
+
// Colors
|
|
15
|
+
bg: #FEFEFE,
|
|
16
|
+
color: #202124,
|
|
17
|
+
placeholder-color: #80868B,
|
|
18
|
+
|
|
19
|
+
// Typography
|
|
20
|
+
font-size: 0.875rem,
|
|
21
|
+
font-weight: 400,
|
|
22
|
+
font-family: inherit,
|
|
23
|
+
|
|
24
|
+
// Label
|
|
25
|
+
label-font-size: 0.875rem,
|
|
26
|
+
label-font-weight: 500,
|
|
27
|
+
label-color: #202124,
|
|
28
|
+
|
|
29
|
+
// States
|
|
30
|
+
focus-border-color: #1A73E8,
|
|
31
|
+
error-color: #D93025,
|
|
32
|
+
disabled-bg: #F1F3F4,
|
|
33
|
+
disabled-color: #80868B,
|
|
34
|
+
required-color: #D93025,
|
|
35
|
+
|
|
36
|
+
// Icon
|
|
37
|
+
icon-color: #5F6368
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
@mixin input-theme($user-config: ()) {
|
|
41
|
+
$config: map.merge($default-input-config, $user-config);
|
|
42
|
+
|
|
43
|
+
// Layout
|
|
44
|
+
--cc-input-height: #{map.get($config, height)};
|
|
45
|
+
--cc-input-padding: #{map.get($config, padding)};
|
|
46
|
+
--cc-input-label-gap: #{map.get($config, label-gap)};
|
|
47
|
+
|
|
48
|
+
// Borders
|
|
49
|
+
--cc-input-border-radius: #{map.get($config, border-radius)};
|
|
50
|
+
--cc-input-border-color: #{map.get($config, border-color)};
|
|
51
|
+
--cc-input-border-width: #{map.get($config, border-width)};
|
|
52
|
+
|
|
53
|
+
// Colors
|
|
54
|
+
--cc-input-bg: #{map.get($config, bg)};
|
|
55
|
+
--cc-input-color: #{map.get($config, color)};
|
|
56
|
+
--cc-input-placeholder-color: #{map.get($config, placeholder-color)};
|
|
57
|
+
|
|
58
|
+
// Typography
|
|
59
|
+
--cc-input-font-size: #{map.get($config, font-size)};
|
|
60
|
+
--cc-input-font-weight: #{map.get($config, font-weight)};
|
|
61
|
+
--cc-input-font-family: #{map.get($config, font-family)};
|
|
62
|
+
|
|
63
|
+
// Label
|
|
64
|
+
--cc-input-label-font-size: #{map.get($config, label-font-size)};
|
|
65
|
+
--cc-input-label-font-weight: #{map.get($config, label-font-weight)};
|
|
66
|
+
--cc-input-label-color: #{map.get($config, label-color)};
|
|
67
|
+
|
|
68
|
+
// States
|
|
69
|
+
--cc-input-focus-border-color: #{map.get($config, focus-border-color)};
|
|
70
|
+
--cc-input-error-color: #{map.get($config, error-color)};
|
|
71
|
+
--cc-input-disabled-bg: #{map.get($config, disabled-bg)};
|
|
72
|
+
--cc-input-disabled-color: #{map.get($config, disabled-color)};
|
|
73
|
+
--cc-input-required-color: #{map.get($config, required-color)};
|
|
74
|
+
|
|
75
|
+
// Icon
|
|
76
|
+
--cc-input-icon-color: #{map.get($config, icon-color)};
|
|
77
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="cc-input-container" [ngStyle]="wrapperStyles">
|
|
2
|
+
<label *ngIf="label" class="cc-input-label" [ngStyle]="labelStyles">
|
|
3
|
+
{{ label }}
|
|
4
|
+
<span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
|
|
5
|
+
</label>
|
|
6
|
+
|
|
7
|
+
<div class="cc-input-wrapper" [class.focused]="focused" [class.disabled]="disabled" [class.error]="errorMessage"
|
|
8
|
+
[ngStyle]="fieldStyles">
|
|
9
|
+
|
|
10
|
+
<!-- Prefix Icon -->
|
|
11
|
+
<span class="cc-input-prefix" *ngIf="prefixIcon">
|
|
12
|
+
<span class="material-icons" *ngIf="getIconType(prefixIcon) === 'material'">{{ getIconValue(prefixIcon)
|
|
13
|
+
}}</span>
|
|
14
|
+
<i *ngIf="getIconType(prefixIcon) === 'fontawesome'" [class]="getIconValue(prefixIcon)"></i>
|
|
15
|
+
<img *ngIf="getIconType(prefixIcon) === 'img'" [src]="getIconValue(prefixIcon)" class="cc-icon-img"
|
|
16
|
+
[attr.alt]="labels?.prefixAltText || 'prefix'" />
|
|
17
|
+
</span>
|
|
18
|
+
|
|
19
|
+
<!-- Input -->
|
|
20
|
+
<input *ngIf="type !== 'textarea'" class="cc-input-element" [type]="inputType" [value]="value"
|
|
21
|
+
[placeholder]="placeholder" [disabled]="disabled" [required]="required" [readonly]="readonly"
|
|
22
|
+
[maxLength]="maxLength || 524288" [minLength]="minLength || 0" [min]="min" [max]="max" [pattern]="pattern"
|
|
23
|
+
(input)="onInputChange($event)" (blur)="onBlur()" (focus)="onFocus()" [attr.aria-invalid]="!!errorMessage"
|
|
24
|
+
[attr.aria-describedby]="helperText ? 'helper-text' : null" />
|
|
25
|
+
|
|
26
|
+
<!-- Textarea -->
|
|
27
|
+
<textarea *ngIf="type === 'textarea'" class="cc-input-element cc-textarea" [value]="value"
|
|
28
|
+
[placeholder]="placeholder" [disabled]="disabled" [required]="required" [readonly]="readonly"
|
|
29
|
+
[maxLength]="maxLength || 524288" [minLength]="minLength || 0" [rows]="rows" (input)="onInputChange($event)"
|
|
30
|
+
(blur)="onBlur()" (focus)="onFocus()" [attr.aria-invalid]="!!errorMessage"></textarea>
|
|
31
|
+
|
|
32
|
+
<!-- Suffix Icon / Password Toggle -->
|
|
33
|
+
<span class="cc-input-suffix">
|
|
34
|
+
<button *ngIf="type === 'password'" type="button" class="cc-icon-btn" (click)="togglePasswordVisibility()"
|
|
35
|
+
[attr.aria-label]="labels?.passwordToggleAriaLabel">
|
|
36
|
+
<span class="material-icons">{{ showPassword ? 'visibility_off' : 'visibility' }}</span>
|
|
37
|
+
</button>
|
|
38
|
+
|
|
39
|
+
<ng-container *ngIf="suffixIcon && type !== 'password'">
|
|
40
|
+
<span class="material-icons" *ngIf="getIconType(suffixIcon) === 'material'">{{ getIconValue(suffixIcon)
|
|
41
|
+
}}</span>
|
|
42
|
+
<i *ngIf="getIconType(suffixIcon) === 'fontawesome'" [class]="getIconValue(suffixIcon)"></i>
|
|
43
|
+
<img *ngIf="getIconType(suffixIcon) === 'img'" [src]="getIconValue(suffixIcon)" class="cc-icon-img"
|
|
44
|
+
[attr.alt]="labels?.suffixAltText || 'suffix'" />
|
|
45
|
+
</ng-container>
|
|
46
|
+
</span>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="cc-helper-text" *ngIf="helperText" id="helper-text">{{ helperText }}</div>
|
|
50
|
+
<div class="cc-error-message" *ngIf="errorMessage">{{ errorMessage }}</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
.cc-input-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--cc-input-label-gap, 0.5rem);
|
|
5
|
+
width: 100%;
|
|
6
|
+
font-family: var(--cc-input-font-family, inherit);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cc-input-label {
|
|
10
|
+
font-size: var(--cc-input-label-font-size, 0.875rem);
|
|
11
|
+
font-weight: var(--cc-input-label-font-weight, 500);
|
|
12
|
+
color: var(--cc-input-label-color, #202124);
|
|
13
|
+
margin: 0;
|
|
14
|
+
line-height: 1.4;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.cc-required {
|
|
18
|
+
color: var(--cc-input-required-color, #D93025);
|
|
19
|
+
margin-left: 0.25rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.cc-input-wrapper {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
width: 100%;
|
|
26
|
+
box-sizing: border-box;
|
|
27
|
+
background-color: var(--cc-input-bg, #FEFEFE);
|
|
28
|
+
border: var(--cc-input-border-width, 1px) solid var(--cc-input-border-color, #BDC1C6);
|
|
29
|
+
border-radius: var(--cc-input-border-radius, 0.4375rem);
|
|
30
|
+
padding: var(--cc-input-padding, 0.5rem 0.75rem);
|
|
31
|
+
min-height: var(--cc-input-height, 2.5rem);
|
|
32
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
33
|
+
|
|
34
|
+
&.focused {
|
|
35
|
+
border-color: var(--cc-input-focus-border-color, #1A73E8);
|
|
36
|
+
// Optional: add box-shadow for better accessibility/focus ring
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&.error {
|
|
40
|
+
border-color: var(--cc-input-error-color, #D93025);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.disabled {
|
|
44
|
+
background-color: var(--cc-input-disabled-bg, #F1F3F4);
|
|
45
|
+
cursor: not-allowed;
|
|
46
|
+
|
|
47
|
+
.cc-input-element {
|
|
48
|
+
cursor: not-allowed;
|
|
49
|
+
color: var(--cc-input-disabled-color, #80868B);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.material-icons,
|
|
53
|
+
i,
|
|
54
|
+
img {
|
|
55
|
+
opacity: 0.5;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.cc-input-element {
|
|
61
|
+
flex: 1;
|
|
62
|
+
border: none;
|
|
63
|
+
background: none;
|
|
64
|
+
outline: none;
|
|
65
|
+
font-family: inherit;
|
|
66
|
+
font-size: var(--cc-input-font-size, 0.875rem);
|
|
67
|
+
font-weight: var(--cc-input-font-weight, 400);
|
|
68
|
+
color: var(--cc-input-color, #202124);
|
|
69
|
+
padding: 0;
|
|
70
|
+
margin: 0;
|
|
71
|
+
width: 100%;
|
|
72
|
+
|
|
73
|
+
&::placeholder {
|
|
74
|
+
color: var(--cc-input-placeholder-color, #80868B);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.cc-textarea {
|
|
78
|
+
resize: vertical;
|
|
79
|
+
min-height: 4rem;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.cc-input-prefix,
|
|
84
|
+
.cc-input-suffix {
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
color: var(--cc-input-icon-color, #5F6368);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.cc-input-prefix {
|
|
91
|
+
margin-right: 0.5rem;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.cc-input-suffix {
|
|
95
|
+
margin-left: 0.5rem;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.cc-icon-img {
|
|
99
|
+
width: 1.25rem;
|
|
100
|
+
height: 1.25rem;
|
|
101
|
+
object-fit: contain;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.cc-icon-btn {
|
|
105
|
+
background: none;
|
|
106
|
+
border: none;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
padding: 0;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
color: inherit;
|
|
112
|
+
|
|
113
|
+
&:focus {
|
|
114
|
+
outline: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.cc-helper-text {
|
|
119
|
+
font-size: 0.75rem;
|
|
120
|
+
color: #5F6368; // Default, can be variable if needed
|
|
121
|
+
margin-top: 0.25rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cc-error-message {
|
|
125
|
+
font-size: 0.75rem;
|
|
126
|
+
color: var(--cc-input-error-color, #D93025);
|
|
127
|
+
margin-top: 0.25rem;
|
|
128
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, forwardRef, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { InputConfig, InputType, InputLabels } from './input.models';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'lib-input',
|
|
7
|
+
templateUrl: './input.component.html',
|
|
8
|
+
styleUrls: ['./input.component.scss'],
|
|
9
|
+
standalone: false,
|
|
10
|
+
providers: [
|
|
11
|
+
{
|
|
12
|
+
provide: NG_VALUE_ACCESSOR,
|
|
13
|
+
useExisting: forwardRef(() => InputComponent),
|
|
14
|
+
multi: true
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
})
|
|
18
|
+
export class InputComponent implements ControlValueAccessor, OnInit, OnChanges {
|
|
19
|
+
@Input() config?: InputConfig;
|
|
20
|
+
@Input() labels?: InputLabels;
|
|
21
|
+
@Input() type: InputType = 'text';
|
|
22
|
+
@Input() label: string = '';
|
|
23
|
+
@Input() placeholder: string = '';
|
|
24
|
+
@Input() disabled: boolean = false;
|
|
25
|
+
@Input() required: boolean = false;
|
|
26
|
+
@Input() readonly: boolean = false;
|
|
27
|
+
@Input() clearable: boolean = true;
|
|
28
|
+
@Input() maxLength?: number;
|
|
29
|
+
@Input() minLength?: number;
|
|
30
|
+
@Input() min?: number | string;
|
|
31
|
+
@Input() max?: number | string;
|
|
32
|
+
@Input() pattern?: string;
|
|
33
|
+
@Input() errorMessage: string = '';
|
|
34
|
+
@Input() helperText: string = '';
|
|
35
|
+
@Input() rows: number = 3;
|
|
36
|
+
@Input() prefixIcon?: any;
|
|
37
|
+
@Input() suffixIcon?: any;
|
|
38
|
+
@Input() value: any = '';
|
|
39
|
+
|
|
40
|
+
// Style inputs
|
|
41
|
+
@Input() width?: string;
|
|
42
|
+
@Input() height?: string;
|
|
43
|
+
@Input() borderRadius?: string;
|
|
44
|
+
@Input() fontSize?: string;
|
|
45
|
+
|
|
46
|
+
@Input() gap?: string;
|
|
47
|
+
@Input() fontFamily?: string;
|
|
48
|
+
@Input() labelColor?: string;
|
|
49
|
+
@Input() labelFontSize?: string;
|
|
50
|
+
@Input() labelFontWeight?: string;
|
|
51
|
+
|
|
52
|
+
@Input() backgroundColor?: string;
|
|
53
|
+
@Input() borderColor?: string;
|
|
54
|
+
@Input() borderWidth?: string;
|
|
55
|
+
@Input() padding?: string;
|
|
56
|
+
@Input() fontWeight?: string;
|
|
57
|
+
@Input() color?: string;
|
|
58
|
+
@Input() placeholderColor?: string;
|
|
59
|
+
@Input() focusBorderColor?: string;
|
|
60
|
+
@Input() errorColor?: string;
|
|
61
|
+
@Input() disabledBackgroundColor?: string;
|
|
62
|
+
@Input() disabledColor?: string;
|
|
63
|
+
@Input() boxShadow?: string;
|
|
64
|
+
|
|
65
|
+
@Output() valueChange = new EventEmitter<any>();
|
|
66
|
+
@Output() inputBlur = new EventEmitter<void>();
|
|
67
|
+
@Output() inputFocus = new EventEmitter<void>();
|
|
68
|
+
|
|
69
|
+
showPassword = false;
|
|
70
|
+
focused = false;
|
|
71
|
+
onChange: (value: any) => void = () => { };
|
|
72
|
+
onTouched: () => void = () => { };
|
|
73
|
+
|
|
74
|
+
ngOnInit(): void {
|
|
75
|
+
this.updateFromConfig();
|
|
76
|
+
this.updateFromLabels();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
80
|
+
if (changes['config']) {
|
|
81
|
+
this.updateFromConfig();
|
|
82
|
+
}
|
|
83
|
+
if (changes['labels']) {
|
|
84
|
+
this.updateFromLabels();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private updateFromConfig(): void {
|
|
89
|
+
if (this.config) {
|
|
90
|
+
this.type = this.config.type ?? this.type;
|
|
91
|
+
this.label = this.config.label ?? this.label;
|
|
92
|
+
this.placeholder = this.config.placeholder ?? this.placeholder;
|
|
93
|
+
this.disabled = this.config.disabled ?? this.disabled;
|
|
94
|
+
this.required = this.config.required ?? this.required;
|
|
95
|
+
this.readonly = this.config.readonly ?? this.readonly;
|
|
96
|
+
this.maxLength = this.config.maxLength ?? this.maxLength;
|
|
97
|
+
this.minLength = this.config.minLength ?? this.minLength;
|
|
98
|
+
this.min = this.config.min ?? this.min;
|
|
99
|
+
this.max = this.config.max ?? this.max;
|
|
100
|
+
this.pattern = this.config.pattern ?? this.pattern;
|
|
101
|
+
this.errorMessage = this.config.errorMessage ?? this.errorMessage;
|
|
102
|
+
this.helperText = this.config.helperText ?? this.helperText;
|
|
103
|
+
this.rows = this.config.rows ?? this.rows;
|
|
104
|
+
this.prefixIcon = this.config.prefixIcon ?? this.prefixIcon;
|
|
105
|
+
this.suffixIcon = this.config.suffixIcon ?? this.suffixIcon;
|
|
106
|
+
|
|
107
|
+
// Style inputs
|
|
108
|
+
this.width = this.config.width ?? this.width;
|
|
109
|
+
this.height = this.config.height ?? this.height;
|
|
110
|
+
this.borderRadius = this.config.borderRadius ?? this.borderRadius;
|
|
111
|
+
this.fontSize = this.config.fontSize ?? this.fontSize;
|
|
112
|
+
this.gap = this.config.gap ?? this.gap;
|
|
113
|
+
this.fontFamily = this.config.fontFamily ?? this.fontFamily;
|
|
114
|
+
this.labelColor = this.config.labelColor ?? this.labelColor;
|
|
115
|
+
this.labelFontSize = this.config.labelFontSize ?? this.labelFontSize;
|
|
116
|
+
this.labelFontWeight = this.config.labelFontWeight ?? this.labelFontWeight;
|
|
117
|
+
this.backgroundColor = this.config.backgroundColor ?? this.backgroundColor;
|
|
118
|
+
this.borderColor = this.config.borderColor ?? this.borderColor;
|
|
119
|
+
this.borderWidth = this.config.borderWidth ?? this.borderWidth;
|
|
120
|
+
this.padding = this.config.padding ?? this.padding;
|
|
121
|
+
this.fontWeight = this.config.fontWeight ?? this.fontWeight;
|
|
122
|
+
this.color = this.config.color ?? this.color;
|
|
123
|
+
this.placeholderColor = this.config.placeholderColor ?? this.placeholderColor;
|
|
124
|
+
this.focusBorderColor = this.config.focusBorderColor ?? this.focusBorderColor;
|
|
125
|
+
this.errorColor = this.config.errorColor ?? this.errorColor;
|
|
126
|
+
this.disabledBackgroundColor = this.config.disabledBackgroundColor ?? this.disabledBackgroundColor;
|
|
127
|
+
this.disabledColor = this.config.disabledColor ?? this.disabledColor;
|
|
128
|
+
this.boxShadow = this.config.boxShadow ?? this.boxShadow;
|
|
129
|
+
|
|
130
|
+
if (this.config.value !== undefined) {
|
|
131
|
+
this.value = this.config.value;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private updateFromLabels(): void {
|
|
137
|
+
if (this.labels) {
|
|
138
|
+
this.label = this.labels.label || this.label;
|
|
139
|
+
this.placeholder = this.labels.placeholder || this.placeholder;
|
|
140
|
+
this.errorMessage = this.labels.errorMessage || this.errorMessage;
|
|
141
|
+
this.helperText = this.labels.helperText || this.helperText;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
get requiredMarker(): string {
|
|
146
|
+
return this.labels?.requiredMarker || '*';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
writeValue(value: any): void {
|
|
150
|
+
this.value = value;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
registerOnChange(fn: any): void {
|
|
154
|
+
this.onChange = fn;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
registerOnTouched(fn: any): void {
|
|
158
|
+
this.onTouched = fn;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
setDisabledState(isDisabled: boolean): void {
|
|
162
|
+
this.disabled = isDisabled;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
onInputChange(event: any): void {
|
|
166
|
+
const value = event.target.value;
|
|
167
|
+
this.value = this.type === 'number' ? (value ? Number(value) : null) : value;
|
|
168
|
+
this.onChange(this.value);
|
|
169
|
+
this.valueChange.emit(this.value);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
onBlur(): void {
|
|
173
|
+
this.focused = false;
|
|
174
|
+
this.onTouched();
|
|
175
|
+
this.inputBlur.emit();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
onFocus(): void {
|
|
179
|
+
this.focused = true;
|
|
180
|
+
this.inputFocus.emit();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
togglePasswordVisibility(): void {
|
|
184
|
+
this.showPassword = !this.showPassword;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
getIconType(icon: any): 'material' | 'fontawesome' | 'img' | 'none' {
|
|
188
|
+
if (!icon) return 'none';
|
|
189
|
+
if (typeof icon === 'string') {
|
|
190
|
+
if (icon.includes('/') || icon.includes('.') || icon.startsWith('http')) {
|
|
191
|
+
return 'img';
|
|
192
|
+
}
|
|
193
|
+
return 'material';
|
|
194
|
+
}
|
|
195
|
+
return icon.type || 'material';
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
getIconValue(icon: any): string {
|
|
199
|
+
if (typeof icon === 'string') return icon;
|
|
200
|
+
return icon?.value || '';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
get inputType(): string {
|
|
204
|
+
if (this.type === 'password' && this.showPassword) {
|
|
205
|
+
return 'text';
|
|
206
|
+
}
|
|
207
|
+
return this.type === 'textarea' ? 'text' : this.type;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private getStyleValue(value: string | undefined): string | undefined {
|
|
211
|
+
return value ? `${value}` : undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
get wrapperStyles(): { [key: string]: string | undefined } {
|
|
215
|
+
return {
|
|
216
|
+
'width': this.getStyleValue(this.width),
|
|
217
|
+
'--cc-input-label-gap': this.getStyleValue(this.gap),
|
|
218
|
+
'--cc-input-font-family': this.getStyleValue(this.fontFamily)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
get labelStyles(): { [key: string]: string | undefined } {
|
|
223
|
+
return {
|
|
224
|
+
'--cc-input-label-color': this.getStyleValue(this.labelColor),
|
|
225
|
+
'--cc-input-label-font-size': this.getStyleValue(this.labelFontSize),
|
|
226
|
+
'--cc-input-label-font-weight': this.getStyleValue(this.labelFontWeight)
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
get fieldStyles(): { [key: string]: string | undefined } {
|
|
231
|
+
return {
|
|
232
|
+
'--cc-input-bg': this.getStyleValue(this.backgroundColor),
|
|
233
|
+
'--cc-input-border-radius': this.getStyleValue(this.borderRadius),
|
|
234
|
+
'--cc-input-border-color': this.getStyleValue(this.borderColor),
|
|
235
|
+
'--cc-input-border-width': this.getStyleValue(this.borderWidth),
|
|
236
|
+
'--cc-input-height': this.getStyleValue(this.height),
|
|
237
|
+
'--cc-input-padding': this.getStyleValue(this.padding),
|
|
238
|
+
'--cc-input-font-size': this.getStyleValue(this.fontSize),
|
|
239
|
+
'--cc-input-font-weight': this.getStyleValue(this.fontWeight),
|
|
240
|
+
'--cc-input-color': this.getStyleValue(this.color),
|
|
241
|
+
'--cc-input-placeholder-color': this.getStyleValue(this.placeholderColor),
|
|
242
|
+
'--cc-input-focus-border-color': this.getStyleValue(this.focusBorderColor),
|
|
243
|
+
'--cc-input-error-color': this.getStyleValue(this.errorColor),
|
|
244
|
+
'--cc-input-disabled-bg': this.getStyleValue(this.disabledBackgroundColor),
|
|
245
|
+
'--cc-input-disabled-color': this.getStyleValue(this.disabledColor),
|
|
246
|
+
'box-shadow': this.getStyleValue(this.boxShadow)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export type InputType = 'text' | 'number' | 'email' | 'password' | 'tel' | 'url' | 'textarea';
|
|
2
|
+
|
|
3
|
+
export interface InputLabels {
|
|
4
|
+
label?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
errorMessage?: string;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
requiredMarker?: string;
|
|
9
|
+
passwordToggleAriaLabel?: string;
|
|
10
|
+
prefixAltText?: string;
|
|
11
|
+
suffixAltText?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface InputConfig {
|
|
15
|
+
type?: InputType;
|
|
16
|
+
label?: string;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
value?: any;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
required?: boolean;
|
|
21
|
+
readonly?: boolean;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
minLength?: number;
|
|
24
|
+
min?: number;
|
|
25
|
+
max?: number;
|
|
26
|
+
pattern?: string;
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
helperText?: string;
|
|
29
|
+
rows?: number; // For textarea
|
|
30
|
+
// Icons
|
|
31
|
+
prefixIcon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
|
|
32
|
+
suffixIcon?: string | { type: 'material' | 'fontawesome' | 'img'; value: string };
|
|
33
|
+
// Customization
|
|
34
|
+
width?: string;
|
|
35
|
+
height?: string;
|
|
36
|
+
borderRadius?: string;
|
|
37
|
+
fontSize?: string;
|
|
38
|
+
gap?: string;
|
|
39
|
+
fontFamily?: string;
|
|
40
|
+
labelColor?: string;
|
|
41
|
+
labelFontSize?: string;
|
|
42
|
+
labelFontWeight?: string;
|
|
43
|
+
backgroundColor?: string;
|
|
44
|
+
borderColor?: string;
|
|
45
|
+
borderWidth?: string;
|
|
46
|
+
padding?: string;
|
|
47
|
+
fontWeight?: string;
|
|
48
|
+
color?: string;
|
|
49
|
+
placeholderColor?: string;
|
|
50
|
+
focusBorderColor?: string;
|
|
51
|
+
errorColor?: string;
|
|
52
|
+
disabledBackgroundColor?: string;
|
|
53
|
+
disabledColor?: string;
|
|
54
|
+
boxShadow?: string;
|
|
55
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
|
|
3
|
+
$default-radio-config: (
|
|
4
|
+
// Layout
|
|
5
|
+
label-gap: 0.5rem,
|
|
6
|
+
group-gap: 0.75rem,
|
|
7
|
+
|
|
8
|
+
// Label
|
|
9
|
+
font-size: 0.875rem,
|
|
10
|
+
font-weight: 400,
|
|
11
|
+
font-family: inherit,
|
|
12
|
+
label-color: #202124,
|
|
13
|
+
|
|
14
|
+
// Group label
|
|
15
|
+
group-label-font-size: 0.875rem,
|
|
16
|
+
group-label-font-weight: 500,
|
|
17
|
+
group-label-color: #202124,
|
|
18
|
+
|
|
19
|
+
// Size
|
|
20
|
+
size: 1.25rem,
|
|
21
|
+
|
|
22
|
+
// Colors
|
|
23
|
+
checked-color: #1A73E8,
|
|
24
|
+
unchecked-color: #BDC1C6,
|
|
25
|
+
|
|
26
|
+
// States
|
|
27
|
+
disabled-color: #80868B,
|
|
28
|
+
error-color: #D93025,
|
|
29
|
+
required-color: #D93025
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
@mixin radio-theme($user-config: ()) {
|
|
33
|
+
$config: map.merge($default-radio-config, $user-config);
|
|
34
|
+
|
|
35
|
+
// Layout
|
|
36
|
+
--cc-radio-label-gap: #{map.get($config, label-gap)};
|
|
37
|
+
--cc-radio-group-gap: #{map.get($config, group-gap)};
|
|
38
|
+
|
|
39
|
+
// Label
|
|
40
|
+
--cc-radio-font-size: #{map.get($config, font-size)};
|
|
41
|
+
--cc-radio-font-weight: #{map.get($config, font-weight)};
|
|
42
|
+
--cc-radio-font-family: #{map.get($config, font-family)};
|
|
43
|
+
--cc-radio-label-color: #{map.get($config, label-color)};
|
|
44
|
+
|
|
45
|
+
// Group label
|
|
46
|
+
--cc-radio-group-label-font-size: #{map.get($config, group-label-font-size)};
|
|
47
|
+
--cc-radio-group-label-font-weight: #{map.get($config, group-label-font-weight)};
|
|
48
|
+
--cc-radio-group-label-color: #{map.get($config, group-label-color)};
|
|
49
|
+
|
|
50
|
+
// Size
|
|
51
|
+
--cc-radio-size: #{map.get($config, size)};
|
|
52
|
+
|
|
53
|
+
// Colors
|
|
54
|
+
--cc-radio-checked-color: #{map.get($config, checked-color)};
|
|
55
|
+
--cc-radio-unchecked-color: #{map.get($config, unchecked-color)};
|
|
56
|
+
|
|
57
|
+
// States
|
|
58
|
+
--cc-radio-disabled-color: #{map.get($config, disabled-color)};
|
|
59
|
+
--cc-radio-error-color: #{map.get($config, error-color)};
|
|
60
|
+
--cc-radio-required-color: #{map.get($config, required-color)};
|
|
61
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="cc-radio-wrapper" [ngStyle]="wrapperStyles">
|
|
2
|
+
<label *ngIf="label" class="cc-radio-group-label" [class.disabled]="disabled">
|
|
3
|
+
{{ label }}
|
|
4
|
+
<span *ngIf="required" class="cc-required">{{ requiredMarker }}</span>
|
|
5
|
+
</label>
|
|
6
|
+
|
|
7
|
+
<div class="cc-radio-group" [class.horizontal]="layout === 'horizontal'" [class.vertical]="layout === 'vertical'"
|
|
8
|
+
role="radiogroup">
|
|
9
|
+
|
|
10
|
+
<label class="cc-radio-label" *ngFor="let option of visibleOptions; let i = index"
|
|
11
|
+
[class.disabled]="disabled || option.disabled" [class.checked]="value === option.value"
|
|
12
|
+
[class.label-before]="labelPosition === 'before'">
|
|
13
|
+
|
|
14
|
+
<input type="radio" [name]="uuid" [value]="option.value" [checked]="value === option.value"
|
|
15
|
+
[disabled]="disabled || option.disabled" (change)="onRadioChange(option)" class="cc-native-radio"
|
|
16
|
+
[id]="uuid + '-' + i">
|
|
17
|
+
|
|
18
|
+
<span class="cc-radio-circle"></span>
|
|
19
|
+
<span class="cc-text">{{ option.label }}</span>
|
|
20
|
+
</label>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|