Git Product home page Git Product logo

calcite-base's Introduction

Calcite Base

The calcite-base repository holds the variables and mixins used in Calcite Components. This includes resources regarding:

  • motion (easing functions, transitions)
  • type (font stacks, sizing, spacing mixins)
  • reponsive design (breakpoints, respond-to mixins)
  • utilities (clearfix, show/hide, etc)
  • shadow (defined levels of depth)
  • spacing (standardized vertical/horizontal spacing units)

Install

If you use npm, installation is as easy as:

npm install @esri/calcite-base

You can also download the latest release manually.

Use

In a Sass project, simply import calcite-base into your project and use the variables/mixins:

@import "./node_modules/@esri/calcite-base/dist/_index.scss";

.myClass {
  @include font-size(-1);
}

If you only require certain mixins, you can import each section directly as well:

@import "./node_modules/@esri/calcite-base/dist/_type.scss";

.myClass {
  @include avenir-light();
  @include font-size(-1);
  @include leading(2);
  @include tracking(166);
  @include word-spacing(200);
}

Custom Properties

If you are using PostCSS (or standard CSS) there are a series of files which declare the variables utilizing custom properties (CSS Variables). You can use these along with something like the postcss-custom-properties library to utilize the base colors, styles, etc in your postcss project:

@import "./node_modules/@esri/calcite-base/dist/variables.css";

.myClass {
  box-shadow: var(--shadow-1);
}

Focus State Styling

The included focus state styling mixins rely on a --calcite-ui-blue-1 variable from calcite-colors. You can find the Calcite Colors repository on GitHub.

JavaScript

If you need some of these values and are using a CSS-in-JS approach, you can import them from the JavaScript file using ES6 modules:

import {avenirLight} from "@esri/calcite-base";
console.log(avenirLight); // '"Avenir Next", "Avenir", "Helvetica Neue", sans-serif'

Note when using partial imports like this, the hyphenated variables become camel case.

Licensing

COPYRIGHT © 2020 Esri

All rights reserved under the copyright laws of the United States and applicable international laws, treaties, and conventions.

This material is licensed for use under the Esri Master License Agreement (MLA), and is bound by the terms of that agreement. You may redistribute and use this code without modification, provided you adhere to the terms of the MLA and include this copyright notice.

See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english

For additional information, contact: Environmental Systems Research Institute, Inc. Attn: Contracts and Legal Services Department 380 New York Street Redlands, California, USA 92373 USA

email: [email protected]

Contributing

Please read the contribute document.

calcite-base's People

Contributors

kstinson14 avatar macandcheese avatar paulcpederson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calcite-base's Issues

Refactor: Migrate Sass to be 2.0.0-friendly

Description

The latest dependency bump led to the following build warnings:

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

We should migrate our style files to be Sass 2.0.0 ready. The following are some changes that will be needed:

  • use math.div instead of /
  • use @use (and @forward) instead of @import

Proposed Advantages

Prevent moving to the latest dependencies when they move to Sass 2.0.0.

Relevant Info

Sass provides a migrating tool to help with this: https://sass-lang.com/documentation/cli/migrator

Dependencies that use Sass will likely also need to be updated (e.g., calcite-base).

Add directional shadow variables

As discussed, there's value in "directional shadows" for elements affixed to the edges of pages. For example, alerts and modals docked to the bottom on mobile, sidebar/menus affixed to the left, etc.

With the example of $shadow-2:

$shadow-2: 0 0 16px 0 rgba(0, 0, 0, 0.15) !default;

$shadow-2-top: 0 -8px 16px 0 rgba(0, 0, 0, 0.15) !default;
$shadow-2-bottom: 0 8px 16px 0 rgba(0, 0, 0, 0.15) !default;
$shadow-2-left: -8px 0 16px 0 rgba(0, 0, 0, 0.15) !default;
$shadow-2-right: 8px 0 16px 0 rgba(0, 0, 0, 0.15) !default;

Open to options for the directional value, just used 1/2 the spread in this case.

fix sass Deprecation Warning message

Using sass 1.54.9 in arcgis-components

sass --style=compressed styles:dist

Deprecation Warning: Using / for division outside of calc() is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($body-size, 16) or calc($body-size / 16)

More info and automated migrator: https://sass-lang.com/d/slash-div

169 │ $unit: $body-size/16;

node_modules\@esri\calcite-base\dist\_type.scss 169:12  modular-scale()
node_modules\@esri\calcite-base\dist\_type.scss 185:14  font-size()
styles\_utils\_tooltip.scss 15:5                        tooltip()
styles\Badges\Badge.scss 20:5                           @import
styles\Badges\Authoritative.scss 1:9                    root stylesheet

Abstracting color nomenclature

Discussions around future proofing and theming led to the need of reducing things like "red" and "blue" to more abstract ideas like "destructive" and "primary"

~

[changing existing things] --> [to these things]

~

calcite-ui-blue --> calcite-ui-blue-1
calcite-ui-blue-hover --> calcite-ui-blue-2
calcite-ui-blue-press --> calcite-ui-blue-3
calcite-ui-green --> calcite-ui-green-1
calcite-ui-green-hover --> calcite-ui-green-2
calcite-ui-green-press --> calcite-ui-green-3
calcite-ui-yellow --> calcite-ui-yellow-1
calcite-ui-yellow-hover --> calcite-ui-yellow-2
calcite-ui-yellow-press --> calcite-ui-yellow-3
calcite-ui-red --> calcite-ui-red-1
calcite-ui-red-hover --> calcite-ui-red-2
calcite-ui-red-press --> calcite-ui-red-3
calcite-ui-background --> no change
calcite-ui-foreground --> calcite-ui-foreground-1
calcite-ui-foreground-hover --> calcite-ui-foreground-2
calcite-ui-foreground-press --> calcite-ui-foreground-3
calcite-ui-text-1 --> no change
calcite-ui-text-2 --> no change
calcite-ui-text-3 --> no change
calcite-ui-border-1 --> no change
calcite-ui-border-2 --> no change
calcite-ui-border-3 --> no change
calcite-ui-border-hover --> calcite-ui-border-4
calcite-ui-border-press --> calcite-ui-border-5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.