Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove bourbon #1883

Merged
merged 12 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"devDependencies": {
"@blueprintjs/karma-build-scripts": "^0.2.0",
"@blueprintjs/node-build-scripts": "^0.2.0",
"bourbon": "^4.3.4",
"enzyme": "~2.9.1",
"karma": "^1.7.1",
"mocha": "^4.0.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,11 @@ Markup:
<pre>
%pt-select {
@include pt-button();
@include prefixer(appearance, none, webkit moz);
border-radius: $pt-border-radius;
height: $pt-button-height;
padding: 0 ($input-padding-horizontal * 3) 0 $input-padding-horizontal;
-moz-appearance: none;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooc, none of our tooling does automatic prefixing by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oof actually no, we don't run autoprefixer on the generated CSS file. one of the things we lost in the (gulp) fire, along with comment stripping.

-webkit-appearance: none;
}
</pre>
<pre><code>export function hasModifier(modifiers: ts.ModifiersArray, ...modifierKinds: ts.SyntaxKind[]) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/common/_font-imports.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "utils/font-face";
@import "variables";

$icon-font-path: "../resources/icons" !default;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/common/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $icon-classes: (

@mixin pt-icon-sized(
$font-size: $pt-icon-size-standard,
$font-family-size: strip-units($font-size)
$font-family-size: strip-unit($font-size)
) {
line-height: 1;
font-family: "Icons#{$font-family-size}", sans-serif;
Expand All @@ -45,7 +45,7 @@ $icon-classes: (

@mixin pt-icon(
$font-size: $pt-icon-size-standard,
$font-family-size: strip-units($font-size)
$font-family-size: strip-unit($font-size)
) {
@include pt-icon-sized($font-size, $font-family-size);
@include pt-icon-font-smoothing();
Expand Down
19 changes: 18 additions & 1 deletion packages/core/src/common/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ $pt-dark-intent-text-colors: (
"danger" : $red5,
) !default;

@mixin position-all($position, $value) {
position: $position;
top: $value;
right: $value;
bottom: $value;
left: $value;
}

@mixin base-typography() {
text-transform: none;
line-height: $pt-line-height;
Expand Down Expand Up @@ -55,7 +63,6 @@ $pt-dark-intent-text-colors: (
}

@mixin overflow-ellipsis() {
// NOTE: not to be confused with Bourbon ellipsis() which sets `display: inline-block` :(
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Expand Down Expand Up @@ -105,3 +112,13 @@ $pt-dark-intent-text-colors: (
@function centered-text($height, $line-height: floor($pt-font-size * $pt-line-height)) {
@return floor(($height - $line-height) / 2);
}

// Removes the unit from a Sass numeric value (if present): `strip-unit(12px) => 12`
// @see https://css-tricks.com/snippets/sass/strip-unit-function/
@function strip-unit($number) {
@if type-of($number) == "number" and not unitless($number) {
@return $number / ($number * 0 + 1);
}

@return $number;
}
3 changes: 0 additions & 3 deletions packages/core/src/common/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
@import "colors";
@import "mixins";

// This line can be removed when we upgrade to Bourbon 5.0
$output-bourbon-deprecation-warnings: false;

// easily the most important variable, so it comes first
// (so other variables can use it to define themselves)
$pt-grid-size: 10px !default;
Expand Down
82 changes: 82 additions & 0 deletions packages/core/src/common/utils/_font-face.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

// these implementations borrowed from Bourbon v5, and modified to fit our use cases.
// changes: removed $asset-pipeline argument, added weight/style params like Bourbon v4.
// https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/library/_font-face.scss
// https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/utilities/_font-source-declaration.scss

// Generates an `@font-face` declaration. You can choose the specific file
// formats you need to output; the mixin supports `eot`, `ttf`, `svg`, `woff2`
// and `woff`.
//
// @argument {string} $font-family
//
// @argument {string} $file-path
//
// @argument {string | list} $file-formats
// List of the font file formats to include.
//
// @argument {string} $weight
//
// @argument {string} $style
//
// @content
// Any additional CSS properties that are included in the `@include`
// directive will be output within the `@font-face` declaration, e.g. you can
// pass in `font-weight`, `font-style` and/or `unicode-range`.
@mixin font-face(
$font-family,
$file-path,
$file-formats,
$font-weight: normal,
$font-style: normal
) {
@font-face {
font-family: $font-family;
font-weight: $font-weight;
font-style: $font-style;

src: font-source-declaration(
$font-family,
$file-path,
$file-formats
);

@content;
}
}

@function font-source-declaration($font-family, $file-path, $file-formats) {
$src: ();

$formats-map: (
eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"),
woff2: "#{$file-path}.woff2" format("woff2"),
woff: "#{$file-path}.woff" format("woff"),
ttf: "#{$file-path}.ttf" format("truetype"),
svg: "#{$file-path}.svg##{$font-family}" format("svg"),
);

@each $key, $values in $formats-map {
@if list-contains($file-formats, $key) {
$file-path: nth($values, 1);
$font-format: nth($values, 2);

$src: append($src, url($file-path) $font-format, comma);
}
}

@return $src;
}

// Returns true if `$list` contains any of `$values`.
@function list-contains($list, $values...) {
@each $value in $values {
@if type-of(index($list, $value)) != "number" {
@return false;
}
}

@return true;
}
1 change: 0 additions & 1 deletion packages/core/src/components/breadcrumbs/_breadcrumbs.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2016 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/icons";
@import "../../common/variables";

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/button/_button-group.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../forms/common";
@import "./common";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/button/_button.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "./common";

Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/components/callout/_callout.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";

/*
Expand Down Expand Up @@ -34,7 +33,9 @@ Styleguide pt-callout

&::before {
@include pt-icon($pt-icon-size-large);
@include position(absolute, $pt-grid-size null null $pt-grid-size);
position: absolute;
top: $pt-grid-size;
left: $pt-grid-size;
color: $pt-icon-color;
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/dialog/_dialog.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/icons";
@import "../../common/mixins";
@import "../../common/react-transition";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2016 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../forms/common";

Expand All @@ -15,7 +14,7 @@

// input styles on the ::before
&::before {
@include position(absolute, (-$pt-border-radius) (-$pt-border-radius));
@include position-all(absolute, -$pt-border-radius);
border-radius: $pt-border-radius;
content: "";
transition: background-color $pt-transition-duration $pt-transition-ease,
Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/components/forms/_common.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/icons";
@import "../../common/variables";
@import "../button/common";
Expand Down Expand Up @@ -225,10 +224,14 @@ $control-group-stack: (
%pt-select {
@include pt-button-base();
@include pt-button();
@include prefixer(appearance, none, webkit moz);
border-radius: $pt-border-radius;
height: $pt-button-height;
padding: 0 ($input-padding-horizontal * 2.5) 0 $input-padding-horizontal;

// stylelint-disable property-no-vendor-prefix
-moz-appearance: none;
-webkit-appearance: none;
// stylelint-enable property-no-vendor-prefix
}

%pt-select-minimal {
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/components/navbar/_navbar.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";

/*
Expand Down Expand Up @@ -57,7 +56,10 @@ $dark-navbar-background-color: $dark-gray5 !default;
}

&.pt-fixed-top {
@include position(fixed, 0 0 null);
position: fixed;
top: 0;
right: 0;
left: 0;
}

.pt-logo {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/overlay/_overlay.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body.pt-overlay-open {

.pt-overlay {
// 0-out all positions so page won't jump when position changes (0s already there)
@include position(static, 0);
@include position-all(static, 0);
z-index: $pt-z-index-overlay;

&:not(.pt-overlay-open) {
Expand Down Expand Up @@ -57,7 +57,7 @@ body.pt-overlay-open {

// fixed position so the backdrop forecefully covers the whole screen
.pt-overlay-backdrop {
@include position(fixed, 0);
@include position-all(fixed, 0);
@include react-transition(
"pt-overlay",
(opacity: 0 1),
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/popover/_common.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../../common/react-transition";

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/progress/_progress-bar.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../progress/common";

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/spinner/_spinner.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../progress/common";
@import "./common";
Expand Down
5 changes: 4 additions & 1 deletion packages/core/src/components/tabs/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ $tab-indicator-width: 3px !default;
pointer-events: none;

.pt-tab-indicator {
@include position(absolute, null 0 0);
position: absolute;
right: 0;
bottom: 0;
left: 0;
background-color: $tab-color-selected;
height: $tab-indicator-width;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/core/src/components/toast/_toast.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2016 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../../common/react-transition";

Expand Down Expand Up @@ -147,7 +146,10 @@ $toast-margin: $pt-grid-size * 2 !default;
}

.pt-toast-container {
@include position(fixed, null 0 null);
position: fixed;
right: 0;
left: 0;

// #975 ensure toasts are on top of everything (esp dialogs)
z-index: $pt-z-index-overlay * 2;
// toasts have margin-top so omit it on container
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/components/tooltip/_tooltip.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.

@import "~bourbon/app/assets/stylesheets/bourbon";
@import "../../common/variables";
@import "../popover/common";
@import "./common";
Expand Down
1 change: 0 additions & 1 deletion packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"devDependencies": {
"@blueprintjs/karma-build-scripts": "^0.2.0",
"@blueprintjs/node-build-scripts": "^0.2.0",
"bourbon": "^4.3.4",
"enzyme": "~2.9.1",
"karma": "^1.7.1",
"mocha": "^4.0.1",
Expand Down
Loading