1.0.0-rc.45 • Published 1 year ago

@mozaic-ds/mozaic-web-components v1.0.0-rc.45

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

This project contains a collection of Svelte and Web Component that implements the Mozaic Design System guidelines.

Getting Started

All the available components are showcased in our Storybook.

To install mozaic-web-components in your project, you will need to run the following command using npm:

npm install --save @mozaic-ds/mozaic-web-components

If you prefer Yarn, use the following command instead:

yarn add @mozaic-ds/mozaic-web-components

Usage

Our library is available in a Svelte and in a Web Component version.

1 - Svelte

Import the Button component:

import Button from '@mozaic-ds/mozaic-web-components/public/components/button/Button.svelte';
// import Mozaic icons as web component
import '@mozaic-ds/mozaic-web-components/public/icons.js';

To avoid declaring the Svelte components as Web Component, you need to change a little your rollup.config.js file.

svelte({
    include: 'node_modules/@mozaic-ds/mozaic-web-components/public/components/**/*.svelte',
	preprocess: [
		postcss({
			syntax: scssSyntax,
			plugins: pluginList,
		}),
		autoPreprocess(),
	],
	compilerOptions: {
		customElement: false /* Important to set it to false value */
	}
}),
svelte({
	include: 'src/**/*.svelte',
	preprocess: [
		postcss({
			syntax: scssSyntax,
			plugins: pluginList,
		}),
		autoPreprocess(),
	]
})

NB:

  • If your project uses TypeScript, you have any TS error, you can externalize your configuration in svelte-xxx.config.js thanks to the configFile property.
  • check the PostCSS installation

2 - Web Components

Import component gloabally:

// load the full library
import '@mozaic-ds/mozaic-web-components/public/bundle.js';
// import Mozaic icons as web component
import '@mozaic-ds/mozaic-web-components/public/icons.js';

Import component individually:

If you do not want to use all the components of the library, but only some of them, you can proceed as follows:

// In the entry point file of your application - usually src/main.js

import Button from '@mozaic-ds/mozaic-web-components/public/components/button/Button.js';
if (!customElements.get('m-button')) {
  customElements.define('m-button', Button);  
}
// For icons
import ArrowArrowRight16 from '@mozaic-ds/mozaic-web-components/public/icons/ArrowArrowRight16.js';

if (!customElements.get('navigation-arrow-arrow--right-16px')) {
  customElements.define(
    'navigation-arrow-arrow--right-16px',
    ArrowArrowRight16
  )
}

Once you've imported the component, you can use our components in the same manner as native HTML tags, for example:

   <m-ratings size="s" value="3" suffixlabel="7 reviews" a11ylabel="Global score: 4/5"></m-ratings>
   <m-button label="Label" size="m"></m-button>

Adeo Preset

In order to use Mozaic web components with Adeo preset, you have to import a specific path:

import '@mozaic-ds/mozaic-web-components/public/adeo/...';

NOTE: This is for global or individual imports

Project setup

npm install
npm ci
npm run build:icons

Compiles and hot-reloads for development

npm run start

Contributing

We're always looking for contributors to help us fix bugs, build features, or help us improve the documentation. If you're intersted chec out our Contribution Guide.

1.0.0-rc.42

1 year ago

1.0.0-rc.41

1 year ago

1.0.0-rc.40

1 year ago

1.0.0-rc.45

1 year ago

1.0.0-rc.44

1 year ago

1.0.0-rc.43

1 year ago

1.0.0-beta.14

1 year ago

1.0.0

1 year ago

1.0.0-rc.39

1 year ago

1.0.0-rc.38

1 year ago

1.0.0-rc-33

1 year ago

1.0.0-beta.13

1 year ago

1.0.0-rc.35

1 year ago

1.0.0-rc.34

1 year ago

1.0.0-rc.37

1 year ago

1.0.0-rc.36

1 year ago

1.0.0-rc-29

1 year ago

1.0.0-rc-28

1 year ago

1.0.0-rc-32

1 year ago

1.0.0-rc-31

1 year ago

1.0.0-rc-30

1 year ago

1.0.0-rc-25

2 years ago

1.0.0-rc-24

2 years ago

1.0.0-rc-23

2 years ago

1.0.0-rc-27

2 years ago

1.0.0-rc-26

2 years ago

1.0.0-beta.11

2 years ago

1.0.0-beta.12

2 years ago

1.0.0-beta.10

2 years ago

1.0.0-rc21

2 years ago

1.0.0-rc22

2 years ago

1.0.0-beta.7

2 years ago

1.0.0-beta.8

2 years ago

1.0.0-beta.9

2 years ago

1.0.0-rc19

2 years ago

1.0.0-beta.2

2 years ago

1.0.0-beta.3

2 years ago

1.0.0-beta.4

2 years ago

1.0.0-beta.5

2 years ago

1.0.0-beta.0

2 years ago

1.0.0-beta.1

2 years ago

1.0.0-rc20

2 years ago

1.0.0-beta.6

2 years ago

1.0.0-rc18

2 years ago

1.0.0-rc16

2 years ago

1.0.0-rc17

2 years ago

1.0.0-rc14

2 years ago

1.0.0-rc15

2 years ago

1.0.0-rc12

2 years ago

1.0.0-rc13

2 years ago

1.0.0-rc11

2 years ago

1.0.0-rc7

2 years ago

1.0.0-rc8

2 years ago

1.0.0-rc9

2 years ago

1.0.0-rc10

2 years ago

1.0.0-rc5

2 years ago

1.0.0-rc6

2 years ago

1.0.0-rc4

2 years ago

1.0.0-rc3

2 years ago

0.0.2-beta.9

2 years ago

1.0.0-rc1

2 years ago

0.0.2-beta.7

2 years ago

1.0.0-rc2

2 years ago

0.0.2-beta.8

2 years ago

0.0.2-beta.6

2 years ago

0.0.2-alpha.0

3 years ago

0.0.2-beta.5

3 years ago

0.0.2-beta.4

3 years ago

0.0.2-beta.3

3 years ago

0.0.2-beta.2

3 years ago

0.0.2-beta.1

3 years ago

0.0.2-beta.0

3 years ago

0.0.1-alpha.0

3 years ago