Skip to content

Commit 08e94f5

Browse files
committed
Add reset-controls functions (same as control-reset but don't require full use of controls module)
1 parent 429165b commit 08e94f5

File tree

3 files changed

+67
-6
lines changed

3 files changed

+67
-6
lines changed

src/site/config.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@use "sass:list";
2-
@use "sass:map";
3-
@use "sass:meta";
1+
@use 'sass:list';
2+
@use 'sass:map';
3+
@use 'sass:meta';
44
////
55
/// @group site.config
66
////

src/site/misc.scss

+60
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,63 @@
6969
@mixin link() {
7070
@include css-map(get('links'));
7171
}
72+
73+
// ----------------------------------------------------------------------------
74+
// Control Resets
75+
// ----------------------------------------------------------------------------
76+
77+
/// Resets the appearance of controls with some opinionated defaults (see source or
78+
/// output for details). Typically used as part of restyling a component.
79+
80+
@function reset-control($overrides: ()) {
81+
@return flat-merge(
82+
(
83+
appearance: none,
84+
box-sizing: border-box,
85+
position: relative,
86+
outline: none,
87+
border: none,
88+
white-space: nowrap,
89+
background-color: transparent,
90+
font-size: get('controls.base.font-size'),
91+
font-family: get('controls.base.font-family'),
92+
font-weight: get('controls.base.font-weight'),
93+
),
94+
$overrides
95+
);
96+
}
97+
98+
@mixin reset-control($overrides: ()) {
99+
@include css-map(reset-control($overrides));
100+
}
101+
102+
/// Resets the style of control much more aggressively than regular control-reset. Really cleans
103+
/// things out!
104+
105+
@function reset-control-hard($overrides: ()) {
106+
@return flat-merge(
107+
(
108+
appearance: none,
109+
display: block,
110+
outline: none,
111+
border: none,
112+
border-radius: 0,
113+
background: none transparent,
114+
padding: 0,
115+
width: auto,
116+
height: auto,
117+
border-spacing: 0,
118+
text-align: left,
119+
text-indent: 0,
120+
line-height: initial,
121+
color: initial,
122+
font-family: initial,
123+
font-size: initial,
124+
),
125+
$overrides
126+
);
127+
}
128+
129+
@mixin reset-control-hard($overrides: ()) {
130+
@include css-map(control-reset-hard($overrides));
131+
}

src/site/variables.scss

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
@use "sass:color";
2-
@use "sass:list";
3-
@use "sass:map";
1+
@use 'sass:color';
2+
@use 'sass:list';
3+
@use 'sass:map';
44
////
55
/// @group site.variables
66
////
@@ -135,6 +135,7 @@
135135
/// ```scss
136136
/// @@use 'variables' as * with (
137137
/// $-config: (
138+
///
138139
/// vars-prefix: 'theme',
139140
/// vars: (
140141
/// page-bg-hsla: white,

0 commit comments

Comments
 (0)