-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_wrap.scss
101 lines (87 loc) · 1.88 KB
/
_wrap.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* ui-wrap
* Custom properties and styles with configuration.
*/
/**
* Requires
*/
@use 'sass:meta';
@use 'abstract';
@use 'mixins';
/**
* Component css class
* @protected
* @type {string} css class
*/
$class: 'ui-wrap' !default;
/**
* Component no flex suffix
* @protected
* @type {string} class variant
*/
$no-flex: '--no-flex' !default;
/**
* Component property prefix
* @protected
* @type {string} property name
*/
$props: 'ui-wrap-' !default;
/**
* Config defaults
* @private
* @type {map}
*/
$-config: ();
/**
* Props defaults
* @private
* @type {map}
*/
$-props: (
wrap: wrap,
);
/**
* Update component config options
* @public
* @param {map} $options - Map of config options
* @output {void} - Only sets config options
*/
@mixin config($options) {
$-config: abstract.config($options, $-config, true, false, 'ui-wrap.config::') !global;
}
/**
* Generate required custom properties
* @public
* @param {null|map} $extend - Extend properties for output only
* @output Adds components custom properties in current scope
*/
@mixin properties($extend: null) {
$render: abstract.merge-optional($-props, $extend);
@include mixins.properties($render, $props, '_at_', 'ui-wrap.properties::');
}
/**
* Generate component styles
* @public
* @output Outputs configured component styles
*/
@mixin styles() {
// Must have at least one defined style
@if meta.type-of($-config) != map {
@error 'You must define at least one wrap style using the config mixin';
}
.#{$class} {
margin: auto;
width: 100%;
// Every wrapper by default is a flex unless when using .ui-wrap--no-flex
&:not(.#{$class}#{$no-flex}) {
display: flex;
flex-wrap: var(--#{$props}wrap);
}
// Include BEM style states
@include mixins.bem-style($-config);
// Allow additional styles
@if meta.content-exists() {
@content;
}
}
}