@daffodil/design 0.89.0 → 0.91.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/README.md +1 -0
- package/accordion/index.d.ts +8 -5
- package/article/README.md +1 -1
- package/article/index.d.ts +20 -0
- package/article/src/article-theme.scss +10 -0
- package/button/index.d.ts +4 -4
- package/button/src/button/button-base.scss +3 -3
- package/button/src/button/raised/raised-theme.scss +6 -16
- package/card/README.md +0 -8
- package/card/index.d.ts +7 -41
- package/card/src/card-base-theme.scss +2 -5
- package/card/src/card-base.scss +2 -2
- package/checkbox/README.md +0 -0
- package/checkbox/index.d.ts +177 -0
- package/fesm2022/daffodil-design-accordion.mjs +23 -14
- package/fesm2022/daffodil-design-accordion.mjs.map +1 -1
- package/fesm2022/daffodil-design-article.mjs +129 -5
- package/fesm2022/daffodil-design-article.mjs.map +1 -1
- package/fesm2022/daffodil-design-button.mjs +24 -20
- package/fesm2022/daffodil-design-button.mjs.map +1 -1
- package/fesm2022/daffodil-design-card.mjs +16 -63
- package/fesm2022/daffodil-design-card.mjs.map +1 -1
- package/fesm2022/daffodil-design-checkbox.mjs +317 -0
- package/fesm2022/daffodil-design-checkbox.mjs.map +1 -0
- package/fesm2022/daffodil-design-form-field.mjs +55 -162
- package/fesm2022/daffodil-design-form-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-form.mjs +62 -0
- package/fesm2022/daffodil-design-form.mjs.map +1 -0
- package/fesm2022/daffodil-design-image.mjs +12 -4
- package/fesm2022/daffodil-design-image.mjs.map +1 -1
- package/fesm2022/daffodil-design-modal.mjs +55 -56
- package/fesm2022/daffodil-design-modal.mjs.map +1 -1
- package/fesm2022/daffodil-design-notification.mjs +14 -50
- package/fesm2022/daffodil-design-notification.mjs.map +1 -1
- package/fesm2022/daffodil-design-paginator.mjs +6 -11
- package/fesm2022/daffodil-design-paginator.mjs.map +1 -1
- package/fesm2022/daffodil-design-quantity-field.mjs +3 -5
- package/fesm2022/daffodil-design-quantity-field.mjs.map +1 -1
- package/fesm2022/daffodil-design-radio.mjs +304 -0
- package/fesm2022/daffodil-design-radio.mjs.map +1 -0
- package/fesm2022/daffodil-design-select.mjs +2 -2
- package/fesm2022/daffodil-design-select.mjs.map +1 -1
- package/fesm2022/daffodil-design-sidebar.mjs +6 -36
- package/fesm2022/daffodil-design-sidebar.mjs.map +1 -1
- package/fesm2022/daffodil-design-switch.mjs +48 -105
- package/fesm2022/daffodil-design-switch.mjs.map +1 -1
- package/fesm2022/daffodil-design-tabs.mjs +22 -14
- package/fesm2022/daffodil-design-tabs.mjs.map +1 -1
- package/fesm2022/daffodil-design-tag.mjs +131 -0
- package/fesm2022/daffodil-design-tag.mjs.map +1 -0
- package/fesm2022/daffodil-design-toast.mjs +56 -55
- package/fesm2022/daffodil-design-toast.mjs.map +1 -1
- package/fesm2022/daffodil-design-tree.mjs +4 -13
- package/fesm2022/daffodil-design-tree.mjs.map +1 -1
- package/fesm2022/daffodil-design.mjs +250 -774
- package/fesm2022/daffodil-design.mjs.map +1 -1
- package/form/README.md +75 -0
- package/form/index.d.ts +27 -0
- package/form-field/README.md +49 -39
- package/form-field/index.d.ts +58 -76
- package/image/README.md +27 -19
- package/image/index.d.ts +6 -1
- package/index.d.ts +180 -424
- package/input/README.md +32 -12
- package/modal/README.md +106 -16
- package/modal/index.d.ts +50 -21
- package/native-select/README.md +52 -15
- package/notification/index.d.ts +7 -38
- package/package.json +1 -1
- package/paginator/index.d.ts +1 -7
- package/radio/README.md +52 -0
- package/radio/index.d.ts +160 -0
- package/scss/core/error/error-to-string.scss +6 -6
- package/scss/core/map/map-get/map-get.scss +3 -3
- package/scss/layout/_breakpoint.scss +1 -1
- package/scss/theme.scss +4 -4
- package/scss/theming/_color-palettes.scss +21 -7
- package/scss/theming/_configure-theme.scss +11 -10
- package/scss/theming/_daff-theme.scss +5 -14
- package/scss/theming/_get-base-color.scss +2 -2
- package/scss/theming/_get-palette.scss +2 -2
- package/scss/theming/_get-theme-mode.scss +3 -3
- package/scss/theming/_index.scss +2 -1
- package/scss/theming/contrast/_index.scss +1 -0
- package/scss/theming/contrast/max-contrast/max-contrast.scss +47 -0
- package/scss/theming/contrast/max-contrast/max-contrast.spec.scss +57 -0
- package/scss/theming/contrast/text-contrast/text-contrast.scss +22 -16
- package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +57 -0
- package/scss/theming/create-theme/_create-theme.scss +330 -0
- package/scss/theming/create-theme/_create-theme.spec.scss +122 -0
- package/scss/theming/create-theme/_index.scss +1 -0
- package/scss/theming/get-font-colors/_get-font-colors.scss +36 -0
- package/scss/theming/get-font-colors/_get-font-colors.spec.scss +72 -0
- package/scss/typography/mixins/_font-weight.scss +8 -14
- package/select/README.md +107 -4
- package/sidebar/README.md +0 -8
- package/sidebar/index.d.ts +3 -15
- package/switch/README.md +19 -27
- package/switch/index.d.ts +18 -48
- package/switch/src/switch-theme.scss +26 -18
- package/tabs/index.d.ts +7 -4
- package/tag/README.md +87 -0
- package/tag/index.d.ts +71 -0
- package/tag/src/tag-theme.scss +137 -0
- package/textarea/README.md +35 -5
- package/tree/index.d.ts +0 -6
- package/tree/src/tree-theme.scss +0 -4
- package/accordion/examples/index.d.ts +0 -20
- package/article/examples/index.d.ts +0 -50
- package/breadcrumb/examples/index.d.ts +0 -10
- package/button/examples/index.d.ts +0 -67
- package/callout/examples/index.d.ts +0 -41
- package/card/examples/index.d.ts +0 -62
- package/card/src/card/raised/raised-theme.scss +0 -28
- package/checkbox/examples/index.d.ts +0 -32
- package/container/examples/index.d.ts +0 -16
- package/fesm2022/daffodil-design-accordion-examples.mjs +0 -50
- package/fesm2022/daffodil-design-accordion-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-article-examples.mjs +0 -134
- package/fesm2022/daffodil-design-article-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-breadcrumb-examples.mjs +0 -46
- package/fesm2022/daffodil-design-breadcrumb-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-button-examples.mjs +0 -178
- package/fesm2022/daffodil-design-button-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-callout-examples.mjs +0 -116
- package/fesm2022/daffodil-design-callout-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-card-examples.mjs +0 -168
- package/fesm2022/daffodil-design-card-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-checkbox-examples.mjs +0 -76
- package/fesm2022/daffodil-design-checkbox-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-container-examples.mjs +0 -41
- package/fesm2022/daffodil-design-container-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-form-field-examples.mjs +0 -96
- package/fesm2022/daffodil-design-form-field-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-hero-examples.mjs +0 -121
- package/fesm2022/daffodil-design-hero-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-image-examples.mjs +0 -58
- package/fesm2022/daffodil-design-image-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-input-examples.mjs +0 -108
- package/fesm2022/daffodil-design-input-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-list-examples.mjs +0 -77
- package/fesm2022/daffodil-design-list-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-loading-icon-examples.mjs +0 -44
- package/fesm2022/daffodil-design-loading-icon-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-media-gallery-examples.mjs +0 -104
- package/fesm2022/daffodil-design-media-gallery-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-menu-examples.mjs +0 -50
- package/fesm2022/daffodil-design-menu-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-modal-examples.mjs +0 -51
- package/fesm2022/daffodil-design-modal-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-native-select-examples.mjs +0 -71
- package/fesm2022/daffodil-design-native-select-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-navbar-examples.mjs +0 -88
- package/fesm2022/daffodil-design-navbar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-notification-examples.mjs +0 -102
- package/fesm2022/daffodil-design-notification-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-paginator-examples.mjs +0 -59
- package/fesm2022/daffodil-design-paginator-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-progress-bar-examples.mjs +0 -57
- package/fesm2022/daffodil-design-progress-bar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-quantity-field-examples.mjs +0 -85
- package/fesm2022/daffodil-design-quantity-field-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-radio-examples.mjs +0 -31
- package/fesm2022/daffodil-design-radio-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-select-examples.mjs +0 -117
- package/fesm2022/daffodil-design-select-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-sidebar-examples.mjs +0 -109
- package/fesm2022/daffodil-design-sidebar-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-sticky-examples.mjs +0 -25
- package/fesm2022/daffodil-design-sticky-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-switch-examples.mjs +0 -110
- package/fesm2022/daffodil-design-switch-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-tabs-examples.mjs +0 -115
- package/fesm2022/daffodil-design-tabs-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-text-snippet-examples.mjs +0 -25
- package/fesm2022/daffodil-design-text-snippet-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-textarea-examples.mjs +0 -66
- package/fesm2022/daffodil-design-textarea-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-toast-examples.mjs +0 -147
- package/fesm2022/daffodil-design-toast-examples.mjs.map +0 -1
- package/fesm2022/daffodil-design-tree-examples.mjs +0 -104
- package/fesm2022/daffodil-design-tree-examples.mjs.map +0 -1
- package/form-field/examples/index.d.ts +0 -18
- package/hero/examples/index.d.ts +0 -45
- package/image/examples/index.d.ts +0 -10
- package/input/examples/index.d.ts +0 -10
- package/list/examples/index.d.ts +0 -29
- package/loading-icon/examples/index.d.ts +0 -16
- package/media-gallery/examples/index.d.ts +0 -38
- package/menu/examples/index.d.ts +0 -20
- package/modal/examples/index.d.ts +0 -15
- package/native-select/examples/index.d.ts +0 -10
- package/navbar/examples/index.d.ts +0 -31
- package/notification/examples/index.d.ts +0 -12
- package/paginator/examples/index.d.ts +0 -26
- package/progress-bar/examples/index.d.ts +0 -10
- package/quantity-field/examples/index.d.ts +0 -30
- package/radio/examples/index.d.ts +0 -13
- package/select/examples/index.d.ts +0 -28
- package/sidebar/examples/index.d.ts +0 -10
- package/sticky/examples/index.d.ts +0 -10
- package/switch/examples/index.d.ts +0 -46
- package/tabs/examples/index.d.ts +0 -12
- package/text-snippet/examples/index.d.ts +0 -10
- package/textarea/examples/index.d.ts +0 -10
- package/toast/examples/index.d.ts +0 -56
- package/tree/examples/index.d.ts +0 -18
- /package/{form-field → form}/src/error-message/error-message-theme.scss +0 -0
- /package/{form-field → form}/src/hint/hint-theme.scss +0 -0
package/radio/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Radio
|
|
2
|
+
Radio is used to select a single value from a selection of values.
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
It can be hooked into Angular's `FormControl` to accomodate custom functionality. The `DaffRadioSetComponent` serves as a wrapper around a logical group of radios to provide styling.
|
|
6
|
+
|
|
7
|
+
<design-land-example-viewer-container example="basic-radio"></design-land-example-viewer-container>
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
### Within a standalone component
|
|
12
|
+
To use radio in a standalone component, import `DAFF_RADIO_COMPONENTS` directly into your custom component:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { DAFF_RADIO_COMPONENTS } from '@daffodil/design/radio';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'custom-component',
|
|
19
|
+
templateUrl: './custom-component.component.html',
|
|
20
|
+
imports: [
|
|
21
|
+
DAFF_RADIO_COMPONENTS,
|
|
22
|
+
],
|
|
23
|
+
})
|
|
24
|
+
export class CustomComponent {}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Within a module (deprecated)
|
|
28
|
+
To use radio in a module, import `DaffRadioModule` into your custom module:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { NgModule } from '@angular/core';
|
|
32
|
+
import { DaffRadioModule } from '@daffodil/design/radio';
|
|
33
|
+
import { CustomComponent } from './custom.component';
|
|
34
|
+
|
|
35
|
+
@NgModule({
|
|
36
|
+
declarations: [
|
|
37
|
+
CustomComponent,
|
|
38
|
+
],
|
|
39
|
+
exports: [
|
|
40
|
+
CustomComponent,
|
|
41
|
+
],
|
|
42
|
+
imports: [
|
|
43
|
+
DaffRadioModule,
|
|
44
|
+
],
|
|
45
|
+
})
|
|
46
|
+
export class CustomComponentModule { }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> Deprecation notice: This method is deprecated. It's recommended to update all custom components to standalone.
|
|
50
|
+
|
|
51
|
+
## Accessibility
|
|
52
|
+
Radio uses native `<input>` HTML elements to ensure an accesible experience by default. It supports inputs to customize the experience for accessibility by allowing native input for `aria-label` and `aria-labelledby`.
|
package/radio/index.d.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, EventEmitter } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { NgControl, ControlValueAccessor } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
declare class DaffRadioSetComponent {
|
|
7
|
+
name: string;
|
|
8
|
+
constructor();
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffRadioSetComponent, never>;
|
|
10
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DaffRadioSetComponent, "daff-radio-set", never, { "name": { "alias": "name"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare class DaffRadioComponent implements OnInit {
|
|
14
|
+
private radioset;
|
|
15
|
+
/**
|
|
16
|
+
* @docs-private
|
|
17
|
+
*/
|
|
18
|
+
_checked: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Output event of selection being changed
|
|
21
|
+
*/
|
|
22
|
+
selectionChange: EventEmitter<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* The checked property of the radio
|
|
25
|
+
*/
|
|
26
|
+
get checked(): boolean;
|
|
27
|
+
set checked(value: boolean);
|
|
28
|
+
/**
|
|
29
|
+
* The value of the radio
|
|
30
|
+
*/
|
|
31
|
+
value: any;
|
|
32
|
+
/**
|
|
33
|
+
* The id of the radio. It is uniquely generated but can be overwritten by the user. Must be unique.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Name of the Radio
|
|
38
|
+
*/
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* Used for aria-label. Default to name if user does not input a label.
|
|
42
|
+
*/
|
|
43
|
+
label: string;
|
|
44
|
+
/**
|
|
45
|
+
* Used for aria-labelledby.
|
|
46
|
+
*/
|
|
47
|
+
labelledby: string;
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
focused: boolean;
|
|
50
|
+
constructor(radioset: DaffRadioSetComponent);
|
|
51
|
+
/**
|
|
52
|
+
* @docs-private
|
|
53
|
+
*/
|
|
54
|
+
ngOnInit(): void;
|
|
55
|
+
/**
|
|
56
|
+
* updates Focus styling
|
|
57
|
+
*/
|
|
58
|
+
onFocus(): void;
|
|
59
|
+
/**
|
|
60
|
+
* updates Blur styling
|
|
61
|
+
*/
|
|
62
|
+
onBlur(): void;
|
|
63
|
+
/**
|
|
64
|
+
* toggles checked attribute on
|
|
65
|
+
*/
|
|
66
|
+
select(): void;
|
|
67
|
+
/**
|
|
68
|
+
* toggles checked attribute off
|
|
69
|
+
*/
|
|
70
|
+
deselect(): void;
|
|
71
|
+
onChange(): void;
|
|
72
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffRadioComponent, [{ optional: true; }]>;
|
|
73
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DaffRadioComponent, "daff-radio", never, { "checked": { "alias": "checked"; "required": false; }; "value": { "alias": "value"; "required": false; }; "id": { "alias": "id"; "required": false; }; "name": { "alias": "name"; "required": false; }; "label": { "alias": "aria-label"; "required": false; }; "labelledby": { "alias": "aria-labelledby"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, ["*"], true, never>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class DaffRadioRegistry {
|
|
77
|
+
private _accessors;
|
|
78
|
+
/**
|
|
79
|
+
* @description
|
|
80
|
+
* Adds a control to the internal registry.
|
|
81
|
+
*/
|
|
82
|
+
add(control: NgControl, accessor: DaffRadioControlValueAccessorDirective): void;
|
|
83
|
+
/**
|
|
84
|
+
* @description
|
|
85
|
+
* Removes a control from the internal registry.
|
|
86
|
+
*/
|
|
87
|
+
remove(accessor: DaffRadioControlValueAccessorDirective): void;
|
|
88
|
+
/**
|
|
89
|
+
* @description
|
|
90
|
+
* Selects a radio button.
|
|
91
|
+
*/
|
|
92
|
+
select(accessor: DaffRadioControlValueAccessorDirective): void;
|
|
93
|
+
private _isSameGroup;
|
|
94
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffRadioRegistry, never>;
|
|
95
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DaffRadioRegistry>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* ControlValueAccessor functionality for the DaffRadio
|
|
100
|
+
*/
|
|
101
|
+
declare class DaffRadioControlValueAccessorDirective implements OnInit, ControlValueAccessor {
|
|
102
|
+
_control: NgControl;
|
|
103
|
+
private _registry;
|
|
104
|
+
private _radio;
|
|
105
|
+
_onChange: () => void;
|
|
106
|
+
_onTouched: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* The value of the ControlValueAccessor
|
|
109
|
+
*/
|
|
110
|
+
value: any;
|
|
111
|
+
/**
|
|
112
|
+
* The name of the ControlValueAccessor
|
|
113
|
+
*/
|
|
114
|
+
name: string;
|
|
115
|
+
constructor(_control: NgControl, _registry: DaffRadioRegistry, _radio: DaffRadioComponent);
|
|
116
|
+
/**
|
|
117
|
+
* @docs-private
|
|
118
|
+
*/
|
|
119
|
+
ngOnInit(): void;
|
|
120
|
+
/**
|
|
121
|
+
*
|
|
122
|
+
* writeValue function from the CVA interface
|
|
123
|
+
*/
|
|
124
|
+
writeValue(value: any): void;
|
|
125
|
+
/**
|
|
126
|
+
* registerOnChange implemented from the CVA interface
|
|
127
|
+
*/
|
|
128
|
+
registerOnChange(fn: any): void;
|
|
129
|
+
/**
|
|
130
|
+
* registerOnTouch implemented from the CVA interface
|
|
131
|
+
*/
|
|
132
|
+
registerOnTouched(fn: any): void;
|
|
133
|
+
/**
|
|
134
|
+
* sets the disabled state.
|
|
135
|
+
*/
|
|
136
|
+
setDisabledState?(isDisabled: boolean): void;
|
|
137
|
+
/**
|
|
138
|
+
calls select function for the radio
|
|
139
|
+
*/
|
|
140
|
+
fireSelect(): void;
|
|
141
|
+
/**
|
|
142
|
+
calls deselect function for the radio
|
|
143
|
+
*/
|
|
144
|
+
fireDeselect(): void;
|
|
145
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffRadioControlValueAccessorDirective, [{ optional: true; self: true; }, null, null]>;
|
|
146
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<DaffRadioControlValueAccessorDirective, "daff-radio[ngModel], daff-radio[formControl], daff-radio[formControlName]", never, { "value": { "alias": "value"; "required": false; }; "name": { "alias": "name"; "required": false; }; }, {}, never, never, true, never>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
declare class DaffRadioModule {
|
|
150
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffRadioModule, never>;
|
|
151
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DaffRadioModule, never, [typeof i1.CommonModule, typeof DaffRadioComponent, typeof DaffRadioSetComponent, typeof DaffRadioControlValueAccessorDirective], [typeof DaffRadioComponent, typeof DaffRadioSetComponent, typeof DaffRadioControlValueAccessorDirective]>;
|
|
152
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DaffRadioModule>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @docs-private
|
|
157
|
+
*/
|
|
158
|
+
declare const DAFF_RADIO_COMPONENTS: readonly [typeof DaffRadioComponent, typeof DaffRadioSetComponent, typeof DaffRadioControlValueAccessorDirective];
|
|
159
|
+
|
|
160
|
+
export { DAFF_RADIO_COMPONENTS, DaffRadioComponent, DaffRadioControlValueAccessorDirective, DaffRadioModule, DaffRadioSetComponent };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
$use-string: false !default;
|
|
2
2
|
|
|
3
3
|
@function error-to-string($message, $override: $use-string) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
@if $override {
|
|
5
|
+
@return $message;
|
|
6
|
+
} @else {
|
|
7
|
+
@error $message;
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
@mixin set-use-string($state: true) {
|
|
12
|
-
|
|
12
|
+
$use-string: $state !global;
|
|
13
13
|
}
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
// @throws error
|
|
14
14
|
@function daff-map-get($map, $keys...) {
|
|
15
15
|
@each $key in $keys {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
@if not map.has-key($map, $key) {
|
|
17
|
+
@return error-to-string.error-to-string("The map doesn't contain the $key: `#{$key}`'");
|
|
18
|
+
}
|
|
19
19
|
$map: map.get($map, $key);
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
///
|
|
21
21
|
@mixin breakpoint($point) {
|
|
22
22
|
@if not map.has-key($map: v.$breakpoints, $key: $point) {
|
|
23
|
-
@warn 'breakpoint(): "#{$
|
|
23
|
+
@warn 'breakpoint(): "#{$point}" is not defined in the $breakpoints map.';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
@media (min-width: map.get(v.$breakpoints, $point)) {
|
package/scss/theme.scss
CHANGED
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
@use '../button/src/button/stroked/stroked-theme' as stroked-button;
|
|
27
27
|
@use '../button/src/button/underline/underline-theme' as underline-button;
|
|
28
28
|
@use '../article/src/article-theme' as article;
|
|
29
|
-
@use '../
|
|
30
|
-
@use '../form
|
|
29
|
+
@use '../tag/src/tag-theme' as tag;
|
|
30
|
+
@use '../form/src/error-message/error-message-theme' as error-message;
|
|
31
|
+
@use '../form/src/hint/hint-theme' as hint;
|
|
31
32
|
@use '../form-field/src/form-field-theme' as form-field;
|
|
32
33
|
@use '../native-select/src/native-select-theme' as native-select;
|
|
33
34
|
@use '../loading-icon/src/loading-icon-theme' as loading-icon;
|
|
34
35
|
@use '../accordion/src/accordion-theme' as accordion;
|
|
35
36
|
@use '../callout/src/callout-theme' as callout;
|
|
36
37
|
@use '../card/src/card-base-theme' as card-base;
|
|
37
|
-
@use '../card/src/card/raised/raised-theme' as raised-card;
|
|
38
38
|
@use '../card/src/card/stroked/stroked-theme' as stroked-card;
|
|
39
39
|
@use '../hero/src/hero-theme' as hero;
|
|
40
40
|
@use '../list/src/list-theme' as list;
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
|
|
72
72
|
@include accordion.daff-accordion-theme($theme);
|
|
73
73
|
@include article.daff-article-theme($theme);
|
|
74
|
+
@include tag.daff-tag-theme($theme);
|
|
74
75
|
@include breadcrumb.daff-breadcrumb-theme($theme);
|
|
75
76
|
|
|
76
77
|
@include button.daff-button-theme($theme);
|
|
@@ -82,7 +83,6 @@
|
|
|
82
83
|
|
|
83
84
|
@include callout.daff-callout-theme($theme);
|
|
84
85
|
@include card-base.daff-card-base-theme($theme);
|
|
85
|
-
@include raised-card.daff-raised-card-theme($theme);
|
|
86
86
|
@include stroked-card.daff-stroked-card-theme($theme);
|
|
87
87
|
|
|
88
88
|
@include form-field.daff-form-field-theme($theme);
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
////
|
|
2
|
+
/// @group color-palettes
|
|
3
|
+
////
|
|
4
|
+
|
|
1
5
|
// Base colors
|
|
2
|
-
|
|
6
|
+
/// @access private
|
|
7
|
+
$white: #ffffff;
|
|
8
|
+
/// @access private
|
|
9
|
+
$black: #070707;
|
|
10
|
+
// need to deprecate
|
|
11
|
+
/// @access private
|
|
3
12
|
$error: #dd0000;
|
|
4
13
|
|
|
5
|
-
|
|
6
|
-
// 50 apart passes AA level for any size text (except for 10/60)
|
|
7
|
-
|
|
14
|
+
/// @access private
|
|
8
15
|
$daff-blue: (
|
|
9
16
|
10: #ebf1ff,
|
|
10
17
|
20: #c4d8ff,
|
|
@@ -18,8 +25,10 @@ $daff-blue: (
|
|
|
18
25
|
100: #000033
|
|
19
26
|
);
|
|
20
27
|
|
|
28
|
+
/// @access private
|
|
21
29
|
$daff-primary: $daff-blue;
|
|
22
30
|
|
|
31
|
+
/// @access private
|
|
23
32
|
$daff-purple: (
|
|
24
33
|
10: #ebebff,
|
|
25
34
|
20: #d4d3ff,
|
|
@@ -33,8 +42,10 @@ $daff-purple: (
|
|
|
33
42
|
100: #110033
|
|
34
43
|
);
|
|
35
44
|
|
|
45
|
+
/// @access private
|
|
36
46
|
$daff-accent: $daff-purple;
|
|
37
47
|
|
|
48
|
+
/// @access private
|
|
38
49
|
$daff-turquoise: (
|
|
39
50
|
10: #d6fcea,
|
|
40
51
|
20: #9dfbd3,
|
|
@@ -48,6 +59,7 @@ $daff-turquoise: (
|
|
|
48
59
|
100: #082218
|
|
49
60
|
);
|
|
50
61
|
|
|
62
|
+
/// @access private
|
|
51
63
|
$daff-yellow: (
|
|
52
64
|
10: #fffaeb,
|
|
53
65
|
20: #fff1c2,
|
|
@@ -61,6 +73,7 @@ $daff-yellow: (
|
|
|
61
73
|
100: #7a5e00
|
|
62
74
|
);
|
|
63
75
|
|
|
76
|
+
/// @access private
|
|
64
77
|
$daff-red: (
|
|
65
78
|
10: #fcf1f1,
|
|
66
79
|
20: #fae0e0,
|
|
@@ -74,6 +87,7 @@ $daff-red: (
|
|
|
74
87
|
100: #3f0809,
|
|
75
88
|
);
|
|
76
89
|
|
|
90
|
+
/// @access private
|
|
77
91
|
$daff-bronze: (
|
|
78
92
|
10: #fcf2eb,
|
|
79
93
|
20: #f7dac6,
|
|
@@ -87,6 +101,7 @@ $daff-bronze: (
|
|
|
87
101
|
100: #1a0f00,
|
|
88
102
|
);
|
|
89
103
|
|
|
104
|
+
/// @access private
|
|
90
105
|
$daff-green: (
|
|
91
106
|
10: #d1fbd6,
|
|
92
107
|
20: #97f8a5,
|
|
@@ -100,8 +115,8 @@ $daff-green: (
|
|
|
100
115
|
100: #07230d,
|
|
101
116
|
);
|
|
102
117
|
|
|
118
|
+
/// @access private
|
|
103
119
|
$daff-neutral: (
|
|
104
|
-
0: #ffffff,
|
|
105
120
|
10: #fafafa,
|
|
106
121
|
20: #e8e8e8,
|
|
107
122
|
30: #d3d3d3,
|
|
@@ -111,6 +126,5 @@ $daff-neutral: (
|
|
|
111
126
|
70: #5e5e5e,
|
|
112
127
|
80: #474747,
|
|
113
128
|
90: #323232,
|
|
114
|
-
100: #1a1a1a
|
|
115
|
-
110: #070707
|
|
129
|
+
100: #1a1a1a
|
|
116
130
|
);
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
|
|
6
6
|
$daff-light-theme: (
|
|
7
7
|
'mode': 'light',
|
|
8
|
-
'font-color':
|
|
9
|
-
'base':
|
|
10
|
-
'base-contrast':
|
|
11
|
-
'white':
|
|
12
|
-
'black':
|
|
8
|
+
'font-color': palette.$black,
|
|
9
|
+
'base': palette.$white,
|
|
10
|
+
'base-contrast': palette.$black,
|
|
11
|
+
'white': palette.$white,
|
|
12
|
+
'black': palette.$black,
|
|
13
13
|
'neutral': configure-palette.daff-configure-palette(palette.$daff-neutral, 60),
|
|
14
14
|
);
|
|
15
15
|
|
|
16
16
|
$daff-dark-theme: (
|
|
17
17
|
'mode': 'dark',
|
|
18
|
-
'font-color':
|
|
19
|
-
'base':
|
|
20
|
-
'base-contrast':
|
|
21
|
-
'white':
|
|
22
|
-
'black':
|
|
18
|
+
'font-color': palette.$white,
|
|
19
|
+
'base': palette.$black,
|
|
20
|
+
'base-contrast': palette.$white,
|
|
21
|
+
'white': palette.$white,
|
|
22
|
+
'black': palette.$black,
|
|
23
23
|
'neutral': configure-palette.daff-configure-palette(palette.$daff-neutral, 50),
|
|
24
24
|
);
|
|
25
25
|
|
|
@@ -28,6 +28,7 @@ $supported-theme-modes: (
|
|
|
28
28
|
'dark': $daff-dark-theme
|
|
29
29
|
);
|
|
30
30
|
|
|
31
|
+
/// @deprecated Use `daff-create-theme` instead.
|
|
31
32
|
/// Create a theme object given some initial settings.
|
|
32
33
|
///
|
|
33
34
|
/// Sets light and dark mode defaults for `$info`, `$warn`, `$critical`, and `$success`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@use 'configure-palette';
|
|
2
|
-
@use '
|
|
2
|
+
@use './create-theme/create-theme';
|
|
3
3
|
@use 'color-palettes' as palette;
|
|
4
4
|
@use '../core';
|
|
5
5
|
|
|
@@ -7,23 +7,14 @@ $primary: configure-palette.daff-configure-palette(palette.$daff-blue, 60);
|
|
|
7
7
|
$secondary: configure-palette.daff-configure-palette(palette.$daff-purple, 60);
|
|
8
8
|
$tertiary: configure-palette.daff-configure-palette(palette.$daff-turquoise, 60);
|
|
9
9
|
|
|
10
|
-
$theme:
|
|
11
|
-
$primary,
|
|
12
|
-
$secondary,
|
|
13
|
-
$tertiary,
|
|
14
|
-
'light'
|
|
10
|
+
$theme: create-theme.daff-create-theme(
|
|
11
|
+
('primary': $primary, 'secondary': $secondary, 'tertiary': $tertiary, 'mode': 'light')
|
|
15
12
|
);
|
|
16
13
|
|
|
17
14
|
$primary-dark: configure-palette.daff-configure-palette(palette.$daff-blue, 50);
|
|
18
15
|
$secondary-dark: configure-palette.daff-configure-palette(palette.$daff-purple, 50);
|
|
19
16
|
$tertiary-dark: configure-palette.daff-configure-palette(palette.$daff-turquoise, 50);
|
|
20
17
|
|
|
21
|
-
$theme-dark:
|
|
22
|
-
$primary-dark,
|
|
23
|
-
$secondary-dark,
|
|
24
|
-
$tertiary-dark,
|
|
25
|
-
'dark'
|
|
18
|
+
$theme-dark: create-theme.daff-create-theme(
|
|
19
|
+
('primary': $primary-dark, 'secondary': $secondary-dark, 'tertiary': $tertiary-dark, 'mode': 'dark')
|
|
26
20
|
);
|
|
27
|
-
|
|
28
|
-
$black: core.daff-map-get($theme, 'core', 'black');
|
|
29
|
-
$white: core.daff-map-get($theme, 'core', 'white');
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
/// Retrieves a core base color from a configured theme.
|
|
4
4
|
///
|
|
5
5
|
/// If you are not using Daffodil's default theme, a theme **must** be
|
|
6
|
-
/// created with `daff-
|
|
6
|
+
/// created with `daff-create-theme` before this function can be used.
|
|
7
7
|
/// See the [customize your own theme](daff.io/docs/design/theming/customize-your-own-theme)
|
|
8
8
|
/// guide for more information.
|
|
9
9
|
///
|
|
10
10
|
/// @group Theming
|
|
11
11
|
///
|
|
12
|
-
/// @param {Map} $theme — A theme map created with the `daff-
|
|
12
|
+
/// @param {Map} $theme — A theme map created with the `daff-create-theme` function.
|
|
13
13
|
/// @param {String} $color — The core color to retrieve. Supported colors: `white`, `black`, `base`, or `base-contrast`.
|
|
14
14
|
///
|
|
15
15
|
/// @throws Will throw an error if `$color` is not supported as part of Daffodil's core colors.
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
/// Retrieves a specific color palette from a configured theme.
|
|
4
4
|
///
|
|
5
5
|
/// If you are not using Daffodil's default theme, a theme **must** be
|
|
6
|
-
/// created with `daff-
|
|
6
|
+
/// created with `daff-create-theme` before this function can be used.
|
|
7
7
|
/// See the [customize your own theme](daff.io/docs/design/theming/customize-your-own-theme)
|
|
8
8
|
/// guide for more information.
|
|
9
9
|
///
|
|
10
10
|
/// @group Theming
|
|
11
11
|
///
|
|
12
|
-
/// @param {Map} $theme — A theme map created with with `daff-
|
|
12
|
+
/// @param {Map} $theme — A theme map created with with `daff-create-theme` function.
|
|
13
13
|
/// @param {Map} $palette — The palette being retrieved.
|
|
14
14
|
/// Supported values: `primary`, `secondary`, `tertiary`, `informational`, `warn`, `critical`, `success`, or `neutral`.
|
|
15
15
|
///
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
@use '../core/map/map-get/map-get';
|
|
2
2
|
|
|
3
|
-
/// Retrieves the mode (`light` or `dark`) from a configured theme created with `daff-
|
|
3
|
+
/// Retrieves the mode (`light` or `dark`) from a configured theme created with `daff-create-theme`.
|
|
4
4
|
/// It should only be used if your app supports **both light and dark themes**.
|
|
5
5
|
///
|
|
6
6
|
/// If you are not using Daffodil's default theme, a theme **must** be
|
|
7
|
-
/// created with `daff-
|
|
7
|
+
/// created with `daff-create-theme` before this function can be used.
|
|
8
8
|
///
|
|
9
9
|
/// See the [customize your own theme](daff.io/docs/design/theming/customize-your-own-theme)
|
|
10
10
|
/// guide for more information.
|
|
11
11
|
///
|
|
12
12
|
/// @group Theming
|
|
13
13
|
///
|
|
14
|
-
/// @param {Map} $theme — A theme map created with the `daff-
|
|
14
|
+
/// @param {Map} $theme — A theme map created with the `daff-create-theme` function.
|
|
15
15
|
///
|
|
16
16
|
/// @example scss
|
|
17
17
|
/// @use '@daffodil/design/scss/theme' as daff-theme;
|
package/scss/theming/_index.scss
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
@forward 'contrast';
|
|
4
4
|
@forward 'illuminate/illuminate';
|
|
5
5
|
@forward 'configure-palette';
|
|
6
|
-
@forward '
|
|
6
|
+
@forward 'create-theme/create-theme';
|
|
7
7
|
@forward 'light-dark';
|
|
8
8
|
@forward 'daff-theme';
|
|
9
9
|
@forward 'get-palette';
|
|
10
10
|
@forward 'get-base-color';
|
|
11
11
|
@forward 'get-theme-mode';
|
|
12
|
+
@forward 'configure-theme' show daff-configure-theme;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use '../contrast-ratio/contrast-ratio' as cr;
|
|
3
|
+
@use '../../../core/error/error-to-string';
|
|
4
|
+
|
|
5
|
+
/// Returns the color from a list of colors that has the highest contrast ratio with a reference color.
|
|
6
|
+
/// If the list is empty, an error is thrown. If the list has one color, that color is returned.
|
|
7
|
+
///
|
|
8
|
+
/// @group Theming
|
|
9
|
+
///
|
|
10
|
+
/// @param {Color} $reference-color
|
|
11
|
+
/// @param {List} $colors — A list of colors to compare against the reference color
|
|
12
|
+
/// @return {Color} The color with the highest contrast ratio between the reference color and the color list
|
|
13
|
+
///
|
|
14
|
+
/// @example scss
|
|
15
|
+
/// .card {
|
|
16
|
+
/// background: daff-color($primary, 30);
|
|
17
|
+
/// border-color: daff-max-contrast(daff-color($primary, 30), (daff-color($secondary, 70), daff-color($accent, 50)));
|
|
18
|
+
/// }
|
|
19
|
+
///
|
|
20
|
+
@function daff-max-contrast(
|
|
21
|
+
$reference-color,
|
|
22
|
+
$colors: ()
|
|
23
|
+
) {
|
|
24
|
+
@if(list.length($colors) == 0) {
|
|
25
|
+
@return error-to-string.error-to-string(
|
|
26
|
+
'Cannot calculate max contrast for `' + $reference-color + '`Provide at least one color to compare against.'
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
@else if(list.length($colors) == 1) {
|
|
30
|
+
@return list.nth($colors, 1);
|
|
31
|
+
}
|
|
32
|
+
@else {
|
|
33
|
+
$max-contrast: -1;
|
|
34
|
+
$max-contrast-color: null;
|
|
35
|
+
|
|
36
|
+
@each $color in $colors {
|
|
37
|
+
$current-contrast: cr.daff-contrast-ratio($reference-color, $color);
|
|
38
|
+
|
|
39
|
+
@if($current-contrast > $max-contrast) {
|
|
40
|
+
$max-contrast: $current-contrast;
|
|
41
|
+
$max-contrast-color: $color;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@return $max-contrast-color;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
@use 'true' as *;
|
|
2
|
+
@use './max-contrast' as *;
|
|
3
|
+
@use '../../../core/error/error-to-string';
|
|
4
|
+
|
|
5
|
+
@include describe('daff-max-contrast') {
|
|
6
|
+
$white: #ffffff;
|
|
7
|
+
$black: #000000;
|
|
8
|
+
$red: #ff0000;
|
|
9
|
+
$blue: #0000ff;
|
|
10
|
+
$gray: #808080;
|
|
11
|
+
$light-gray: #cccccc;
|
|
12
|
+
$dark-gray: #333333;
|
|
13
|
+
|
|
14
|
+
$single-color-list: ($white);
|
|
15
|
+
$two-color-list: ($white, $black);
|
|
16
|
+
$multiple-color-list: ($red, $blue, $gray, $light-gray, $dark-gray);
|
|
17
|
+
$empty-list: ();
|
|
18
|
+
|
|
19
|
+
@include error-to-string.set-use-string(true);
|
|
20
|
+
|
|
21
|
+
@include it('returns the contrast ratio for single color') {
|
|
22
|
+
@include assert-equal(daff-max-contrast($black, $single-color-list), white);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include it('returns the highest contrast ratio from two colors') {
|
|
26
|
+
@include assert-equal(daff-max-contrast($black, $two-color-list), white);
|
|
27
|
+
@include assert-equal(daff-max-contrast($white, $two-color-list), black);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@include it('returns the highest contrast ratio from multiple colors') {
|
|
31
|
+
@include assert-equal(daff-max-contrast($black, $multiple-color-list), $light-gray);
|
|
32
|
+
|
|
33
|
+
@include assert-equal(daff-max-contrast($white, $multiple-color-list), $dark-gray);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include it('returns consistent results regardless of list order') {
|
|
37
|
+
$reordered-list: ($dark-gray, $light-gray, $gray, $blue, $red);
|
|
38
|
+
@include assert-equal(
|
|
39
|
+
daff-max-contrast($black, $multiple-color-list),
|
|
40
|
+
daff-max-contrast($black, $reordered-list)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@include it('works with different reference colors') {
|
|
45
|
+
@include assert-equal(daff-max-contrast($red, ($white, $black, $blue)), black);
|
|
46
|
+
@include assert-equal(daff-max-contrast($blue, ($white, $black, $red)), white);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@include it('errors when given an empty color list') {
|
|
50
|
+
@include assert-equal(
|
|
51
|
+
daff-max-contrast($black, $empty-list),
|
|
52
|
+
'Cannot calculate max contrast for `' + $black + '`Provide at least one color to compare against.'
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@include error-to-string.set-use-string(false);
|
|
57
|
+
}
|