@daffodil/design 0.42.4 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/esm2020/molecules/callout/callout/callout.component.mjs +2 -2
  2. package/esm2020/molecules/card/card/card.component.mjs +2 -2
  3. package/esm2020/molecules/hero/hero/hero.component.mjs +2 -2
  4. package/esm2020/molecules/image-list/image-list.component.mjs +2 -2
  5. package/esm2020/molecules/list/list/list.component.mjs +2 -2
  6. package/esm2020/molecules/paginator/paginator.component.mjs +2 -2
  7. package/fesm2015/daffodil-design.mjs +12 -12
  8. package/fesm2015/daffodil-design.mjs.map +1 -1
  9. package/fesm2020/daffodil-design.mjs +12 -12
  10. package/fesm2020/daffodil-design.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/{src/scss → scss}/README.md +0 -0
  13. package/scss/accessibility/_errors.scss +12 -0
  14. package/scss/accessibility/_index.scss +1 -0
  15. package/scss/core/_index.scss +4 -0
  16. package/scss/core/map/map-deep-check/map-deep-check.scss +26 -0
  17. package/scss/core/map/map-deep-check/map-deep-check.spec.scss +43 -0
  18. package/scss/core/map/map-deep-get/map-deep-get.scss +27 -0
  19. package/scss/core/map/map-deep-get/map-deep-get.spec.scss +25 -0
  20. package/scss/core/string/split/string-split.scss +33 -0
  21. package/scss/core/string/split/string-split.spec.scss +35 -0
  22. package/scss/daff-global.scss +49 -0
  23. package/scss/daff-typography.scss +55 -0
  24. package/scss/daff-util.scss +21 -0
  25. package/scss/interactions/_index.scss +1 -0
  26. package/scss/interactions/mouse/_clickable.scss +22 -0
  27. package/scss/layout/_breakpoint.scss +21 -0
  28. package/scss/layout/_index.scss +2 -0
  29. package/scss/layout/_variables.scss +13 -0
  30. package/scss/theme.scss +77 -0
  31. package/scss/theming/README.md +59 -0
  32. package/scss/theming/_color-palettes.scss +116 -0
  33. package/scss/theming/_configure-palette.scss +20 -0
  34. package/scss/theming/_configure-theme.scss +68 -0
  35. package/scss/theming/_get-color.scss +18 -0
  36. package/scss/theming/_index.scss +6 -0
  37. package/scss/theming/_theme-css-variables.scss +43 -0
  38. package/scss/theming/contrast/_index.scss +5 -0
  39. package/scss/theming/contrast/contrast-ratio/contrast-ratio.scss +11 -0
  40. package/scss/theming/contrast/contrast-ratio/contrast-ratio.spec.scss +0 -0
  41. package/scss/theming/contrast/luminance/_variables.scss +268 -0
  42. package/scss/theming/contrast/luminance/luminance.scss +19 -0
  43. package/scss/theming/contrast/luminance/luminance.spec.scss +24 -0
  44. package/scss/theming/contrast/text-contrast/text-contrast.scss +34 -0
  45. package/scss/theming/contrast/text-contrast/text-contrast.spec.scss +0 -0
  46. package/scss/theming/illuminate/illuminate.scss +145 -0
  47. package/scss/theming/illuminate/illuminate.spec.scss +15 -0
  48. package/scss/theming/prebuilt/internal-theme.scss +13 -0
  49. package/scss/typography/README.md +88 -0
  50. package/scss/typography/_classes.scss +20 -0
  51. package/scss/typography/_index.scss +5 -0
  52. package/scss/typography/mixins/_font-weight.scss +18 -0
  53. package/scss/typography/mixins/_sizes.scss +84 -0
  54. package/scss/typography/mixins/_text-transform.scss +4 -0
  55. package/scss/typography/mixins/_text-truncate.scss +23 -0
  56. package/scss/typography/utilities/_index.scss +1 -0
  57. package/scss/typography/utilities/_variables.scss +12 -0
  58. package/src/atoms/button/button-theme-variants/button.scss +35 -0
  59. package/src/atoms/button/button-theme-variants/focus.scss +6 -0
  60. package/src/atoms/button/button-theme-variants/icon.scss +21 -0
  61. package/src/atoms/button/button-theme-variants/raised.scss +56 -0
  62. package/src/atoms/button/button-theme-variants/stroked.scss +36 -0
  63. package/src/atoms/button/button-theme-variants/underline.scss +9 -0
  64. package/src/atoms/button/button-theme.scss +570 -0
  65. package/src/atoms/form/error-message/error-message-theme.scss +7 -0
  66. package/src/atoms/form/form-field/form-field/form-field-theme.scss +38 -0
  67. package/src/atoms/form/input/input-theme.scss +16 -0
  68. package/src/atoms/form/radio/radio.scss +0 -0
  69. package/src/atoms/form/select/select/select-theme.scss +19 -0
  70. package/src/atoms/loading-icon/loading-icon-theme.scss +57 -0
  71. package/src/atoms/progress-indicator/progress-indicator-theme.scss +60 -0
  72. package/src/molecules/accordion/accordion-item/accordion-item-theme.scss +12 -0
  73. package/src/molecules/article/article/_stops-article-cascade.scss +7 -0
  74. package/src/molecules/article/article/article-theme.scss +78 -0
  75. package/src/molecules/callout/callout-theme.scss +59 -0
  76. package/src/molecules/card/card/card-theme-variants/basic-card.scss +6 -0
  77. package/src/molecules/card/card/card-theme-variants/linkable-card.scss +23 -0
  78. package/src/molecules/card/card/card-theme-variants/stroked-card.scss +3 -0
  79. package/src/molecules/card/card/card-theme.scss +186 -0
  80. package/src/molecules/hero/hero-theme.scss +59 -0
  81. package/src/molecules/list/list/list-theme.scss +68 -0
  82. package/src/molecules/media-gallery/media-gallery-theme.scss +20 -0
  83. package/src/molecules/modal/modal-theme.scss +9 -0
  84. package/src/molecules/navbar/navbar-theme.scss +57 -0
  85. package/src/molecules/paginator/paginator-theme.scss +72 -0
  86. package/src/molecules/sidebar/sidebar/sidebar-theme.scss +13 -0
  87. package/src/molecules/sidebar/sidebar-viewport/sidebar-viewport-theme.scss +11 -0
  88. package/daff-global.scss +0 -2
  89. package/daff-theme.scss +0 -3634
  90. package/daff-typography.scss +0 -505
  91. package/daff-util.scss +0 -377
