Giter Site home page Giter Site logo

subbarajug / calcite-components Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esri/calcite-design-system

0.0 0.0 0.0 22.46 MB

Web Components for the Calcite Design System. Built with Stencil JS. Currently in Beta!

Home Page: https://esri.github.io/calcite-components/

License: Other

CSS 0.05% TypeScript 45.83% HTML 45.05% Shell 0.06% JavaScript 0.31% SCSS 8.69%

calcite-components's Introduction

Built With Stencil npm

Calcite Components

Shared Web Components for Esri's Calcite design framework. To see the components in action, view the documentation.

Sketch library

All of the Calcite Components are available in the calcite-sketch-library with all variations and sizes.

Installation

npm install --save @esri/calcite-components

Script tag

Calcite components can be loaded via two <script> tags in the head of your HTML document:

<script type="module" src="https://unpkg.com/@esri/calcite-components/dist/calcite/calcite.esm.js"></script>
<script nomodule="" src="https://unpkg.com/@esri/calcite-components/dist/calcite/calcite.js"></script>

Browsers that support modules will load the first, while older browsers will load the second, bundled version.

Once these script tags are added, components can be used just like any other HTML element. Only components that are actually used will be loaded.

Styles

You will also need to explicitly load the calcite.css file:

<link rel="stylesheet" type="text/css" href="https://unpkg.com/@esri/calcite-components/dist/calcite/calcite.css" />

Webpack

If you already have a webpack build for your project, you can use @stencil/webpack to add calcite-components to your bundle.

After installing calcite-components, install the plugin as a dev dependency:

npm install --save-dev @stencil/webpack

Then import and call the plugin in webpack.config.js:

const stencil = require('@stencil/webpack');
module.exports = {
  ...
  plugins: [
    new stencil.StencilPlugin()
  ]
}

Lastly, add the import in your main bundle js (or ts) file:

import "@esri/calcite-components/dist/calcite.js";

This will add the initial stencil loader to your bundle, and copy over the actual component code to the output directory you've configured for Webpack. Components will still be lazy-loaded as they are needed. Note: you must use the .js file path for the Webpack plugin to work correctly, even if your bundle file is a TypeScript file.

TypeScript

Stencil provides a full set of typings for all the components in this repo. To make TypeScript aware of these components, just import the library:

import "@esri/calcite-components";

This will provide autocomplete of component names/properties, as well as additional HTML element types:

// created elements will implicitly have the correct type already
const loader = document.createElement("calcite-loader");
document.body.appendChild(loader);
loader.isActive = true;

// you can also explicitly type an element using the generated types
// the type name will always be formatted like HTML{CamelCaseComponentName}Element
const loader = document.querySelector(".my-loader-element") as HTMLCalciteLoaderElement;
loader.isActive = true;

TypeScript with Preact

For preact applications using TypeScript, you must add an additional file to your tsconfig.json:

"files": [
  "node_modules/@esri/calcite-components/dist/types/preact.d.ts"
],

This allows you to use custom tags and provides auto-complete for calcite-components. See the Preact + TypeScript example for more details.

Browser Support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
IE11, Edge last 2 versions last 2 versions last 2 versions

Contributing

We welcome contributions to this project. See CONTRIBUTING.md for an overview of contribution guidelines.

License

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]

calcite-components's People

Contributors

macandcheese avatar paulcpederson avatar driskull avatar eriklharper avatar jcfranco avatar patrickarlt avatar asangma avatar kstinson14 avatar kumargayu avatar pr3tori4n avatar kat10140 avatar ffaubry avatar vcolavin avatar jgibson02 avatar crowjonah avatar cosbyr avatar tomwayson avatar dependabot[bot] avatar gpbmike avatar drewdaemon avatar oknoway avatar

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.