@siemens/element-theme 47.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.
Files changed (92) hide show
  1. package/package.json +28 -0
  2. package/src/styles/_accessibility.scss +9 -0
  3. package/src/styles/_all-variables.scss +7 -0
  4. package/src/styles/_bootstrap.scss +26 -0
  5. package/src/styles/_themes.scss +35 -0
  6. package/src/styles/_variables.scss +10 -0
  7. package/src/styles/bootstrap/_alert.scss +60 -0
  8. package/src/styles/bootstrap/_badges.scss +115 -0
  9. package/src/styles/bootstrap/_breadcrumb.scss +32 -0
  10. package/src/styles/bootstrap/_button-group.scss +101 -0
  11. package/src/styles/bootstrap/_buttons.scss +244 -0
  12. package/src/styles/bootstrap/_card.scss +208 -0
  13. package/src/styles/bootstrap/_containers.scss +44 -0
  14. package/src/styles/bootstrap/_dropdowns.scss +216 -0
  15. package/src/styles/bootstrap/_forms.scss +10 -0
  16. package/src/styles/bootstrap/_functions.scss +188 -0
  17. package/src/styles/bootstrap/_grid.scss +33 -0
  18. package/src/styles/bootstrap/_helpers.scss +6 -0
  19. package/src/styles/bootstrap/_images.scss +45 -0
  20. package/src/styles/bootstrap/_list-group.scss +197 -0
  21. package/src/styles/bootstrap/_mixins.scss +30 -0
  22. package/src/styles/bootstrap/_modals.scss +234 -0
  23. package/src/styles/bootstrap/_nav.scss +155 -0
  24. package/src/styles/bootstrap/_pagination.scss +58 -0
  25. package/src/styles/bootstrap/_popovers.scss +188 -0
  26. package/src/styles/bootstrap/_progress.scss +42 -0
  27. package/src/styles/bootstrap/_reboot.scss +618 -0
  28. package/src/styles/bootstrap/_root.scss +22 -0
  29. package/src/styles/bootstrap/_tables.scss +186 -0
  30. package/src/styles/bootstrap/_tooltip.scss +145 -0
  31. package/src/styles/bootstrap/_transitions.scss +28 -0
  32. package/src/styles/bootstrap/_type.scss +235 -0
  33. package/src/styles/bootstrap/_utilities.scss +105 -0
  34. package/src/styles/bootstrap/_variables.scss +654 -0
  35. package/src/styles/bootstrap/forms/_form-check.scss +249 -0
  36. package/src/styles/bootstrap/forms/_form-control.scss +151 -0
  37. package/src/styles/bootstrap/forms/_form-file.scss +29 -0
  38. package/src/styles/bootstrap/forms/_form-label.scss +39 -0
  39. package/src/styles/bootstrap/forms/_form-range.scss +68 -0
  40. package/src/styles/bootstrap/forms/_input-group.scss +103 -0
  41. package/src/styles/bootstrap/forms/_validation.scss +95 -0
  42. package/src/styles/bootstrap/helpers/_clearfix.scss +5 -0
  43. package/src/styles/bootstrap/helpers/_position.scss +34 -0
  44. package/src/styles/bootstrap/helpers/_stacks.scss +13 -0
  45. package/src/styles/bootstrap/helpers/_stretched-link.scss +14 -0
  46. package/src/styles/bootstrap/helpers/_text-truncation.scss +9 -0
  47. package/src/styles/bootstrap/helpers/_visually-hidden.scss +10 -0
  48. package/src/styles/bootstrap/mixins/_backdrop.scss +19 -0
  49. package/src/styles/bootstrap/mixins/_breakpoints.scss +136 -0
  50. package/src/styles/bootstrap/mixins/_clearfix.scss +7 -0
  51. package/src/styles/bootstrap/mixins/_container.scss +7 -0
  52. package/src/styles/bootstrap/mixins/_deprecate.scss +12 -0
  53. package/src/styles/bootstrap/mixins/_gradients.scss +14 -0
  54. package/src/styles/bootstrap/mixins/_grid.scss +171 -0
  55. package/src/styles/bootstrap/mixins/_image.scss +15 -0
  56. package/src/styles/bootstrap/mixins/_lists.scss +5 -0
  57. package/src/styles/bootstrap/mixins/_reset-text.scss +18 -0
  58. package/src/styles/bootstrap/mixins/_table-row.scss +31 -0
  59. package/src/styles/bootstrap/mixins/_text-truncate.scss +7 -0
  60. package/src/styles/bootstrap/mixins/_transition.scss +28 -0
  61. package/src/styles/bootstrap/mixins/_utilities.scss +86 -0
  62. package/src/styles/bootstrap/mixins/_visually-hidden.scss +29 -0
  63. package/src/styles/components/_application-header.scss +244 -0
  64. package/src/styles/components/_container-grid.scss +99 -0
  65. package/src/styles/components/_datatable.scss +328 -0
  66. package/src/styles/components/_drag_drop.scss +105 -0
  67. package/src/styles/components/_electron-titlebar.scss +5 -0
  68. package/src/styles/components/_elevation.scss +21 -0
  69. package/src/styles/components/_focus.scss +21 -0
  70. package/src/styles/components/_icons.scss +25 -0
  71. package/src/styles/components/_layout.scss +105 -0
  72. package/src/styles/components/_links.scss +34 -0
  73. package/src/styles/components/_pills.scss +45 -0
  74. package/src/styles/components/_scrollbar.scss +10 -0
  75. package/src/styles/components/_skeleton.scss +42 -0
  76. package/src/styles/components/_switch.scss +77 -0
  77. package/src/styles/components/_system-banner.scss +5 -0
  78. package/src/styles/components/_widgets.scss +58 -0
  79. package/src/styles/variables/_animations.scss +7 -0
  80. package/src/styles/variables/_elevation.scss +25 -0
  81. package/src/styles/variables/_focus.scss +55 -0
  82. package/src/styles/variables/_layout.scss +6 -0
  83. package/src/styles/variables/_semantic-tokens.scss +178 -0
  84. package/src/styles/variables/_si-vars.scss +19 -0
  85. package/src/styles/variables/_spacers.scss +28 -0
  86. package/src/styles/variables/_typography.scss +66 -0
  87. package/src/styles/variables/_utilities.scss +599 -0
  88. package/src/styles/variables/_zindex.scss +20 -0
  89. package/src/theme/_base-colors.scss +79 -0
  90. package/src/theme/_data-colors.scss +105 -0
  91. package/src/theme/_theme-element.scss +339 -0
  92. package/src/theme.scss +49 -0
