@1024pix/pix-ui 15.0.1 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  name: Deploy Pix UI Storybook
2
2
 
3
- on:
4
- workflow_dispatch:
3
+ on:
4
+ workflow_dispatch:
5
5
  push:
6
6
  tags:
7
7
  - '*'
@@ -10,12 +10,13 @@ jobs:
10
10
  deploy:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v2
14
- - uses: actions/setup-node@v1
13
+ - uses: actions/checkout@v3
14
+ - uses: actions/setup-node@v3
15
15
  with:
16
- node-version: 14
16
+ node-version: 16.14.0
17
+ - run: npm i -g npm@8.13.2
17
18
  - run: npm ci
18
19
  - name: Deploy storybook to Github Pages
19
20
  run: npm run deploy-storybook -- --ci
20
21
  env:
21
- GH_TOKEN: 1024pix:${{ secrets.GITHUB_TOKEN }}
22
+ GH_TOKEN: 1024pix:${{ secrets.GITHUB_TOKEN }}
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v16.1.0 (03/08/2022)
4
+
5
+
6
+ ### :rocket: Amélioration
7
+ - [#232](https://github.com/1024pix/pix-ui/pull/232) [FEATURE] Ajout du composant checkbox (PIX-3030)
8
+
9
+ ## v16.0.0 (13/07/2022)
10
+
11
+
12
+ ### :building_construction: Tech
13
+ - [#238](https://github.com/1024pix/pix-ui/pull/238) [TECH] Monter de version fontawesome (PIX-5325)
14
+
15
+ ## v15.0.2 (11/07/2022)
16
+
17
+
18
+ ### :building_construction: Tech
19
+ - [#237](https://github.com/1024pix/pix-ui/pull/237) [TECH] Changer les pré-requis engine du package.json (PIX-5319)
20
+
21
+ ### :bug: Correction
22
+ - [#236](https://github.com/1024pix/pix-ui/pull/236) [BUGFIX] Correction du déploiement de Storybook
23
+
3
24
  ## v15.0.1 (08/07/2022)
4
25
 
5
26
 
@@ -6,7 +6,7 @@
6
6
  {{#if this.isExternalLink}}
7
7
  <a class="pix-banner__action" href={{@actionUrl}} target="_blank" rel="noopener noreferrer">
8
8
  {{@actionLabel}}
9
- <FaIcon class="external-link" @icon="external-link-alt" />
9
+ <FaIcon class="external-link" @icon="up-right-from-square" />
10
10
  </a>
11
11
  {{else}}
12
12
  <LinkTo class="pix-banner__action" @route={{@actionUrl}}>{{@actionLabel}}</LinkTo>
@@ -16,9 +16,9 @@ const types = [
16
16
  ];
17
17
 
18
18
  const icons = {
19
- [TYPE_INFO]: 'info-circle',
20
- [TYPE_ERROR]: 'exclamation-triangle',
21
- [TYPE_WARNING]: 'exclamation-circle',
19
+ [TYPE_INFO]: 'circle-info',
20
+ [TYPE_ERROR]: 'triangle-exclamation',
21
+ [TYPE_WARNING]: 'circle-exclamation',
22
22
  [TYPE_COMMUNICATION]: 'bullhorn',
23
23
  [TYPE_COMMUNICATION_ORGA]: 'bullhorn',
24
24
  [TYPE_COMMUNICATION_CERTIF]: 'bullhorn',
@@ -0,0 +1,14 @@
1
+ <div class="pix-checkbox">
2
+ <label
3
+ class="pix-checkbox__label {{this.labelSizeClass}} {{if @screenReaderOnly 'sr-only'}}"
4
+ for={{this.id}}
5
+ >
6
+ {{this.label}}
7
+ </label>
8
+ <input
9
+ id={{this.id}}
10
+ type="checkbox"
11
+ class="pix-checkbox__input {{if @isIndeterminate ' pix-checkbox__input--indeterminate'}}"
12
+ ...attributes
13
+ />
14
+ </div>
@@ -0,0 +1,30 @@
1
+ import Component from '@glimmer/component';
2
+ import { htmlSafe } from '@ember/string';
3
+
4
+ const labelSizeToClass = new Map([
5
+ ['small', 'pix-checkbox__label--small'],
6
+ ['default', 'pix-checkbox__label--default'],
7
+ ['large', 'pix-checkbox__label--large'],
8
+ ]);
9
+
10
+ export default class PixCheckbox extends Component {
11
+ constructor() {
12
+ super(...arguments);
13
+
14
+ if (!this.args.label) {
15
+ throw new Error('ERROR in PixCheckbox component, you must provide @label params');
16
+ }
17
+ this.label = htmlSafe(this.args.label);
18
+ }
19
+
20
+ get id() {
21
+ if (!this.args.id || !this.args.id.toString().trim()) {
22
+ throw new Error('ERROR in PixCheckbox component, @id param is not provided');
23
+ }
24
+ return this.args.id;
25
+ }
26
+
27
+ get labelSizeClass() {
28
+ return labelSizeToClass.get(this.args.labelSize);
29
+ }
30
+ }
@@ -33,7 +33,7 @@
33
33
  aria-label={{@clearLabel}}
34
34
  {{on "click" this.clearSelection}}
35
35
  >
36
- <FaIcon @icon="times" />
36
+ <FaIcon @icon="xmark" />
37
37
  </button>
38
38
  {{/if}}
39
39
 
@@ -62,7 +62,7 @@
62
62
 
63
63
  {{#if @isSearchable}}
64
64
  <div class="pix-dropdown__menu--search">
65
- <FaIcon class="pix-dropdown__menu--search-icon" @icon="search" />
65
+ <FaIcon class="pix-dropdown__menu--search-icon" @icon="magnifying-glass" />
66
66
  <label
67
67
  class="pix-dropdown__menu--search-input-label"
68
68
  for={{this.searchInputId}}
@@ -23,7 +23,7 @@
23
23
  @size="small"
24
24
  @triggerAction={{@onClearFilters}}
25
25
  >
26
- <FaIcon class="pix-filter-banner-button__icon" @icon="trash-alt" @prefix="far" />
26
+ <FaIcon class="pix-filter-banner-button__icon" @icon="trash-can" @prefix="far" />
27
27
  {{@clearFiltersLabel}}
28
28
  </PixButton>
29
29
  </div>
@@ -42,7 +42,7 @@
42
42
  />
43
43
 
44
44
  {{#if @errorMessage}}
45
- <FaIcon @icon="times" class="pix-input-password__error-icon" />
45
+ <FaIcon @icon="xmark" class="pix-input-password__error-icon" />
46
46
  {{/if}}
47
47
  </div>
48
48
 
@@ -26,7 +26,7 @@
26
26
  />
27
27
 
28
28
  {{#if @errorMessage}}
29
- <FaIcon @icon="times" class="pix-input__error-icon" />
29
+ <FaIcon @icon="xmark" class="pix-input__error-icon" />
30
30
  {{/if}}
31
31
  </div>
32
32
 
@@ -19,11 +19,11 @@ export default class PixMessage extends Component {
19
19
 
20
20
  get iconClass() {
21
21
  const classes = {
22
- [TYPE_INFO]: 'info-circle',
23
- [TYPE_SUCCESS]: 'check-circle',
24
- [TYPE_WARNING]: 'exclamation-circle',
25
- [TYPE_ALERT]: 'exclamation-triangle',
26
- [TYPE_ERROR]: 'exclamation-triangle',
22
+ [TYPE_INFO]: 'circle-info',
23
+ [TYPE_SUCCESS]: 'circle-check',
24
+ [TYPE_WARNING]: 'circle-exclamation',
25
+ [TYPE_ALERT]: 'triangle-exclamation',
26
+ [TYPE_ERROR]: 'triangle-exclamation',
27
27
  };
28
28
  return classes[this.type];
29
29
  }
@@ -10,7 +10,7 @@
10
10
  <header class="pix-modal__header">
11
11
  <h1 id="modal-title" class="pix-modal__title">{{@title}}</h1>
12
12
  <PixIconButton
13
- @icon="times"
13
+ @icon="xmark"
14
14
  @triggerAction={{@onCloseButtonClick}}
15
15
  @ariaLabel="Fermer"
16
16
  @size="small"
@@ -8,7 +8,7 @@
8
8
  <label class="pix-multi-select-header {{if this.isBig 'pix-multi-select-header--big'}}">
9
9
 
10
10
  <span class="pix-multi-select-header__title">{{@title}}</span>
11
- <FaIcon @icon="search" class="pix-multi-select-header__search-icon" />
11
+ <FaIcon @icon="magnifying-glass" class="pix-multi-select-header__search-icon" />
12
12
 
13
13
  <input
14
14
  id={{@id}}
@@ -0,0 +1,77 @@
1
+ .pix-checkbox {
2
+ @import 'reset-css';
3
+ display: flex;
4
+ align-items: center;
5
+ display: flex;
6
+ flex-direction: row-reverse;
7
+
8
+ label, input {
9
+ cursor: pointer;
10
+ }
11
+
12
+ &__label {
13
+ color: $pix-neutral-70;
14
+ @include text;
15
+
16
+ &--small {
17
+ @include text-small;
18
+ }
19
+ &--default {
20
+ @include text;
21
+ }
22
+ &--large {
23
+ @include text-large;
24
+ }
25
+ }
26
+
27
+ &__input {
28
+ appearance: none;
29
+ margin: 0 10px;
30
+ min-width: 18px;
31
+ min-height: 18px;
32
+ border: 1.2px solid $pix-neutral-90;
33
+ border-radius: 2px;
34
+ display: flex;
35
+ justify-content: center;
36
+ align-items: center;
37
+
38
+ &:hover, &:focus {
39
+ box-shadow: inset 0 1px 3px rgba(0,0,0, .1), 0 0 0 6px $pix-neutral-15;
40
+ }
41
+
42
+ &:active {
43
+ box-shadow: inset 0 1px 3px rgba(0,0,0, .1), 0 0 0 6px $pix-neutral-22;
44
+ }
45
+
46
+ &:checked {
47
+ background: $pix-primary border-box;
48
+ border-color: $pix-primary;
49
+
50
+ &::after {
51
+ content: '';
52
+ background-image: url("data:image/svg+xml,%3Csvg width='13' height='10' viewBox='0 0 13 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 3L0 4.5L5 9.5L13 1.5L11.5 0L5 6.5L1.5 3Z' fill='white'/%3E%3C/svg%3E%0A");
53
+ background-repeat: no-repeat;
54
+ background-position: center;
55
+ width: 16px;
56
+ height: 16px;
57
+
58
+ }
59
+ }
60
+
61
+ &.pix-checkbox__input--indeterminate {
62
+ &:checked {
63
+ background: $pix-neutral-60 border-box;
64
+ border-color: $pix-neutral-60;
65
+
66
+ &::after {
67
+ content: '';
68
+ background-image: url("data:image/svg+xml,%3Csvg width='10' height='2' viewBox='0 0 10 2' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='10' height='2' fill='white'/%3E%3C/svg%3E%0A");
69
+ background-repeat: no-repeat;
70
+ background-position: center;
71
+ width: 16px;
72
+ height: 16px;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
@@ -26,6 +26,7 @@
26
26
  @import 'pix-selectable-tag';
27
27
  @import 'pix-dropdown';
28
28
  @import 'pix-pagination';
29
+ @import 'pix-checkbox';
29
30
 
30
31
  html {
31
32
  font-size: 16px;
@@ -0,0 +1 @@
1
+ export { default } from '@1024pix/pix-ui/components/pix-checkbox';
@@ -67,6 +67,10 @@ export const form = (args) => {
67
67
  />
68
68
  <br>
69
69
 
70
+ <PixCheckbox @id="spam-pub" @labelSize="small" @label="Acceptez-vous de vous faire spammer de PUB ?" />
71
+
72
+ <br><br>
73
+
70
74
  <div class="pix-form__actions">
71
75
  <PixButton @triggerAction={{cancel}} @backgroundColor="transparent-light" @isBorderVisible={{true}}>
72
76
  Annuler
@@ -0,0 +1,88 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ export const Template = (args) => {
4
+ return {
5
+ template: hbs`
6
+ <PixCheckbox
7
+ @id={{id}}
8
+ @label={{label}}
9
+ @screenReaderOnly={{screenReaderOnly}}
10
+ @isIndeterminate={{isIndeterminate}}
11
+ @labelSize={{labelSize}}
12
+ />
13
+ `,
14
+ context: args,
15
+ };
16
+ };
17
+
18
+ export const Default = Template.bind({});
19
+ Default.args = {
20
+ id: 'acceptNewsletter',
21
+ label: 'Recevoir la newsletter',
22
+ };
23
+
24
+ export const indeterminateCheckbox = Template.bind({});
25
+ indeterminateCheckbox.args = {
26
+ id: 'acceptNewsletter2',
27
+ label: 'Recevoir la newsletter',
28
+ isIndeterminate: true,
29
+ };
30
+
31
+ export const checkboxWithSmallLabel = Template.bind({});
32
+ checkboxWithSmallLabel.args = {
33
+ id: 'acceptNewsletter2',
34
+ label: 'Recevoir la newsletter',
35
+ labelSize: 'small',
36
+ };
37
+
38
+ export const checkboxWithLargeLabel = Template.bind({});
39
+ checkboxWithLargeLabel.args = {
40
+ id: 'acceptNewsletter2',
41
+ label: 'Recevoir la newsletter',
42
+ labelSize: 'large',
43
+ };
44
+
45
+ export const argTypes = {
46
+ id: {
47
+ name: 'id',
48
+ description: 'Identifiant du champ permettant de lui attacher un label',
49
+ type: { name: 'string', required: true },
50
+ defaultValue: null,
51
+ },
52
+ label: {
53
+ name: 'label',
54
+ description: "Le label de l'input",
55
+ type: { name: 'string', required: false },
56
+ defaultValue: null,
57
+ },
58
+ screenReaderOnly: {
59
+ name: 'screenReaderOnly',
60
+ description:
61
+ "Permet de ne pas afficher le label à l'écran. Sert à garder un label qui sera lisible par les lecteurs d'écran.",
62
+ type: { name: 'boolean', required: true },
63
+ table: {
64
+ type: { summary: 'boolean' },
65
+ defaultValue: { summary: false },
66
+ },
67
+ },
68
+ isIndeterminate: {
69
+ name: 'isIndeterminate',
70
+ description:
71
+ "Rendre la checkbox indéterminée, état indiquant que la/les case(s) n'est/ne sont ni cochée(s) ni décochée(s) (exemple: une checkbox parente indiquant la sélection partielle de plusieurs checkbox enfants)",
72
+ type: { name: 'boolean', required: true },
73
+ table: {
74
+ type: { summary: 'boolean' },
75
+ defaultValue: { summary: false },
76
+ },
77
+ },
78
+ labelSize: {
79
+ name: 'labelSize',
80
+ description: 'Correspond à la taille de la police du label.',
81
+ type: { name: 'string', required: false },
82
+ defaultValue: { summary: 'default' },
83
+ control: {
84
+ type: 'select',
85
+ options: ['small', 'default', 'large'],
86
+ },
87
+ },
88
+ };
@@ -0,0 +1,50 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import centered from '@storybook/addon-centered/ember';
3
+
4
+ import * as stories from './pix-checkbox.stories.js';
5
+
6
+ <Meta
7
+ title='Form/Checkbox'
8
+ component='PixCheckbox'
9
+ decorators={[centered]}
10
+ argTypes={stories.argTypes}
11
+ />
12
+
13
+ # PixCheckbox
14
+
15
+ La PixCheckbox permet de créer des checkbox basiques ou des checkbox mixées (checkbox servant d'indicateur lors d'une sélection multiple).
16
+
17
+ <Canvas>
18
+ <Story name='Default' story={stories.Default} height={60} />
19
+ </Canvas>
20
+
21
+ ## Checkbox indéterminée
22
+ <Canvas>
23
+ <Story name='Indeterminate' story={stories.indeterminateCheckbox} height={60} />
24
+ </Canvas>
25
+
26
+ ## Checkbox avec un petit label
27
+ <Canvas>
28
+ <Story name='SmallLabel' story={stories.checkboxWithSmallLabel} height={60} />
29
+ </Canvas>
30
+
31
+ ## Checkbox avec un grand label
32
+ <Canvas>
33
+ <Story name='LargeLabel' story={stories.checkboxWithLargeLabel} height={60} />
34
+ </Canvas>
35
+
36
+ ## Usage
37
+
38
+ ```html
39
+ <PixCheckbox
40
+ @id="superId"
41
+ @label="Recevoir la newsletter"
42
+ @screenReaderOnly={{false}}
43
+ @isIndeterminate={{false}}
44
+ @labelSize="small"
45
+ />
46
+ ```
47
+
48
+ ## Arguments
49
+
50
+ <ArgsTable story="Default" />
@@ -20,7 +20,7 @@ const Template = (args) => {
20
20
  export const Default = Template.bind({});
21
21
  Default.args = {
22
22
  ariaLabel: 'Action du bouton',
23
- icon: 'times',
23
+ icon: 'xmark',
24
24
  triggerAction: () => {
25
25
  return new Promise().resolves();
26
26
  },
@@ -43,13 +43,12 @@ export const argTypes = {
43
43
  name: 'ariaLabel',
44
44
  description: "l'action du bouton, pour l'accessibilité",
45
45
  type: { name: 'string', required: true },
46
- table: { defaultValue: { summary: 'times' } },
47
46
  },
48
47
  icon: {
49
48
  name: 'icon',
50
49
  description: 'Icône font-awesome',
51
50
  type: { name: 'string', required: true },
52
- table: { defaultValue: { summary: 'times' } },
51
+ table: { defaultValue: { summary: 'plus' } },
53
52
  },
54
53
  iconPrefix: {
55
54
  name: 'iconPrefix',
@@ -81,7 +81,7 @@ Bouton d'action
81
81
  ```html
82
82
  <PixIconButton
83
83
  @ariaLabel="L'action du bouton"
84
- @icon="times"
84
+ @icon="xmark"
85
85
  disabled={{true}}
86
86
  aria-disabled={{true}}
87
87
  />
@@ -38,7 +38,7 @@ const TemplateWithHTMLElement = (args) => {
38
38
  </:triggerElement>
39
39
 
40
40
  <:tooltip>
41
- <FaIcon @icon="external-link-alt" /> <strong>HTML/Ember</strong>
41
+ <FaIcon @icon="up-right-from-square" /> <strong>HTML/Ember</strong>
42
42
  </:tooltip>
43
43
  </PixTooltip>
44
44
  `,
@@ -37,7 +37,7 @@ Si vous utilisez un élément `<div>` ou `<span>`, il faut ajouter `tabindex="0"
37
37
  </PixTooltip>
38
38
  ```
39
39
 
40
- Les tooltips doivent prendre un `@id` et être référencées par leur élément déclencheur
40
+ Les tooltips doivent prendre un `@id` et être référencées par leur élément déclencheur
41
41
 
42
42
  - soit via `aria-describedby` si l'élément possèdent déjà un label, car le tooltip agit alors comme une description supplémentaire.
43
43
 
@@ -131,7 +131,7 @@ Infobulle contenant des éléments HTML
131
131
  <button>Tooltip par défaut</button>
132
132
  </:triggerElement>
133
133
  <:tooltip>
134
- <FaIcon @icon="external-link-alt" /> Avec des <strong>éléments</strong> HTML/Ember
134
+ <FaIcon @icon="up-right-from-square" /> Avec des <strong>éléments</strong> HTML/Ember
135
135
  </:tooltip>
136
136
  </PixTooltip>
137
137
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "15.0.1",
3
+ "version": "16.1.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -9,7 +9,7 @@
9
9
  "author": "GIP Pix",
10
10
  "engines": {
11
11
  "node": "16.14.0",
12
- "npm": "8.13.2"
12
+ "npm": ">=8.3.1 <=8.13.2"
13
13
  },
14
14
  "ember": {
15
15
  "edition": "octane"
@@ -58,8 +58,8 @@
58
58
  "@ember/test-helpers": "^2.6.0",
59
59
  "@formatjs/intl": "^2.1.0",
60
60
  "@fortawesome/ember-fontawesome": "^0.2.3",
61
- "@fortawesome/free-regular-svg-icons": "^5.15.4",
62
- "@fortawesome/free-solid-svg-icons": "^5.15.4",
61
+ "@fortawesome/free-regular-svg-icons": "^6.1.1",
62
+ "@fortawesome/free-solid-svg-icons": "^6.1.1",
63
63
  "@glimmer/component": "^1.0.4",
64
64
  "@glimmer/tracking": "^1.0.4",
65
65
  "@storybook/addon-a11y": "^6.3.7",