@1024pix/pix-ui 23.2.1 → 24.0.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 (44) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/addon/components/pix-indicator-card.hbs +45 -0
  3. package/addon/components/pix-indicator-card.js +21 -0
  4. package/addon/styles/_pix-banner.scss +0 -1
  5. package/addon/styles/_pix-button-base.scss +0 -2
  6. package/addon/styles/_pix-checkbox.scss +0 -1
  7. package/addon/styles/_pix-collapsible.scss +0 -3
  8. package/addon/styles/_pix-dropdown.scss +0 -1
  9. package/addon/styles/_pix-icon-button.scss +0 -2
  10. package/addon/styles/_pix-indicator-card.scss +65 -0
  11. package/addon/styles/_pix-input-code.scss +0 -1
  12. package/addon/styles/_pix-input-password.scss +0 -2
  13. package/addon/styles/_pix-input.scss +0 -2
  14. package/addon/styles/_pix-message.scss +0 -2
  15. package/addon/styles/_pix-modal.scss +1 -1
  16. package/addon/styles/_pix-return-to.scss +0 -2
  17. package/addon/styles/_pix-selectable-tag.scss +0 -1
  18. package/addon/styles/_pix-sidebar.scss +1 -1
  19. package/addon/styles/_pix-stars.scss +0 -1
  20. package/addon/styles/_pix-tag.scss +0 -2
  21. package/addon/styles/_pix-textarea.scss +0 -2
  22. package/addon/styles/_pix-tooltip.scss +0 -2
  23. package/addon/styles/addon.scss +2 -13
  24. package/addon/styles/normalize-reset/_normalize.scss +349 -0
  25. package/addon/styles/normalize-reset/_reset.scss +20 -0
  26. package/addon/styles/normalize-reset/index.scss +2 -0
  27. package/addon/styles/{_breakpoints.scss → pix-design-tokens/_breakpoints.scss} +0 -0
  28. package/addon/styles/{_colors.scss → pix-design-tokens/_colors.scss} +0 -0
  29. package/addon/styles/{_fonts.scss → pix-design-tokens/_fonts.scss} +0 -0
  30. package/addon/styles/{_form.scss → pix-design-tokens/_form.scss} +0 -0
  31. package/addon/styles/{_shadows.scss → pix-design-tokens/_shadows.scss} +0 -0
  32. package/addon/styles/{_spacing.scss → pix-design-tokens/_spacing.scss} +0 -0
  33. package/addon/styles/{_typography.scss → pix-design-tokens/_typography.scss} +0 -0
  34. package/addon/styles/{pix-design-tokens.scss → pix-design-tokens/index.scss} +0 -0
  35. package/addon/utils/accessible-contrasted-color-generator.js +29 -0
  36. package/app/components/pix-indicator-card.js +1 -0
  37. package/app/stories/pix-block.stories.mdx +3 -9
  38. package/app/stories/pix-checkbox.stories.js +1 -1
  39. package/app/stories/pix-indicator-card.stories.js +57 -0
  40. package/app/stories/pix-indicator-card.stories.mdx +38 -0
  41. package/app/stories/pix-multi-select.stories.js +2 -2
  42. package/package.json +5 -4
  43. package/addon/styles/_pix-button-link.scss +0 -3
  44. package/addon/styles/_reset-css.scss +0 -30
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Pix-UI Changelog
2
2
 
