An open API service indexing awesome lists of open source software.

https://github.com/conectate/ct-elements

LitElement Web Components
https://github.com/conectate/ct-elements

conectate-elements javascript-modules lit-element litelement web-components

Last synced: 8 months ago
JSON representation

LitElement Web Components

Awesome Lists containing this project

README

          

# Conectate Elements

> IMPORTANT: The Conectate Elements are a work in progress and subject to major changes.

The Conectate Elements (CT) are a collection of [Web Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components) maintained by [@herberthobregon](https://github.com/herberthobregon) that implement [Material Design](https://material.io/design/).

## Components

| Component | Status | Issues |
| ------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-button) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-button.svg)](https://www.npmjs.com/package/@conectate/ct-button) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-button%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-card) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-card.svg)](https://www.npmjs.com/package/@conectate/ct-card) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-card%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-chartjs) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-chartjs.svg)](https://www.npmjs.com/package/@conectate/ct-chartjs) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-charjs%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-checkbox) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-checkbox.svg)](https://www.npmjs.com/package/@conectate/ct-checkbox) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-checkbox%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-collapse) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-collapse.svg)](https://www.npmjs.com/package/@conectate/ct-collapse) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-collapse%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-date) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-date.svg)](https://www.npmjs.com/package/@conectate/ct-date) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-date%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-dialog) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-dialog.svg)](https://www.npmjs.com/package/@conectate/ct-dialog) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-dialog%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-helpers) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-helpers.svg)](https://www.npmjs.com/package/@conectate/ct-helpers) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-helpers%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-icon) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-icon.svg)](https://www.npmjs.com/package/@conectate/ct-icon) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-icon%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-img) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-img.svg)](https://www.npmjs.com/package/@conectate/ct-img) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-img%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-input) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-input.svg)](https://www.npmjs.com/package/@conectate/ct-input) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-input%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-lit) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-lit.svg)](https://www.npmjs.com/package/@conectate/ct-lit) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-lit%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-loading-bar) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-loading-bar.svg)](https://www.npmjs.com/package/@conectate/ct-loading-bar) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-loading-bar%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-loading-placeholder) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-loading-placeholder.svg)](https://www.npmjs.com/package/@conectate/ct-loading-placeholder) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-loading-placeholder%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-menu) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-menu.svg)](https://www.npmjs.com/package/@conectate/ct-menu) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-menu%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-radio) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-radio.svg)](https://www.npmjs.com/package/@conectate/ct-radio) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-radio%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-router) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-router.svg)](https://www.npmjs.com/package/@conectate/ct-router) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-router%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-scroll-threshold) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-scroll-threshold.svg)](https://www.npmjs.com/package/@conectate/ct-scroll-threshold) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-scroll-threshold%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-select) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-select.svg)](https://www.npmjs.com/package/@conectate/ct-select) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-select%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-spinner) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-spinner.svg)](https://www.npmjs.com/package/@conectate/ct-spinner) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-spinner%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-tabs) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-tabs.svg)](https://www.npmjs.com/package/@conectate/ct-tabs) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-tabs%22) |
| [``](https://github.com/conectate/ct-elements/tree/master/packages/ct-tooltip) | [![Published on npm](https://img.shields.io/npm/v/@conectate/ct-tooltip.svg)](https://www.npmjs.com/package/@conectate/ct-tooltip) | [_Issues_](https://github.com/conectate/ct-elements/issues?q=is%3Aissue+is%3Aopen+label%3A%22Component%3A+ct-tooltip%22) |

## Quick start with `ct-button`

#### 1) Install

Install a component (ct-button for example) from NPM:

```sh
npm i @conectate/ct-button @webcomponents/webcomponentsjs
# or
yarn install @conectate/ct-button @webcomponents/webcomponentsjs
```

#### 2) Write Raw HTML and JavaScript (without frameworks)

Import the component's JavaScript module, use the component in your HTML, and control it with JavaScript, just like you would with a built-in element such as ``:

```html



My Example App






Click Me!



// Importing this module registers <ct-button> as an element that you
// can use in this page.
//
// ====================================================================
// Note this import is a BARE MODULE specifier, so it must be converted
// to a path using a server such as es-dev-server.
// ====================================================================
import '@conectate/ct-button';

// Standard DOM APIs work with Web Components just like they do for
// built-in elements.
const button = document.querySelector('#myButton');
button.addEventListener('click', () => {
alert('You clicked!');
});

```

#### 3) Serve

Serve your HTML with any server or build process that supports **bare module specifier resolution** (see next section):

```sh
npm install -g es-dev-server
es-dev-server --node-resolve
```

## Bare module specifiers

The Conectate Elements are published as standard [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) that use _bare module specifiers_. Bare module specifiers are not yet supported by browsers, so it is necessary to use a tool that transforms
them to a _path_ (for example from `@conectate/ct-button` to `./node_modules/@conectate/ct-button/ct-button.js`).

Two great choices for tools that do this are:

- During local development, use open-wc's [`es-dev-server`](https://open-wc.org/developing/es-dev-server.html) with the `--node-resolve` flag.
- For your production deployment, build your application with [Webpack](http://webpack.js.org/) or [Rollup](https://rollupjs.org/guide/en/) with the [`rollup-plugin-node-resolve`](https://github.com/rollup/rollup-plugin-node-resolve) plugin.

## Fonts

Most applications should include the following tags in their main HTML file to ensure that text and icons
render correctly:

```html

```

The Conectate Elements default to using the [Roboto](https://fonts.google.com/specimen/Roboto) font for text. This fonts are _not_ automatically loaded, so it is the application's responsiblity to ensure that they are loaded.

## Supporting older browsers

The Conectate Elements use modern browser features that are natively supported in the latest versions of Chrome, Safari, Firefox, and Edge. IE11 and some older versions of other browsers are also supported, but they require additional build steps and polyfills.


Feature

Chrome

Safari

Firefox

Edge

IE11


Web Components
Yes
Yes
Yes
Yes
Polyfill *


Modules
Yes
Yes
Yes
Yes
Transform *


ES2015
Yes
Yes
Yes
Yes
Transpile *

#### Web Components

To support Web Components in IE11 and other older browsers, install the [Web Components Polyfills](https://github.com/webcomponents/polyfills/tree/master/packages/webcomponentsjs):

```sh
npm install @webcomponents/webcomponentsjs
```

And include the `webcomponents-loader.js` script in your HTML, which detects when polyfills are needed and loads them automatically:

```html

```

#### Modules

To support IE11 or other older browsers that do not support JavaScript modules, you must transform JavaScript modules to classic JavaScript scripts. [Webpack](http://webpack.js.org/) or [Rollup](https://rollupjs.org/guide/en/) is a popular tool that can consume JavaScript modules and produce a number of other formats, such as AMD.

#### ES2015

If you support IE11 or other older browsers that do not support the latest version of JavaScript, you must _transpile_ your application to ES5. [Babel](https://babeljs.io/) is a popular tool that does this. You can integrate Babel transpilation into a Rollup or Webpack.