@@ -0,0 +1,13 @@
1
+ @import '../variables';
2
+ @import '../color';
3
+ @import '../configure-palette';
4
+ @import '../configure-theme';
5
+ @import '../theme';
6
+
7
+ $primary: daff-configure-palette($daff-blue, 60);
8
+ $secondary: daff-configure-palette($daff-purple, 60);
9
+ $tertiary: daff-configure-palette($daff-turquoise, 60);
10
+
11
+ $theme: daff-configure-theme($primary, $secondary, $tertiary);
12
+
13
+ @include daff-theme($theme);
@@ -0,0 +1,88 @@
1
+ # Typography
2
+ Daffodil uses typography to establish hierarchy and create clear visual patterns to guide users through a product or experience.
3
+
4
+ ## Usage
5
+ To include typography in your project, you can add the following in your Sass file:
6
+
7
+ ```scss
8
+ @use '@daffodil/design/scss/typography';
9
+ ```
10
+
11
+ ## Type Scale
12
+ `@daffodil/design`'s typographic scale is designed with visual distinctions to help users better understand content and UI. Text sizes, styles, and layouts have been chosen to maintain logical hierarchies and drive consistency throughout an application.
13
+
14
+ ### 8px System
15
+ Our type scale is based on an 8px system, where the type is largely divisible by 8. For smaller sizes, the system allows for the scale to be divisible by 4. Font sizes are typically smaller on mobile and scaled up at the `tablet` breakpoint to be larger on desktop.
16
+
17
+ ## Font Stack
18
+ Daffodil uses a system font stack to maximize on performance, legibility, and accessibility. System fonts play into the improvement of today's rich displays Additionally, system fonts provides a seamless experience for users because the application feel more like it blends in with their device's OS.
19
+
20
+ ```scss
21
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
22
+ ```
23
+
24
+ * `-apple-system` and `BlinkMacSystemFont` targets default fonts in Safari, Firefox, and Chrome on macOS and iOS.
25
+ * `Segoe UI` is the system font for Windows.
26
+ * `Helvetica` and `Arial` are added as fallbacks.
27
+ * `Apple Color Emoji`, `Segoe UI Emoji`, and `Segoe UI Symbol` are included so that emojis are rendered correctly in macOS and Windows.
28
+
29
+ ## Typography Mixins
30
+ Typography mixins are used to keep typography consistent with logical hierarchies. Utilizing the mixin ensures that content within the UI are clear and easily recognizable. Mixins are available for headlines, body, subheading, and caption. They are used within the `@daffodil/design` components and can also be used within custom CSS.
31
+
32
+ The headline mixins are responsive and will adjust at the `tablet` breakpoint.
33
+
34
+ | Mixin | Font size: mobile | Line height: mobile | Font size: desktop | Line height: desktop | Font weight | Letter spacing |
35
+ | ----------- | ----------------- | ------------------- | ------------------ | -------------------- | ----------- | -------------- |
36
+ | headline-xl | 40px | 48px | 56px | 64px | 700 | 0px |
37
+ | headline-lg | 32px | 36px | 48px | 56px | 700 | 0px |
38
+ | headline-md | 24px | 28px | 32px | 40px | 700 | 0px |
39
+ | headline-sm | 20px | 24px | 24px | 32px | 700 | 0px |
40
+ | body-lg | 24px | 32px | 24px | 32px | 400 | 0px |
41
+ | body-md | 20px | 28px | 20px | 28px | 400 | 0px |
42
+ | body-sm | 16px | 24px | 16px | 24px | 400 | 0px |
43
+ | body-xs | 14px | 20px | 14px | 20px | 400 | 0px |
44
+ | subheading | 14px | 16px | 14px | 16px | 700 | 0.5px |
45
+ | caption | 12px | 16px | 12px | 16px | 400 | 0px |
46
+
47
+ **Example:**
48
+ ```scss
49
+ @use '@daffodil/design/scss/typography';
50
+
51
+ .title {
52
+ @include typography.headline-xl;
53
+ }
54
+ ```
55
+
56
+ ## Formatting Utilities and Mixins
57
+ `@daffodil/design` also provides a few mixins to enforce consistency and ease-of-use. We recommend using the utility classes sparingly.
58
+
59
+ | Class/Mixin | Description |
60
+ | ------------- | ---------------------------------------------------------------------------- |
61
+ | embolden | Changes the weight of text to 700 |
62
+ | uppercase | Changes the casing of a piece of text to uppercase |
63
+ | text-truncate | Forces a line of text to ellipsis once it reaches the width of its container |
64
+
65
+ > `text-truncate` should only be used if the element is `display: block;` or `display: inline-block;`
66
+
67
+ **Examples:**
68
+ ```html
69
+ <div class="title"><span class="embolden">Daffodil</span> is a frontend Ecommerce framework that allows developers to build complex Ecommerce stores.</div>
70
+ ```
71
+
72
+ ```scss
73
+ @use '@daffodil/design/scss/typography';
74
+
75
+ .title {
76
+ span {
77
+ @include typography.embolden;
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## Typography Variables
83
+ ```scss
84
+ $large-font-size: 1.5rem;
85
+ $medium-font-size: 1.25rem;
86
+ $normal-font-size: 1rem;
87
+ $small-font-size: 0.875rem;
88
+ ```
@@ -0,0 +1,20 @@
1
+ @use './mixins/text-transform' as *;
2
+ @use './mixins/font-weight' as *;
3
+ @use './mixins/text-truncate' as *;
4
+
5
+ .embolden { /* stylelint-disable-line selector-class-pattern */
6
+ @include embolden();
7
+ }
8
+
9
+ .uppercase { /* stylelint-disable-line selector-class-pattern */
10
+ text-transform: uppercase;
11
+ }
12
+
13
+ // deprecate in v1.0
14
+ .single-line-ellipsis { /* stylelint-disable-line selector-class-pattern */
15
+ @include single-line-ellipsis();
16
+ }
17
+
18
+ .text-truncate { /* stylelint-disable-line selector-class-pattern */
19
+ @include text-truncate();
20
+ }
@@ -0,0 +1,5 @@
1
+ @forward 'mixins/font-weight';
2
+ @forward 'mixins/sizes';
3
+ @forward 'mixins/text-transform';
4
+ @forward 'mixins/text-truncate';
5
+ @forward 'utilities';
@@ -0,0 +1,18 @@
1
+ @use '../utilities/variables';
2
+
3
+ //
4
+ // @docs
5
+ //
6
+ // Changes the weight of text to bold
7
+ //
8
+ // @usage
9
+ // ```scss
10
+ // @use '@daffodil/design/scss/typography;
11
+ //
12
+ // @include typography.embolden;
13
+ // ```
14
+ //
15
+
16
+ @mixin embolden() {
17
+ font-weight: variables.$bold-font-weight;
18
+ }
@@ -0,0 +1,84 @@
1
+ @use '../../layout' as layout;
2
+ @use 'font-weight';
3
+
4
+ @mixin headline-xl() {
5
+ @include font-weight.embolden;
6
+ font-size: 2.5rem;
7
+ line-height: 2.75rem;
8
+
9
+ @include layout.breakpoint(tablet) {
10
+ font-size: 3.5rem;
11
+ line-height: 4rem;
12
+ }
13
+ }
14
+
15
+ @mixin headline-lg() {
16
+ @include font-weight.embolden;
17
+ font-size: 2rem;
18
+ line-height: 2.25rem;
19
+
20
+ @include layout.breakpoint(tablet) {
21
+ font-size: 3rem;
22
+ line-height: 3.5rem;
23
+ }
24
+ }
25
+
26
+ @mixin headline-md() {
27
+ @include font-weight.embolden;
28
+ font-size: 1.5rem;
29
+ line-height: 1.75rem;
30
+
31
+ @include layout.breakpoint(tablet) {
32
+ font-size: 2rem;
33
+ line-height: 2.5rem;
34
+ }
35
+ }
36
+
37
+ @mixin headline-sm() {
38
+ @include font-weight.embolden;
39
+ font-size: 1.25rem;
40
+ line-height: 1.5rem;
41
+
42
+ @include layout.breakpoint(tablet) {
43
+ font-size: 1.5rem;
44
+ line-height: 2rem;
45
+ }
46
+ }
47
+
48
+ @mixin body-lg() {
49
+ font-size: 1.5rem;
50
+ font-weight: 400;
51
+ line-height: 2rem;
52
+ }
53
+
54
+ @mixin body-md() {
55
+ font-size: 1.25rem;
56
+ font-weight: 400;
57
+ line-height: 1.75rem;
58
+ }
59
+
60
+ @mixin body-sm() {
61
+ font-size: 1rem;
62
+ font-weight: 400;
63
+ line-height: 1.5rem;
64
+ }
65
+
66
+ @mixin body-xs() {
67
+ font-size: 0.875rem;
68
+ font-weight: 400;
69
+ line-height: 1.25rem;
70
+ }
71
+
72
+ @mixin subheading() {
73
+ font-size: 0.875rem;
74
+ font-weight: 600;
75
+ letter-spacing: 0.03125rem;
76
+ line-height: 1rem;
77
+ text-transform: uppercase;
78
+ }
79
+
80
+ @mixin caption() {
81
+ font-size: 0.75rem;
82
+ line-height: 1rem;
83
+ font-weight: 400;
84
+ }
@@ -0,0 +1,4 @@
1
+ // @deprecated in v1.0.0
2
+ @mixin uppercase() {
3
+ text-transform: uppercase;
4
+ }
@@ -0,0 +1,23 @@
1
+ // @docs
2
+ //
3
+ // Forces a line of text to ellipsis once it reaches the
4
+ // width of its container. It should only be used if the element
5
+ // is `display: block` or `display: inline-block`.
6
+ // @usage
7
+ // ```scss
8
+ // @use '@daffodil/design/scss/typography;'
9
+ //
10
+ // @include typography.text-truncate;
11
+ // ```
12
+
13
+ // @deprecated in v1.0 in favor of text-truncate
14
+ @mixin single-line-ellipsis() {
15
+ @include text-truncate();
16
+ }
17
+
18
+ @mixin text-truncate() {
19
+ display: block;
20
+ overflow: hidden;
21
+ text-overflow: ellipsis;
22
+ white-space: nowrap;
23
+ }
@@ -0,0 +1 @@
1
+ @forward 'variables';
@@ -0,0 +1,12 @@
1
+ $body-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica,
2
+ Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
3
+ $base-font-family: $body-font-family;
4
+ $monospace-font-family: ui-monospace, 'SFMono-Regular', SF Mono, Menlo, Consolas,
5
+ 'Liberation Mono', monospace;
6
+
7
+ $large-font-size: 1.5rem;
8
+ $medium-font-size: 1.25rem;
9
+ $normal-font-size: 1rem;
10
+ $small-font-size: 0.875rem;
11
+
12
+ $bold-font-weight: bold;
@@ -0,0 +1,35 @@
1
+ @use '../../../../scss/theming';
2
+
3
+ @mixin daff-button-theme-variant(
4
+ $base-color,
5
+ $hover-color,
6
+ $active-color: $hover-color
7
+ ) {
8
+ // @if daff-contrast-ratio($base-color, daff-text-contrast($base-color)) < 4.5 {
9
+ // @error 'Button Initial State: ' + map-get($wcag-aa-errors, 'text-contrast');
10
+ // }
11
+
12
+ // @if daff-contrast-ratio($hover-color, daff-text-contrast($base-color)) < 4.5 {
13
+ // @error 'Button Hover State: ' + map-get($wcag-aa-errors, 'text-contrast');
14
+ // }
15
+
16
+ // @if daff-contrast-ratio($active-color, daff-text-contrast($base-color)) < 4.5 {
17
+ // @error 'Button Active State: ' + map-get($wcag-aa-errors, 'text-contrast');
18
+ // }
19
+ background-color: $base-color;
20
+ border: 1px solid $base-color;
21
+ color: theming.daff-text-contrast($base-color);
22
+
23
+ &:hover,
24
+ &:focus {
25
+ background-color: $hover-color;
26
+ border: 1px solid $hover-color;
27
+ color: theming.daff-text-contrast($hover-color);
28
+ }
29
+
30
+ &:active {
31
+ background-color: $active-color;
32
+ border: 1px solid $active-color;
33
+ color: theming.daff-text-contrast($active-color);
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ @mixin daff-button-focus-theme-variant($shadow-color) {
2
+ &:focus {
3
+ outline: none;
4
+ box-shadow: 0 0 0 4px rgba($shadow-color, 0.3);
5
+ }
6
+ }
@@ -0,0 +1,21 @@
1
+ @mixin daff-icon-button-theme-variant(
2
+ $base-color: currentColor,
3
+ $hover-color: currentColor,
4
+ $active-color: $hover-color
5
+ ) {
6
+ color: $base-color;
7
+
8
+ &:hover {
9
+ color: $hover-color;
10
+ @if $base-color == currentColor {
11
+ opacity: 0.8;
12
+ }
13
+ @else {
14
+ opacity: 1;
15
+ }
16
+ }
17
+
18
+ &:active {
19
+ color: $active-color;
20
+ }
21
+ }
@@ -0,0 +1,56 @@
1
+ @use 'sass:map';
2
+ @use '../../../../scss/core';
3
+ @use '../../../../scss/theming';
4
+ @use '../../../../scss/accessibility' as a11y;
5
+
6
+ $black: theming.daff-color(theming.$daff-gray, 110);
7
+
8
+ @mixin daff-raised-button-theme-variant(
9
+ $base-color,
10
+ $active-color,
11
+ $focus-shadow
12
+ ) {
13
+ @if theming.daff-contrast-ratio($base-color, theming.daff-text-contrast($base-color)) < 4.5 {
14
+ @error 'Button Initial State: ' + map.get(a11y.$wcag-aa-errors, 'text-contrast');
15
+ }
16
+
17
+ @if theming.daff-contrast-ratio($base-color, theming.daff-text-contrast($base-color)) < 4.5 {
18
+ @error 'Button Hover State: '+ map.get(a11y.$wcag-aa-errors, 'text-contrast');
19
+ }
20
+
21
+ @if theming.daff-contrast-ratio($active-color, theming.daff-text-contrast($active-color)) < 4.5 {
22
+ @error 'Button Active State: ' + map.get(a11y.$wcag-aa-errors, 'text-contrast');
23
+ }
24
+ background-color: $base-color;
25
+ border: 1px solid $base-color;
26
+ box-shadow:
27
+ 0 3px 5px rgba($black, 0.12),
28
+ 0 1px 3px rgba($black, 0.08);
29
+ color: theming.daff-text-contrast($base-color);
30
+
31
+ &:hover {
32
+ background-color: $base-color;
33
+ border: 1px solid $base-color;
34
+ }
35
+
36
+ &:hover,
37
+ &:active {
38
+ box-shadow:
39
+ 0 6px 12px rgba($black, 0.12),
40
+ 0 4px 6px rgba($black, 0.1);
41
+ }
42
+
43
+ &:focus {
44
+ outline: none;
45
+ box-shadow:
46
+ 0 0 0 4px rgba($focus-shadow, 0.3),
47
+ 0 6px 12px rgba($black, 0.12),
48
+ 0 4px 6px rgba($black, 0.1);
49
+ }
50
+
51
+ &:active {
52
+ background-color: $active-color;
53
+ border: 1px solid $active-color;
54
+ color: theming.daff-text-contrast($active-color);
55
+ }
56
+ }
@@ -0,0 +1,36 @@
1
+ @use 'sass:map';
2
+ @use '../../../../scss/theming';
3
+
4
+ @mixin daff-stroked-button-theme-variant(
5
+ $base-color,
6
+ $font-color,
7
+ $focus-color
8
+ ) {
9
+ // @if daff-contrast-ratio($base-color, daff-text-contrast($base-color)) < 4.5 {
10
+ // @error 'Stroked Button Hover State: ' + map.get($wcag-aa-errors, 'text-contrast');
11
+ // }
12
+
13
+ // @if daff-contrast-ratio($focus-color, daff-text-contrast($focus-color)) < 4.5 {
14
+ // @error 'Stroked Button Focus State: ' + map.get($wcag-aa-errors, 'text-contrast');
15
+ // }
16
+
17
+ // @if daff-contrast-ratio($focus-color, daff-text-contrast($focus-color)) < 4.5 {
18
+ // @error 'Stroked Button Active State: ' + map.get($wcag-aa-errors, 'text-contrast');
19
+ // }
20
+ border: 1px solid $base-color;
21
+ color: $font-color;
22
+ background-color: transparent;
23
+
24
+ &:hover,
25
+ &:focus {
26
+ background-color: $base-color;
27
+ border: 1px solid $base-color;
28
+ color: theming.daff-text-contrast($base-color);
29
+ }
30
+
31
+ &:active {
32
+ background-color: $focus-color;
33
+ border: 1px solid $focus-color;
34
+ color: theming.daff-text-contrast($focus-color);
35
+ }
36
+ }
@@ -0,0 +1,9 @@
1
+ @mixin daff-underline-button-theme-variant(
2
+ $base-color: currentColor,
3
+ ) {
4
+ color: $base-color;
5
+
6
+ &::after {
7
+ background-color: $base-color;
8
+ }
9
+ }