@1024pix/pix-ui 11.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.
Files changed (196) hide show
  1. package/.buildpacks +2 -0
  2. package/.circleci/config.yml +22 -0
  3. package/.gitattributes +7 -0
  4. package/.github/workflows/auto-merge.yml +26 -0
  5. package/.github/workflows/deploy-storybook.yml +21 -0
  6. package/.github/workflows/npm-publish.yml +23 -0
  7. package/.github/workflows/on-dev-merge.yml +33 -0
  8. package/.nvmrc +1 -0
  9. package/.prettierignore +1 -0
  10. package/.prettierrc.json +12 -0
  11. package/.storybook/fonts.css +1 -0
  12. package/.storybook/main.js +10 -0
  13. package/.storybook/manager.js +6 -0
  14. package/.storybook/preview.js +37 -0
  15. package/.storybook/storybook-custom-theme.js +37 -0
  16. package/CHANGELOG.md +469 -0
  17. package/CNAME +1 -0
  18. package/LICENSE.md +9 -0
  19. package/README.md +58 -0
  20. package/addon/components/pix-background-header.hbs +7 -0
  21. package/addon/components/pix-background-header.js +5 -0
  22. package/addon/components/pix-banner.hbs +16 -0
  23. package/addon/components/pix-banner.js +43 -0
  24. package/addon/components/pix-block.hbs +5 -0
  25. package/addon/components/pix-block.js +11 -0
  26. package/addon/components/pix-button-base.js +27 -0
  27. package/addon/components/pix-button-link.hbs +16 -0
  28. package/addon/components/pix-button-link.js +10 -0
  29. package/addon/components/pix-button-upload.hbs +11 -0
  30. package/addon/components/pix-button-upload.js +20 -0
  31. package/addon/components/pix-button.hbs +43 -0
  32. package/addon/components/pix-button.js +54 -0
  33. package/addon/components/pix-collapsible.hbs +29 -0
  34. package/addon/components/pix-collapsible.js +27 -0
  35. package/addon/components/pix-filter-banner.hbs +28 -0
  36. package/addon/components/pix-filter-banner.js +13 -0
  37. package/addon/components/pix-icon-button.hbs +11 -0
  38. package/addon/components/pix-icon-button.js +33 -0
  39. package/addon/components/pix-input-code.hbs +24 -0
  40. package/addon/components/pix-input-code.js +133 -0
  41. package/addon/components/pix-input-password.hbs +43 -0
  42. package/addon/components/pix-input-password.js +34 -0
  43. package/addon/components/pix-input.hbs +30 -0
  44. package/addon/components/pix-input.js +26 -0
  45. package/addon/components/pix-message.hbs +8 -0
  46. package/addon/components/pix-message.js +30 -0
  47. package/addon/components/pix-multi-select.hbs +70 -0
  48. package/addon/components/pix-multi-select.js +162 -0
  49. package/addon/components/pix-progress-gauge.hbs +19 -0
  50. package/addon/components/pix-progress-gauge.js +29 -0
  51. package/addon/components/pix-radio-button.hbs +12 -0
  52. package/addon/components/pix-radio-button.js +5 -0
  53. package/addon/components/pix-return-to.hbs +15 -0
  54. package/addon/components/pix-return-to.js +20 -0
  55. package/addon/components/pix-select.hbs +55 -0
  56. package/addon/components/pix-select.js +58 -0
  57. package/addon/components/pix-selectable-tag.hbs +10 -0
  58. package/addon/components/pix-selectable-tag.js +13 -0
  59. package/addon/components/pix-stars.hbs +16 -0
  60. package/addon/components/pix-stars.js +27 -0
  61. package/addon/components/pix-tag.hbs +3 -0
  62. package/addon/components/pix-tag.js +11 -0
  63. package/addon/components/pix-textarea.hbs +21 -0
  64. package/addon/components/pix-textarea.js +17 -0
  65. package/addon/components/pix-tooltip-deprecated.hbs +18 -0
  66. package/addon/components/pix-tooltip-deprecated.js +26 -0
  67. package/addon/components/pix-tooltip.hbs +18 -0
  68. package/addon/components/pix-tooltip.js +17 -0
  69. package/addon/styles/_breakpoints.scss +17 -0
  70. package/addon/styles/_colors.scss +87 -0
  71. package/addon/styles/_fonts.scss +10 -0
  72. package/addon/styles/_form.scss +68 -0
  73. package/addon/styles/_pix-background-header.scss +20 -0
  74. package/addon/styles/_pix-banner.scss +67 -0
  75. package/addon/styles/_pix-block.scss +29 -0
  76. package/addon/styles/_pix-button-base.scss +137 -0
  77. package/addon/styles/_pix-button-link.scss +4 -0
  78. package/addon/styles/_pix-button-upload.scss +5 -0
  79. package/addon/styles/_pix-button.scss +40 -0
  80. package/addon/styles/_pix-collapsible.scss +82 -0
  81. package/addon/styles/_pix-filter-banner.scss +74 -0
  82. package/addon/styles/_pix-icon-button.scss +60 -0
  83. package/addon/styles/_pix-input-code.scss +71 -0
  84. package/addon/styles/_pix-input-password.scss +68 -0
  85. package/addon/styles/_pix-input.scss +93 -0
  86. package/addon/styles/_pix-message.scss +35 -0
  87. package/addon/styles/_pix-multi-select.scss +182 -0
  88. package/addon/styles/_pix-progress-gauge.scss +119 -0
  89. package/addon/styles/_pix-radio-button.scss +72 -0
  90. package/addon/styles/_pix-return-to.scss +64 -0
  91. package/addon/styles/_pix-select.scss +71 -0
  92. package/addon/styles/_pix-selectable-tag.scss +86 -0
  93. package/addon/styles/_pix-stars.scss +43 -0
  94. package/addon/styles/_pix-tag.scss +69 -0
  95. package/addon/styles/_pix-textarea.scss +39 -0
  96. package/addon/styles/_pix-tooltip.scss +196 -0
  97. package/addon/styles/_reset-css.scss +36 -0
  98. package/addon/styles/_spacing.scss +9 -0
  99. package/addon/styles/addon.scss +41 -0
  100. package/app/components/pix-background-header.js +1 -0
  101. package/app/components/pix-banner.js +1 -0
  102. package/app/components/pix-block.js +1 -0
  103. package/app/components/pix-button-link.js +1 -0
  104. package/app/components/pix-button-upload.js +1 -0
  105. package/app/components/pix-button.js +1 -0
  106. package/app/components/pix-collapsible.js +1 -0
  107. package/app/components/pix-filter-banner.js +1 -0
  108. package/app/components/pix-icon-button.js +1 -0
  109. package/app/components/pix-input-code.js +1 -0
  110. package/app/components/pix-input-password.js +1 -0
  111. package/app/components/pix-input.js +1 -0
  112. package/app/components/pix-message.js +1 -0
  113. package/app/components/pix-multi-select.js +1 -0
  114. package/app/components/pix-progress-gauge.js +1 -0
  115. package/app/components/pix-radio-button.js +1 -0
  116. package/app/components/pix-return-to.js +1 -0
  117. package/app/components/pix-select.js +1 -0
  118. package/app/components/pix-selectable-tag.js +1 -0
  119. package/app/components/pix-stars.js +1 -0
  120. package/app/components/pix-tag.js +1 -0
  121. package/app/components/pix-textarea.js +1 -0
  122. package/app/components/pix-tooltip-deprecated.js +1 -0
  123. package/app/components/pix-tooltip.js +1 -0
  124. package/app/stories/form.stories.js +91 -0
  125. package/app/stories/form.stories.mdx +16 -0
  126. package/app/stories/pix-background-header.stories.js +19 -0
  127. package/app/stories/pix-background-header.stories.mdx +36 -0
  128. package/app/stories/pix-banner.stories.js +89 -0
  129. package/app/stories/pix-banner.stories.mdx +107 -0
  130. package/app/stories/pix-block.stories.js +20 -0
  131. package/app/stories/pix-block.stories.mdx +44 -0
  132. package/app/stories/pix-button-link.stories.js +125 -0
  133. package/app/stories/pix-button-link.stories.mdx +57 -0
  134. package/app/stories/pix-button-upload.stories.js +85 -0
  135. package/app/stories/pix-button-upload.stories.mdx +39 -0
  136. package/app/stories/pix-button.stories.js +253 -0
  137. package/app/stories/pix-button.stories.mdx +99 -0
  138. package/app/stories/pix-collapsible.stories.js +56 -0
  139. package/app/stories/pix-collapsible.stories.mdx +39 -0
  140. package/app/stories/pix-filter-banner.stories.js +51 -0
  141. package/app/stories/pix-filter-banner.stories.mdx +33 -0
  142. package/app/stories/pix-icon-button.stories.js +95 -0
  143. package/app/stories/pix-icon-button.stories.mdx +90 -0
  144. package/app/stories/pix-input-code.stories.js +74 -0
  145. package/app/stories/pix-input-code.stories.mdx +46 -0
  146. package/app/stories/pix-input-password.stories.js +89 -0
  147. package/app/stories/pix-input-password.stories.mdx +69 -0
  148. package/app/stories/pix-input.stories.js +94 -0
  149. package/app/stories/pix-input.stories.mdx +57 -0
  150. package/app/stories/pix-message.stories.js +57 -0
  151. package/app/stories/pix-message.stories.mdx +71 -0
  152. package/app/stories/pix-multi-select.stories.js +199 -0
  153. package/app/stories/pix-multi-select.stories.mdx +55 -0
  154. package/app/stories/pix-progress-gauge.stories.js +78 -0
  155. package/app/stories/pix-progress-gauge.stories.mdx +43 -0
  156. package/app/stories/pix-radio-button.stories.js +71 -0
  157. package/app/stories/pix-radio-button.stories.mdx +49 -0
  158. package/app/stories/pix-return-to.stories.js +45 -0
  159. package/app/stories/pix-return-to.stories.mdx +41 -0
  160. package/app/stories/pix-select.stories.js +140 -0
  161. package/app/stories/pix-select.stories.mdx +57 -0
  162. package/app/stories/pix-selectable-tag.stories.js +91 -0
  163. package/app/stories/pix-selectable-tag.stories.mdx +55 -0
  164. package/app/stories/pix-stars.stories.js +43 -0
  165. package/app/stories/pix-stars.stories.mdx +35 -0
  166. package/app/stories/pix-tag.stories.js +56 -0
  167. package/app/stories/pix-tag.stories.mdx +46 -0
  168. package/app/stories/pix-textarea.stories.js +59 -0
  169. package/app/stories/pix-textarea.stories.mdx +36 -0
  170. package/app/stories/pix-tooltip-deprecated.stories.js +136 -0
  171. package/app/stories/pix-tooltip-deprecated.stories.mdx +143 -0
  172. package/app/stories/pix-tooltip.stories.js +157 -0
  173. package/app/stories/pix-tooltip.stories.mdx +183 -0
  174. package/app/styles/app.scss +0 -0
  175. package/config/environment.js +5 -0
  176. package/docs/architecture.stories.mdx +106 -0
  177. package/docs/assets/accessibility-storybook.png +0 -0
  178. package/docs/assets/screen-pix-storybook.png +0 -0
  179. package/docs/breaking-changes.stories.mdx +90 -0
  180. package/docs/changelog.stories.mdx +6 -0
  181. package/docs/create-component.stories.mdx +118 -0
  182. package/docs/design-system.stories.mdx +20 -0
  183. package/docs/good-practices-a11y.stories.mdx +48 -0
  184. package/docs/good-practices-design.stories.mdx +71 -0
  185. package/docs/good-practices-responsive.stories.mdx +51 -0
  186. package/docs/good-practices-style-css.stories.mdx +40 -0
  187. package/docs/good-practices-tests.stories.mdx +9 -0
  188. package/docs/make-a-release.stories.mdx +66 -0
  189. package/docs/pull_request_template.md +14 -0
  190. package/docs/storybook.stories.mdx +44 -0
  191. package/docs/use-component.stories.mdx +89 -0
  192. package/docs/use-install.stories.mdx +37 -0
  193. package/index.js +5 -0
  194. package/package.json +121 -0
  195. package/scalingo.json +17 -0
  196. package/servers.conf.erb +30 -0