@@ -0,0 +1,208 @@
1
+ @use '../variables/semantic-tokens';
2
+ @use '../variables/spacers';
3
+ @use '../variables/typography';
4
+ @use 'mixins/breakpoints';
5
+ @use 'variables';
6
+
7
+ @use 'sass:map';
8
+
9
+ %card-inner-radius-top {
10
+ border-start-start-radius: variables.$card-inner-border-radius;
11
+ border-start-end-radius: variables.$card-inner-border-radius;
12
+ }
13
+
14
+ %card-inner-radius-start {
15
+ border-start-start-radius: variables.$card-inner-border-radius;
16
+ border-end-start-radius: variables.$card-inner-border-radius;
17
+ }
18
+
19
+ %card-inner-radius-bottom {
20
+ border-end-start-radius: variables.$card-inner-border-radius;
21
+ border-end-end-radius: variables.$card-inner-border-radius;
22
+ }
23
+
24
+ .card {
25
+ position: relative;
26
+ display: flex;
27
+ flex-direction: column;
28
+ min-inline-size: 0; // See https://github.com/twbs/bootstrap/pull/22740#issuecomment-305868106
29
+ block-size: variables.$card-height;
30
+ word-wrap: break-word;
31
+ background-color: variables.$card-bg;
32
+ border-radius: variables.$card-border-radius;
33
+
34
+ > .list-group {
35
+ &:first-child {
36
+ @extend %card-inner-radius-top;
37
+ }
38
+
39
+ &:last-child {
40
+ @extend %card-inner-radius-bottom;
41
+ }
42
+ }
43
+
44
+ &.accent-primary {
45
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-ui-0;
46
+ }
47
+
48
+ &.accent-inactive {
49
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-ui-4;
50
+ }
51
+
52
+ &.accent-info {
53
+ border-inline-start: map.get(spacers.$spacers, 4) solid
54
+ semantic-tokens.$element-status-information;
55
+ }
56
+
57
+ &.accent-success {
58
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-status-success;
59
+ }
60
+
61
+ &.accent-warning {
62
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-status-warning;
63
+ }
64
+
65
+ &.accent-caution {
66
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-status-caution;
67
+ }
68
+
69
+ &.accent-danger {
70
+ border-inline-start: map.get(spacers.$spacers, 4) solid semantic-tokens.$element-status-danger;
71
+ }
72
+ }
73
+
74
+ .card-header {
75
+ font-size: typography.$si-font-size-title-2;
76
+ font-weight: typography.$si-font-weight-title-2;
77
+ min-block-size: map.get(spacers.$spacers, 9) + map.get(spacers.$spacers, 4);
78
+ white-space: nowrap;
79
+ text-overflow: ellipsis;
80
+ overflow: hidden;
81
+ padding-block: variables.$card-cap-padding-y;
82
+ padding-inline: variables.$card-cap-padding-x;
83
+ margin-block-end: 0; // Removes the default margin-bottom of <hN>
84
+ color: variables.$card-cap-color;
85
+ background-color: variables.$card-cap-bg;
86
+
87
+ &,
88
+ .icon {
89
+ line-height: typography.$si-font-size-title-2;
90
+ }
91
+
92
+ &:first-child {
93
+ @extend %card-inner-radius-top;
94
+ }
95
+ }
96
+
97
+ .card-body {
98
+ overflow: hidden;
99
+ // Enable `flex-grow: 1` for decks and groups so that card blocks take up
100
+ // as much space as possible, ensuring footers are aligned to the bottom.
101
+ flex: 1 1 auto;
102
+ padding-block: variables.$card-spacer-y;
103
+ padding-inline: variables.$card-spacer-x;
104
+ color: variables.$card-color;
105
+ }
106
+
107
+ .card-title {
108
+ margin-block-end: variables.$card-title-spacer-y;
109
+ }
110
+
111
+ .card-subtitle {
112
+ margin-block: (-(variables.$card-title-spacer-y) * 0.5) 0;
113
+ }
114
+
115
+ .card-text:last-child {
116
+ margin-block-end: 0;
117
+ }
118
+
119
+ // If the card has a header, remove the top padding for the body.
120
+ // Since we removed the separator line from the header, too much
121
+ // padding looks weird.
122
+ .card-header + .card-body {
123
+ padding-block-start: 0;
124
+ }
125
+
126
+ .card-footer {
127
+ @extend %card-inner-radius-bottom;
128
+ padding-inline: variables.$card-cap-padding-x;
129
+ padding-block-start: variables.$card-cap-padding-y;
130
+ padding-block-end: variables.$card-cap-padding-x;
131
+ background-color: variables.$card-cap-bg;
132
+ }
133
+
134
+ .card-img-overlay {
135
+ position: absolute;
136
+ inset: 0;
137
+ padding: variables.$card-img-overlay-padding;
138
+ border-radius: variables.$card-inner-border-radius;
139
+ }
140
+
141
+ .card-img,
142
+ .card-img-top,
143
+ .card-img-bottom {
144
+ inline-size: 100%; // Required because we use flexbox and this inherently applies align-self: stretch
145
+ }
146
+
147
+ .card-img,
148
+ .card-img-top {
149
+ @extend %card-inner-radius-top;
150
+ }
151
+
152
+ .card-img,
153
+ .card-img-start {
154
+ @extend %card-inner-radius-start;
155
+ }
156
+
157
+ .card-img,
158
+ .card-img-bottom {
159
+ @extend %card-inner-radius-bottom;
160
+ }
161
+
162
+ .card-group {
163
+ // The child selector allows nested `.card` within `.card-group` to display properly.
164
+ > .card {
165
+ margin-block-end: variables.$card-group-margin;
166
+ }
167
+
168
+ @include breakpoints.media-breakpoint-up(sm) {
169
+ display: flex;
170
+ flex-flow: row wrap;
171
+ // The child selector allows nested `.card` within `.card-group` to display properly.
172
+ > .card {
173
+ flex: 1 0 0%;
174
+ margin-block-end: 0;
175
+
176
+ + .card {
177
+ margin-inline-start: 0;
178
+ }
179
+
180
+ // Handle rounded corners
181
+ &:not(:last-child) {
182
+ border-start-end-radius: 0;
183
+ border-end-end-radius: 0;
184
+
185
+ :is(.card-img-top, .card-header) {
186
+ border-start-end-radius: 0;
187
+ }
188
+
189
+ :is(.card-img-bottom, .card-footer) {
190
+ border-end-end-radius: 0;
191
+ }
192
+ }
193
+
194
+ &:not(:first-child) {
195
+ border-start-start-radius: 0;
196
+ border-end-start-radius: 0;
197
+
198
+ :is(.card-img-top, .card-header) {
199
+ border-start-start-radius: 0;
200
+ }
201
+
202
+ :is(.card-img-bottom, .card-footer) {
203
+ border-end-start-radius: 0;
204
+ }
205
+ }
206
+ }
207
+ }
208
+ }
@@ -0,0 +1,44 @@
1
+ @use './mixins/breakpoints';
2
+ @use './mixins/container';
3
+ @use './variables';
4
+
5
+ // Container widths
6
+ //
7
+ // Set the container width, and override it for fixed navbars in media queries.
8
+
9
+ // Single container class with breakpoint max-widths
10
+ .container,
11
+ // 100% wide container at all breakpoints
12
+ .container-fluid {
13
+ @include container.make-container();
14
+ }
15
+
16
+ // Responsive containers that are 100% wide until a breakpoint
17
+ // FIXME: do we need responsive containers?
18
+ @each $breakpoint, $container-max-width in variables.$container-max-widths {
19
+ .container-#{$breakpoint} {
20
+ @extend .container-fluid;
21
+ }
22
+
23
+ @include breakpoints.media-breakpoint-up($breakpoint, variables.$grid-breakpoints) {
24
+ %responsive-container-#{$breakpoint} {
25
+ max-inline-size: $container-max-width;
26
+ }
27
+
28
+ // Extend each breakpoint which is smaller or equal to the current breakpoint
29
+ $extend-breakpoint: true;
30
+
31
+ @each $name, $width in variables.$grid-breakpoints {
32
+ @if ($extend-breakpoint) {
33
+ .container#{breakpoints.breakpoint-infix($name, variables.$grid-breakpoints)} {
34
+ @extend %responsive-container-#{$breakpoint};
35
+ }
36
+
37
+ // Once the current breakpoint is reached, stop extending
38
+ @if ($breakpoint == $name) {
39
+ $extend-breakpoint: false;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
@@ -0,0 +1,216 @@
1
+ @use '../variables';
2
+ @use '../variables/semantic-tokens';
3
+ @use '../variables/spacers';
4
+ @use '../variables/typography';
5
+ @use '../variables/zindex';
6
+ @use './variables' as bootstrap-variables;
7
+
8
+ @use 'sass:map';
9
+
10
+ .dropup,
11
+ .dropend,
12
+ .dropdown,
13
+ .dropstart {
14
+ position: relative;
15
+ }
16
+
17
+ .dropdown-menu {
18
+ position: absolute;
19
+ z-index: zindex.$zindex-dropdown;
20
+ display: none; // none by default, but block on "open" of the menu
21
+ min-inline-size: bootstrap-variables.$dropdown-min-width;
22
+ max-block-size: calc(100vh - #{map.get(spacers.$spacers, 1) * 2});
23
+ overflow-y: auto;
24
+ padding-block: bootstrap-variables.$dropdown-padding-y;
25
+ padding-inline: bootstrap-variables.$dropdown-padding-x;
26
+ font-size: bootstrap-variables.$dropdown-font-size;
27
+ color: bootstrap-variables.$dropdown-color;
28
+ list-style: none;
29
+ background-color: bootstrap-variables.$dropdown-bg;
30
+ background-clip: padding-box;
31
+ border-radius: bootstrap-variables.$dropdown-border-radius;
32
+ box-shadow: bootstrap-variables.$dropdown-box-shadow;
33
+ margin-block: map.get(spacers.$spacers, 1);
34
+ margin-inline: 0;
35
+ text-align: start;
36
+
37
+ &.show {
38
+ display: block;
39
+ }
40
+ }
41
+
42
+ .dropdown-menu,
43
+ .dropdown-item {
44
+ .icon + .item-title {
45
+ padding-inline-start: map.get(spacers.$spacers, 4);
46
+ }
47
+ }
48
+
49
+ .dropdown-toggle {
50
+ --caret-rotate: 0deg;
51
+ text-align: start;
52
+
53
+ .dropdown-caret {
54
+ padding-inline-start: map.get(spacers.$spacers, 2);
55
+ margin-block: -#{map.get(spacers.$spacers, 2)};
56
+ margin-inline: auto -#{map.get(spacers.$spacers, 4)};
57
+ font-size: 1.5rem !important; // stylelint-disable-line declaration-no-important
58
+
59
+ &::before {
60
+ transform: rotate(var(--caret-rotate));
61
+ transition: transform variables.$si-caret-transition-duration;
62
+ display: inline-block;
63
+ }
64
+ }
65
+
66
+ &.show .dropdown-caret::before {
67
+ transform: rotate(calc(var(--caret-rotate) + 180deg));
68
+ }
69
+ }
70
+
71
+ .dropup .dropdown-toggle {
72
+ --caret-rotate: 180deg;
73
+ }
74
+
75
+ .dropstart .dropdown-toggle {
76
+ --caret-rotate: 90deg;
77
+ }
78
+
79
+ .dropend .dropdown-toggle {
80
+ --caret-rotate: 270deg;
81
+ }
82
+
83
+ .dropdown-item,
84
+ .dropdown-item-text {
85
+ display: flex;
86
+ flex-wrap: nowrap;
87
+ align-items: center;
88
+ block-size: 32px;
89
+ inline-size: 100%;
90
+ padding-block: bootstrap-variables.$dropdown-item-padding-y;
91
+ padding-inline: bootstrap-variables.$dropdown-item-padding-x;
92
+ color: bootstrap-variables.$dropdown-link-color;
93
+ text-decoration: none;
94
+ }
95
+
96
+ .dropdown-item {
97
+ font-weight: bootstrap-variables.$font-weight-normal;
98
+ text-align: inherit; // For `<button>`s
99
+ white-space: nowrap; // prevent links from randomly breaking onto new lines
100
+ background-color: transparent; // For `<button>`s
101
+ border: 0; // For `<button>`s
102
+ cursor: pointer;
103
+
104
+ .item-title {
105
+ flex: 1;
106
+ }
107
+
108
+ &:focus {
109
+ color: bootstrap-variables.$dropdown-link-color;
110
+ background: transparent;
111
+ }
112
+
113
+ // duplicating hover styles from bootstrap. To split them from focus styles. Otherwise hover on focus elements will not work.
114
+ &:hover {
115
+ color: semantic-tokens.$element-text-primary;
116
+ background-color: semantic-tokens.$element-base-1-hover;
117
+ text-decoration: none;
118
+ }
119
+
120
+ // duplicating hover styles from bootstrap. To split them from focus styles. Otherwise hover on focus elements will not work.
121
+ &:is(:active, .active) {
122
+ color: var(--element-text-primary);
123
+ background-color: var(--element-base-1-selected);
124
+ }
125
+
126
+ &:is(.disabled, :disabled) {
127
+ color: bootstrap-variables.$dropdown-link-disabled-color;
128
+ pointer-events: none;
129
+ background-color: transparent;
130
+ cursor: default;
131
+ }
132
+
133
+ .menu-end-icon {
134
+ margin-inline-end: -1 * map.get(spacers.$spacers, 3);
135
+
136
+ &.element-record-filled {
137
+ font-size: 1rem;
138
+ margin-inline-end: -1 * map.get(spacers.$spacers, 1);
139
+ }
140
+ }
141
+ }
142
+
143
+ .dropdown-item-static,
144
+ .dropdown-item-text {
145
+ cursor: default;
146
+ }
147
+
148
+ // FIXME: drop when dropping si-menu-legacy
149
+ .dropdown-item-static {
150
+ &:is(.active, :active, :hover, :hover:focus:not(:focus-visible), :focus) {
151
+ background-color: semantic-tokens.$element-base-1;
152
+ }
153
+ }
154
+
155
+ .dropdown-header {
156
+ display: block;
157
+ padding-block: bootstrap-variables.$dropdown-padding-y;
158
+ padding-inline: bootstrap-variables.$dropdown-item-padding-x;
159
+ margin-block-end: 0; // for use with heading elements
160
+ color: bootstrap-variables.$dropdown-header-color;
161
+ white-space: nowrap; // as with > li > a
162
+ font-size: typography.$si-font-size-title-2;
163
+ font-weight: typography.$si-font-weight-title-2;
164
+ }
165
+
166
+ .dropdown-divider {
167
+ block-size: 0;
168
+ margin-block: bootstrap-variables.$dropdown-divider-margin-y;
169
+ margin-inline: map.get(spacers.$spacers, 5);
170
+ overflow: hidden;
171
+ border-block-start: 1px solid bootstrap-variables.$dropdown-divider-bg;
172
+ }
173
+
174
+ .dropdown > .dropdown-menu {
175
+ inset-block: 100% auto;
176
+ inset-inline: 0 auto;
177
+ margin-block: bootstrap-variables.$dropdown-spacer 0;
178
+ margin-inline: 0;
179
+ }
180
+
181
+ .dropup > .dropdown-menu {
182
+ inset-block: auto 100%;
183
+ inset-inline: auto;
184
+ margin-block: 0 bootstrap-variables.$dropdown-spacer;
185
+ margin-inline: 0;
186
+ }
187
+
188
+ .dropend > .dropdown-menu {
189
+ inset-block: 0 auto;
190
+ inset-inline: 100% auto;
191
+ margin-block: 0;
192
+ margin-inline: bootstrap-variables.$dropdown-spacer 0;
193
+ }
194
+
195
+ .dropstart > .dropdown-menu {
196
+ inset-block: 0 auto;
197
+ inset-inline: auto 100%;
198
+ margin-block: 0;
199
+ margin-inline: 0 bootstrap-variables.$dropdown-spacer;
200
+ }
201
+
202
+ .dropdown-menu {
203
+ &.align-center {
204
+ left: 0; // stylelint-disable-line liberty/use-logical-spec
205
+ right: unset; // stylelint-disable-line liberty/use-logical-spec
206
+ transform: translateX(-50%);
207
+ }
208
+
209
+ &.align-start {
210
+ inset-inline: 0 auto;
211
+ }
212
+
213
+ &.align-end {
214
+ inset-inline: auto 0;
215
+ }
216
+ }
@@ -0,0 +1,10 @@
1
+ @use './forms/form-check';
2
+ @use './forms/form-control';
3
+ @use './forms/form-file';
4
+ @use './forms/form-label';
5
+ @use './forms/form-range';
6
+ // not part of the design system
7
+ // @import 'bootstrap/scss/forms/floating-labels';
8
+ // FIXME: check if needed
9
+ @use './forms/input-group';
10
+ @use './forms/validation';
@@ -0,0 +1,188 @@
1
+ @use 'sass:color';
2
+ @use 'sass:map';
3
+ @use 'sass:math';
4
+ @use 'sass:meta';
5
+ @use 'sass:list';
6
+ @use 'sass:string';
7
+
8
+ // Characters which are escaped by the escape-svg function
9
+ $escaped-characters: (
10
+ ('<', '%3c'),
11
+ ('>', '%3e'),
12
+ ('#', '%23'),
13
+ ('(', '%28'),
14
+ (')', '%29')
15
+ ) !default;
16
+
17
+ // Bootstrap functions
18
+ //
19
+ // Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
20
+
21
+ // Ascending
22
+ // Used to evaluate Sass maps like our grid breakpoints.
23
+ @mixin assert-ascending($map, $map-name) {
24
+ $prev-key: null;
25
+ $prev-num: null;
26
+ @each $key, $num in $map {
27
+ @if $prev-num == null or math.unit($num) == '%' or math.unit($prev-num) == '%' {
28
+ // Do nothing
29
+ } @else if not math.compatible($prev-num, $num) {
30
+ @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
31
+ } @else if $prev-num >= $num {
32
+ @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
33
+ }
34
+ $prev-key: $key;
35
+ $prev-num: $num;
36
+ }
37
+ }
38
+
39
+ // Starts at zero
40
+ // Used to ensure the min-width of the lowest breakpoint starts at 0.
41
+ @mixin assert-starts-at-zero($map, $map-name: '$grid-breakpoints') {
42
+ @if list.length($map) > 0 {
43
+ $values: map.values($map);
44
+ $first-value: list.nth($values, 1);
45
+ @if $first-value != 0 {
46
+ @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
47
+ }
48
+ }
49
+ }
50
+
51
+ // Replace `$search` with `$replace` in `$string`
52
+ // Used on our SVG icon backgrounds for custom forms.
53
+ //
54
+ // @author Hugo Giraudel
55
+ // @param {String} $string - Initial string
56
+ // @param {String} $search - Substring to replace
57
+ // @param {String} $replace ('') - New value
58
+ // @return {String} - Updated string
59
+ @function str-replace($string, $search, $replace: '') {
60
+ $index: string.index($string, $search);
61
+
62
+ @if $index {
63
+ @return sting.slice($string, 1, $index - 1) + $replace +
64
+ str-replace(string.slice($string, $index + string.length($search)), $search, $replace);
65
+ }
66
+
67
+ @return $string;
68
+ }
69
+
70
+ // See https://codepen.io/kevinweber/pen/dXWoRw
71
+ //
72
+ // Requires the use of quotes around data URIs.
73
+
74
+ @function escape-svg($string) {
75
+ @if string.index($string, 'data:image/svg+xml') {
76
+ @each $char, $encoded in $escaped-characters {
77
+ // Do not escape the url brackets
78
+ @if string.index($string, 'url(') == 1 {
79
+ $string: url('#{str-replace(string.slice($string, 6, -3), $char, $encoded)}');
80
+ } @else {
81
+ $string: str-replace($string, $char, $encoded);
82
+ }
83
+ }
84
+ }
85
+
86
+ @return $string;
87
+ }
88
+
89
+ // Return valid calc
90
+ @function add($value1, $value2, $return-calc: true) {
91
+ @if $value1 == null {
92
+ @return $value2;
93
+ }
94
+
95
+ @if $value2 == null {
96
+ @return $value1;
97
+ }
98
+
99
+ @if meta.type-of($value1) ==
100
+ number and
101
+ meta.type-of($value2) ==
102
+ number and
103
+ math.compatible($value1, $value2)
104
+ {
105
+ @return $value1 + $value2;
106
+ }
107
+
108
+ @return if(
109
+ $return-calc == true,
110
+ calc(#{$value1} + #{$value2}),
111
+ $value1 + string.unquote(' + ') + $value2
112
+ );
113
+ }
114
+
115
+ @function subtract($value1, $value2, $return-calc: true) {
116
+ @if $value1 == null and $value2 == null {
117
+ @return null;
118
+ }
119
+
120
+ @if $value1 == null {
121
+ @return -$value2;
122
+ }
123
+
124
+ @if $value2 == null {
125
+ @return $value1;
126
+ }
127
+
128
+ @if meta.type-of($value1) ==
129
+ number and
130
+ meta.type-of($value2) ==
131
+ number and
132
+ math.compatible($value1, $value2)
133
+ {
134
+ @return $value1 - $value2;
135
+ }
136
+
137
+ @if meta.type-of($value2) != number {
138
+ $value2: string.unquote('(') + $value2 + string.unquote(')');
139
+ }
140
+
141
+ @return if(
142
+ $return-calc == true,
143
+ calc(#{$value1} - #{$value2}),
144
+ $value1 + string.unquote(' - ') + $value2
145
+ );
146
+ }
147
+
148
+ @function divide($dividend, $divisor, $precision: 10) {
149
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
150
+ $dividend: math.abs($dividend);
151
+ $divisor: math.abs($divisor);
152
+ @if $dividend == 0 {
153
+ @return 0;
154
+ }
155
+ @if $divisor == 0 {
156
+ @error "Cannot divide by 0";
157
+ }
158
+ $remainder: $dividend;
159
+ $result: 0;
160
+ $factor: 10;
161
+ @while ($remainder > 0 and $precision >= 0) {
162
+ $quotient: 0;
163
+ @while ($remainder >= $divisor) {
164
+ $remainder: $remainder - $divisor;
165
+ $quotient: $quotient + 1;
166
+ }
167
+ $result: $result * 10 + $quotient;
168
+ $factor: $factor * 0.1;
169
+ $remainder: $remainder * 10;
170
+ $precision: $precision - 1;
171
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
172
+ $result: $result + 1;
173
+ }
174
+ }
175
+ $result: $result * $factor * $sign;
176
+ $dividend-unit: math.unit($dividend);
177
+ $divisor-unit: math.unit($divisor);
178
+ $unit-map: (
179
+ 'px': 1px,
180
+ 'rem': 1rem,
181
+ 'em': 1em,
182
+ '%': 1%
183
+ );
184
+ @if ($dividend-unit != $divisor-unit and map.has-key($unit-map, $dividend-unit)) {
185
+ $result: $result * map.get($unit-map, $dividend-unit);
186
+ }
187
+ @return $result;
188
+ }
@@ -0,0 +1,33 @@
1
+ @use './mixins/grid';
2
+ @use './variables';
3
+
4
+ // Row
5
+ //
6
+ // Rows contain your columns.
7
+
8
+ .row {
9
+ @include grid.make-row();
10
+
11
+ > * {
12
+ @include grid.make-col-ready();
13
+ }
14
+ }
15
+
16
+ @if variables.$enable-cssgrid {
17
+ .grid {
18
+ display: grid;
19
+ grid-template-rows: repeat(var(--#{variables.$variable-prefix}rows, 1), 1fr);
20
+ grid-template-columns: repeat(
21
+ var(--#{variables.$variable-prefix}columns, #{variables.$grid-columns}),
22
+ 1fr
23
+ );
24
+ gap: var(--#{variables.$variable-prefix}gap, #{variables.$grid-gutter-width});
25
+
26
+ @include grid.make-cssgrid();
27
+ }
28
+ }
29
+
30
+ // Columns
31
+ //
32
+ // Common styles for small and large grid columns
33
+ @include grid.make-grid-columns();
@@ -0,0 +1,6 @@
1
+ @use './helpers/clearfix';
2
+ @use './helpers/stacks';
3
+ @use './helpers/position';
4
+ @use './helpers/visually-hidden';
5
+ @use './helpers/stretched-link';
6
+ @use './helpers/text-truncation';