@daffodil/design 0.42.2 → 0.43.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/esm2020/atoms/button/button.component.mjs +1 -1
- package/esm2020/molecules/callout/callout/callout.component.mjs +2 -2
- package/esm2020/molecules/card/card/card.component.mjs +2 -2
- package/esm2020/molecules/hero/hero/hero.component.mjs +2 -2
- package/esm2020/molecules/image-list/image-list.component.mjs +2 -2
- package/esm2020/molecules/list/list/list.component.mjs +2 -2
- package/esm2020/molecules/paginator/paginator.component.mjs +2 -2
- package/fesm2015/daffodil-design.mjs +12 -12
- package/fesm2015/daffodil-design.mjs.map +1 -1
- package/fesm2020/daffodil-design.mjs +12 -12
- package/fesm2020/daffodil-design.mjs.map +1 -1
- package/package.json +1 -1
- package/{src/scss → scss}/README.md +0 -0
- package/scss/accessibility/_errors.scss +12 -0
- package/scss/accessibility/_index.scss +1 -0
- package/scss/core/_index.scss +4 -0
- package/scss/core/map/map-deep-check/map-deep-check.scss +26 -0
- package/scss/core/map/map-deep-check/map-deep-check.spec.scss +43 -0
- package/scss/core/map/map-deep-get/map-deep-get.scss +27 -0
- package/scss/core/map/map-deep-get/map-deep-get.spec.scss +25 -0
- package/scss/core/string/split/string-split.scss +33 -0
- package/scss/core/string/split/string-split.spec.scss +35 -0
- package/scss/daff-global.scss +49 -0
- package/scss/daff-typography.scss +55 -0
- package/scss/daff-util.scss +21 -0
- package/scss/interactions/_index.scss +1 -0
- package/scss/interactions/mouse/_clickable.scss +22 -0
- package/scss/layout/_breakpoint.scss +21 -0
- package/scss/layout/_index.scss +2 -0
- package/scss/layout/_variables.scss +13 -0
- package/scss/theme.scss +77 -0
- package/scss/theming/README.md +59 -0
- package/scss/theming/_color-palettes.scss +116 -0
- package/scss/theming/_configure-palette.scss +20 -0
- package/scss/theming/_configure-theme.scss +68 -0
- package/scss/theming/_get-color.scss +18 -0
- package/scss/theming/_index.scss +6 -0
- package/scss/theming/_theme-css-variables.scss +43 -0
- package/scss/theming/contrast/_index.scss +5 -0
- package/scss/theming/contrast/contrast-ratio/contrast-ratio.scss +11 -0
- package/scss/theming/contrast/contrast-ratio/contrast-ratio.spec.scss +0 -0
- package/scss/theming/contrast/luminance/_variables.scss +268 -0
- package/scss/theming/contrast/luminance/luminance.scss +19 -0
- package/scss/theming/contrast/luminance/luminance.spec.scss +24 -0
- package/scss/theming/contrast/text-contrast/text-contrast.scss +34 -0
- package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +0 -0
- package/scss/theming/illuminate/illuminate.scss +145 -0
- package/scss/theming/illuminate/illuminate.spec.scss +15 -0
- package/scss/theming/prebuilt/internal-theme.scss +13 -0
- package/scss/typography/README.md +88 -0
- package/scss/typography/_classes.scss +20 -0
- package/scss/typography/_index.scss +5 -0
- package/scss/typography/mixins/_font-weight.scss +18 -0
- package/scss/typography/mixins/_sizes.scss +84 -0
- package/scss/typography/mixins/_text-transform.scss +4 -0
- package/scss/typography/mixins/_text-truncate.scss +23 -0
- package/scss/typography/utilities/_index.scss +1 -0
- package/scss/typography/utilities/_variables.scss +12 -0
- package/src/atoms/button/README.md +16 -11
- package/src/atoms/button/button-theme-variants/button.scss +35 -0
- package/src/atoms/button/button-theme-variants/focus.scss +6 -0
- package/src/atoms/button/button-theme-variants/icon.scss +21 -0
- package/src/atoms/button/button-theme-variants/raised.scss +56 -0
- package/src/atoms/button/button-theme-variants/stroked.scss +36 -0
- package/src/atoms/button/button-theme-variants/underline.scss +9 -0
- package/src/atoms/button/button-theme.scss +570 -0
- package/src/atoms/form/error-message/error-message-theme.scss +7 -0
- package/src/atoms/form/form-field/form-field/form-field-theme.scss +38 -0
- package/src/atoms/form/input/input-theme.scss +16 -0
- package/src/atoms/form/radio/radio.scss +0 -0
- package/src/atoms/form/select/select/select-theme.scss +19 -0
- package/src/atoms/loading-icon/loading-icon-theme.scss +57 -0
- package/src/atoms/progress-indicator/progress-indicator-theme.scss +60 -0
- package/src/molecules/accordion/accordion-item/accordion-item-theme.scss +12 -0
- package/src/molecules/article/article/_stops-article-cascade.scss +7 -0
- package/src/molecules/article/article/article-theme.scss +78 -0
- package/src/molecules/callout/callout-theme.scss +59 -0
- package/src/molecules/card/card/card-theme-variants/basic-card.scss +6 -0
- package/src/molecules/card/card/card-theme-variants/linkable-card.scss +23 -0
- package/src/molecules/card/card/card-theme-variants/stroked-card.scss +3 -0
- package/src/molecules/card/card/card-theme.scss +186 -0
- package/src/molecules/hero/hero-theme.scss +59 -0
- package/src/molecules/list/list/list-theme.scss +68 -0
- package/src/molecules/media-gallery/media-gallery-theme.scss +20 -0
- package/src/molecules/modal/modal-theme.scss +9 -0
- package/src/molecules/navbar/navbar-theme.scss +57 -0
- package/src/molecules/paginator/paginator-theme.scss +72 -0
- package/src/molecules/sidebar/sidebar/sidebar-theme.scss +13 -0
- package/src/molecules/sidebar/sidebar-viewport/sidebar-viewport-theme.scss +11 -0
- package/daff-global.scss +0 -2
- package/daff-theme.scss +0 -3633
- package/daff-typography.scss +0 -505
- package/daff-util.scss +0 -377
package/package.json
CHANGED
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/* stylelint-disable */
|
2
|
+
$wcag-aa-errors: (
|
3
|
+
'text-contrast': 'WCAG 2.0 level AA requires text and its background color to have a contrast ratio of at least 4.5:1',
|
4
|
+
'icon-contrast': 'WCAG 2.0 level AA requires the icon and its background color to have a contrast ratio of at least 3:1'
|
5
|
+
);
|
6
|
+
|
7
|
+
$wcag-aaa-errors: (
|
8
|
+
map-merge($wcag-aa-errors, (
|
9
|
+
'text-contrast': 'WCAG 2.0 level AA requires text and its background color to have a contrast ratio of at least 7:1',
|
10
|
+
))
|
11
|
+
);
|
12
|
+
/* stylelint-enable */
|
@@ -0,0 +1 @@
|
|
1
|
+
@forward 'errors';
|
@@ -0,0 +1,26 @@
|
|
1
|
+
@use 'sass:map';
|
2
|
+
|
3
|
+
//
|
4
|
+
// Checks whether or not a map has a nested key
|
5
|
+
//
|
6
|
+
// @param $map - the map being checked
|
7
|
+
// @param $keys - an list of ordered keys to traverse down
|
8
|
+
//
|
9
|
+
// @returns boolean
|
10
|
+
// @throws error
|
11
|
+
//
|
12
|
+
@function daff-map-deep-check($map, $keys) {
|
13
|
+
@if (type-of($map) != 'map') {
|
14
|
+
@error 'Expected first parameter to be of type `map`';
|
15
|
+
}
|
16
|
+
|
17
|
+
@each $key in $keys {
|
18
|
+
@if (not map.has-key($map, $key)) {
|
19
|
+
@return false;
|
20
|
+
}
|
21
|
+
|
22
|
+
$map: map.get($map, $key);
|
23
|
+
}
|
24
|
+
|
25
|
+
@return true;
|
26
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
@use 'true' as *;
|
2
|
+
@use './map-deep-check' as *;
|
3
|
+
|
4
|
+
@include describe('map-deep-check') {
|
5
|
+
$map: (
|
6
|
+
'nested': (
|
7
|
+
'string': '1',
|
8
|
+
'number': 2,
|
9
|
+
'map': (
|
10
|
+
'string': '3',
|
11
|
+
'number': 4
|
12
|
+
)
|
13
|
+
)
|
14
|
+
);
|
15
|
+
|
16
|
+
@include it('returns `true` if the map contains the key') {
|
17
|
+
@include assert-equal(
|
18
|
+
daff-map-deep-check($map, ('nested', 'string')),
|
19
|
+
true
|
20
|
+
);
|
21
|
+
@include assert-equal(
|
22
|
+
daff-map-deep-check($map, ('nested', 'number')),
|
23
|
+
true
|
24
|
+
);
|
25
|
+
@include assert-equal(daff-map-deep-check($map, ('nested', 'map')), true);
|
26
|
+
@include assert-equal(
|
27
|
+
daff-map-deep-check($map, ('nested', 'map', 'string')),
|
28
|
+
true
|
29
|
+
);
|
30
|
+
@include assert-equal(
|
31
|
+
daff-map-deep-check($map, ('nested', 'map', 'number')),
|
32
|
+
true
|
33
|
+
);
|
34
|
+
}
|
35
|
+
|
36
|
+
@include it('should return false if the $key is not in the list') {
|
37
|
+
@include assert-equal(
|
38
|
+
daff-map-deep-check($map, ('UNREALKEY', 'TEST')),
|
39
|
+
false
|
40
|
+
);
|
41
|
+
@include assert-equal(daff-map-deep-check($map, ('SOMEOTHER')), false);
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
@use 'sass:map';
|
2
|
+
@use '../../string/split/string-split';
|
3
|
+
@use '../map-deep-check/map-deep-check';
|
4
|
+
|
5
|
+
//
|
6
|
+
// Return a the value of a nested key in a map if it exists.
|
7
|
+
// If the key doesn't exist, it throw an error.
|
8
|
+
//
|
9
|
+
// Note: This function doesn't support the use
|
10
|
+
// of the search character in your map key names.
|
11
|
+
//
|
12
|
+
// @usage daff-map-deep-get($map, "nested.map.key");
|
13
|
+
// @returns any
|
14
|
+
// @throws error
|
15
|
+
@function daff-map-deep-get($map, $key, $search-character: '.') {
|
16
|
+
$keys: string-split.daff-string-split($key, $search-character);
|
17
|
+
|
18
|
+
@if not map-deep-check.daff-map-deep-check($map, $keys) {
|
19
|
+
@error 'The map doesn\'t contain the $key: `#{$key}`\'';
|
20
|
+
}
|
21
|
+
|
22
|
+
@each $key in $keys {
|
23
|
+
$map: map.get($map, $key);
|
24
|
+
}
|
25
|
+
|
26
|
+
@return $map;
|
27
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
@use 'true' as *;
|
2
|
+
@use './map-deep-get' as *;
|
3
|
+
|
4
|
+
@include describe('map-deep-get') {
|
5
|
+
$nested-map: (
|
6
|
+
'string': '3',
|
7
|
+
'number': 4
|
8
|
+
);
|
9
|
+
|
10
|
+
$map: (
|
11
|
+
'nested': (
|
12
|
+
'string': '1',
|
13
|
+
'number': 2,
|
14
|
+
'map': $nested-map
|
15
|
+
)
|
16
|
+
);
|
17
|
+
|
18
|
+
@include it('returns the value of the nested key if it exists in the map') {
|
19
|
+
@include assert-equal(daff-map-deep-get($map, ('nested.string')), '1');
|
20
|
+
@include assert-equal(daff-map-deep-get($map, ('nested.number')), 2);
|
21
|
+
@include assert-equal(daff-map-deep-get($map, ('nested.map')), $nested-map);
|
22
|
+
@include assert-equal(daff-map-deep-get($map, ('nested.map.string')), '3');
|
23
|
+
@include assert-equal(daff-map-deep-get($map, ('nested.map.number')), 4);
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
//
|
2
|
+
// @docs
|
3
|
+
// @private
|
4
|
+
// Splits a string into an array based on a separator
|
5
|
+
// Remember, string arrays begin at 1 in SASS.
|
6
|
+
//
|
7
|
+
// @returns comma-list
|
8
|
+
//
|
9
|
+
@function daff-string-split($string, $separator) {
|
10
|
+
$list: ();
|
11
|
+
$index: str-index($string, $separator);
|
12
|
+
|
13
|
+
@if ($index == null) {
|
14
|
+
@return $list;
|
15
|
+
}
|
16
|
+
|
17
|
+
@while $index !=null {
|
18
|
+
$item: str-slice($string, 1, $index - 1);
|
19
|
+
|
20
|
+
@if ($item != '') {
|
21
|
+
$list: append($list, $item, 'comma');
|
22
|
+
}
|
23
|
+
|
24
|
+
$string: str-slice($string, $index + 1);
|
25
|
+
$index: str-index($string, $separator);
|
26
|
+
}
|
27
|
+
|
28
|
+
@if ($string != '') {
|
29
|
+
$list: append($list, $string, 'comma');
|
30
|
+
}
|
31
|
+
|
32
|
+
@return $list;
|
33
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@use 'true' as *;
|
2
|
+
@use './string-split' as *;
|
3
|
+
|
4
|
+
@include describe('daff-string-split') {
|
5
|
+
@include it(
|
6
|
+
'returns an empty map if the separator does not exist in the string'
|
7
|
+
) {
|
8
|
+
@include assert-equal(daff-string-split('a', '.'), ());
|
9
|
+
}
|
10
|
+
|
11
|
+
@include it(
|
12
|
+
'returns a single element if there is only one separator at the beginning'
|
13
|
+
) {
|
14
|
+
@include assert-equal(daff-string-split('.a', '.'), ('a',));
|
15
|
+
}
|
16
|
+
|
17
|
+
@include it(
|
18
|
+
'will treat duplicate separators as if there was only a single separator'
|
19
|
+
) {
|
20
|
+
@include assert-equal(daff-string-split('..a..', '.'), ('a',));
|
21
|
+
}
|
22
|
+
|
23
|
+
@include it(
|
24
|
+
'returns a single element if there is only one separator at the end'
|
25
|
+
) {
|
26
|
+
@include assert-equal(daff-string-split('a.', '.'), ('a',));
|
27
|
+
}
|
28
|
+
|
29
|
+
@include it('splits a string based on a separator') {
|
30
|
+
@include assert-equal(
|
31
|
+
daff-string-split('abc.xyz.csv', '.'),
|
32
|
+
('abc', 'xyz', 'csv')
|
33
|
+
);
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
// @docs
|
2
|
+
|
3
|
+
// `daff-global` holds boilerplate code for the project. It includes
|
4
|
+
// standard styles such as resets and typographic rules, which are
|
5
|
+
// commonly used throughout your project.
|
6
|
+
//
|
7
|
+
// @note This should only be imported once in your `styles.scss` file.
|
8
|
+
//
|
9
|
+
// @usage
|
10
|
+
// ```scss
|
11
|
+
// @use '@daffodil/design/scss/daff-global';
|
12
|
+
// ```
|
13
|
+
|
14
|
+
@use 'typography' as t;
|
15
|
+
@use '~@angular/cdk/overlay-prebuilt';
|
16
|
+
@use '~modern-normalize/modern-normalize';
|
17
|
+
@forward './theming/theme-css-variables';
|
18
|
+
|
19
|
+
body,
|
20
|
+
html {
|
21
|
+
font-family: t.$body-font-family;
|
22
|
+
font-size: 16px;
|
23
|
+
font-weight: 400;
|
24
|
+
line-height: 1.5;
|
25
|
+
-webkit-font-smoothing: antialiased;
|
26
|
+
-moz-osx-font-smoothing: grayscale;
|
27
|
+
}
|
28
|
+
|
29
|
+
html {
|
30
|
+
scroll-behavior: smooth;
|
31
|
+
}
|
32
|
+
|
33
|
+
a {
|
34
|
+
color: currentColor;
|
35
|
+
|
36
|
+
&:hover {
|
37
|
+
text-decoration: none;
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
h1,
|
42
|
+
h2,
|
43
|
+
h3,
|
44
|
+
h4,
|
45
|
+
h5,
|
46
|
+
h6 {
|
47
|
+
margin: 0;
|
48
|
+
padding: 0;
|
49
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
//
|
2
|
+
// @docs
|
3
|
+
//
|
4
|
+
// @deprecated in v1.0.0
|
5
|
+
// `daff-typography` will be deprecated in v1.0.0 in favor
|
6
|
+
// of the typography module. Check out the [typography
|
7
|
+
// documentation](libs/design/scss/typography/README.md)
|
8
|
+
// for more information.
|
9
|
+
//
|
10
|
+
// `daff-typography` is a generic typography library that
|
11
|
+
// sets common typography settings for the daffodil design
|
12
|
+
// package. It IS NOT necessary, but can be used.
|
13
|
+
//
|
14
|
+
// @note You SHOULD NOT import this as often as you like,
|
15
|
+
// as it only contains CSS
|
16
|
+
// and will effect your final compiled stylesheet size.
|
17
|
+
//
|
18
|
+
// @usage
|
19
|
+
// ```scss
|
20
|
+
// @use '@daffodil/design/scss/daff-typography';
|
21
|
+
// ```
|
22
|
+
|
23
|
+
@use '~modern-normalize/modern-normalize';
|
24
|
+
|
25
|
+
@use 'typography' as t;
|
26
|
+
@forward 'typography';
|
27
|
+
@forward 'typography/classes';
|
28
|
+
|
29
|
+
body,
|
30
|
+
html {
|
31
|
+
font-family: t.$body-font-family;
|
32
|
+
font-size: 16px;
|
33
|
+
font-weight: 400;
|
34
|
+
line-height: 1.5;
|
35
|
+
-webkit-font-smoothing: antialiased;
|
36
|
+
-moz-osx-font-smoothing: grayscale;
|
37
|
+
}
|
38
|
+
|
39
|
+
a {
|
40
|
+
color: currentColor;
|
41
|
+
|
42
|
+
&:hover {
|
43
|
+
text-decoration: none;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
h1,
|
48
|
+
h2,
|
49
|
+
h3,
|
50
|
+
h4,
|
51
|
+
h5,
|
52
|
+
h6 {
|
53
|
+
margin: 0;
|
54
|
+
padding: 0;
|
55
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// @docs
|
2
|
+
//
|
3
|
+
// `daff-util` is a utility library that contains common functions,
|
4
|
+
// mixins and variables that make writing SCSS stylesheets a bit
|
5
|
+
// easier.
|
6
|
+
//
|
7
|
+
//
|
8
|
+
// @note You can import this as often as you like, as it only contains SCSS
|
9
|
+
// variables, mixins, and functions; thus it won't effect your final
|
10
|
+
// compiled stylesheet size.
|
11
|
+
//
|
12
|
+
// @usage
|
13
|
+
// ```scss
|
14
|
+
// @use '@daffodil/design/scss/daff-util';
|
15
|
+
// ```
|
16
|
+
|
17
|
+
@forward 'core';
|
18
|
+
@forward 'typography';
|
19
|
+
@forward 'layout';
|
20
|
+
@forward 'interactions';
|
21
|
+
@forward 'accessibility';
|
@@ -0,0 +1 @@
|
|
1
|
+
@forward 'mouse/clickable';
|
@@ -0,0 +1,22 @@
|
|
1
|
+
//
|
2
|
+
// @docs
|
3
|
+
//
|
4
|
+
// The clickable() mixin sets mouse cursor to display when the mouse
|
5
|
+
// pointer is over an element for all supported browsers
|
6
|
+
//
|
7
|
+
// Supported browsers: Chrome all/Safari all/Firefox all/IE 10+
|
8
|
+
//
|
9
|
+
// @usage
|
10
|
+
// ```
|
11
|
+
// @include clickable();
|
12
|
+
// ```
|
13
|
+
@mixin clickable() {
|
14
|
+
cursor: pointer;
|
15
|
+
-webkit-user-select: none;
|
16
|
+
/// Chrome all / Safari all ///
|
17
|
+
-moz-user-select: none;
|
18
|
+
/// Firefox all ///
|
19
|
+
-ms-user-select: none;
|
20
|
+
/// IE 10+ ///
|
21
|
+
user-select: none;
|
22
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
@use 'sass:map';
|
2
|
+
@use 'variables' as v;
|
3
|
+
|
4
|
+
//
|
5
|
+
// Take a the list of breakpoints and retrieves the defined point.
|
6
|
+
// If an invalid breakpoint is defined, it will display a warning.
|
7
|
+
//
|
8
|
+
// @usage
|
9
|
+
// ```
|
10
|
+
// @include layout.breakpoint(mobile) {}
|
11
|
+
// ```
|
12
|
+
//
|
13
|
+
@mixin breakpoint($point) {
|
14
|
+
@if not map.has-key($map: v.$breakpoints, $key: $point) {
|
15
|
+
@warn 'breakpoint(): "#{$key}" is not defined in your $breakpoints setting.';
|
16
|
+
}
|
17
|
+
|
18
|
+
@media (min-width: map.get(v.$breakpoints, $point)) {
|
19
|
+
@content;
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
//
|
2
|
+
// @docs
|
3
|
+
//
|
4
|
+
// Sensible breakpoints to be used for layouts and interfaces.
|
5
|
+
// These breakpoints are based on common devices viewport widths.
|
6
|
+
$breakpoints: (
|
7
|
+
desktop: 1920px,
|
8
|
+
laptop: 1440px,
|
9
|
+
small-laptop: 1200px,
|
10
|
+
big-tablet: 1024px,
|
11
|
+
tablet: 768px,
|
12
|
+
mobile: 480px
|
13
|
+
);
|
package/scss/theme.scss
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
// @docs
|
2
|
+
|
3
|
+
// `theme` is a utility library for theming the daffodil
|
4
|
+
// design library. It contains many useful mixins, functions,
|
5
|
+
// and variables.
|
6
|
+
|
7
|
+
// @note You can use this as often as you like, as it only contains SCSS
|
8
|
+
// variables, mixins, and functions; thus it won't effect your final
|
9
|
+
// compiled stylesheet size.
|
10
|
+
|
11
|
+
// @usage
|
12
|
+
// ```
|
13
|
+
// @use '@daffodil/design/scss/theme';
|
14
|
+
// ```
|
15
|
+
|
16
|
+
@forward 'core';
|
17
|
+
@forward 'accessibility';
|
18
|
+
@forward 'theming';
|
19
|
+
|
20
|
+
// @daffodil/design components
|
21
|
+
@use './theming/theme-css-variables' as variables;
|
22
|
+
@use '../src/atoms/button/button-theme' as button;
|
23
|
+
@use '../src/atoms/form/error-message/error-message-theme' as error-message;
|
24
|
+
@use '../src/atoms/form/form-field/form-field/form-field-theme' as form-field;
|
25
|
+
@use '../src/atoms/form/input/input-theme' as input;
|
26
|
+
@use '../src/atoms/form/select/select/select-theme' as select;
|
27
|
+
@use '../src/atoms/loading-icon/loading-icon-theme' as loading-icon;
|
28
|
+
@use '../src/atoms/progress-indicator/progress-indicator-theme' as progress-indicator;
|
29
|
+
@use '../src/molecules/accordion/accordion-item/accordion-item-theme' as accordion-item;
|
30
|
+
@use '../src/molecules/article/article/article-theme' as article;
|
31
|
+
@use '../src/molecules/callout/callout-theme' as callout;
|
32
|
+
@use '../src/molecules/card/card/card-theme' as card;
|
33
|
+
@use '../src/molecules/hero/hero-theme' as hero;
|
34
|
+
@use '../src/molecules/list/list/list-theme' as list;
|
35
|
+
@use '../src/molecules/media-gallery/media-gallery-theme' as media-gallery;
|
36
|
+
@use '../src/molecules/modal/modal-theme' as modal;
|
37
|
+
@use '../src/molecules/navbar/navbar-theme' as navbar;
|
38
|
+
@use '../src/molecules/paginator/paginator-theme' as paginator;
|
39
|
+
@use '../src/molecules/sidebar/sidebar/sidebar-theme' as sidebar;
|
40
|
+
@use '../src/molecules/sidebar/sidebar-viewport/sidebar-viewport-theme' as sidebar-viewport;
|
41
|
+
|
42
|
+
//
|
43
|
+
// Generates the styles of a @daffodil/design theme.
|
44
|
+
//
|
45
|
+
// Usage:
|
46
|
+
// ```scss
|
47
|
+
// @use '@daffodil/design/scss/theme';
|
48
|
+
//
|
49
|
+
// @include daff-theme($theme);
|
50
|
+
// ```
|
51
|
+
@mixin daff-theme($theme) {
|
52
|
+
// CSS variables
|
53
|
+
@include variables.daff-theme-css-variables($theme);
|
54
|
+
|
55
|
+
// Atoms
|
56
|
+
@include button.daff-button-theme($theme);
|
57
|
+
@include error-message.daff-error-message-theme($theme);
|
58
|
+
@include form-field.daff-form-field-theme($theme);
|
59
|
+
@include input.daff-input-theme($theme);
|
60
|
+
@include select.daff-select-theme($theme);
|
61
|
+
@include loading-icon.daff-loading-icon-theme($theme);
|
62
|
+
@include progress-indicator.daff-progress-indicator-theme($theme);
|
63
|
+
|
64
|
+
// Molecules
|
65
|
+
@include accordion-item.daff-accordion-item-theme($theme);
|
66
|
+
@include article.daff-article-theme($theme);
|
67
|
+
@include callout.daff-callout-theme($theme);
|
68
|
+
@include card.daff-card-theme($theme);
|
69
|
+
@include hero.daff-hero-theme($theme);
|
70
|
+
@include list.daff-list-theme($theme);
|
71
|
+
@include media-gallery.daff-media-gallery-theme($theme);
|
72
|
+
@include modal.daff-modal-theme($theme);
|
73
|
+
@include navbar.daff-navbar-theme($theme);
|
74
|
+
@include paginator.daff-paginator-theme($theme);
|
75
|
+
@include sidebar.daff-sidebar-theme($theme);
|
76
|
+
@include sidebar-viewport.daff-sidebar-viewport-theme($theme);
|
77
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# Theming
|
2
|
+
Daffodil's theming capabilities enables you to customize `@daffodil/design` components to reflect your brand. A theme consists of custom color configurations that will work in dark and light themes.
|
3
|
+
|
4
|
+
## Custom Colors
|
5
|
+
:stop: Before you begin, read the [accessibility guide on color in `@daffodil/design`](../../guides/color#accessibility.md).
|
6
|
+
|
7
|
+
[validate palette function]
|
8
|
+
|
9
|
+
## Themes
|
10
|
+
Dark and light modes are supported in all `@daffodil/design` components. When a theme is not specified, Daffodil defaults to the `light` mode.
|
11
|
+
|
12
|
+
### Setting up the theme file
|
13
|
+
Configure your application to support light and dark modes by adding the following to the `theme.scss` file:
|
14
|
+
|
15
|
+
```scss
|
16
|
+
@use '@daffodil/design/scss/theme' as daff-theme;
|
17
|
+
|
18
|
+
// These palettes describe the colors that make up the "theme" of the components.
|
19
|
+
|
20
|
+
$primary: daff-theme.daff-configure-palette(daff-theme.$daff-blue, 60);
|
21
|
+
$secondary: daff-theme.daff-configure-palette(daff-theme.$daff-purple, 60);
|
22
|
+
$tertiary: daff-theme.daff-configure-palette(daff-theme.$daff-turquoise, 60);
|
23
|
+
|
24
|
+
$theme: daff-theme.daff-configure-theme($primary, $secondary, $tertiary, 'light');
|
25
|
+
|
26
|
+
$primary-dark: daff-theme.daff-configure-palette(daff-theme.$daff-blue, 50);
|
27
|
+
$secondary-dark: daff-theme.daff-configure-palette(daff-theme.$daff-purple, 50);
|
28
|
+
$tertiary-dark: daff-theme.daff-configure-palette(daff-theme.$daff-green, 50);
|
29
|
+
|
30
|
+
$theme-dark: daff-theme.daff-configure-theme($primary-dark, $secondary-dark, $tertiary-dark, 'dark');
|
31
|
+
|
32
|
+
$black: daff-theme.daff-map-deep-get($theme, 'core.black');
|
33
|
+
$white: daff-theme.daff-map-deep-get($theme, 'core.white');
|
34
|
+
$gray: daff-theme.daff-map-deep-get($theme, 'core.gray');
|
35
|
+
```
|
36
|
+
|
37
|
+
### Setting up the styles file
|
38
|
+
Add `theme.scss` to the `styles.scss` file.
|
39
|
+
|
40
|
+
```scss
|
41
|
+
@use 'theme' as app-theme;
|
42
|
+
```
|
43
|
+
|
44
|
+
> These lines include theme variables and functions that will generate the theme CSS and style the components.
|
45
|
+
|
46
|
+
Create classes in the `styles.scss` file to include the `daff-theme` mixin for `$theme` and `$theme-dark` variables. This will allow you to set a click event on a button to switch between modes. [View this setup in Stackblitz](https://stackblitz.com/edit/daffodil-design-theming-angular-10)
|
47
|
+
|
48
|
+
```scss
|
49
|
+
@use '@daffodil/design/scss/theme' as daff-theme;
|
50
|
+
@use 'theme' as app-theme;
|
51
|
+
|
52
|
+
.daff-theme-light {
|
53
|
+
@include daff-theme.daff-theme(app-theme.$theme);
|
54
|
+
}
|
55
|
+
|
56
|
+
.daff-theme-dark {
|
57
|
+
@include daff-theme.daff-theme(app-theme.$theme-dark);
|
58
|
+
}
|
59
|
+
```
|
@@ -0,0 +1,116 @@
|
|
1
|
+
// Base colors
|
2
|
+
$daff-white: #ffffff;
|
3
|
+
$error: #dd0000;
|
4
|
+
|
5
|
+
// 60 apart passes AAA level for any size text (except for 10/70)
|
6
|
+
// 50 apart passes AA level for any size text (except for 10/60)
|
7
|
+
|
8
|
+
$daff-blue: (
|
9
|
+
10: #ebf1ff,
|
10
|
+
20: #c4d8ff,
|
11
|
+
30: #9dbeff,
|
12
|
+
40: #79a7ff,
|
13
|
+
50: #548fff,
|
14
|
+
60: #1f66ff,
|
15
|
+
70: #093cf3,
|
16
|
+
80: #001bcb,
|
17
|
+
90: #00098a,
|
18
|
+
100: #000033
|
19
|
+
);
|
20
|
+
|
21
|
+
$daff-primary: $daff-blue;
|
22
|
+
|
23
|
+
$daff-purple: (
|
24
|
+
10: #ebebff,
|
25
|
+
20: #d4d3ff,
|
26
|
+
30: #b7b4ff,
|
27
|
+
40: #a19bff,
|
28
|
+
50: #8b82ff,
|
29
|
+
60: #6a57ff,
|
30
|
+
70: #5631f3,
|
31
|
+
80: #3c13bd,
|
32
|
+
90: #2c068a,
|
33
|
+
100: #110033
|
34
|
+
);
|
35
|
+
|
36
|
+
$daff-accent: $daff-purple;
|
37
|
+
|
38
|
+
$daff-turquoise: (
|
39
|
+
10: #d6fcea,
|
40
|
+
20: #9dfbd3,
|
41
|
+
30: #51e1ae,
|
42
|
+
40: #37c193,
|
43
|
+
50: #1fa67c,
|
44
|
+
60: #00835f,
|
45
|
+
70: #0f654a,
|
46
|
+
80: #104b37,
|
47
|
+
90: #0d3426,
|
48
|
+
100: #082218
|
49
|
+
);
|
50
|
+
|
51
|
+
$daff-yellow: (
|
52
|
+
10: #fffaeb,
|
53
|
+
20: #fff1c2,
|
54
|
+
30: #ffe799,
|
55
|
+
40: #ffde70,
|
56
|
+
50: #ffd447,
|
57
|
+
60: #ffc810,
|
58
|
+
70: #f5bc00,
|
59
|
+
80: #cc9c00,
|
60
|
+
90: #a37d00,
|
61
|
+
100: #7a5e00
|
62
|
+
);
|
63
|
+
|
64
|
+
$daff-red: (
|
65
|
+
10: #fcf1f1,
|
66
|
+
20: #fae0e0,
|
67
|
+
30: #f8babb,
|
68
|
+
40: #f88d8f,
|
69
|
+
50: #fb5d61,
|
70
|
+
60: #ec0019,
|
71
|
+
70: #b30e19,
|
72
|
+
80: #871016,
|
73
|
+
90: #5e0c10,
|
74
|
+
100: #3f0809,
|
75
|
+
);
|
76
|
+
|
77
|
+
$daff-bronze: (
|
78
|
+
10: #fcf2eb,
|
79
|
+
20: #f7dac6,
|
80
|
+
30: #f2c093,
|
81
|
+
40: #e49d40,
|
82
|
+
50: #d2801a,
|
83
|
+
60: #b36200,
|
84
|
+
70: #955400,
|
85
|
+
80: #704000,
|
86
|
+
90: #462900,
|
87
|
+
100: #1a0f00,
|
88
|
+
);
|
89
|
+
|
90
|
+
$daff-green: (
|
91
|
+
10: #c4ffcc,
|
92
|
+
20: #6aff86,
|
93
|
+
30: #00db57,
|
94
|
+
40: #13c049,
|
95
|
+
50: #00aa3c,
|
96
|
+
60: #00852e,
|
97
|
+
70: #006b23,
|
98
|
+
80: #004b17,
|
99
|
+
90: #0c3515,
|
100
|
+
100: #07230d,
|
101
|
+
);
|
102
|
+
|
103
|
+
$daff-gray: (
|
104
|
+
0: #ffffff,
|
105
|
+
10: #fafafa,
|
106
|
+
20: #e8e8e8,
|
107
|
+
30: #d3d3d3,
|
108
|
+
40: #b6b6b6,
|
109
|
+
50: #949494,
|
110
|
+
60: #767676,
|
111
|
+
70: #5e5e5e,
|
112
|
+
80: #474747,
|
113
|
+
90: #323232,
|
114
|
+
100: #1a1a1a,
|
115
|
+
110: #070707
|
116
|
+
);
|