@avenirs-esr/avenirs-dsav 0.1.107 → 0.1.109

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,142 @@
1
+ @use '../core/namespace' as *;
2
+ @use '../mixins/responsive-utility' as *;
3
+ @use '../settings/breakpoints' as bp;
4
+ @use '../core/spacing' as sp;
5
+ @use "sass:map";
6
+
7
+ // === Containers ===
8
+ $container-paddings: (
9
+ sm: sm,
10
+ md: sm,
11
+ lg: md,
12
+ xl: md
13
+ );
14
+
15
+ // === Base container ===
16
+ // Ex: .av-container, .av-container-fluid
17
+ @include ns("container") {
18
+ max-width: 90rem;
19
+ margin-left: auto;
20
+ margin-right: auto;
21
+ padding-left: var(--spacing-sm);
22
+ padding-right: var(--spacing-sm);
23
+
24
+ &-fluid {
25
+ max-width: none;
26
+ padding-left: var(--spacing-none);
27
+ padding-right: var(--spacing-none);
28
+ overflow: hidden;
29
+ }
30
+ }
31
+
32
+ // === Responsive containers ===
33
+ // Ex: .av-container--md / .av-container--lg
34
+ @each $bp-name, $bp-value in bp.$breakpoints {
35
+ @media (min-width: #{$bp-value}) {
36
+ @include ns("container--#{$bp-name}") {
37
+ width: 100%;
38
+ max-width: #{$bp-value};
39
+ margin-left: auto;
40
+ margin-right: auto;
41
+ padding-left: var(--spacing-#{map.get($container-paddings, $bp-name)});
42
+ padding-right: var(--spacing-#{map.get($container-paddings, $bp-name)});
43
+ }
44
+ }
45
+ }
46
+
47
+ // === Rows ===
48
+ @include responsive-utility("row", (
49
+ display: flex,
50
+ flex-direction: row
51
+ ));
52
+
53
+ // === Columns ===
54
+ @include responsive-utility("col", (
55
+ display: flex,
56
+ flex-direction: column
57
+ ));
58
+
59
+ // === Flex wrap ===
60
+ @include responsive-utility("wrap", (
61
+ flex-wrap: wrap
62
+ ));
63
+ @include responsive-utility("nowrap", (
64
+ flex-wrap: nowrap
65
+ ));
66
+
67
+ // === Accessibility ===
68
+ // Ex: .av-sr-only / .av-sr-only--sm / .av-sr-only--md / .av-sr-only--lg / .av-sr-only--xl
69
+ @include responsive-utility("sr-only", (
70
+ position: absolute !important,
71
+ width: 1px !important,
72
+ height: 1px !important,
73
+ padding: 0 !important,
74
+ margin: -1px !important,
75
+ overflow: hidden !important,
76
+ clip: rect(0, 0, 0, 0) !important,
77
+ white-space: nowrap !important,
78
+ border: 0 !important
79
+ ));
80
+
81
+ // === Visibility classes ===
82
+ // Ex: .av-hidden / .av-hidden--md / .av-unhidden / .av-unhidden--lg
83
+ @include responsive-utility("hidden", (
84
+ display: none !important
85
+ ));
86
+ @include responsive-utility("unhidden", (
87
+ display: inherit !important
88
+ ));
89
+
90
+ // === Gapped layouts ===
91
+ // Ex: .av-gap-sm / .av-gap-lg / .av-gap-lg--lg
92
+ @each $size, $value in sp.$spacing {
93
+ @include responsive-utility("gap-#{$size}", (
94
+ gap: var(--spacing-#{$size})
95
+ ));
96
+ }
97
+
98
+ // === Flex fill class ===
99
+ // Ex: .av-flex-fill / .av-flex-fill--md
100
+ @include responsive-utility("flex-fill", (
101
+ flex: 1 1 0%
102
+ ));
103
+
104
+ // === Full width/height classes ===
105
+ // Ex: .av-w-full / .av-h-full / .av-w-full--lg / .av-h-full--md
106
+ @include responsive-utility("w-full", (
107
+ width: 100%
108
+ ));
109
+ @include responsive-utility("h-full", (
110
+ height: 100%
111
+ ));
112
+
113
+ // === Flex alignment classes ===
114
+ // Ex: .av-align-center / .av-align-end / .av-align-baseline--lg
115
+ $alignments: (
116
+ start: flex-start,
117
+ center: center,
118
+ end: flex-end,
119
+ stretch: stretch,
120
+ baseline: baseline
121
+ );
122
+ @each $alignment, $value in $alignments {
123
+ @include responsive-utility("align-#{$alignment}", (
124
+ align-items: $value
125
+ ));
126
+ }
127
+
128
+ // === Flex justification classes ===
129
+ // Ex: .av-justify-center / .av-justify-between / .av-justify-end--md
130
+ $justifications: (
131
+ start: flex-start,
132
+ center: center,
133
+ end: flex-end,
134
+ between: space-between,
135
+ around: space-around,
136
+ evenly: space-evenly
137
+ );
138
+ @each $justification, $value in $justifications {
139
+ @include responsive-utility("justify-#{$justification}", (
140
+ justify-content: $value
141
+ ));
142
+ }
@@ -0,0 +1,91 @@
1
+ ---
2
+ layout: page
3
+ lastUpdated: true
4
+ ---
5
+
6
+ # Spacing
7
+
8
+ ## ✨ Introduction
9
+
10
+ This `spacing` utility generates margin and padding classes for all defined spacing sizes, both globally and directionally, with responsive variants.
11
+
12
+ ## 🏷️ Class patterns
13
+
14
+ | Class pattern | Description | Responsive variants |
15
+ |---------------|-------------|---------------------|
16
+ | `.av-m{direction?}-{spacing}` | Applies `margin`; optional direction: `t` (`top`), `r` (`right`), `b` (`bottom`), `l` (`left`), `x` (`horizontal`), `y` (`vertical`) | `--sm`, `--md`, `--lg`, `--xl` |
17
+ | `.av-p{direction?}-{spacing}` | Applies `padding`; optional direction: `t` (`top`), `r` (`right`), `b` (`bottom`), `l` (`left`), `x` (`horizontal`), `y` (`vertical`) | `--sm`, `--md`, `--lg`, `--xl` |
18
+
19
+ 📝 Notes:
20
+ - `{spacing}` corresponds to the spacing scale defined in the core: `none`, `xxxs`, `xxs`, `xs`, `sm`, `md`, `lg`, `xl`, `2xl`, `4xl`, `5xl`.
21
+
22
+ ## 🎨 Some CSS results
23
+
24
+ ### Global margin
25
+
26
+ ```css
27
+ .av-m-sm {
28
+ margin: var(--spacing-sm) !important;
29
+ }
30
+
31
+ @media (min-width: 36rem) {
32
+ .av-m-sm--md {
33
+ margin: var(--spacing-sm) !important;
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### Directional margin
39
+
40
+ ```css
41
+ .av-mt-sm {
42
+ margin-top: var(--spacing-sm) !important;
43
+ }
44
+
45
+ @media (min-width: 48rem) {
46
+ .av-my-lg--md {
47
+ margin-top: var(--spacing-lg) !important;
48
+ margin-bottom: var(--spacing-lg) !important;
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### Global padding
54
+
55
+ ```css
56
+ .av-p-md {
57
+ padding: var(--spacing-md) !important;
58
+ }
59
+
60
+ @media (min-width: 64rem) {
61
+ .av-p-md--lg {
62
+ padding: var(--spacing-md) !important;
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### Directional padding
68
+
69
+ ```css
70
+ .av-pb-lg--md {
71
+ padding-bottom: var(--spacing-lg) !important;
72
+ }
73
+
74
+ @media (min-width: 48rem) {
75
+ .av-px-lg--md {
76
+ padding-left: var(--spacing-lg) !important;
77
+ padding-right: var(--spacing-lg) !important;
78
+ }
79
+ }
80
+ ```
81
+
82
+ ## 💡 Examples of use
83
+
84
+ ```html
85
+ <div class="av-mt-md av-mb-lg--md av-px-sm av-py-xl--lg">
86
+ <!-- mt-md: top margin md on all screens -->
87
+ <!-- mb-lg--md: bottom margin lg on medium screens and up -->
88
+ <!-- px-sm: horizontal padding sm -->
89
+ <!-- py-xl--lg: vertical padding xl on large screens and up -->
90
+ </div>
91
+ ```
@@ -1,5 +1,6 @@
1
1
  @use '../core/spacing' as sp;
2
2
  @use '../core/namespace' as *;
3
+ @use '../mixins/responsive-utility' as *;
3
4
  @use '../settings/breakpoints' as bp;
4
5
  @use "sass:meta";
5
6
 
@@ -18,71 +19,31 @@ $directions: (
18
19
  y: (top, bottom),
19
20
  );
20
21
 
21
- // === Directional classes ===
22
- // Ex : .av-mt-sm / .av-px-md
23
- @each $type, $property-value in $properties {
24
- @each $direction-key, $direction-value in $directions {
25
- @each $size, $value in sp.$spacing {
26
- @if meta.type-of($direction-value) == 'list' {
27
- @include ns("#{$type}#{$direction-key}-#{$size}") {
28
- @each $d in $direction-value {
29
- #{$property-value}-#{$d}: var(--spacing-#{$size}) !important;
30
- }
31
- }
32
- } @else {
33
- @include ns("#{$type}#{$direction-key}-#{$size}") {
34
- #{$property-value}-#{$direction-value}: var(--spacing-#{$size}) !important;
35
- }
36
- }
37
- }
38
- }
39
- }
40
-
41
22
  // === Global classes ===
42
- // Ex : .av-m-sm / .av-p-md
23
+ // Ex : .av-m-sm / .av-p-md / .av-m-none--lg / .av-p-md--xl
43
24
  @each $type, $property-value in $properties {
44
25
  @each $size, $value in sp.$spacing {
45
- @include ns("#{$type}-#{$size}") {
46
- #{$property-value}: var(--spacing-#{$size}) !important;
47
- }
26
+ @include responsive-utility("#{$type}-#{$size}", (
27
+ #{$property-value}: var(--spacing-#{$size}) !important
28
+ ));
48
29
  }
49
30
  }
50
31
 
51
- // === Breakpoint-specific directional classes ===
52
- // Ex : .av-mt-sm--lg / .av-px-md--xl / .av-mt-none--lg
32
+ // === Directional classes ===
33
+ // Ex : .av-mt-sm / .av-px-md / .av-mb-none--lg / .av-pt-md--xl
53
34
  @each $type, $property-value in $properties {
54
35
  @each $direction-key, $direction-value in $directions {
55
36
  @each $size, $value in sp.$spacing {
56
- @each $breakpoint, $breakpoint-value in bp.$breakpoints {
57
- @if meta.type-of($direction-value) == 'list' {
58
- @include ns("#{$type}#{$direction-key}-#{$size}--#{$breakpoint}") {
59
- @include bp.min-width($breakpoint) {
60
- @each $d in $direction-value {
61
- #{$property-value}-#{$d}: var(--spacing-#{$size}) !important;
62
- }
63
- }
64
- }
65
- } @else {
66
- @include ns("#{$type}#{$direction-key}-#{$size}--#{$breakpoint}") {
67
- @include bp.min-width($breakpoint) {
68
- #{$property-value}-#{$direction-value}: var(--spacing-#{$size}) !important;
69
- }
70
- }
71
- }
72
- }
73
- }
74
- }
75
- }
76
-
77
- // === Breakpoint-specific global classes ===
78
- // Ex : .av-m-sm--lg / .av-p-md--xl / .av-m-none--lg
79
- @each $type, $property-value in $properties {
80
- @each $size, $value in sp.$spacing {
81
- @each $breakpoint, $breakpoint-value in bp.$breakpoints {
82
- @include ns("#{$type}-#{$size}--#{$breakpoint}") {
83
- @include bp.min-width($breakpoint) {
84
- #{$property-value}: var(--spacing-#{$size}) !important;
37
+ @if meta.type-of($direction-value) == 'list' {
38
+ @each $d in $direction-value {
39
+ @include responsive-utility("#{$type}#{$direction-key}-#{$size}", (
40
+ #{$property-value}-#{$d}: var(--spacing-#{$size}) !important
41
+ ));
85
42
  }
43
+ } @else {
44
+ @include responsive-utility("#{$type}#{$direction-key}-#{$size}", (
45
+ #{$property-value}-#{$direction-value}: var(--spacing-#{$size}) !important
46
+ ));
86
47
  }
87
48
  }
88
49
  }
@@ -1,183 +0,0 @@
1
- @use '../core/namespace' as *;
2
- @use '../settings/breakpoints' as bp;
3
- @use '../core/spacing' as sp;
4
-
5
- $columns: 12;
6
-
7
- // === Containers ===
8
- // Default container
9
- // Ex: .av-container, .av-container--fluid
10
- @include ns("container") {
11
- max-width: 90rem;
12
- margin-left: auto;
13
- margin-right: auto;
14
- padding-left: sp.get(sm);
15
- padding-right: sp.get(sm);
16
-
17
- &--fluid {
18
- max-width: none;
19
- padding-left: var(--spacing-none);
20
- padding-right: var(--spacing-none);
21
- overflow: hidden;
22
- }
23
- }
24
-
25
- // Breakpoint-specific containers
26
- // Ex: .av-container-md / .av-container-lg
27
- @each $bp-name, $bp-value in bp.$breakpoints {
28
- @media (min-width: #{$bp-value}) {
29
- @include ns("container-#{$bp-name}") {
30
- width: 100%;
31
- max-width: #{$bp-value};
32
- margin-left: auto;
33
- margin-right: auto;
34
- @if $bp-name == lg or $bp-name == xl {
35
- padding-left: sp.get(md);
36
- padding-right: sp.get(md);
37
- } @else {
38
- padding-left: sp.get(sm);
39
- padding-right: sp.get(sm);
40
- }
41
- }
42
- }
43
- }
44
-
45
- // === Rows ===
46
- $row-justifications: (
47
- left: flex-start,
48
- right: flex-end,
49
- center: center,
50
- between: space-between
51
- );
52
-
53
- $row-alignments: (
54
- top: flex-start,
55
- middle: center,
56
- bottom: flex-end
57
- );
58
-
59
- @include ns("row") {
60
- display: flex;
61
- flex-wrap: wrap;
62
-
63
- // Horizontal alignments
64
- // Ex: .av-row--left / .av-row--center
65
- @each $mod-name, $justify in $row-justifications {
66
- &--#{$mod-name} {
67
- justify-content: $justify;
68
- }
69
- }
70
-
71
- // Vertical alignments
72
- // Ex: .av-row--top / .av-row--bottom
73
- @each $mod-name, $align in $row-alignments {
74
- &--#{$mod-name} {
75
- align-items: $align;
76
- }
77
- }
78
- }
79
-
80
- @each $bp-name, $bp-value in bp.$breakpoints {
81
- @media (min-width: #{$bp-value}) {
82
- // Base row
83
- // Ex: .av-row-md
84
- @include ns("row-#{$bp-name}") {
85
- display: flex;
86
- flex-wrap: wrap;
87
- margin-left: -#{sp.get(sm)};
88
- margin-right: -#{sp.get(sm)};
89
-
90
- > * {
91
- padding-left: sp.get(sm);
92
- padding-right: sp.get(sm);
93
- }
94
-
95
- &.av-no-gutters {
96
- margin-left: 0;
97
- margin-right: 0;
98
-
99
- > * {
100
- padding-left: 0;
101
- padding-right: 0;
102
- }
103
- }
104
-
105
- // Horizontal alignments
106
- // Ex: .av-row-md--left / .av-row-lg--center
107
- @each $mod-name, $justify in $row-justifications {
108
- &--#{$mod-name} {
109
- justify-content: $justify;
110
- }
111
- }
112
-
113
- // Vertical alignments
114
- // Ex: .av-row-md--top / .av-row-lg--bottom
115
- @each $mod-name, $align in $row-alignments {
116
- &--#{$mod-name} {
117
- align-items: $align;
118
- }
119
- }
120
- }
121
- }
122
- }
123
-
124
- // === Columns ===
125
- $col-alignments: (
126
- top: flex-start,
127
- middle: center,
128
- bottom: flex-end
129
- );
130
-
131
- @each $bp-name, $bp-value in bp.$breakpoints {
132
- @media (min-width: #{$bp-value}) {
133
- // Base column
134
- // Ex: .av-col-md
135
- @include ns("col-#{$bp-name}") {
136
- flex: 1;
137
- }
138
-
139
- // Align-self modifiers
140
- // Ex: .av-col-md--top / .av-col-lg--bottom
141
- @each $mod-name, $align in $col-alignments {
142
- @include ns("col-#{$bp-name}--#{$mod-name}") {
143
- align-self: $align;
144
- }
145
- }
146
-
147
- // Width and offsets
148
- // Ex: .av-col-md-4 / .av-col-offset-md-2 / .av-col-offset-md-2--right
149
- @for $i from 1 through $columns {
150
- @include ns("col-#{$bp-name}-#{$i}") {
151
- flex: 0 0 calc(100% * #{$i} / #{$columns});
152
- max-width: calc(100% * #{$i} / #{$columns});
153
- }
154
-
155
- @include ns("col-offset-#{$bp-name}-#{$i}") {
156
- margin-left: calc(100% * #{$i} / #{$columns});
157
- }
158
-
159
- @include ns("col-offset-#{$bp-name}-#{$i}--right") {
160
- margin-left: 0;
161
- margin-right: calc(100% * #{$i} / #{$columns});
162
- }
163
- }
164
- }
165
- }
166
-
167
- // === Gapped flex directions ===
168
- // Ex: .av-flex-row-md / .av-flex-col-sm
169
- $flex-directions: (
170
- row: row,
171
- col: column,
172
- );
173
-
174
- @each $dir-name, $dir-value in $flex-directions {
175
- @each $size, $value in sp.$spacing {
176
- @include ns("flex-#{$dir-name}-#{$size}") {
177
- display: flex;
178
- flex: 1;
179
- flex-direction: $dir-value;
180
- gap: var(--spacing-#{$size});
181
- }
182
- }
183
- }
@@ -1,14 +0,0 @@
1
- @use './namespace' as *;
2
-
3
- @include ns("sr-only") {
4
- position: absolute !important;
5
- width: 1px !important;
6
- height: 1px !important;
7
- padding: 0 !important;
8
- margin: -1px !important;
9
- overflow: hidden !important;
10
- clip: rect(0, 0, 0, 0) !important;
11
- white-space: nowrap !important;
12
- border: 0 !important;
13
- display: block !important;
14
- }