3
+ ## v24.0.0 (09/01/2023)
4
+
5
+
6
+ ### :coffee: Autre
7
+ - [#314](https://github.com/1024pix/pix-ui/pull/314) [BREAKING_CHANGE] Ajouter un normalize/reset css dans Pix UI (pix-6723)
8
+
9
+ ## v23.3.0 (29/12/2022)
10
+
11
+
12
+ ### :rocket: Amélioration
13
+ - [#307](https://github.com/1024pix/pix-ui/pull/307) [FEATURE] Création du composant carte (PIX-6141).
14
+
15
+ ### :building_construction: Tech
16
+ - [#313](https://github.com/1024pix/pix-ui/pull/313) [TECH] Ne plus ajouter de lien vers la review-app dans la pull-request
17
+
3
18
  ## v23.2.1 (21/12/2022)
4
19
 
5
20
 
@@ -0,0 +1,45 @@
1
+ <section class="indicator-card" ...attributes>
2
+ {{#if @isLoading}}
3
+ <p class="screen-reader-only">{{@loadingMessage}}</p>
4
+ <div class="indicator-card__icon" aria-hidden="true"></div>
5
+ <div class="indicator-card__content" aria-hidden="true"></div>
6
+ {{else}}
7
+ <div
8
+ id={{this.iconId}}
9
+ class="indicator-card__icon"
10
+ aria-hidden="true"
11
+ {{did-insert this.setIconColor}}
12
+ >
13
+ <FaIcon @icon={{@icon}} />
14
+ </div>
15
+ <dl class="indicator-card__content">
16
+ <div class="indicator-card__title">
17
+ <dt>{{@title}}</dt>
18
+ {{#if @info}}
19
+ <PixTooltip
20
+ @id={{this.tooltipId}}
21
+ @position="top"
22
+ @isWide={{true}}
23
+ class="indicator-card__tooltip hide-on-mobile"
24
+ >
25
+ <:triggerElement>
26
+ <FaIcon
27
+ @icon="circle-question"
28
+ class="indicator-card__tooltip-icon"
29
+ tabindex="0"
30
+ aria-describedby={{this.tooltipId}}
31
+ />
32
+ </:triggerElement>
33
+ <:tooltip>
34
+ {{@info}}
35
+ </:tooltip>
36
+ </PixTooltip>
37
+ {{/if}}
38
+ </div>
39
+ <dd class="indicator-card__value">{{yield}}</dd>
40
+ <p class="indicator-card__sub">
41
+ {{yield to="sub"}}
42
+ </p>
43
+ </dl>
44
+ {{/if}}
45
+ </section>
@@ -0,0 +1,21 @@
1
+ import Component from '@glimmer/component';
2
+ import { action } from '@ember/object';
3
+ import { guidFor } from '@ember/object/internals';
4
+ import accessibleContrastedColorGenerator from '@1024pix/pix-ui/utils/accessible-contrasted-color-generator';
5
+
6
+ export default class PixIndicatorCard extends Component {
7
+ id = guidFor(this);
8
+ iconId = 'icon-' + this.id;
9
+ tooltipId = 'tooltip-' + this.id;
10
+
11
+ @action
12
+ setIconColor() {
13
+ const element = document.getElementById(this.iconId);
14
+ try {
15
+ element.style.color = this.args.color;
16
+ element.style.backgroundColor = accessibleContrastedColorGenerator(this.args.color);
17
+ } catch (error) {
18
+ console.error(error.message);
19
+ }
20
+ }
21
+ }
@@ -1,5 +1,4 @@
1
1
  .pix-banner {
2
- @import 'reset-css';
3
2
  font-family: $font-roboto;
4
3
  font-weight: $font-normal;
5
4
  padding: 16px 24px;
@@ -1,6 +1,4 @@
1
1
  .pix-button {
2
- @import 'reset-css';
3
-
4
2
  color: $pix-neutral-0;
5
3
  font-family: $font-roboto;
6
4
  font-size: 0.875rem;
@@ -1,5 +1,4 @@
1
1
  .pix-checkbox {
2
- @import 'reset-css';
3
2
  align-items: center;
4
3
  display: flex;
5
4
 
@@ -1,6 +1,4 @@
1
1
  .pix-collapsible {
2
- @import 'reset-css';
3
-
4
2
  width: 100%;
5
3
  display: flex;
6
4
  flex-direction: column;
@@ -21,7 +19,6 @@
21
19
  border: none;
22
20
  color: $pix-neutral-60;
23
21
  font-size: 1rem;
24
- font-weight: 500;
25
22
  align-items: center;
26
23
 
27
24
  &:hover {
@@ -1,5 +1,4 @@
1
1
  .pix-dropdown {
2
- @import 'reset-css';
3
2
  width: 100%;
4
3
  position: relative;
5
4
 
@@ -1,6 +1,4 @@
1
1
  .pix-icon-button {
2
- @import 'reset-css';
3
-
4
2
  border-radius: 50%;
5
3
  cursor: pointer;
6
4
  border: none;
@@ -0,0 +1,65 @@
1
+ .indicator-card {
2
+ display: flex;
3
+ width: 100%;
4
+ background-color: $pix-neutral-0;
5
+ border-radius: 8px;
6
+ min-height: 112px;
7
+
8
+ box-shadow: 0 4px 8px rgba($pix-neutral-110, 0.05);
9
+ padding: 0;
10
+
11
+ &__icon {
12
+ display: flex;
13
+ justify-content: center;
14
+ align-items: center;
15
+ border-radius: 8px 0 0 8px;
16
+ background-color: $pix-neutral-20;
17
+ min-width: 96px;
18
+ font-size: 2.5rem;
19
+ }
20
+
21
+ &__content {
22
+ display: flex;
23
+ flex-direction: column;
24
+ justify-content: center;
25
+ color: $pix-neutral-60;
26
+ padding: $spacing-s $spacing-m;
27
+ margin: 0;
28
+ }
29
+
30
+ &__title {
31
+ @include text-large();
32
+ display: flex;
33
+ align-items: center;
34
+ font-weight: $font-medium;
35
+ font-size: 1rem;
36
+ line-height: 1.375rem;
37
+ margin-bottom: $spacing-xxs;
38
+ }
39
+
40
+ &__value {
41
+ font-family: $font-open-sans;
42
+ font-weight: $font-medium;
43
+ font-size: 2rem;
44
+ line-height: 2.5rem;
45
+ margin: 0;
46
+ margin-bottom: $spacing-xxs;
47
+ }
48
+
49
+ &__sub {
50
+ @include text-small();
51
+ font-weight: $font-normal;
52
+ display: flex;
53
+ gap: 10px;
54
+ margin: 0
55
+ }
56
+
57
+ &__tooltip {
58
+ font-weight: $font-normal;
59
+ }
60
+
61
+ &__tooltip-icon {
62
+ color: $pix-neutral-30;
63
+ margin: 0 $spacing-xs;
64
+ }
65
+ }
@@ -1,5 +1,4 @@
1
1
  .pix-input-code {
2
- @import 'reset-css';
3
2
  display: flex;
4
3
 
5
4
  // hide up/down cursors
@@ -1,6 +1,4 @@
1
1
  .pix-input-password {
2
- @import 'reset-css';
3
-
4
2
  display: flex;
5
3
  flex-direction: column;
6
4
  position: relative;
@@ -1,6 +1,4 @@
1
1
  .pix-input {
2
- @import 'reset-css';
3
-
4
2
  display: flex;
5
3
  flex-direction: column;
6
4
  position: relative;
@@ -1,6 +1,4 @@
1
1
  .pix-message {
2
- @import 'reset-css';
3
-
4
2
  margin: 0;
5
3
  padding: 0.75rem 1rem;
6
4
  font-size: 0.875rem;
@@ -35,7 +35,7 @@ $space-between-title-and-close-button: 8px;
35
35
  $button-margin: 16px;
36
36
 
37
37
  .pix-modal {
38
- @import 'reset-css';
38
+
39
39
  display: inline-block;
40
40
  vertical-align: middle; // Centered vertically with the .pix-modal__overlay::after which is 100% height
41
41
  width: 512px;
@@ -1,6 +1,4 @@
1
1
  .pix-return-to {
2
- @import 'reset-css';
3
-
4
2
  font-size: 1rem;
5
3
  font-weight: $font-medium;
6
4
  letter-spacing: 0.15px;
@@ -17,7 +17,6 @@ $checkmark-width-with-space: $checkmark-width + 0.438rem;
17
17
  }
18
18
 
19
19
  .pix-selectable-tag {
20
- @import 'reset-css';
21
20
  display: inline-block;
22
21
  text-align: center;
23
22
  position: relative;
@@ -22,7 +22,7 @@ $space-between-title-and-close-button: 8px;
22
22
  $button-margin: 16px;
23
23
 
24
24
  .pix-sidebar {
25
- @import 'reset-css';
25
+
26
26
  display: flex;
27
27
  flex-direction: column;
28
28
  height: 100%;
@@ -1,5 +1,4 @@
1
1
  .pix-stars {
2
- @import 'reset-css';
3
2
  line-height: 0;
4
3
 
5
4
  > svg {
@@ -1,6 +1,4 @@
1
1
  .pix-tag {
2
- @import 'reset-css';
3
-
4
2
  display: inline-block;
5
3
  text-align: center;
6
4
  vertical-align: baseline;
@@ -1,6 +1,4 @@
1
1
  .pix-textarea {
2
- @import 'reset-css';
3
-
4
2
  textarea {
5
3
  width: 100%;
6
4
  border: 1px solid $pix-neutral-40;
@@ -1,6 +1,4 @@
1
1
  .pix-tooltip {
2
- @import 'reset-css';
3
-
4
2
  position: relative;
5
3
  display: flex;
6
4
  justify-content: center;
@@ -1,4 +1,5 @@
1
1
  @import 'pix-design-tokens';
2
+ @import 'normalize-reset';
2
3
  @import 'a11y';
3
4
  @import 'pix-background-header';
4
5
  @import 'pix-banner';
@@ -17,7 +18,6 @@
17
18
  @import 'pix-tag';
18
19
  @import 'pix-textarea';
19
20
  @import 'pix-tooltip';
20
- @import 'pix-button-link';
21
21
  @import 'pix-button-upload';
22
22
  @import 'pix-input';
23
23
  @import 'pix-input-password';
@@ -30,19 +30,8 @@
30
30
  @import 'pix-pagination';
31
31
  @import 'pix-checkbox';
32
32
  @import 'pix-toggle';
33
+ @import 'pix-indicator-card';
33
34
  @import 'trap-focus';
34
35
 
35
36
  // at the end so it can override it's children scss
36
37
  @import 'pix-filterable-and-searchable-select';
37
-
38
- html {
39
- font-size: 16px;
40
- }
41
-
42
- body {
43
- font-family: $font-roboto;
44
- }
45
-
46
- * {
47
- box-sizing: border-box;
48
- }
@@ -0,0 +1,349 @@
1
+ /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2
+
3
+ /* Document
4
+ ========================================================================== */
5
+
6
+ /**
7
+ * 1. Correct the line height in all browsers.
8
+ * 2. Prevent adjustments of font size after orientation changes in iOS.
9
+ */
10
+
11
+ html {
12
+ line-height: 1.15; /* 1 */
13
+ -webkit-text-size-adjust: 100%; /* 2 */
14
+ }
15
+
16
+ /* Sections
17
+ ========================================================================== */
18
+
19
+ /**
20
+ * Remove the margin in all browsers.
21
+ */
22
+
23
+ body {
24
+ margin: 0;
25
+ }
26
+
27
+ /**
28
+ * Render the `main` element consistently in IE.
29
+ */
30
+
31
+ main {
32
+ display: block;
33
+ }
34
+
35
+ /**
36
+ * Correct the font size and margin on `h1` elements within `section` and
37
+ * `article` contexts in Chrome, Firefox, and Safari.
38
+ */
39
+
40
+ h1 {
41
+ font-size: 2em;
42
+ margin: 0.67em 0;
43
+ }
44
+
45
+ /* Grouping content
46
+ ========================================================================== */
47
+
48
+ /**
49
+ * 1. Add the correct box sizing in Firefox.
50
+ * 2. Show the overflow in Edge and IE.
51
+ */
52
+
53
+ hr {
54
+ box-sizing: content-box; /* 1 */
55
+ height: 0; /* 1 */
56
+ overflow: visible; /* 2 */
57
+ }
58
+
59
+ /**
60
+ * 1. Correct the inheritance and scaling of font size in all browsers.
61
+ * 2. Correct the odd `em` font sizing in all browsers.
62
+ */
63
+
64
+ pre {
65
+ font-family: monospace, monospace; /* 1 */
66
+ font-size: 1em; /* 2 */
67
+ }
68
+
69
+ /* Text-level semantics
70
+ ========================================================================== */
71
+
72
+ /**
73
+ * Remove the gray background on active links in IE 10.
74
+ */
75
+
76
+ a {
77
+ background-color: transparent;
78
+ }
79
+
80
+ /**
81
+ * 1. Remove the bottom border in Chrome 57-
82
+ * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
83
+ */
84
+
85
+ abbr[title] {
86
+ border-bottom: none; /* 1 */
87
+ text-decoration: underline; /* 2 */
88
+ text-decoration: underline dotted; /* 2 */
89
+ }
90
+
91
+ /**
92
+ * Add the correct font weight in Chrome, Edge, and Safari.
93
+ */
94
+
95
+ b,
96
+ strong {
97
+ font-weight: bolder;
98
+ }
99
+
100
+ /**
101
+ * 1. Correct the inheritance and scaling of font size in all browsers.
102
+ * 2. Correct the odd `em` font sizing in all browsers.
103
+ */
104
+
105
+ code,
106
+ kbd,
107
+ samp {
108
+ font-family: monospace, monospace; /* 1 */
109
+ font-size: 1em; /* 2 */
110
+ }
111
+
112
+ /**
113
+ * Add the correct font size in all browsers.
114
+ */
115
+
116
+ small {
117
+ font-size: 80%;
118
+ }
119
+
120
+ /**
121
+ * Prevent `sub` and `sup` elements from affecting the line height in
122
+ * all browsers.
123
+ */
124
+
125
+ sub,
126
+ sup {
127
+ font-size: 75%;
128
+ line-height: 0;
129
+ position: relative;
130
+ vertical-align: baseline;
131
+ }
132
+
133
+ sub {
134
+ bottom: -0.25em;
135
+ }
136
+
137
+ sup {
138
+ top: -0.5em;
139
+ }
140
+
141
+ /* Embedded content
142
+ ========================================================================== */
143
+
144
+ /**
145
+ * Remove the border on images inside links in IE 10.
146
+ */
147
+
148
+ img {
149
+ border-style: none;
150
+ }
151
+
152
+ /* Forms
153
+ ========================================================================== */
154
+
155
+ /**
156
+ * 1. Change the font styles in all browsers.
157
+ * 2. Remove the margin in Firefox and Safari.
158
+ */
159
+
160
+ button,
161
+ input,
162
+ optgroup,
163
+ select,
164
+ textarea {
165
+ font-family: inherit; /* 1 */
166
+ font-size: 100%; /* 1 */
167
+ line-height: 1.15; /* 1 */
168
+ margin: 0; /* 2 */
169
+ }
170
+
171
+ /**
172
+ * Show the overflow in IE.
173
+ * 1. Show the overflow in Edge.
174
+ */
175
+
176
+ button,
177
+ input { /* 1 */
178
+ overflow: visible;
179
+ }
180
+
181
+ /**
182
+ * Remove the inheritance of text transform in Edge, Firefox, and IE.
183
+ * 1. Remove the inheritance of text transform in Firefox.
184
+ */
185
+
186
+ button,
187
+ select { /* 1 */
188
+ text-transform: none;
189
+ }
190
+
191
+ /**
192
+ * Correct the inability to style clickable types in iOS and Safari.
193
+ */
194
+
195
+ button,
196
+ [type="button"],
197
+ [type="reset"],
198
+ [type="submit"] {
199
+ -webkit-appearance: button;
200
+ }
201
+
202
+ /**
203
+ * Remove the inner border and padding in Firefox.
204
+ */
205
+
206
+ button::-moz-focus-inner,
207
+ [type="button"]::-moz-focus-inner,
208
+ [type="reset"]::-moz-focus-inner,
209
+ [type="submit"]::-moz-focus-inner {
210
+ border-style: none;
211
+ padding: 0;
212
+ }
213
+
214
+ /**
215
+ * Restore the focus styles unset by the previous rule.
216
+ */
217
+
218
+ button:-moz-focusring,
219
+ [type="button"]:-moz-focusring,
220
+ [type="reset"]:-moz-focusring,
221
+ [type="submit"]:-moz-focusring {
222
+ outline: 1px dotted ButtonText;
223
+ }
224
+
225
+ /**
226
+ * Correct the padding in Firefox.
227
+ */
228
+
229
+ fieldset {
230
+ padding: 0.35em 0.75em 0.625em;
231
+ }
232
+
233
+ /**
234
+ * 1. Correct the text wrapping in Edge and IE.
235
+ * 2. Correct the color inheritance from `fieldset` elements in IE.
236
+ * 3. Remove the padding so developers are not caught out when they zero out
237
+ * `fieldset` elements in all browsers.
238
+ */
239
+
240
+ legend {
241
+ box-sizing: border-box; /* 1 */
242
+ color: inherit; /* 2 */
243
+ display: table; /* 1 */
244
+ max-width: 100%; /* 1 */
245
+ padding: 0; /* 3 */
246
+ white-space: normal; /* 1 */
247
+ }
248
+
249
+ /**
250
+ * Add the correct vertical alignment in Chrome, Firefox, and Opera.
251
+ */
252
+
253
+ progress {
254
+ vertical-align: baseline;
255
+ }
256
+
257
+ /**
258
+ * Remove the default vertical scrollbar in IE 10+.
259
+ */
260
+
261
+ textarea {
262
+ overflow: auto;
263
+ }
264
+
265
+ /**
266
+ * 1. Add the correct box sizing in IE 10.
267
+ * 2. Remove the padding in IE 10.
268
+ */
269
+
270
+ [type="checkbox"],
271
+ [type="radio"] {
272
+ box-sizing: border-box; /* 1 */
273
+ padding: 0; /* 2 */
274
+ }
275
+
276
+ /**
277
+ * Correct the cursor style of increment and decrement buttons in Chrome.
278
+ */
279
+
280
+ [type="number"]::-webkit-inner-spin-button,
281
+ [type="number"]::-webkit-outer-spin-button {
282
+ height: auto;
283
+ }
284
+
285
+ /**
286
+ * 1. Correct the odd appearance in Chrome and Safari.
287
+ * 2. Correct the outline style in Safari.
288
+ */
289
+
290
+ [type="search"] {
291
+ -webkit-appearance: textfield; /* 1 */
292
+ outline-offset: -2px; /* 2 */
293
+ }
294
+
295
+ /**
296
+ * Remove the inner padding in Chrome and Safari on macOS.
297
+ */
298
+
299
+ [type="search"]::-webkit-search-decoration {
300
+ -webkit-appearance: none;
301
+ }
302
+
303
+ /**
304
+ * 1. Correct the inability to style clickable types in iOS and Safari.
305
+ * 2. Change font properties to `inherit` in Safari.
306
+ */
307
+
308
+ ::-webkit-file-upload-button {
309
+ -webkit-appearance: button; /* 1 */
310
+ font: inherit; /* 2 */
311
+ }
312
+
313
+ /* Interactive
314
+ ========================================================================== */
315
+
316
+ /*
317
+ * Add the correct display in Edge, IE 10+, and Firefox.
318
+ */
319
+
320
+ details {
321
+ display: block;
322
+ }
323
+
324
+ /*
325
+ * Add the correct display in all browsers.
326
+ */
327
+
328
+ summary {
329
+ display: list-item;
330
+ }
331
+
332
+ /* Misc
333
+ ========================================================================== */
334
+
335
+ /**
336
+ * Add the correct display in IE 10+.
337
+ */
338
+
339
+ template {
340
+ display: none;
341
+ }
342
+
343
+ /**
344
+ * Add the correct display in IE 10.
345
+ */
346
+
347
+ [hidden] {
348
+ display: none;
349
+ }
@@ -0,0 +1,20 @@
1
+ /****** Elad Shechter's RESET *******/
2
+ /*** box sizing border-box for all elements ***/
3
+ html {
4
+ font-size: 16px;
5
+ }
6
+ body {
7
+ font-family: $font-roboto;
8
+ }
9
+ *,
10
+ *::before,
11
+ *::after{box-sizing:border-box;}
12
+ a{text-decoration:none; color:inherit; cursor:pointer;}
13
+ button{background-color:transparent; color:inherit; border-width:0; padding:0; cursor:pointer;}
14
+ figure{margin:0;}
15
+ input::-moz-focus-inner {border:0; padding:0; margin:0;}
16
+ ul, ol, dd{margin:0; padding:0; list-style:none;}
17
+ h1, h2, h3, h4, h5, h6{margin:0; font-size:inherit; font-weight:inherit;}
18
+ p{margin:0;}
19
+ cite {font-style:normal;}
20
+ fieldset{border-width:0; padding:0; margin:0;}
@@ -0,0 +1,2 @@
1
+ @import 'normalize';
2
+ @import 'reset';
@@ -0,0 +1,29 @@
1
+ import Color from 'color';
2
+
3
+ // See this link that explains why we had to implement lightenBy and darkenBy https://github.com/Qix-/color/issues/53#issuecomment-487822576
4
+ function lightenBy(color, ratio) {
5
+ const lightness = color.lightness();
6
+ return color.lightness(lightness + (100 - lightness) * ratio);
7
+ }
8
+
9
+ function darkenBy(color, ratio) {
10
+ const lightness = color.lightness();
11
+ return color.lightness(lightness - lightness * ratio);
12
+ }
13
+
14
+ export default function (hex) {
15
+ const color = Color(hex);
16
+ let newColor = color;
17
+ let contrast;
18
+ do {
19
+ if (color.luminosity() < 0.5) {
20
+ newColor = lightenBy(newColor, 0.05);
21
+ } else {
22
+ newColor = darkenBy(newColor, 0.05);
23
+ }
24
+ contrast = color.contrast(newColor);
25
+
26
+ // newColor.luminosity() can return 0.9999..99 when newColor is white but reinstanciating Color with the hexacode #FFFFFF returns 1
27
+ } while (contrast < 4.5 && Color(newColor.hex()).luminosity() < 1);
28
+ return newColor.hex();
29
+ }
@@ -0,0 +1 @@
1
+ export { default } from '@1024pix/pix-ui/components/pix-indicator-card';
@@ -1,11 +1,7 @@
1
1
  import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
2
  import * as stories from './pix-block.stories.js';
3
3
 
4
- <Meta
5
- title='Layout/Block'
6
- component='PixBlock'
7
- argTypes={stories.argTypes}
8
- />
4
+ <Meta title="Layout/Block" component="PixBlock" argTypes={stories.argTypes} />
9
5
 
10
6
  # Pix Block
11
7
 
@@ -21,18 +17,16 @@ Un \`Block\` est un bloc de fond blanc dont les bords sont arrondis et ayant une
21
17
  <Story name="Block" story={stories.block} height={60} />
22
18
  </Canvas>
23
19
 
24
-
25
20
  ## Usage
26
21
 
27
22
  ```html
28
23
  <PixBlock @shadow="light">
29
- <div> Un bloc avec une ombre faible </div>
24
+ <div>Un bloc avec une ombre faible</div>
30
25
  </PixBlock>
31
26
 
32
27
  <PixBlock @shadow="heavy">
33
- <div> Un bloc avec une ombre forte </div>
28
+ <div>Un bloc avec une ombre forte</div>
34
29
  </PixBlock>
35
-
36
30
  ```
37
31
 
38
32
  ## Arguments
@@ -9,7 +9,7 @@ export const Template = (args) => {
9
9
  @labelSize={{this.labelSize}}
10
10
  @checked={{this.checked}}
11
11
  >
12
- {{label}}
12
+ {{this.label}}
13
13
  </PixCheckbox>`,
14
14
  context: args,
15
15
  };
@@ -0,0 +1,57 @@
1
+ import { hbs } from 'ember-cli-htmlbars';
2
+
3
+ const Template = (args) => {
4
+ return {
5
+ template: hbs`
6
+ <div style="min-width:300px">
7
+ <PixIndicatorCard
8
+ @title={{this.title}}
9
+ @color={{this.color}}
10
+ @icon={{this.icon}}
11
+ @info={{this.info}}
12
+ @isLoading={{this.isLoading}}
13
+ @loadingMessage={{this.loadingMessage}}
14
+ >
15
+ <:default>{{this.value}}</:default>
16
+ <:sub>
17
+ <span>En cours : 1</span><span>En attente : 2</span><span>Envoyés : 3</span>
18
+ </:sub>
19
+ </PixIndicatorCard>
20
+ </div>`,
21
+ context: args,
22
+ };
23
+ };
24
+
25
+ export const Default = Template.bind({});
26
+ Default.args = {
27
+ title: 'Hello Dedans',
28
+ color: 'purple',
29
+ icon: 'circle-question',
30
+ value: '42',
31
+ info: "Coucou la bulle d'infos",
32
+ isLoading: false,
33
+ loadingMessage: 'texte de chargement ScreenReader',
34
+ };
35
+
36
+ export const argTypes = {
37
+ title: {
38
+ name: 'Title',
39
+ description: 'Titre de la carte',
40
+ },
41
+ color: {
42
+ name: 'Color',
43
+ description: "Couleur de l'icone",
44
+ },
45
+ icon: {
46
+ name: 'Icon',
47
+ description: "Icone dans l'encart",
48
+ },
49
+ value: {
50
+ name: 'Value',
51
+ description: 'Contenu principal',
52
+ },
53
+ info: {
54
+ name: 'Info',
55
+ description: "Contenu de la bulle d'info",
56
+ },
57
+ };
@@ -0,0 +1,38 @@
1
+ import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks';
2
+ import * as stories from './pix-indicator-card.stories.js';
3
+
4
+ <Meta title="Others/Indicator Card" component="PixIndicatorCard" argTypes={stories.argTypes} />
5
+
6
+ # Pix Indicator Card
7
+
8
+ Une carte est un bloc en 2 parties dont les bords sont arrondis et ayant une ombre projetée.
9
+
10
+ > La carte adapte la couleur de fond avec la couleur de l'icone passée en paramètre.
11
+
12
+ > La carte peut contenir un titre, une tooltip ainsi que des infos complémentaires.
13
+
14
+ ## Default
15
+
16
+ <Canvas>
17
+ <Story name="Default" story={stories.Default} height={200} />
18
+ </Canvas>
19
+
20
+ ## Usage
21
+
22
+ ```html
23
+ <PixIndicatorCard
24
+ @title={{this.title}}
25
+ @color={{this.color}}
26
+ @icon={{this.icon}}
27
+ @info={{this.info}}
28
+ @isLoading={{this.isLoading}}
29
+ @loadingMessage={{this.loadingMessage}}
30
+ >
31
+ <:default>{{this.value}}</:default>
32
+ <:sub>
33
+ <span>En cours : 1</span><span>En attente : 2</span><span>Envoyés : 3</span>
34
+ </:sub>
35
+ </PixIndicatorCard>
36
+ ```
37
+
38
+ <ArgsTable story="Default" />
@@ -8,7 +8,7 @@ const Template = (args) => ({
8
8
  border : none;
9
9
  }
10
10
  </style>
11
- <h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
11
+ <h4><strong>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</strong></h4>
12
12
  {{#if this.id}}
13
13
  <div>
14
14
  <label for={{this.id}}>Un label en dehors du composant</label>
@@ -54,7 +54,7 @@ Default.args = {
54
54
  export const multiSelectWithChildComponent = (args) => {
55
55
  return {
56
56
  template: hbs`
57
- <h4>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</h4>
57
+ <h4><strong>⚠️ La sélection des éléments ne fonctionne pas dans Storybook.</strong></h4>
58
58
  <PixMultiSelect
59
59
  @label={{this.label}}
60
60
  @placeholder={{this.placeholder}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "23.2.1",
3
+ "version": "24.0.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"
@@ -23,7 +23,7 @@
23
23
  "test": "tests"
24
24
  },
25
25
  "scripts": {
26
- "build": "./scripts/build.sh && npm run signal-github",
26
+ "build": "./scripts/build.sh",
27
27
  "build-ember": "ember build --environment=production",
28
28
  "build-storybook": "ember build && cp -v CNAME dist && build-storybook -s dist",
29
29
  "clean": "rm -rf dist node_modules",
@@ -39,10 +39,10 @@
39
39
  "storybook": "ember build && ember serve & start-storybook -p 9001 -s dist",
40
40
  "test": "ember test",
41
41
  "test:ember": "ember test",
42
- "test:ember-compatibility": "ember try:each",
43
- "signal-github": "./scripts/signal-deploy-to-pr.sh"
42
+ "test:ember-compatibility": "ember try:each"
44
43
  },
45
44
  "dependencies": {
45
+ "color": "^4.2.3",
46
46
  "ember-cli-babel": "^7.26.8",
47
47
  "ember-cli-htmlbars": "^6.1.1",
48
48
  "ember-cli-sass": "^11.0.1",
@@ -82,6 +82,7 @@
82
82
  "core-js": "^3.26.1",
83
83
  "ember-auto-import": "^2.5.0",
84
84
  "ember-cli": "^4.8.0",
85
+ "ember-cli-cjs-transform": "^2.0.0",
85
86
  "ember-cli-dependency-checker": "^3.3.1",
86
87
  "ember-cli-inject-live-reload": "^2.1.0",
87
88
  "ember-cli-sri": "^2.1.1",
@@ -1,3 +0,0 @@
1
- .pix-button-link {
2
- @import 'reset-css';
3
- }
@@ -1,30 +0,0 @@
1
- ul, ol, li, form, fieldset, legend
2
- {
3
- margin: 0;
4
- padding: 0;
5
- }
6
-
7
- h1, h2, h3, h4, h5, h6, p { margin-top: 0; }
8
-
9
- fieldset,img { border: 0; }
10
-
11
- legend { color: #000; }
12
-
13
- li { list-style: none; }
14
-
15
- sup { vertical-align: text-top; }
16
-
17
- sub { vertical-align: text-bottom; }
18
-
19
- table
20
- {
21
- border-collapse: collapse;
22
- border-spacing: 0;
23
- }
24
-
25
- caption, th, td
26
- {
27
- text-align: left;
28
- vertical-align: top;
29
- font-weight: normal;
30
- }