Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit b391c68

Browse files
committed
build(select): handle sharing input variables between input and select
- update `buildModuleStyles()` to support building separate module styles - update `config.scssBaseFiles` to support building the single styles file - add underscore in front of Sass partial file names
1 parent 9fc2f3f commit b391c68

File tree

9 files changed

+48
-40
lines changed

9 files changed

+48
-40
lines changed

gulp/config.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,35 @@ module.exports = {
8585
'src/components/virtualRepeat',
8686
'src/components/whiteframe'
8787
],
88+
inputVariables: 'src/components/input/_input-variables.scss',
8889
mockFiles: [
8990
'test/angular-material-mocks.js'
9091
],
9192
themeBaseFiles: [
92-
'src/core/style/variables.scss',
93-
'src/core/style/mixins.scss'
93+
'src/core/style/_variables.scss',
94+
'src/core/style/_mixins.scss'
9495
],
9596
themeCore: 'src/core/style/core-theme.scss',
9697
scssBaseFiles: [
9798
'src/core/style/color-palette.scss',
98-
'src/core/style/variables.scss',
99-
'src/core/style/mixins.scss',
99+
'src/core/style/_variables.scss',
100+
'src/components/input/_input-variables.scss',
101+
'src/core/style/_mixins.scss',
100102
'src/core/style/structure.scss',
101103
'src/core/style/typography.scss',
102104
'src/core/style/layout.scss',
103105
'src/components/panel/*.scss'
104106
],
105107
scssServicesLayout: 'src/core/services/layout/layout.scss',
106108
scssLayoutFiles: [
107-
'src/core/style/variables.scss',
108-
'src/core/style/mixins.scss',
109+
'src/core/style/_variables.scss',
110+
'src/core/style/_mixins.scss',
109111
'src/core/style/layout.scss',
110112
'src/core/services/layout/layout.scss'
111113
],
112114
scssLayoutAttributeFiles: [
113-
'src/core/style/variables.scss',
114-
'src/core/style/mixins.scss',
115+
'src/core/style/_variables.scss',
116+
'src/core/style/_mixins.scss',
115117
'src/core/services/layout/layout-attributes.scss'
116118
],
117119
scssComponentPaths: [

gulp/util.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function buildModule(module, opts) {
174174
}
175175

176176
/**
177-
* @param {string} name module name
177+
* @param {string} name module name. I.e. 'select', 'dialog', etc.
178178
* @returns {*}
179179
*/
180180
function buildModuleStyles(name) {
@@ -183,6 +183,13 @@ function buildModule(module, opts) {
183183
files = files.concat(glob(fileGlob, {cwd: ROOT}));
184184
});
185185

186+
// Handle md-input and md-input-container variables that need to be shared with md-select
187+
// in order to orchestrate identical layouts and alignments. In the future, it may be necessary
188+
// to also use these variables with md-datepicker and md-autocomplete.
189+
if (name === 'input' || name === 'select') {
190+
files = files.concat(glob(config.inputVariables, {cwd: ROOT}));
191+
}
192+
186193
const baseStyles = files.map(function(fileName) {
187194
return fs.readFileSync(fileName, 'utf8').toString();
188195
}).join('\n');

src/components/bottomSheet/bottom-sheet.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ md-bottom-sheet {
132132
@include grid-items-per-row(7);
133133
}
134134

135-
// Override of the IE11 fix from @mixin ie11-min-height-flexbug, line 109 mixins.scss
135+
// Override of the IE11 fix from @mixin ie11-min-height-flexbug, line 109 _mixins.scss
136136
&::before {
137137
display: none;
138138
}

src/components/checkbox/checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//$checkbox-border-radius: 2px !default;
44
//$checkbox-border-width: 2px !default;
55
//
6-
// ^^ defined in variables.scss
6+
// ^^ defined in _variables.scss
77
//
88
$checkbox-margin: 16px !default;
99
$checkbox-text-margin: 10px !default;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
$input-container-padding: 2px !default;
2+
3+
$input-label-default-offset: 24px !default;
4+
$input-label-default-scale: 1.0 !default;
5+
$input-label-float-offset: 6px !default;
6+
$input-label-float-scale: 0.75 !default;
7+
$input-label-float-width: $input-container-padding + 16px !default;
8+
9+
$input-placeholder-offset: $input-label-default-offset !default;
10+
11+
$input-border-width-default: 1px !default;
12+
$input-border-width-focused: 2px !default;
13+
$input-line-height: 26px !default;
14+
$input-padding-top: 2px !default;
15+
16+
$input-error-font-size: 12px !default;
17+
$input-error-height: 24px !default;
18+
$input-error-line-height: $input-error-font-size + 2px !default;
19+
$error-padding-top: ($input-error-height - $input-error-line-height) / 2 !default;
20+
21+
$icon-offset: 36px !default;
22+
23+
$icon-top-offset: ($icon-offset - $input-padding-top - $input-border-width-focused) / 4 !default;
24+
25+
$icon-float-focused-top: -8px !default;
26+
27+
$input-resize-handle-height: 10px !default;

src/components/input/input.scss

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,3 @@
1-
$input-container-padding: 2px !default;
2-
3-
$input-label-default-offset: 24px !default;
4-
$input-label-default-scale: 1.0 !default;
5-
$input-label-float-offset: 6px !default;
6-
$input-label-float-scale: 0.75 !default;
7-
$input-label-float-width: $input-container-padding + 16px !default;
8-
9-
$input-placeholder-offset: $input-label-default-offset !default;
10-
11-
$input-border-width-default: 1px !default;
12-
$input-border-width-focused: 2px !default;
13-
$input-line-height: 26px !default;
14-
$input-padding-top: 2px !default;
15-
16-
$input-error-font-size: 12px !default;
17-
$input-error-height: 24px !default;
18-
$input-error-line-height: $input-error-font-size + 2px !default;
19-
$error-padding-top: ($input-error-height - $input-error-line-height) / 2 !default;
20-
21-
$icon-offset: 36px !default;
22-
23-
$icon-top-offset: ($icon-offset - $input-padding-top - $input-border-width-focused) / 4 !default;
24-
25-
$icon-float-focused-top: -8px !default;
26-
27-
$input-resize-handle-height: 10px !default;
28-
291
md-input-container {
302
@include pie-clearfix();
313
display: inline-block;
File renamed without changes.
File renamed without changes.

src/core/util/constant.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function MdConstantFactory() {
113113
},
114114

115115
/**
116-
* As defined in core/style/variables.scss
116+
* As defined in core/style/_variables.scss
117117
*
118118
* $layout-breakpoint-xs: 600px !default;
119119
* $layout-breakpoint-sm: 960px !default;

0 commit comments

Comments
 (0)