@mezzanine-ui/system 0.7.0 → 0.11.2

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/_system.scss CHANGED
@@ -3,6 +3,7 @@
3
3
  @use './spacing';
4
4
  @use './typography';
5
5
  @use './z-index';
6
+ @use './palette' as system-palette;
6
7
 
7
8
  @mixin common-variables($options: ()) {
8
9
  $motion: map.get($options, motion);
@@ -10,27 +11,31 @@
10
11
  $typography: map.get($options, typography);
11
12
  $z-index: map.get($options, z-index);
12
13
 
13
- @if $motion == null {
14
+ @if not $motion {
14
15
  @include motion.variables();
15
16
  } @else {
16
17
  @include motion.variables($motion);
17
18
  }
18
19
 
19
- @if $spacing == null {
20
+ @if not $spacing {
20
21
  @include spacing.variables();
21
22
  } @else {
22
23
  @include spacing.variables($spacing);
23
24
  }
24
25
 
25
- @if $typography == null {
26
+ @if not $typography {
26
27
  @include typography.variables();
27
28
  } @else {
28
29
  @include typography.variables($typography);
29
30
  }
30
31
 
31
- @if $z-index == null {
32
+ @if not $z-index {
32
33
  @include z-index.variables();
33
34
  } @else {
34
35
  @include z-index.variables($z-index);
35
36
  }
36
37
  }
38
+
39
+ @mixin palette($mode: 'light', $palette: ()) {
40
+ @include system-palette.variables($mode, $palette);
41
+ }
@@ -25,7 +25,7 @@ $breakpoint-names: (sm, md, lg, xl, xxl);
25
25
 
26
26
  @function get($breakpoint-name) {
27
27
  @if not is-valid-breakpoint-name($breakpoint-name) {
28
- @error "Invalid breakpoint name #{$breakpoint-name}. Please choose one of #{$breakpoint-names}";
28
+ @error 'Invalid breakpoint name #{$breakpoint-name}. Please choose one of #{$breakpoint-names}';
29
29
  }
30
30
 
31
31
  @return map.get($breakpoints, $breakpoint-name);
@@ -33,7 +33,7 @@ $breakpoint-names: (sm, md, lg, xl, xxl);
33
33
 
34
34
  @mixin above($min) {
35
35
  @if not is-valid-breakpoint-name($min) {
36
- @error "Invalid breakpoint name #{$min}. Please choose one of #{$breakpoint-names}";
36
+ @error 'Invalid breakpoint name #{$min}. Please choose one of #{$breakpoint-names}';
37
37
  }
38
38
 
39
39
  @media (min-width: get($min)) {
@@ -43,24 +43,24 @@ $breakpoint-names: (sm, md, lg, xl, xxl);
43
43
 
44
44
  @mixin below($max) {
45
45
  @if not is-valid-breakpoint-name($max) {
46
- @error "Invalid breakpoint name #{$max}. Please choose one of #{$breakpoint-names}";
46
+ @error 'Invalid breakpoint name #{$max}. Please choose one of #{$breakpoint-names}';
47
47
  }
48
48
 
49
- @media (max-width: get($max) - 1px) {
49
+ @media (max-width: (get($max) - 1px)) {
50
50
  @content;
51
51
  }
52
52
  }
53
53
 
54
54
  @mixin between($min: null, $max: null) {
55
- @if $min == null and $max == null {
56
- @error "Should provide at least one breakpoint";
55
+ @if not $min and not $max {
56
+ @error 'Should provide at least one breakpoint';
57
57
  }
58
58
 
59
- @if $min == null {
59
+ @if not $min {
60
60
  @include below($max) {
61
61
  @content;
62
62
  }
63
- } @else if $max == null {
63
+ } @else if not $max {
64
64
  @include above($min) {
65
65
  @content;
66
66
  }
@@ -35,7 +35,7 @@ $default-options: (
35
35
 
36
36
  @function duration($duration-name) {
37
37
  @if not is-duration-name-valid($duration-name) {
38
- @error "Invalid duration name #{$duration-name}. Please choose one of #{$duration-names}";
38
+ @error 'Invalid duration name #{$duration-name}. Please choose one of #{$duration-names}';
39
39
  }
40
40
 
41
41
  @return var(--#{$prefix}-duration-#{$duration-name});
@@ -43,7 +43,7 @@ $default-options: (
43
43
 
44
44
  @function easing($easing-name) {
45
45
  @if not is-easing-name-valid($easing-name) {
46
- @error "Invalid easing name #{$easing-name}. Please choose one of #{$easing-names}";
46
+ @error 'Invalid easing name #{$easing-name}. Please choose one of #{$easing-names}';
47
47
  }
48
48
 
49
49
  @return var(--#{$prefix}-easing-#{$easing-name});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezzanine-ui/system",
3
- "version": "0.7.0",
3
+ "version": "0.11.2",
4
4
  "description": "Design System for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -9,7 +9,7 @@ $prefix: mzn-color;
9
9
  }
10
10
 
11
11
  @function _get-main-color-transformed-palette($color) {
12
- $rgba: meta.get-function("rgba");
12
+ $rgba: meta.get-function('rgba');
13
13
 
14
14
  @return (
15
15
  #{$color}-hover-bg: (
@@ -39,7 +39,7 @@ $prefix: mzn-color;
39
39
 
40
40
  $main-color-names: (primary, secondary, error, warning, success);
41
41
  $color-names: list.flat-push(
42
- list.flat-map($main-color-names, meta.get-function("_get-main-related-color-names")),
42
+ list.flat-map($main-color-names, meta.get-function('_get-main-related-color-names')),
43
43
  (
44
44
  text-primary,
45
45
  text-secondary,
@@ -111,14 +111,14 @@ $default-light-palette: map.assign(
111
111
  divider: #f2f2f2,
112
112
  overlay-bg: (
113
113
  from: action-active,
114
- transformer: meta.get-function("rgba"),
114
+ transformer: meta.get-function('rgba'),
115
115
  args: (
116
116
  0.5,
117
117
  ),
118
118
  ),
119
119
  overlay-surface-bg: (
120
120
  from: surface,
121
- transformer: meta.get-function("rgba"),
121
+ transformer: meta.get-function('rgba'),
122
122
  args: (
123
123
  0.9,
124
124
  ),
@@ -156,14 +156,14 @@ $default-dark-palette: map.assign(
156
156
  divider: #494949,
157
157
  overlay-bg: (
158
158
  from: action-active,
159
- transformer: meta.get-function("rgba"),
159
+ transformer: meta.get-function('rgba'),
160
160
  args: (
161
161
  0.5,
162
162
  ),
163
163
  ),
164
164
  overlay-surface-bg: (
165
165
  from: surface,
166
- transformer: meta.get-function("rgba"),
166
+ transformer: meta.get-function('rgba'),
167
167
  args: (
168
168
  0.9,
169
169
  ),
@@ -186,10 +186,10 @@ $default-palette: (
186
186
 
187
187
  @each $color-name, $color in $palette {
188
188
  @if not is-color-name-valid($color-name) {
189
- @error "Invalid color name #{$color-name}. Please choose one of #{$color-names}";
189
+ @error 'Invalid color name #{$color-name}. Please choose one of #{$color-names}';
190
190
  }
191
191
 
192
- @if meta.type-of($color) != "color" {
192
+ @if meta.type-of($color) != 'color' {
193
193
  $color: _transform-color-from-palette($palette, $color);
194
194
  }
195
195
 
@@ -199,7 +199,7 @@ $default-palette: (
199
199
 
200
200
  @function color($color-name) {
201
201
  @if not is-color-name-valid($color-name) {
202
- @error "Invalid color name #{$color-name}. Please choose one of #{$color-names}";
202
+ @error 'Invalid color name #{$color-name}. Please choose one of #{$color-names}';
203
203
  }
204
204
 
205
205
  @return var(--#{$prefix}-#{$color-name});
@@ -12,7 +12,7 @@ $variants: (h1, h2, h3, h4, h5, h6, body1, body2, caption, button1, button2, but
12
12
 
13
13
  $default-options: (
14
14
  base: (
15
- font-family: string.unquote("PingFang TC, Microsoft JhengHei"),
15
+ font-family: string.unquote('PingFang TC, Microsoft JhengHei'),
16
16
  ),
17
17
  h1: (
18
18
  font-size: px-to-rem(32px),
@@ -120,12 +120,12 @@ $default-options: (
120
120
 
121
121
  @function base-prop($prop, $fallback: null) {
122
122
  @if not is-baseprop-valid($prop) {
123
- @error "Invalid base prop #{$prop}. Please choose one of #{$props}";
123
+ @error 'Invalid base prop #{$prop}. Please choose one of #{$props}';
124
124
  }
125
125
 
126
126
  $varname: --#{$prefix}-#{$prop};
127
127
 
128
- @if $fallback == null {
128
+ @if not $fallback {
129
129
  @return var(#{$varname});
130
130
  }
131
131
 
@@ -135,16 +135,16 @@ $default-options: (
135
135
  // Get the css variable of the specific prop of variant.
136
136
  @function prop($variant, $prop, $fallback: null) {
137
137
  @if not is-variant-valid($variant) {
138
- @error "Invalid variant #{$variant}. Please choose one of #{$variants}";
138
+ @error 'Invalid variant #{$variant}. Please choose one of #{$variants}';
139
139
  }
140
140
 
141
141
  @if not is-prop-valid($prop) {
142
- @error "Invalid prop #{$prop}. Please choose one of #{$props}";
142
+ @error 'Invalid prop #{$prop}. Please choose one of #{$props}';
143
143
  }
144
144
 
145
145
  $varname: --#{$prefix}-#{$variant}-#{$prop};
146
146
 
147
- @if $fallback == null {
147
+ @if not $fallback {
148
148
  @return var(#{$varname});
149
149
  }
150
150
 
@@ -154,7 +154,7 @@ $default-options: (
154
154
  @function font($variant, $exclude-props: ()) {
155
155
  @each $prop in $exclude-props {
156
156
  @if $prop == font-family or $prop == font-size or not is-prop-valid($prop) {
157
- @error "Invalid prop #{$prop}. Please choose one of #{$props}";
157
+ @error 'Invalid prop #{$prop}. Please choose one of #{$props}';
158
158
  }
159
159
  }
160
160
 
@@ -163,7 +163,7 @@ $default-options: (
163
163
  $font-weight: if(list.includes($exclude-props, font-weight), null, prop($variant, font-weight));
164
164
 
165
165
  @if not list.includes($exclude-props, line-height) {
166
- $font-size: $font-size/prop($variant, line-height);
166
+ $font-size: $font-size / prop($variant, line-height);
167
167
  }
168
168
 
169
169
  @return $font-weight $font-size $font-family;
@@ -173,7 +173,7 @@ $default-options: (
173
173
  // Only accept valid props.
174
174
  @each $prop in $exclude-props {
175
175
  @if not is-prop-valid($prop) {
176
- @error "Invalid prop #{$prop}. Please choose one of #{$props}";
176
+ @error 'Invalid prop #{$prop}. Please choose one of #{$props}';
177
177
  }
178
178
  }
179
179
 
@@ -193,16 +193,16 @@ $default-options: (
193
193
  }
194
194
 
195
195
  @mixin partial-variables($options: ()) {
196
- $base: map.get($options, "base");
197
- $variants-options: map.omit($options, ("base"));
196
+ $base: map.get($options, 'base');
197
+ $variants-options: map.omit($options, ('base'));
198
198
 
199
- @if $base != null {
199
+ @if $base {
200
200
  @each $prop, $value in $base {
201
201
  @if not is-base-prop-valid($prop) {
202
- @error "Invalid base prop #{$prop}. Please choose one of #{$props}";
202
+ @error 'Invalid base prop #{$prop}. Please choose one of #{$props}';
203
203
  }
204
204
 
205
- @if $value != null {
205
+ @if $value {
206
206
  --#{$prefix}-#{$prop}: #{$value};
207
207
  }
208
208
  }
@@ -211,15 +211,15 @@ $default-options: (
211
211
  @if $variants-options {
212
212
  @each $variant, $props-options in $variants-options {
213
213
  @if not is-variant-valid($variant) {
214
- @error "Invalid variant #{$variant}. Please choose one of #{$variants}";
214
+ @error 'Invalid variant #{$variant}. Please choose one of #{$variants}';
215
215
  }
216
216
 
217
217
  @each $prop, $value in $props-options {
218
218
  @if not is-prop-valid($prop) {
219
- @error "Invalid prop #{$prop}. Please choose one of #{$props}";
219
+ @error 'Invalid prop #{$prop}. Please choose one of #{$props}';
220
220
  }
221
221
 
222
- @if $value != null {
222
+ @if $value {
223
223
  --#{$prefix}-#{$variant}-#{$prop}: #{$value};
224
224
  }
225
225
  }
@@ -229,17 +229,17 @@ $default-options: (
229
229
 
230
230
  @mixin variables($options: (), $defaults: $default-options) {
231
231
  $options: map.deep-merge($defaults, $options);
232
- $variants-options: map.omit($options, ("base"));
232
+ $variants-options: map.omit($options, ('base'));
233
233
 
234
234
  @each $variant, $props-options in $variants-options {
235
235
  @if not is-variant-valid($variant) {
236
- @error "Invalid variant #{$variant}. Please choose one of #{$variants}";
236
+ @error 'Invalid variant #{$variant}. Please choose one of #{$variants}';
237
237
  }
238
238
 
239
239
  @each $prop in $base-props {
240
240
  $value: map.get($options, $variant, $prop);
241
241
 
242
- @if $value == null {
242
+ @if not $value {
243
243
  $options: map.set($options, $variant, $prop, base-prop($prop));
244
244
  }
245
245
  }
@@ -38,6 +38,6 @@
38
38
  // of defaulting to the container bottom when text is empty.
39
39
  @mixin zero-width-prefix() {
40
40
  &::before {
41
- content: "\200b";
41
+ content: '\200b';
42
42
  }
43
43
  }
package/utils/_list.scss CHANGED
@@ -14,8 +14,8 @@
14
14
  @each $value in $values {
15
15
  $pusher: if(
16
16
  meta.type-of($value) == list,
17
- meta.get-function("join", $module: list),
18
- meta.get-function("append", $module: list)
17
+ meta.get-function('join', $module: list),
18
+ meta.get-function('append', $module: list)
19
19
  );
20
20
  $list: meta.call($pusher, $list, $value);
21
21
  }
@@ -13,7 +13,7 @@ $orders: (modal, drawer, popover, feedback);
13
13
 
14
14
  @function get($name) {
15
15
  @if not list.includes($orders, $name) {
16
- @error "Only accept #{$orders} for z-index";
16
+ @error 'Only accept #{$orders} for z-index';
17
17
  }
18
18
 
19
19
  @return var(--#{$prefix}-#{$name});