@oardi/css-utils 0.19.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.
@@ -0,0 +1,130 @@
1
+ @use 'sass:map';
2
+ @use '../theme.scss';
3
+
4
+ $sizes: (
5
+ xs: 32px,
6
+ sm: 36px,
7
+ md: 40px,
8
+ lg: 44px,
9
+ );
10
+
11
+ :root {
12
+ --icon-button-padding: 0.25rem;
13
+ --icon-button-border-width: 2px;
14
+ --icon-button-highlight: var(--gray-90);
15
+ --icon-button-disabled-bg-color: none;
16
+ }
17
+
18
+ .icon-btn {
19
+ fill: var(--font-color);
20
+ padding: var(--icon-button-padding);
21
+ min-width: 40px;
22
+ width: 40px;
23
+ height: 40px;
24
+ border-radius: 100%;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+
29
+ border-width: var(--icon-button-border-width);
30
+ border-style: solid;
31
+ background-color: transparent;
32
+ border-color: transparent;
33
+ color: var(--font-color);
34
+ transition: all 0.3s ease;
35
+ -webkit-tap-highlight-color: transparent;
36
+ touch-action: manipulation; // ios fix
37
+
38
+ svg {
39
+ max-width: 18px;
40
+ max-height: 18px;
41
+ overflow: visible;
42
+ }
43
+
44
+ &:hover {
45
+ cursor: pointer;
46
+ text-decoration: none;
47
+ background-color: var(--icon-button-highlight);
48
+ }
49
+
50
+ &[disabled],
51
+ &[disabled]:hover,
52
+ &[active]:hover {
53
+ color: var(--gray-80);
54
+ fill: var(--gray-80);
55
+ cursor: not-allowed;
56
+ box-shadow: none;
57
+ background-color: var(--icon-button-disabled-bg-color);
58
+ outline: 0;
59
+ }
60
+
61
+ &:focus {
62
+ outline: 0;
63
+ box-shadow: 0 0 0 0.2rem var(--font-color);
64
+ }
65
+ }
66
+
67
+ @each $name, $value in $sizes {
68
+ .icon-btn-#{$name} {
69
+ min-width: $value;
70
+ width: $value;
71
+ height: $value;
72
+
73
+ svg {
74
+ max-width: calc($value - 20px);
75
+ max-height: calc($value - 20px);
76
+ }
77
+ }
78
+ }
79
+
80
+ @each $name, $value in map.get(theme.$theme, colors) {
81
+ .icon-btn-#{$name} {
82
+ color: var(--#{$name});
83
+ fill: var(--#{$name});
84
+ background-color: transparent;
85
+ box-shadow: 0 0 0 0.2rem transparent;
86
+
87
+ &:hover,
88
+ &:active,
89
+ &:focus {
90
+ box-shadow: 0 0 0 0.2rem var(--icon-button-highlight);
91
+ color: var(--on-#{$name});
92
+ }
93
+
94
+ &[disabled],
95
+ &[disabled]:hover,
96
+ &[active]:hover {
97
+ color: var(--#{$name}-light);
98
+ fill: var(--#{$name}-light);
99
+ cursor: not-allowed;
100
+ box-shadow: none;
101
+ background-color: var(--icon-button-disabled-bg-color);
102
+ outline: 0;
103
+ }
104
+ }
105
+
106
+ .icon-btn-#{$name}-contained {
107
+ color: var(--on-#{$name});
108
+ fill: var(--on-#{$name});
109
+ background-color: var(--#{$name});
110
+ box-shadow: 0 0 0 0.2rem transparent;
111
+
112
+ &:hover,
113
+ &:active,
114
+ &:focus {
115
+ box-shadow: 0 0 0 0.2rem var(--#{$name});
116
+ background-color: var(--#{$name}-dark);
117
+ }
118
+
119
+ &[disabled],
120
+ &[disabled]:hover,
121
+ &[active]:hover {
122
+ color: var(--#{$name}-light);
123
+ fill: var(--#{$name}-light);
124
+ cursor: not-allowed;
125
+ box-shadow: none;
126
+ background-color: var(--icon-button-disabled-bg-color);
127
+ outline: 0;
128
+ }
129
+ }
130
+ }
@@ -0,0 +1,33 @@
1
+ :root {
2
+ --list-bg-color: var(--white);
3
+ --list-border-color: transparent;
4
+ // --list-item-hover-bg-color: var(--highlight);
5
+ --list-border-width: 1px;
6
+ --list-padding: 0rem;
7
+ --list-item-padding: 1rem;
8
+ }
9
+
10
+ .list {
11
+ background-color: var(--list-bg-color);
12
+ border: var(--list-border-width) solid var(--list-border-color);
13
+ padding: var(--list-padding);
14
+ list-style-type: none;
15
+
16
+ .list-item {
17
+ color: var(--font-color);
18
+ min-height: 1px;
19
+ padding: var(--list-item-padding);
20
+ display: flex;
21
+ align-items: start;
22
+ flex-direction: column;
23
+
24
+ &.is-active,
25
+ &:hover {
26
+ cursor: pointer;
27
+ // background-color: var(--list-item-hover-bg-color);
28
+ color: var(--primary);
29
+ fill: var(--primary);
30
+ text-decoration: none;
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,61 @@
1
+ :root {
2
+ --nav-bg-color: #ffffff;
3
+ }
4
+
5
+ nav {
6
+ padding-top: 0.6rem;
7
+ padding-bottom: 0.6rem;
8
+ background-color: var(--nav-bg-color);
9
+ min-height: 60px;
10
+ display: flex;
11
+ align-items: center;
12
+ }
13
+
14
+ nav .logo:hover {
15
+ text-decoration: none;
16
+ color: var(--primary-dark);
17
+ }
18
+
19
+ nav .nav-open,
20
+ nav .nav-close {
21
+ display: none;
22
+ border: none;
23
+ }
24
+
25
+ nav .nav-open svg,
26
+ nav .nav-close svg {
27
+ height: 20px;
28
+ }
29
+
30
+ nav .nav-open:hover,
31
+ nav .nav-close:hover {
32
+ background-color: var(--gray-90);
33
+ }
34
+
35
+ nav .menu {
36
+ background-color: var(--white);
37
+ }
38
+
39
+ nav .menu ul {
40
+ display: flex;
41
+ align-items: center;
42
+ list-style: none;
43
+ }
44
+
45
+ nav .menu ul li {
46
+ display: flex;
47
+ border-radius: var(--border-radius);
48
+ }
49
+
50
+ nav .menu ul li:hover {
51
+ background-color: var(--gray-90);
52
+ }
53
+
54
+ nav .menu ul li:hover a {
55
+ color: var(--primary-dark);
56
+ }
57
+
58
+ nav .menu ul li a {
59
+ padding: 0.75rem 0.75rem;
60
+ text-decoration: none;
61
+ }
@@ -0,0 +1,7 @@
1
+ .overlay {
2
+ background: rgba(0, 0, 0, 0.5);
3
+ position: fixed;
4
+ inset: 0;
5
+ z-index: 1040;
6
+ display: none;
7
+ }
@@ -0,0 +1,47 @@
1
+ :root {
2
+ --tab-highlight: var(--highlight);
3
+ }
4
+
5
+ .tabs {
6
+ display: flex;
7
+ cursor: pointer;
8
+ -webkit-tap-highlight-color: transparent;
9
+ overflow-x: scroll;
10
+ overflow-y: visible;
11
+ padding-inline: 0.2rem; // fix for box-shadow on focus
12
+ padding-block: 0.2rem; // fix for box-shadow on focus
13
+ margin-inline: -0.2rem; // fix for box-shadow on focus
14
+
15
+ .tab {
16
+ color: var(--font-color);
17
+ padding: 16px 20px;
18
+ border-bottom: 3px solid var(--gray-80);
19
+ flex: 0 0 auto;
20
+
21
+ &.active {
22
+ color: var(--primary);
23
+ background: var(--body-bg-color);
24
+ border-bottom: 3px solid var(--primary);
25
+ }
26
+
27
+ &:focus {
28
+ outline: 0;
29
+ box-shadow: var(--box-shadow);
30
+ z-index: 1;
31
+ }
32
+
33
+ &:hover {
34
+ cursor: pointer;
35
+ background-color: var(--tab-highlight);
36
+ }
37
+ }
38
+ }
39
+
40
+ .tab-content {
41
+ display: none;
42
+ padding: 20px;
43
+
44
+ &.active {
45
+ display: block;
46
+ }
47
+ }
@@ -0,0 +1,21 @@
1
+ @use 'sass:map';
2
+ @use '../theme.scss';
3
+
4
+ .toast {
5
+ background-color: white;
6
+ border-color: transparent;
7
+ color: var(--font-color);
8
+ box-shadow: var(--shadow);
9
+ padding: 1rem;
10
+ border-radius: var(--border-radius);
11
+ display: flex;
12
+ align-items: center;
13
+ width: 100%;
14
+ }
15
+
16
+ @each $name, $value in map.get(theme.$theme, colors) {
17
+ .toast-#{$name} {
18
+ color: var(--white);
19
+ background-color: var(--#{$name});
20
+ }
21
+ }
@@ -0,0 +1,12 @@
1
+ @use './components/button.scss';
2
+ @use './components/card.scss';
3
+ @use './components/chip.scss';
4
+ @use './components/drawer.scss';
5
+ @use './components/expansion-panel.scss';
6
+ @use './components/form.scss';
7
+ @use './components/icon-button.scss';
8
+ @use './components/list.scss';
9
+ @use './components/nav.scss';
10
+ @use './components/overlay.scss';
11
+ @use './components/tabs.scss';
12
+ @use './components/toast.scss';
@@ -0,0 +1,108 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss';
3
+
4
+ // TODO
5
+ // add responsive classes for
6
+ // d-flex, d-inline-flex
7
+
8
+ @each $bp, $bp-value in map.get(theme.$theme, breakpoints) {
9
+ @media (min-width: #{$bp-value}) {
10
+ @each $key, $value in map.get(theme.$theme, spacings) {
11
+ .gap-#{$bp}-#{$key} {
12
+ gap: $value !important;
13
+ }
14
+
15
+ .row-gap-#{$bp}-#{$key} {
16
+ row-gap: $value !important;
17
+ }
18
+
19
+ .column-gap-#{$bp}-#{$key} {
20
+ column-gap: $value !important;
21
+ }
22
+ }
23
+
24
+ // basic
25
+ .d-#{$bp}-flex {
26
+ display: flex !important;
27
+ }
28
+
29
+ .d-#{$bp}-inline-flex {
30
+ display: inline-flex !important;
31
+ }
32
+
33
+ // directions
34
+ .flex-#{$bp}-row {
35
+ flex-direction: row !important;
36
+ }
37
+
38
+ .flex-#{$bp}-column {
39
+ flex-direction: column !important;
40
+ }
41
+
42
+ .flex-#{$bp}-row-reverse {
43
+ flex-direction: row-reverse !important;
44
+ }
45
+
46
+ .flex-#{$bp}-column-reverse {
47
+ flex-direction: column-reverse !important;
48
+ }
49
+
50
+ // justify content - start, end, center, between, around, evenly
51
+ .justify-content-#{$bp}-start {
52
+ justify-content: start !important;
53
+ }
54
+
55
+ .justify-content-#{$bp}-end {
56
+ justify-content: end !important;
57
+ }
58
+
59
+ .justify-content-#{$bp}-center {
60
+ justify-content: center !important;
61
+ }
62
+
63
+ .justify-content-#{$bp}-between {
64
+ justify-content: space-between !important;
65
+ }
66
+
67
+ .justify-content-#{$bp}-around {
68
+ justify-content: space-around !important;
69
+ }
70
+
71
+ .justify-content-#{$bp}-evenly {
72
+ justify-content: space-evenly !important;
73
+ }
74
+
75
+ // align items - start, end, center, baseline, or stretch
76
+ .align-items-#{$bp}-start {
77
+ align-items: start !important;
78
+ }
79
+
80
+ .align-items-#{$bp}-end {
81
+ align-items: end !important;
82
+ }
83
+
84
+ .align-items-#{$bp}-center {
85
+ align-items: center !important;
86
+ }
87
+
88
+ .align-items-#{$bp}-baseline {
89
+ align-items: baseline !important;
90
+ }
91
+
92
+ .align-items-#{$bp}-stretch {
93
+ align-items: stretch !important;
94
+ }
95
+
96
+ // align self
97
+ // TODO
98
+
99
+ // fill
100
+ // TODO
101
+
102
+ // grow
103
+ // TODO
104
+
105
+ // shrink
106
+ // TODO
107
+ }
108
+ }
package/scss/flex.scss ADDED
@@ -0,0 +1,166 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss' as theme;
3
+
4
+ // TODO - use the following to iterate
5
+ $flex-directions: (row, row-reverse, column, column-reverse);
6
+ $flex-ratios: (0, 1);
7
+ $flex-justify-content-alignments: (start, end, center, between, around, evenly);
8
+ $flex-align-items-alignments: (start, end, center, between, around, evenly);
9
+
10
+ // basic
11
+ .d-flex {
12
+ display: flex;
13
+ }
14
+
15
+ .d-inline-flex {
16
+ display: inline-flex;
17
+ }
18
+
19
+ // directions
20
+ .flex-row {
21
+ flex-direction: row;
22
+ }
23
+
24
+ .flex-row-reverse {
25
+ flex-direction: row-reverse;
26
+ }
27
+
28
+ .flex-column {
29
+ flex-direction: column;
30
+ }
31
+
32
+ .flex-column-reverse {
33
+ flex-direction: column-reverse;
34
+ }
35
+
36
+ // justify content - start, end, center, between, around or evenly
37
+ .justify-content-start {
38
+ justify-content: start;
39
+ }
40
+
41
+ .justify-content-end {
42
+ justify-content: end;
43
+ }
44
+
45
+ .justify-content-center {
46
+ justify-content: center;
47
+ }
48
+
49
+ .justify-content-between {
50
+ justify-content: space-between;
51
+ }
52
+
53
+ .justify-content-around {
54
+ justify-content: space-around;
55
+ }
56
+
57
+ .justify-content-evenly {
58
+ justify-content: space-evenly;
59
+ }
60
+
61
+ // align items - start, end, center, baseline, or stretch
62
+ .align-items-start {
63
+ align-items: start;
64
+ }
65
+
66
+ .align-items-end {
67
+ align-items: end;
68
+ }
69
+
70
+ .align-items-center {
71
+ align-items: center;
72
+ }
73
+
74
+ .align-items-baseline {
75
+ align-items: baseline;
76
+ }
77
+
78
+ .align-items-stretch {
79
+ align-items: stretch;
80
+ }
81
+
82
+ // align self
83
+ // TODO
84
+
85
+ // fill
86
+ .flex-fill {
87
+ flex: 1 1 auto;
88
+ }
89
+
90
+ // grow
91
+ .flex-grow-0 {
92
+ flex-grow: 0;
93
+ }
94
+
95
+ .flex-grow-1 {
96
+ flex-grow: 1;
97
+ }
98
+
99
+ // shrink
100
+ .flex-shrink-0 {
101
+ flex-shrink: 0;
102
+ }
103
+
104
+ .flex-shrink-1 {
105
+ flex-shrink: 1;
106
+ }
107
+
108
+ // wrap
109
+ .flex-wrap {
110
+ flex-wrap: wrap;
111
+ }
112
+
113
+ .flex-nowrap {
114
+ flex-wrap: nowrap;
115
+ }
116
+
117
+ // order
118
+ .order-0 {
119
+ order: 0;
120
+ }
121
+
122
+ .order-1 {
123
+ order: 1;
124
+ }
125
+
126
+ .order-2 {
127
+ order: 2;
128
+ }
129
+
130
+ .order-3 {
131
+ order: 3;
132
+ }
133
+
134
+ .order-4 {
135
+ order: 4;
136
+ }
137
+
138
+ .order-5 {
139
+ order: 5;
140
+ }
141
+
142
+ .order-first {
143
+ order: -1;
144
+ }
145
+
146
+ .order-last {
147
+ order: 6;
148
+ }
149
+
150
+ // align-content
151
+ // TODO
152
+
153
+ // gap - move to own file?
154
+ @each $key, $value in map.get(theme.$theme, spacings) {
155
+ .gap-#{$key} {
156
+ gap: $value;
157
+ }
158
+
159
+ .row-gap-#{$key} {
160
+ row-gap: $value;
161
+ }
162
+
163
+ .column-gap-#{$key} {
164
+ column-gap: $value;
165
+ }
166
+ }
@@ -0,0 +1,14 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss' as theme;
3
+
4
+ // grid responsive
5
+
6
+ @each $bp, $bp-value in map.get(theme.$theme, breakpoints) {
7
+ @media (min-width: #{$bp-value}) {
8
+ @for $i from 1 through 12 {
9
+ .col-#{$bp}-#{$i} {
10
+ grid-column: span $i !important;
11
+ }
12
+ }
13
+ }
14
+ }
package/scss/grid.scss ADDED
@@ -0,0 +1,17 @@
1
+ .grid {
2
+ display: grid;
3
+ grid-template-columns: repeat(12, minmax(0, 1fr));
4
+
5
+ column-gap: 1rem;
6
+ row-gap: 1rem;
7
+ }
8
+
9
+ .col {
10
+ grid-column: span 12;
11
+ }
12
+
13
+ @for $i from 1 through 12 {
14
+ .col-#{$i} {
15
+ grid-column: span $i;
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ @use './theme.scss';
2
+ @use './variables.scss';
3
+ @use './typography.scss';
4
+ @use './utilities.scss';
5
+ @use './spacings.scss';
6
+ @use './spacings-responsive.scss';
7
+ @use './flex.scss';
8
+ @use './flex-responsive.scss';
9
+ @use './grid.scss';
10
+ @use './grid-responsive.scss';
@@ -0,0 +1,20 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss' as theme;
3
+
4
+ @mixin media($size) {
5
+ $bps: map.get(theme.$theme, breakpoints);
6
+
7
+ @if map.has-key($bps, $size) {
8
+ @media (min-width: #{map.get($bps, $size)}) {
9
+ @content;
10
+ }
11
+ } @else {
12
+ @error "Breakpoint `#{$size}` wurde nicht gefunden!";
13
+ }
14
+ }
15
+
16
+ // usage
17
+ // @use './breakpoints' as bp;
18
+ // @include bp.media(md) {
19
+ // dosomething;
20
+ // }
@@ -0,0 +1,19 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss';
3
+
4
+ // margin / padding with breakpoints and directions
5
+ @each $bp, $bp-value in map.get(theme.$theme, breakpoints) {
6
+ @media (min-width: #{$bp-value}) {
7
+ @each $key, $value in map.get(theme.$theme, spacings) {
8
+ @each $dir, $prop in map.get(theme.$theme, directions) {
9
+ .m#{$dir}-#{$bp}-#{$key} {
10
+ margin-#{$prop}: $value !important;
11
+ }
12
+
13
+ .p#{$dir}-#{$bp}-#{$key} {
14
+ padding-#{$prop}: $value !important;
15
+ }
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,30 @@
1
+ @use 'sass:map';
2
+ @use './theme.scss';
3
+
4
+ .ml-auto {
5
+ margin-left: auto;
6
+ }
7
+
8
+ // margin / padding spacings
9
+ @each $key, $value in map.get(theme.$theme, spacings) {
10
+ .m-#{$key} {
11
+ margin: $value;
12
+ }
13
+
14
+ .p-#{$key} {
15
+ padding: $value;
16
+ }
17
+ }
18
+
19
+ // margin / padding with directions
20
+ @each $key, $value in map.get(theme.$theme, spacings) {
21
+ @each $dir, $prop in map.get(theme.$theme, directions) {
22
+ .m#{$dir}-#{$key} {
23
+ margin-#{$prop}: $value !important;
24
+ }
25
+
26
+ .p#{$dir}-#{$key} {
27
+ padding-#{$prop}: $value !important;
28
+ }
29
+ }
30
+ }