bcgov / design-system-web-components

Web components used for design system
Apache License 2.0
5 stars 2 forks source link
bcgov design-system javascript menu-navigation stenciljs web-components wordpress

img

BCGov Design System Web Components

Install

npm i git+https://github.com/bcgov/design-system-web-components.git

Use with module bundler (Webpack, React, Angular)

Use with CSS

-index.js file

import "core-js/stable"; // makes it ie11 compatible, needs to be first item.
.....
import "@bcgov/web-components/html/dist/bcgov-web-components/bcgov-web-components.css";
import { applyPolyfills, defineCustomElements } from "@bcgov/web-components/html/dist/loader";

applyPolyfills().then(() => {
  defineCustomElements(window);
});

Use with SCSS

index.js file

import "core-js/stable"; // makes it ie11 compatible, needs to be first item.
.....
import "@bcgov/web-components/src/components/sass/style.scss";
import { applyPolyfills, defineCustomElements } from "@bcgov/web-components/html/dist/loader";

applyPolyfills().then(() => {
  defineCustomElements(window);
});

Making IE11 compatable.

npm npm i corejs

package.json file

  "browserslist": [
    "> 1.5%",
    "ie >= 11",
    "edge >= 17"
  ],
  "babel": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "useBuiltIns": "usage",
          "corejs": "3.0.0",
          "targets": {
            "esmodules": true,
            "ie": "11"
          }
        }
      ]
    ]
  }

Description

The BCGov Web components was created to give a standard look and feel to meet the criteria of the Design System
Here is how it does it:

Accessibility

All components should meet or exceed WCAG 2.0 AA standards Although this is the intention, this is very much a work in progress.

Components

Development

Builds are known to work with node v15.14.0 and npm v7.7.6.

Tip: npm --no-save install with npm7 will prevent unnecessary package-lock.json changes from needing to be committed back to the repository; not forcing an upgrade for others with npm6.