@@ -0,0 +1,91 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+ import { action } from '@storybook/addon-actions';
3
+
4
+ export const form = (args) => {
5
+ return {
6
+ template: hbs`
7
+ <form>
8
+ <PixInput @id='firstName' @label='Prénom' @errorMessage={{genericErrorMessage}} />
9
+ <br>
10
+ <PixInputPassword @id='password' @label='Mot de passe' @errorMessage={{genericErrorMessage}} />
11
+ <br>
12
+
13
+ <PixMultiSelect
14
+ @title="Votre notation en étoiles..."
15
+ @id="form__pix-mutli-select"
16
+ @label="A quel point aimez vous Pix-UI ?"
17
+ @onSelect={{onSelect}}
18
+ @selected={{selected}}
19
+ @options={{options}} as |star|
20
+ >
21
+ <PixStars @count={{star.value}} @total={{star.total}} />
22
+ </PixMultiSelect>
23
+ <br><br>
24
+
25
+ <PixSelect
26
+ @id="form__searchable-pix-select"
27
+ @label="Votre fruit préféré est : "
28
+ @options={{selectOptions}}
29
+ @isSearchable={{true}}
30
+ @isValidationActive={{true}}
31
+ placeholder='Fraises, Mangues...'
32
+ style='width:100%'
33
+ />
34
+ <br>
35
+
36
+ <PixTextarea
37
+ @id="form__pix-textarea"
38
+ @value=""
39
+ @maxlength={{200}}
40
+ @label="Un commentaire ?"
41
+ @errorMessage={{genericErrorMessage}} />
42
+ <br>
43
+
44
+ <label class="pix-form__label"> Votre légume préféré est : </label>
45
+ <PixRadioButton
46
+ @label="Chou"
47
+ @value="chou"
48
+ name="légume"
49
+ />
50
+ <PixRadioButton
51
+ @label="Carotte"
52
+ @value="carotte"
53
+ name="légume"
54
+ />
55
+ <br>
56
+
57
+ <div class="pix-form__actions">
58
+ <PixButton @triggerAction={{cancel}} @backgroundColor="transparent-light" @isBorderVisible={{true}}>
59
+ Annuler
60
+ </PixButton>
61
+ <PixButton @type="submit">Envoyer mes réponses</PixButton>
62
+ </div>
63
+ </form>
64
+ `,
65
+ context: args,
66
+ };
67
+ };
68
+ form.args = {
69
+ genericErrorMessage: '',
70
+ selected: ['1', '4'],
71
+ options: [
72
+ { value: '1', total: 3 },
73
+ { value: '2', total: 3 },
74
+ { value: '3', total: 3 },
75
+ ],
76
+ cancel: action('cancel'),
77
+ onSelect: action('onSelect'),
78
+ selectOptions: [
79
+ { value: 'Figues', label: 'Figues' },
80
+ { value: 'Bananes', label: 'Bananes' },
81
+ { value: 'Noix', label: 'Noix' },
82
+ { value: 'Papayes', label: 'Papayes' },
83
+ { value: 'Fèves de chocolat', label: 'Fèves de chocolat' },
84
+ { value: 'Dattes', label: 'Dattes' },
85
+ { value: 'Mangues', label: 'Mangues' },
86
+ { value: 'Jujube', label: 'Jujube' },
87
+ { value: 'Avocat', label: 'Avocat' },
88
+ { value: 'Fraises', label: 'Fraises' },
89
+ { value: 'Kaki', label: 'Kaki' },
90
+ ],
91
+ };
@@ -0,0 +1,16 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import centered from '@storybook/addon-centered/ember';
3
+ import * as stories from './form.stories.js';
4
+
5
+ <Meta
6
+ title='Form/Example'
7
+ decorators={[centered]}
8
+ />
9
+
10
+ # Formulaire avec les composants Pix UI
11
+
12
+ Un formulaire complet avec les composants Pix UI :
13
+
14
+ <Canvas>
15
+ <Story name="Form" story={stories.form} height={600} />
16
+ </Canvas>
@@ -0,0 +1,19 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ export const backgroundHeader = (args) => {
4
+ return {
5
+ template: hbs`
6
+ <PixBackgroundHeader>
7
+
8
+ <PixBlock>Un panel avec du text</PixBlock>
9
+
10
+ <PixBlock>
11
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis a interdum mauris. Morbi ac diam varius, maximus massa id, venenatis lectus. Fusce interdum tincidunt mattis. Nullam porta sollicitudin lorem, sodales cursus arcu finibus in. Nam pretium congue diam sollicitudin faucibus. Aliquam nec augue massa. Pellentesque eleifend nec arcu eu tincidunt. Pellentesque at quam dignissim, lacinia sem et, pharetra magna. Etiam venenatis felis augue, id sollicitudin sapien interdum at. Cras bibendum fermentum eros, rutrum varius turpis venenatis vitae. Suspendisse aliquet iaculis sem in blandit. Mauris vitae erat lobortis est volutpat bibendum non molestie purus.
12
+ Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed consequat porttitor metus a imperdiet. Duis quis enim fermentum, sodales massa sit amet, blandit elit. Aliquam felis purus, dictum sed pretium vel, aliquam sit amet felis. Nunc convallis pellentesque convallis. Suspendisse potenti. Aenean iaculis, nunc placerat aliquam posuere, tellus enim facilisis metus, non egestas sapien arcu et leo.
13
+ </PixBlock>
14
+
15
+ </PixBackgroundHeader>
16
+ `,
17
+ context: args,
18
+ };
19
+ };
@@ -0,0 +1,36 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import centered from '@storybook/addon-centered/ember';
3
+ import * as stories from './pix-background-header.stories.js';
4
+
5
+ <Meta
6
+ title='Layout/Background Header'
7
+ component='PixBackgroundHeader'
8
+ decorators={[centered]}
9
+ />
10
+
11
+ # Pix Background Header
12
+
13
+ Un `BackgroundHeader` est une bannière donnant un fond de couleur bleu en haut d'une page.
14
+ Les enfants de la bannière se mettrons en colonne.
15
+
16
+ > Pour le moment ce composant n'est pas paramétrable car nous n'avons pas d'autres types de bannières.
17
+
18
+ > Le `BackgroundHeader` se couple bien avec un ou plusieurs `PixBlock`.
19
+
20
+ <Canvas>
21
+ <Story name="Background Header" story={stories.backgroundHeader} height={500} />
22
+ </Canvas>
23
+
24
+ ## Usage
25
+
26
+ ```html
27
+ <PixBackgroundHeader>
28
+ <PixBlock>
29
+ Lorem ipsum
30
+ </PixBlock>
31
+ </PixBackgroundHeader>
32
+ ```
33
+
34
+ ## Arguments
35
+
36
+ Le composant ne prend pas d'arguments
@@ -0,0 +1,89 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ const Template = (args) => {
4
+ return {
5
+ template: hbs`
6
+ <PixBanner
7
+ @type={{type}}
8
+ @actionLabel={{actionLabel}}
9
+ @actionUrl={{actionUrl}}
10
+ >
11
+ Parcours de rentrée 2020 : les codes sont disponibles dans l'onglet campagne. N’oubliez pas de les diffuser aux élèves avant la Toussaint.
12
+ </PixBanner>
13
+ `,
14
+ context: args,
15
+ };
16
+ };
17
+
18
+ export const Default = Template.bind({});
19
+
20
+ export const warning = Template.bind({});
21
+ warning.args = {
22
+ type: 'warning',
23
+ };
24
+
25
+ export const error = Template.bind({});
26
+ error.args = {
27
+ type: 'error',
28
+ };
29
+
30
+ export const communicationPixApp = Template.bind({});
31
+ communicationPixApp.args = {
32
+ type: 'communication',
33
+ };
34
+
35
+ export const communicationPixOrga = Template.bind({});
36
+ communicationPixOrga.args = {
37
+ type: 'communication-orga',
38
+ };
39
+
40
+ export const communicationPixCertif = Template.bind({});
41
+ communicationPixCertif.args = {
42
+ type: 'communication-certif',
43
+ };
44
+
45
+ export const withExternalLink = Template.bind({});
46
+ withExternalLink.args = {
47
+ type: 'info',
48
+ actionLabel: 'Voir le nouveau site',
49
+ actionUrl: 'www.test.fr/',
50
+ };
51
+
52
+ export const withInternalLink = Template.bind({});
53
+ withInternalLink.args = {
54
+ type: 'info',
55
+ actionLabel: 'Voir la liste des participants',
56
+ actionUrl: 'campaign.list',
57
+ };
58
+
59
+ export const argsTypes = {
60
+ actionLabel: {
61
+ name: 'actionLabel',
62
+ description: 'Nom de l‘action',
63
+ type: { name: 'string', required: false },
64
+ defaultValue: '',
65
+ },
66
+ actionUrl: {
67
+ name: 'actionUrl',
68
+ description: 'Lien de l‘action',
69
+ type: { name: 'string', required: false },
70
+ defaultValue: '',
71
+ },
72
+ type: {
73
+ name: 'type',
74
+ description: 'Définit le type de bannière',
75
+ type: { name: 'string', required: false },
76
+ defaultValue: { summary: 'information' },
77
+ control: {
78
+ type: 'select',
79
+ options: [
80
+ 'information',
81
+ 'warning',
82
+ 'error',
83
+ 'communication',
84
+ 'communication-orga',
85
+ 'communication-certif',
86
+ ],
87
+ },
88
+ },
89
+ };
@@ -0,0 +1,107 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import centered from '@storybook/addon-centered/ember';
3
+ import * as stories from './pix-banner.stories.js';
4
+
5
+ <Meta
6
+ title='Notification/Banner'
7
+ component='PixBanner'
8
+ decorators={[centered]}
9
+ argTypes={stories.argsTypes}
10
+ />
11
+
12
+ # Pix Banner
13
+
14
+ Une `Banner` permet de mettre en avant une information importante.
15
+
16
+ > Il est possible de surcharger le style d'une `<PixBanner>` via l'attribut `class` ainsi que de passer n'importe quel attribut sur sa `div` wrapper (par exemple, un `aria-label`)
17
+
18
+
19
+ ## Default
20
+
21
+ Bannière Information (par défaut).
22
+
23
+ <Canvas>
24
+ <Story name="Default" story={stories.Default} height={75} />
25
+ </Canvas>
26
+
27
+ ## Warning
28
+
29
+ Bannière pour les alertes.
30
+
31
+ <Canvas>
32
+ <Story name="Warning" story={stories.warning} height={75} />
33
+ </Canvas>
34
+
35
+ ## Error
36
+
37
+ Bannière pour les erreurs.
38
+
39
+ <Canvas>
40
+ <Story name="Error" story={stories.error} height={75} />
41
+ </Canvas>
42
+
43
+ ## Communication
44
+
45
+ <Canvas isColumn>
46
+ Bannière pour Pix App
47
+ <Story name="Communication Pix App" story={stories.communicationPixApp} height={75} />
48
+ Bannière pour Pix Orga
49
+ <Story name="Pix Orga" story={stories.communicationPixOrga} height={75} />
50
+ Bannière pour Pix Certif
51
+ <Story name="Pix Certif" story={stories.communicationPixCertif} height={75} />
52
+ </Canvas>
53
+
54
+ ## With Internal Link
55
+
56
+ Bannière contenant un lien interne.
57
+
58
+ <Canvas>
59
+ <Story name="With internal link" story={stories.withInternalLink} height={100} />
60
+ </Canvas>
61
+
62
+ ## With External Link
63
+
64
+ Bannière contenant un lien externe.
65
+
66
+ <Canvas>
67
+ <Story name="With external link" story={stories.withExternalLink} height={100} />
68
+ </Canvas>
69
+
70
+ ## Usage
71
+
72
+ ```html
73
+ <PixBanner>
74
+ Bannière Info par défaut
75
+ </PixBanner>
76
+
77
+ <PixBanner @type='communication'>
78
+ Bannière Communication pour Pix App
79
+ </PixBanner>
80
+
81
+ <PixBanner @type='warning'>
82
+ Bannière Warning
83
+ </PixBanner>
84
+
85
+ <PixBanner @type='error'>
86
+ Bannière Error
87
+ </PixBanner>
88
+
89
+ <PixBanner
90
+ @actionLabel='Liste des campagnes'
91
+ @actionUrl='authenticated.campaigns'
92
+ >
93
+ Bannière avec une route pour lien
94
+ </PixBanner>
95
+
96
+ <PixBanner
97
+ @actionLabel='Ajouter des élèves'
98
+ @actionUrl='https://orga.pix.fr/eleves'
99
+ >
100
+ Bannière avec une route externe
101
+ </PixBanner>
102
+
103
+ ```
104
+
105
+ ## Arguments
106
+
107
+ <ArgsTable story="Default" />
@@ -0,0 +1,20 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ export const block = (args) => ({
4
+ template: hbs`
5
+ <PixBlock @shadow={{shadow}}>
6
+ Lorem ipsum
7
+ </PixBlock>
8
+ `,
9
+ context: args,
10
+ });
11
+
12
+ export const argTypes = {
13
+ shadow: {
14
+ name: 'shadow',
15
+ description: 'Ombre sur le bloc',
16
+ type: { name: 'string', required: false },
17
+ defaultValue: 'light',
18
+ control: { type: 'select', options: ['light', 'heavy'] },
19
+ },
20
+ };
@@ -0,0 +1,44 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import centered from '@storybook/addon-centered/ember';
3
+ import * as stories from './pix-block.stories.js';
4
+
5
+ <Meta
6
+ title='Layout/Block'
7
+ component='PixBlock'
8
+ decorators={[centered]}
9
+ argTypes={stories.argTypes}
10
+ />
11
+
12
+ # Pix Block
13
+
14
+ Un \`Block\` est un bloc de fond blanc dont les bords sont arrondis et ayant une ombre projetée.
15
+
16
+ > Les marges intérieures du bloc sont de 14px (haut et bas) et 24px (droite et gauche), sauf pour la version mobile où c'est 16px (partout).
17
+
18
+ > Un \`Block\` prendra toute la largeur de son parent, dans la limite maximale de 980px.
19
+
20
+ > Donnez donc un parent de la taille que vous souhaitez, votre bloc prendra la même taille.
21
+
22
+ > Il est souvent utilisé dans le PixBackgroundHeader.
23
+
24
+ <Canvas>
25
+ <Story name="Block" story={stories.block} height={60} />
26
+ </Canvas>
27
+
28
+
29
+ ## Usage
30
+
31
+ ```html
32
+ <PixBlock @shadow="light">
33
+ <div> Un bloc avec une ombre faible </div>
34
+ </PixBlock>
35
+
36
+ <PixBlock @shadow="heavy">
37
+ <div> Un bloc avec une ombre forte </div>
38
+ </PixBlock>
39
+
40
+ ```
41
+
42
+ ## Arguments
43
+
44
+ <ArgsTable story="Block" />
@@ -0,0 +1,125 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ export const htmlLinkTemplate = (args) => {
4
+ return {
5
+ template: hbs`
6
+ <PixButtonLink
7
+ @href="https://pix.fr"
8
+ target="NEW"
9
+ @shape={{shape}}
10
+ @backgroundColor={{backgroundColor}}
11
+ @size={{size}}
12
+ @isBorderVisible={{isBorderVisible}}
13
+ @isDisabled={{isDisabled}}
14
+ >
15
+ Lien HTML classique
16
+ </PixButtonLink>
17
+ `,
18
+ context: args,
19
+ };
20
+ };
21
+
22
+ export const emberLinkTemplate = (args) => {
23
+ return {
24
+ template: hbs`
25
+ <PixButtonLink
26
+ @route=""
27
+ @model=""
28
+ @query={{query}}
29
+ @shape={{shape}}
30
+ @backgroundColor={{backgroundColor}}
31
+ @size={{size}}
32
+ @isBorderVisible={{isBorderVisible}}
33
+ @isDisabled={{isDisabled}}
34
+ >
35
+ Lien route Ember (LinkTo)
36
+ </PixButtonLink>
37
+ `,
38
+ context: args,
39
+ };
40
+ };
41
+
42
+ export const htmlLink = htmlLinkTemplate.bind({});
43
+
44
+ export const emberLink = emberLinkTemplate.bind({});
45
+
46
+ export const argTypes = {
47
+ href: {
48
+ name: 'href',
49
+ description: 'Paramètre à renseigner pour utiliser lien HTML.',
50
+ type: { name: 'string', required: false },
51
+ defaultValue: null,
52
+ },
53
+ route: {
54
+ name: 'route',
55
+ description:
56
+ "Paramètre à renseigner pour utiliser un composant LinkTo à la place d'un lien classique. Il prend comme valeur la route de redirection",
57
+ type: { name: 'string', required: false },
58
+ defaultValue: null,
59
+ },
60
+ model: {
61
+ name: 'model',
62
+ description: 'Model Ember lié à la route utilisée',
63
+ type: { required: false },
64
+ },
65
+ query: {
66
+ name: 'query',
67
+ description:
68
+ "Paramètre facultatif du <LinkTo> Ember permettant d'ajouter des paires de clé/valeur dans les paramètres d'une URL",
69
+ type: { required: false },
70
+ },
71
+ shape: {
72
+ name: 'shape',
73
+ description: 'forme: `rounded`,`squircle`',
74
+ type: { name: 'string', required: false },
75
+ options: ['rounded', 'squircle'],
76
+ control: { type: 'select' },
77
+ table: {
78
+ type: { summary: 'string' },
79
+ defaultValue: { summary: 'squircle' },
80
+ },
81
+ },
82
+ backgroundColor: {
83
+ name: 'backgroundColor',
84
+ description:
85
+ 'color: `blue`, `green`, `yellow`, `red`, `grey`, `transparent-light`, `transparent-dark`',
86
+ options: ['blue', 'green', 'yellow', 'red', 'grey', 'transparent-light', 'transparent-dark'],
87
+ type: { name: 'string', required: false },
88
+ control: { type: 'select' },
89
+ table: {
90
+ type: { summary: 'string' },
91
+ defaultValue: { summary: 'blue' },
92
+ },
93
+ },
94
+ size: {
95
+ name: 'size',
96
+ description: 'taille: `big`,`small`',
97
+ options: ['big', 'small'],
98
+ type: { name: 'string', required: false },
99
+ control: { type: 'select' },
100
+ table: {
101
+ type: { summary: 'string' },
102
+ defaultValue: { summary: 'big' },
103
+ },
104
+ },
105
+ isBorderVisible: {
106
+ name: 'isBorderVisible',
107
+ description:
108
+ 'Paramètre utilisé seulement quand le `backgroundColor` est `transparent-light` ou `transparent-dark`',
109
+ type: { name: 'boolean', required: false },
110
+ control: { type: 'boolean' },
111
+ table: {
112
+ type: { summary: 'boolean' },
113
+ defaultValue: { summary: 'false' },
114
+ },
115
+ },
116
+ isDisabled: {
117
+ name: 'isDisabled',
118
+ type: { name: 'boolean', required: false },
119
+ control: { type: 'boolean' },
120
+ table: {
121
+ type: { summary: 'boolean' },
122
+ defaultValue: { summary: 'false' },
123
+ },
124
+ },
125
+ };
@@ -0,0 +1,57 @@
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-button-link.stories.js';
5
+
6
+ <Meta
7
+ title='Basics/ButtonLink'
8
+ component='PixButtonLink'
9
+ decorators={[centered]}
10
+ argTypes={stories.argTypes}
11
+ />
12
+
13
+ # ButtonLink
14
+
15
+ Affiche un lien avec le style d'un bouton Pix. Il peut être de type HTML ou Route EmberJS.
16
+
17
+ Hérite des styles de base de `PixButton` (`shape`, `backgroundColor`, `size`, `isBorderVisible`, `isDisabled`)
18
+
19
+ ## Lien HTML
20
+
21
+ Affiche un bouton avec les propriétés de lien HTML définies.
22
+
23
+ Prend en entrée la propriété `@href`.
24
+ Redirige directement les attributs de la balise HTML `<a>` (eg. `target`...).
25
+
26
+ <Canvas>
27
+ <Story name='Lien HTML' story={stories.htmlLink} height={60} />
28
+ </Canvas>
29
+
30
+ ```html
31
+ <PixButtonLink @href="https://pix.fr" target="_blank">
32
+ Libellé du lien
33
+ </PixButtonLink>
34
+ ```
35
+
36
+ ## Route EmberJS
37
+
38
+ Affiche un bouton vers la route EmberJS définie en paramètre.
39
+ Equivalent au `<LinkTo />` de EmberJS avec le style d'un bouton Pix.
40
+
41
+ Prend en entrée la propriété `@route` et `@model`.
42
+
43
+ Un bouton de route EmberJS peut être désactivé via la propriété `@isDisabled`.
44
+
45
+ <Canvas>
46
+ <Story name='Route EmberJS' story={stories.emberLink} height={60} />
47
+ </Canvas>
48
+
49
+ ```html
50
+ <PixButtonLink @route="ma.route.ember" @model="mon-model">
51
+ Libellé du lien
52
+ </PixButtonLink>
53
+ ```
54
+
55
+ ## Arguments
56
+
57
+ <ArgsTable story="Lien HTML" />
@@ -0,0 +1,85 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+ import { action } from '@storybook/addon-actions';
3
+
4
+ export const buttonUpload = (args) => {
5
+ return {
6
+ template: hbs`
7
+ <PixButtonUpload
8
+ @id="id"
9
+ @onChange={{onChange}}
10
+ @shape={{shape}}
11
+ @backgroundColor={{backgroundColor}}
12
+ @size={{size}}
13
+ @isBorderVisible={{isBorderVisible}}
14
+ >
15
+ Cliquer pour uploader un fichier
16
+ </PixButtonUpload>
17
+ `,
18
+ context: args,
19
+ };
20
+ };
21
+
22
+ buttonUpload.args = {
23
+ onChange: action('onChange'),
24
+ };
25
+
26
+ export const argTypes = {
27
+ id: {
28
+ name: 'id',
29
+ description: "identifiant du bouton d'upload",
30
+ type: { name: 'string', required: true },
31
+ defaultValue: 'file-upload',
32
+ },
33
+ onChange: {
34
+ name: 'onChange',
35
+ description:
36
+ "fonction à exécuter au moment de l'upload du fichier, elle prend en entrée la liste des fichiers uploadés.",
37
+ type: { name: 'function', required: true },
38
+ defaultValue: null,
39
+ },
40
+ shape: {
41
+ name: 'shape',
42
+ description: 'forme: `rounded`,`squircle`',
43
+ type: { name: 'string', required: false },
44
+ options: ['rounded', 'squircle'],
45
+ control: { type: 'select' },
46
+ table: {
47
+ type: { summary: 'string' },
48
+ defaultValue: { summary: 'squircle' },
49
+ },
50
+ },
51
+ backgroundColor: {
52
+ name: 'backgroundColor',
53
+ description:
54
+ 'color: `blue`, `green`, `yellow`, `red`, `grey`, `transparent-light`, `transparent-dark`',
55
+ options: ['blue', 'green', 'yellow', 'red', 'grey', 'transparent-light', 'transparent-dark'],
56
+ type: { name: 'string', required: false },
57
+ control: { type: 'select' },
58
+ table: {
59
+ type: { summary: 'string' },
60
+ defaultValue: { summary: 'blue' },
61
+ },
62
+ },
63
+ size: {
64
+ name: 'size',
65
+ description: 'taille: `big`,`small`',
66
+ options: ['big', 'small'],
67
+ type: { name: 'string', required: false },
68
+ control: { type: 'select' },
69
+ table: {
70
+ type: { summary: 'string' },
71
+ defaultValue: { summary: 'big' },
72
+ },
73
+ },
74
+ isBorderVisible: {
75
+ name: 'isBorderVisible',
76
+ description:
77
+ 'Paramètre utilisé seulement quand le `backgroundColor` est `transparent-light` ou `transparent-dark`',
78
+ type: { name: 'boolean', required: false },
79
+ control: { type: 'boolean' },
80
+ table: {
81
+ type: { summary: 'boolean' },
82
+ defaultValue: { summary: 'false' },
83
+ },
84
+ },
85
+ };