@1024pix/pix-ui 58.4.2 → 58.4.4
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.
- package/addon/components/pix-accordions.gjs +81 -0
- package/addon/components/pix-app-layout.gjs +1 -1
- package/addon/components/pix-background-header.gjs +15 -0
- package/addon/components/{pix-banner-alert.js → pix-banner-alert.gjs} +49 -0
- package/addon/components/{pix-block.js → pix-block.gjs} +18 -0
- package/addon/components/pix-breadcrumb.gjs +40 -0
- package/addon/components/pix-button/pix-button-content.gjs +21 -0
- package/addon/components/pix-button-link.gjs +49 -0
- package/addon/components/{pix-button-upload.js → pix-button-upload.gjs} +15 -0
- package/addon/components/{pix-button.js → pix-button.gjs} +30 -0
- package/addon/components/{pix-checkbox.js → pix-checkbox.gjs} +42 -1
- package/addon/components/pix-code.gjs +59 -0
- package/addon/components/{pix-filterable-and-searchable-select.js → pix-filterable-and-searchable-select.gjs} +55 -0
- package/addon/components/pix-gauge.gjs +199 -0
- package/addon/components/{pix-icon-button.js → pix-icon-button.gjs} +21 -0
- package/addon/components/{pix-icon.js → pix-icon.gjs} +19 -0
- package/addon/components/pix-indicator-card.gjs +68 -0
- package/addon/components/{pix-input-code.js → pix-input-code.gjs} +29 -0
- package/addon/components/pix-input-password.gjs +102 -0
- package/addon/components/pix-input.gjs +57 -0
- package/addon/components/pix-label-wrapped.gjs +64 -0
- package/addon/components/pix-modal.gjs +55 -0
- package/addon/components/pix-navigation-separator.gjs +1 -0
- package/addon/components/{pix-navigation.js → pix-navigation.gjs} +49 -0
- package/addon/components/{pix-notification-alert.js → pix-notification-alert.gjs} +19 -0
- package/addon/components/pix-overlay.gjs +31 -0
- package/addon/components/{pix-pagination.js → pix-pagination.gjs} +58 -0
- package/addon/components/{pix-progress-bar.js → pix-progress-bar.gjs} +22 -0
- package/addon/components/{pix-radio-button.js → pix-radio-button.gjs} +42 -0
- package/addon/components/{pix-search-input.js → pix-search-input.gjs} +31 -0
- package/addon/components/pix-select-list.gjs +166 -0
- package/addon/components/pix-selectable-tag.gjs +23 -0
- package/addon/components/pix-sidebar.gjs +49 -0
- package/addon/components/pix-stars.gjs +34 -0
- package/addon/components/pix-structure-switcher.gjs +107 -0
- package/addon/components/{pix-table-column.js → pix-table-column.gjs} +33 -0
- package/addon/components/{pix-tabs.js → pix-tabs.gjs} +6 -0
- package/addon/components/pix-textarea.gjs +68 -0
- package/addon/components/pix-toast-container.gjs +16 -0
- package/addon/components/{pix-toast.js → pix-toast.gjs} +25 -0
- package/addon/components/pix-tooltip.gjs +82 -0
- package/addon/components/{toast-example.js → toast-example.gjs} +13 -0
- package/package.json +1 -1
- package/addon/components/pix-accordions.hbs +0 -48
- package/addon/components/pix-accordions.js +0 -26
- package/addon/components/pix-background-header.hbs +0 -7
- package/addon/components/pix-background-header.js +0 -5
- package/addon/components/pix-banner-alert.hbs +0 -38
- package/addon/components/pix-block.hbs +0 -8
- package/addon/components/pix-breadcrumb.hbs +0 -21
- package/addon/components/pix-breadcrumb.js +0 -12
- package/addon/components/pix-button/pix-button-content.hbs +0 -17
- package/addon/components/pix-button-link.hbs +0 -32
- package/addon/components/pix-button-link.js +0 -10
- package/addon/components/pix-button-upload.hbs +0 -11
- package/addon/components/pix-button.hbs +0 -25
- package/addon/components/pix-checkbox.hbs +0 -37
- package/addon/components/pix-code.hbs +0 -31
- package/addon/components/pix-code.js +0 -24
- package/addon/components/pix-filterable-and-searchable-select.hbs +0 -48
- package/addon/components/pix-gauge.hbs +0 -98
- package/addon/components/pix-gauge.js +0 -96
- package/addon/components/pix-icon-button.hbs +0 -15
- package/addon/components/pix-icon.hbs +0 -15
- package/addon/components/pix-indicator-card.hbs +0 -47
- package/addon/components/pix-indicator-card.js +0 -14
- package/addon/components/pix-input-code.hbs +0 -24
- package/addon/components/pix-input-password.hbs +0 -68
- package/addon/components/pix-input-password.js +0 -28
- package/addon/components/pix-input.hbs +0 -38
- package/addon/components/pix-input.js +0 -14
- package/addon/components/pix-label-wrapped.hbs +0 -32
- package/addon/components/pix-label-wrapped.js +0 -27
- package/addon/components/pix-modal.hbs +0 -33
- package/addon/components/pix-modal.js +0 -16
- package/addon/components/pix-navigation-separator.hbs +0 -1
- package/addon/components/pix-navigation.hbs +0 -43
- package/addon/components/pix-notification-alert.hbs +0 -13
- package/addon/components/pix-overlay.hbs +0 -11
- package/addon/components/pix-overlay.js +0 -13
- package/addon/components/pix-pagination.hbs +0 -52
- package/addon/components/pix-progress-bar.hbs +0 -19
- package/addon/components/pix-radio-button.hbs +0 -37
- package/addon/components/pix-search-input.hbs +0 -25
- package/addon/components/pix-select-list.hbs +0 -115
- package/addon/components/pix-select-list.js +0 -41
- package/addon/components/pix-selectable-tag.hbs +0 -10
- package/addon/components/pix-selectable-tag.js +0 -9
- package/addon/components/pix-sidebar.hbs +0 -28
- package/addon/components/pix-sidebar.js +0 -16
- package/addon/components/pix-stars.hbs +0 -17
- package/addon/components/pix-stars.js +0 -13
- package/addon/components/pix-structure-switcher.hbs +0 -41
- package/addon/components/pix-structure-switcher.js +0 -54
- package/addon/components/pix-table-column.hbs +0 -28
- package/addon/components/pix-tabs.hbs +0 -3
- package/addon/components/pix-textarea.hbs +0 -36
- package/addon/components/pix-textarea.js +0 -23
- package/addon/components/pix-toast-container.hbs +0 -5
- package/addon/components/pix-toast-container.js +0 -6
- package/addon/components/pix-toast.hbs +0 -17
- package/addon/components/pix-tooltip.hbs +0 -30
- package/addon/components/pix-tooltip.js +0 -46
- package/addon/components/toast-example.hbs +0 -7
- /package/addon/components/{pix-button-base.js → pix-button-base.gjs} +0 -0
- /package/addon/components/{pix-input-base.js → pix-input-base.gjs} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { warn } from '@ember/debug';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
import { eq } from 'ember-truth-helpers';
|
|
4
|
+
|
|
5
|
+
export default class PixGauge extends Component {
|
|
6
|
+
get label() {
|
|
7
|
+
warn('PixGauge: @label must be defined', !this.args.label, {
|
|
8
|
+
id: 'pix-ui.gauge.label.not-defined',
|
|
9
|
+
});
|
|
10
|
+
return this.args.label;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get reachedLevel() {
|
|
14
|
+
warn(
|
|
15
|
+
'PixGauge: @reachedLevel must be between 0 and 8',
|
|
16
|
+
this.args.reachedLevel <= 8 || this.args.reachedLevel >= 0,
|
|
17
|
+
{
|
|
18
|
+
id: 'pix-ui.gauge.reachedLevel.not-defined',
|
|
19
|
+
},
|
|
20
|
+
);
|
|
21
|
+
return this.args.reachedLevel;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get maxLevel() {
|
|
25
|
+
warn(
|
|
26
|
+
'PixGauge: @maxLevel must be between 1 and 8',
|
|
27
|
+
this.args.maxLevel <= 8 || this.args.maxLevel >= 1,
|
|
28
|
+
{
|
|
29
|
+
id: 'pix-ui.gauge.maxLevel.not-defined',
|
|
30
|
+
},
|
|
31
|
+
);
|
|
32
|
+
return this.args.maxLevel;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get hideValues() {
|
|
36
|
+
return this.args.hideValues ?? false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get maxLevelPourcentage() {
|
|
40
|
+
return this.maxLevel / 8;
|
|
41
|
+
}
|
|
42
|
+
get viewBox() {
|
|
43
|
+
if (this.args.isSmall) {
|
|
44
|
+
return '0 22 200 32';
|
|
45
|
+
}
|
|
46
|
+
return '0 0 100% 70';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get reachedLevelPercentage() {
|
|
50
|
+
return this.reachedLevel / 8;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get whiteAndPurpleGaugeRx() {
|
|
54
|
+
return this.args.isSmall ? 12 : 20;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get whiteAndPurpleGaugesHeight() {
|
|
58
|
+
return this.args.isSmall ? 24 : 40;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// background
|
|
62
|
+
get greyGaugeRx() {
|
|
63
|
+
return this.args.isSmall ? 16 : 24;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get backgroundHeight() {
|
|
67
|
+
return this.args.isSmall ? 32 : 48;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get statsFontHeight() {
|
|
71
|
+
return this.args.isSmall ? 18 : 26;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
isLevelActive = (index) => {
|
|
75
|
+
if (this.reachedLevel === 0 && index === 0) return true;
|
|
76
|
+
const step = 8 / this.args.stepLabels.length;
|
|
77
|
+
return index * step < this.reachedLevel && this.reachedLevel <= (index + 1) * step;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
stepLabelX = (index) => {
|
|
81
|
+
const stepStart = 1 / this.args.stepLabels.length;
|
|
82
|
+
return `${stepStart * index + (1 / 2) * stepStart}`;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
stepLineX = (index) => {
|
|
86
|
+
const stepStart = 1 / this.args.stepLabels.length;
|
|
87
|
+
return `${stepStart * index}`;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
formatNumber = (str) => {
|
|
91
|
+
const num = Number(str);
|
|
92
|
+
const oneDigitNum = num.toFixed(1);
|
|
93
|
+
if (oneDigitNum.toString().endsWith('0')) {
|
|
94
|
+
return Math.ceil(oneDigitNum);
|
|
95
|
+
}
|
|
96
|
+
return oneDigitNum;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
<template>
|
|
100
|
+
<svg
|
|
101
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
|
102
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
103
|
+
viewBox={{this.viewBox}}
|
|
104
|
+
version="1.1"
|
|
105
|
+
preserveAspectRatio="none"
|
|
106
|
+
class="result-level-gauge {{if @isSmall 'result-level-gauge__small'}}"
|
|
107
|
+
role="progressbar"
|
|
108
|
+
aria-valuenow={{this.formatNumber this.reachedLevel}}
|
|
109
|
+
aria-valuemin={{0}}
|
|
110
|
+
aria-valuemax={{this.formatNumber this.maxLevel}}
|
|
111
|
+
aria-valuetext={{this.label}}
|
|
112
|
+
aria-label={{this.label}}
|
|
113
|
+
>
|
|
114
|
+
<title {{this.label}}></title>
|
|
115
|
+
|
|
116
|
+
{{! gauge grey background}}
|
|
117
|
+
<rect
|
|
118
|
+
y={{22}}
|
|
119
|
+
width="100%"
|
|
120
|
+
height={{this.backgroundHeight}}
|
|
121
|
+
rx={{this.greyGaugeRx}}
|
|
122
|
+
class="result-level-gauge__background"
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
<g transform="translate(4, 0)">
|
|
126
|
+
{{! template-lint-disable no-inline-styles style-concatenation }}
|
|
127
|
+
{{! gauge white max level}}
|
|
128
|
+
<rect
|
|
129
|
+
y={{26}}
|
|
130
|
+
width="calc(calc(100% - 8px) * {{this.maxLevelPourcentage}})"
|
|
131
|
+
height={{this.whiteAndPurpleGaugesHeight}}
|
|
132
|
+
rx={{this.whiteAndPurpleGaugeRx}}
|
|
133
|
+
class="result-level-gauge__max-bar"
|
|
134
|
+
/>
|
|
135
|
+
{{#unless this.hideValues}}
|
|
136
|
+
<g style="transform: translate(calc(calc(100% - 8px) * {{this.maxLevelPourcentage}}))">
|
|
137
|
+
<text
|
|
138
|
+
y={{this.statsFontHeight}}
|
|
139
|
+
x="0"
|
|
140
|
+
dx={{-10}}
|
|
141
|
+
dy={{26}}
|
|
142
|
+
class="result-level-gauge__max-value"
|
|
143
|
+
aria-hidden={{this.hideValues}}
|
|
144
|
+
>{{this.formatNumber @maxLevel}}</text>
|
|
145
|
+
</g>
|
|
146
|
+
{{/unless}}
|
|
147
|
+
{{! mean purple level }}
|
|
148
|
+
<rect
|
|
149
|
+
y={{26}}
|
|
150
|
+
width="max(calc(calc(100% - 8px) * {{this.reachedLevelPercentage}}), 44px)"
|
|
151
|
+
height={{this.whiteAndPurpleGaugesHeight}}
|
|
152
|
+
rx={{this.whiteAndPurpleGaugeRx}}
|
|
153
|
+
class="result-level-gauge__mean-bar"
|
|
154
|
+
/>
|
|
155
|
+
{{#unless this.hideValues}}
|
|
156
|
+
<g
|
|
157
|
+
style="transform: translate(max(calc(calc(100% - 8px) * {{this.reachedLevelPercentage}}), 44px))"
|
|
158
|
+
>
|
|
159
|
+
<text
|
|
160
|
+
y={{this.statsFontHeight}}
|
|
161
|
+
x="0"
|
|
162
|
+
dx={{-10}}
|
|
163
|
+
dy={{26}}
|
|
164
|
+
class="result-level-gauge__mean-value"
|
|
165
|
+
aria-hidden={{this.hideValues}}
|
|
166
|
+
>{{this.formatNumber @reachedLevel}}</text>
|
|
167
|
+
</g>
|
|
168
|
+
{{/unless}}
|
|
169
|
+
{{! level labels }}
|
|
170
|
+
{{#unless @isSmall}}
|
|
171
|
+
{{#each @stepLabels as |stepLabel index|}}
|
|
172
|
+
<g style="transform: translate(calc(calc(100% - 8px) * {{this.stepLabelX index}}))">
|
|
173
|
+
<text
|
|
174
|
+
y={{15}}
|
|
175
|
+
class="result-level-gauge__rank
|
|
176
|
+
{{if (this.isLevelActive index) 'result-level-gauge__rank--active'}}"
|
|
177
|
+
>{{stepLabel}}</text>
|
|
178
|
+
</g>
|
|
179
|
+
{{#unless (eq index 0)}}
|
|
180
|
+
<g style="transform: translate(calc(100% * {{this.stepLineX index}}))">
|
|
181
|
+
<line
|
|
182
|
+
x1="0"
|
|
183
|
+
y1={{7}}
|
|
184
|
+
x2="0"
|
|
185
|
+
y2="74.6641"
|
|
186
|
+
stroke-width={{2}}
|
|
187
|
+
stroke-linecap="round"
|
|
188
|
+
stroke-dasharray="2 8"
|
|
189
|
+
class="result-level-gauge__separator"
|
|
190
|
+
role="separator"
|
|
191
|
+
/>
|
|
192
|
+
</g>
|
|
193
|
+
{{/unless}}
|
|
194
|
+
{{/each}}
|
|
195
|
+
{{/unless}}
|
|
196
|
+
</g>
|
|
197
|
+
</svg>
|
|
198
|
+
</template>
|
|
199
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
2
3
|
import { action } from '@ember/object';
|
|
3
4
|
import Component from '@glimmer/component';
|
|
4
5
|
|
|
6
|
+
import PixIcon from './pix-icon';
|
|
7
|
+
|
|
5
8
|
export default class PixIconButton extends Component {
|
|
6
9
|
text = 'pix-icon-button';
|
|
7
10
|
|
|
@@ -45,4 +48,22 @@ export default class PixIconButton extends Component {
|
|
|
45
48
|
this.args.triggerAction(params);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<button
|
|
54
|
+
type="button"
|
|
55
|
+
class="pix-icon-button pix-icon-button--{{this.size}}"
|
|
56
|
+
{{on "click" this.triggerAction}}
|
|
57
|
+
aria-disabled="{{this.isDisabled}}"
|
|
58
|
+
...attributes
|
|
59
|
+
>
|
|
60
|
+
<span class="screen-reader-only">{{this.ariaLabel}}</span>
|
|
61
|
+
<PixIcon
|
|
62
|
+
class="pix-icon-button__icon pix-icon-button__icon--{{this.size}}"
|
|
63
|
+
@ariaHidden={{true}}
|
|
64
|
+
@name={{@iconName}}
|
|
65
|
+
@plainIcon={{@plainIcon}}
|
|
66
|
+
/>
|
|
67
|
+
</button>
|
|
68
|
+
</template>
|
|
48
69
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ICONS } from '@1024pix/pix-ui/helpers/icons';
|
|
2
2
|
import { warn } from '@ember/debug';
|
|
3
|
+
import { uniqueId } from '@ember/helper';
|
|
3
4
|
import Component from '@glimmer/component';
|
|
4
5
|
|
|
5
6
|
export default class PixIcon extends Component {
|
|
@@ -45,4 +46,22 @@ export default class PixIcon extends Component {
|
|
|
45
46
|
|
|
46
47
|
return this.args.plainIcon && Boolean(icon.plainIcon) ? icon.plainIcon : icon.default;
|
|
47
48
|
}
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
{{#let (uniqueId) as |titleId|}}
|
|
52
|
+
<svg
|
|
53
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
54
|
+
aria-hidden={{this.ariaHidden}}
|
|
55
|
+
role="img"
|
|
56
|
+
class="pix-icon"
|
|
57
|
+
aria-describedby={{if this.title titleId}}
|
|
58
|
+
...attributes
|
|
59
|
+
>
|
|
60
|
+
{{#if this.title}}
|
|
61
|
+
<title id={{titleId}}>{{this.title}}</title>
|
|
62
|
+
{{/if}}
|
|
63
|
+
<use href="/@1024pix/pix-ui/svg/pix-sprite.svg#{{this.iconName}}" />
|
|
64
|
+
</svg>
|
|
65
|
+
{{/let}}
|
|
66
|
+
</template>
|
|
48
67
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { guidFor } from '@ember/object/internals';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
|
|
4
|
+
import PixBlock from './pix-block';
|
|
5
|
+
import PixIcon from './pix-icon';
|
|
6
|
+
import PixTooltip from './pix-tooltip';
|
|
7
|
+
|
|
8
|
+
export default class PixIndicatorCard extends Component {
|
|
9
|
+
id = guidFor(this);
|
|
10
|
+
iconId = 'icon-' + this.id;
|
|
11
|
+
tooltipId = 'tooltip-' + this.id;
|
|
12
|
+
|
|
13
|
+
get color() {
|
|
14
|
+
const { color } = this.args;
|
|
15
|
+
if (!color) return `indicator-card__icon-wrapper--grey`;
|
|
16
|
+
return `indicator-card__icon-wrapper--${color}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<PixBlock @variant="orga" class="indicator-card" role="region" ...attributes>
|
|
21
|
+
{{#if @isLoading}}
|
|
22
|
+
<p class="screen-reader-only">{{@loadingMessage}}</p>
|
|
23
|
+
<div class="indicator-card__icon" aria-hidden="true"></div>
|
|
24
|
+
<div class="indicator-card__content" aria-hidden="true"></div>
|
|
25
|
+
{{else}}
|
|
26
|
+
<div id={{this.iconId}} class="indicator-card__icon-wrapper {{this.color}}">
|
|
27
|
+
<PixIcon
|
|
28
|
+
@name={{@iconName}}
|
|
29
|
+
@plainIcon={{@plainIcon}}
|
|
30
|
+
@ariaHidden={{true}}
|
|
31
|
+
class="indicator-card__icon"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
<dl class="indicator-card__content">
|
|
35
|
+
<div class="indicator-card__title">
|
|
36
|
+
<dt>{{@title}}</dt>
|
|
37
|
+
{{#if @info}}
|
|
38
|
+
<PixTooltip
|
|
39
|
+
@id={{this.tooltipId}}
|
|
40
|
+
@position="top"
|
|
41
|
+
@isWide={{true}}
|
|
42
|
+
class="indicator-card__tooltip hide-on-mobile"
|
|
43
|
+
>
|
|
44
|
+
<:triggerElement>
|
|
45
|
+
<PixIcon
|
|
46
|
+
@name="info"
|
|
47
|
+
@plainIcon={{true}}
|
|
48
|
+
class="indicator-card__tooltip-icon"
|
|
49
|
+
tabindex="0"
|
|
50
|
+
aria-label={{@infoLabel}}
|
|
51
|
+
aria-describedby={{this.tooltipId}}
|
|
52
|
+
/>
|
|
53
|
+
</:triggerElement>
|
|
54
|
+
<:tooltip>
|
|
55
|
+
{{@info}}
|
|
56
|
+
</:tooltip>
|
|
57
|
+
</PixTooltip>
|
|
58
|
+
{{/if}}
|
|
59
|
+
</div>
|
|
60
|
+
<dd class="indicator-card__value">{{yield}}</dd>
|
|
61
|
+
<p class="indicator-card__sub">
|
|
62
|
+
{{yield to="sub"}}
|
|
63
|
+
</p>
|
|
64
|
+
</dl>
|
|
65
|
+
{{/if}}
|
|
66
|
+
</PixBlock>
|
|
67
|
+
</template>
|
|
68
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fn } from '@ember/helper';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
1
3
|
import { action } from '@ember/object';
|
|
2
4
|
import Component from '@glimmer/component';
|
|
3
5
|
|
|
@@ -131,6 +133,33 @@ export default class PixInputCode extends Component {
|
|
|
131
133
|
const element = document.getElementById(`code-input-${index}`);
|
|
132
134
|
element && element.select();
|
|
133
135
|
}
|
|
136
|
+
|
|
137
|
+
<template>
|
|
138
|
+
<div class="pix-input-code">
|
|
139
|
+
<fieldset aria-describedby="pix-input-code__details-of-use">
|
|
140
|
+
<p id="pix-input-code__details-of-use">{{this.explanationOfUse}}</p>
|
|
141
|
+
<legend>{{this.legend}}</legend>
|
|
142
|
+
{{#each this.numberOfIterations as |i|}}
|
|
143
|
+
<input
|
|
144
|
+
id="code-input-{{i}}"
|
|
145
|
+
type="{{this.inputType}}"
|
|
146
|
+
aria-label="{{this.ariaLabel}} {{i}}"
|
|
147
|
+
class="pix-input-code__input"
|
|
148
|
+
min="1"
|
|
149
|
+
max="9"
|
|
150
|
+
autocomplete="off"
|
|
151
|
+
placeholder="{{this.placeholder}}"
|
|
152
|
+
{{on "keydown" this.handleArrowUpOrDown}}
|
|
153
|
+
{{on "keyup" (fn this.handleKeyUp i)}}
|
|
154
|
+
{{on "input" (fn this.handleCodeInput i)}}
|
|
155
|
+
{{on "paste" (fn this.handlePaste i)}}
|
|
156
|
+
{{on "focus" (fn this.handleFocus i)}}
|
|
157
|
+
...attributes
|
|
158
|
+
/>
|
|
159
|
+
{{/each}}
|
|
160
|
+
</fieldset>
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
134
163
|
}
|
|
135
164
|
|
|
136
165
|
function _extractValidCharacters(pastedText) {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { action } from '@ember/object';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
|
|
4
|
+
import PixIcon from './pix-icon';
|
|
5
|
+
import PixIconButton from './pix-icon-button';
|
|
6
|
+
import PixInputBase from './pix-input-base';
|
|
7
|
+
import PixLabel from './pix-label';
|
|
8
|
+
|
|
9
|
+
export default class PixInputPassword extends PixInputBase {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
|
|
13
|
+
this.prefix = 'pix-input-password';
|
|
14
|
+
this.inputValidationError = {
|
|
15
|
+
default: '',
|
|
16
|
+
error: 'pix-input-password__container--error',
|
|
17
|
+
success: 'pix-input-password__container--success',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@tracked isPasswordVisible = false;
|
|
22
|
+
|
|
23
|
+
@action
|
|
24
|
+
togglePasswordVisibility() {
|
|
25
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
26
|
+
const InputElement = document.getElementById(this.args.id);
|
|
27
|
+
if (InputElement) {
|
|
28
|
+
InputElement.focus();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div class="pix-input-password {{if @inlineLabel ' pix-input-password--inline'}}">
|
|
34
|
+
<PixLabel
|
|
35
|
+
@for={{this.id}}
|
|
36
|
+
@requiredLabel={{@requiredLabel}}
|
|
37
|
+
@size={{@size}}
|
|
38
|
+
@subLabel={{@subLabel}}
|
|
39
|
+
@screenReaderOnly={{@screenReaderOnly}}
|
|
40
|
+
@inlineLabel={{@inlineLabel}}
|
|
41
|
+
>
|
|
42
|
+
{{yield to="label"}}
|
|
43
|
+
</PixLabel>
|
|
44
|
+
<div>
|
|
45
|
+
<div
|
|
46
|
+
class="pix-input-password__container
|
|
47
|
+
{{this.validationStatusClassName}}
|
|
48
|
+
{{if @prefix 'pix-input-password__with-prefix'}}"
|
|
49
|
+
>
|
|
50
|
+
|
|
51
|
+
{{#if @prefix}}
|
|
52
|
+
<span class="pix-input-password__prefix">{{@prefix}}</span>
|
|
53
|
+
{{/if}}
|
|
54
|
+
|
|
55
|
+
<input
|
|
56
|
+
id={{this.id}}
|
|
57
|
+
type={{if this.isPasswordVisible "text" "password"}}
|
|
58
|
+
value={{@value}}
|
|
59
|
+
aria-required="{{if @requiredLabel true false}}"
|
|
60
|
+
required={{if @requiredLabel true false}}
|
|
61
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
62
|
+
...attributes
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
<PixIconButton
|
|
66
|
+
class="pix-input-password__button"
|
|
67
|
+
@iconName={{if this.isPasswordVisible "eye" "eyeOff"}}
|
|
68
|
+
@plainIcon={{true}}
|
|
69
|
+
@ariaLabel={{if
|
|
70
|
+
this.isPasswordVisible
|
|
71
|
+
"Masquer le mot de passe"
|
|
72
|
+
"Afficher le mot de passe"
|
|
73
|
+
}}
|
|
74
|
+
@triggerAction={{this.togglePasswordVisibility}}
|
|
75
|
+
@size="small"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
{{#if this.hasError}}
|
|
79
|
+
<PixIcon
|
|
80
|
+
@name="close"
|
|
81
|
+
@ariaHidden={{true}}
|
|
82
|
+
class="pix-input-password__icon pix-input-password__error-icon"
|
|
83
|
+
/>
|
|
84
|
+
{{/if}}
|
|
85
|
+
{{#if this.hasSuccess}}
|
|
86
|
+
<PixIcon
|
|
87
|
+
@name="check"
|
|
88
|
+
@ariaHidden={{true}}
|
|
89
|
+
class="pix-input-password__icon pix-input-password__success-icon"
|
|
90
|
+
/>
|
|
91
|
+
{{/if}}
|
|
92
|
+
</div>
|
|
93
|
+
|
|
94
|
+
{{#if this.hasErrorMessage}}
|
|
95
|
+
<p id={{this.ariaDescribedBy}} class="pix-input-password__error-message">
|
|
96
|
+
{{@errorMessage}}
|
|
97
|
+
</p>
|
|
98
|
+
{{/if}}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</template>
|
|
102
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import PixIcon from './pix-icon';
|
|
2
|
+
import PixInputBase from './pix-input-base';
|
|
3
|
+
import PixLabel from './pix-label';
|
|
4
|
+
|
|
5
|
+
export default class PixInput extends PixInputBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
|
|
9
|
+
this.prefix = 'pix-input';
|
|
10
|
+
this.inputValidationError = {
|
|
11
|
+
default: '',
|
|
12
|
+
error: 'pix-input__input--error',
|
|
13
|
+
success: 'pix-input__input--success',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class={{this.rootClassNames}}>
|
|
19
|
+
{{#if (has-block "label")}}
|
|
20
|
+
<PixLabel
|
|
21
|
+
@for={{this.id}}
|
|
22
|
+
@requiredLabel={{@requiredLabel}}
|
|
23
|
+
@subLabel={{@subLabel}}
|
|
24
|
+
@size={{@size}}
|
|
25
|
+
@screenReaderOnly={{@screenReaderOnly}}
|
|
26
|
+
@inlineLabel={{@inlineLabel}}
|
|
27
|
+
>
|
|
28
|
+
{{yield to="label"}}
|
|
29
|
+
</PixLabel>
|
|
30
|
+
{{/if}}
|
|
31
|
+
<div class="pix-input__field-container">
|
|
32
|
+
<div class="pix-input__container">
|
|
33
|
+
<input
|
|
34
|
+
id={{this.id}}
|
|
35
|
+
class="pix-input__input {{this.validationStatusClassName}}"
|
|
36
|
+
value={{@value}}
|
|
37
|
+
aria-required="{{if @requiredLabel true false}}"
|
|
38
|
+
required={{if @requiredLabel true false}}
|
|
39
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
40
|
+
...attributes
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
{{#if this.hasError}}
|
|
44
|
+
<PixIcon @name="close" class="pix-input__error-icon" @ariaHidden={{true}} />
|
|
45
|
+
{{/if}}
|
|
46
|
+
{{#if this.hasSuccess}}
|
|
47
|
+
<PixIcon @name="check" class="pix-input__success-icon" @ariaHidden={{true}} />
|
|
48
|
+
{{/if}}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
{{#if this.hasErrorMessage}}
|
|
52
|
+
<p id={{this.ariaDescribedBy}} class="pix-input__error-message">{{@errorMessage}}</p>
|
|
53
|
+
{{/if}}
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
import PixIcon from './pix-icon';
|
|
4
|
+
|
|
5
|
+
export default class PixLabelWrapped extends Component {
|
|
6
|
+
get className() {
|
|
7
|
+
const classes = ['pix-label', 'pix-label-wrapped'];
|
|
8
|
+
|
|
9
|
+
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
|
|
10
|
+
if (this.args.isDisabled) classes.push('pix-label-wrapped--disabled');
|
|
11
|
+
if (this.args.variant === 'tile') classes.push('pix-label-wrapped--variant-tile');
|
|
12
|
+
if (this.args.state === 'success') classes.push('pix-label-wrapped--state-success');
|
|
13
|
+
if (this.args.state === 'error') classes.push('pix-label-wrapped--state-error');
|
|
14
|
+
|
|
15
|
+
const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
|
|
16
|
+
|
|
17
|
+
classes.push(`pix-label--${size}`);
|
|
18
|
+
|
|
19
|
+
return classes.join(' ');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get hasError() {
|
|
23
|
+
return this.args.state === 'error';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get hasSuccess() {
|
|
27
|
+
return this.args.state === 'success';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<label for={{@for}} class={{this.className}} ...attributes>
|
|
32
|
+
{{#if this.hasError}}
|
|
33
|
+
<PixIcon
|
|
34
|
+
@name="cancel"
|
|
35
|
+
@plainIcon={{true}}
|
|
36
|
+
@ariaHidden={{true}}
|
|
37
|
+
class="pix-label-wrapped__state-icon"
|
|
38
|
+
/>
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#if this.hasSuccess}}
|
|
41
|
+
<PixIcon
|
|
42
|
+
@name="checkCircle"
|
|
43
|
+
@plainIcon={{true}}
|
|
44
|
+
@ariaHidden={{true}}
|
|
45
|
+
class="pix-label-wrapped__state-icon"
|
|
46
|
+
/>
|
|
47
|
+
{{/if}}
|
|
48
|
+
|
|
49
|
+
{{yield to="inputElement"}}
|
|
50
|
+
|
|
51
|
+
<span class="{{if @screenReaderOnly 'screen-reader-only'}}">
|
|
52
|
+
{{yield}}
|
|
53
|
+
|
|
54
|
+
{{#if @requiredLabel}}
|
|
55
|
+
<abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
|
|
56
|
+
{{/if}}
|
|
57
|
+
|
|
58
|
+
{{#if @subLabel}}
|
|
59
|
+
<span class="pix-label__sub-label">{{@subLabel}}</span>
|
|
60
|
+
{{/if}}
|
|
61
|
+
</span>
|
|
62
|
+
</label>
|
|
63
|
+
</template>
|
|
64
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { guidFor } from '@ember/object/internals';
|
|
2
|
+
import Component from '@glimmer/component';
|
|
3
|
+
|
|
4
|
+
import PixIconButton from './pix-icon-button';
|
|
5
|
+
import PixOverlay from './pix-overlay';
|
|
6
|
+
|
|
7
|
+
export default class PixModal extends Component {
|
|
8
|
+
constructor(...args) {
|
|
9
|
+
super(...args);
|
|
10
|
+
|
|
11
|
+
if (!this.args.title) {
|
|
12
|
+
throw new Error('ERROR in PixModal component: @title argument is required.');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get id() {
|
|
17
|
+
return guidFor(this);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<PixOverlay
|
|
22
|
+
@isVisible={{@showModal}}
|
|
23
|
+
@onClose={{@onCloseButtonClick}}
|
|
24
|
+
@focusOnClose={{@focusOnClose}}
|
|
25
|
+
@hasCenteredContent={{true}}
|
|
26
|
+
>
|
|
27
|
+
<div
|
|
28
|
+
class="pix-modal"
|
|
29
|
+
role="dialog"
|
|
30
|
+
aria-labelledby="modal-title--{{this.id}}"
|
|
31
|
+
aria-describedby="modal-content--{{this.id}}"
|
|
32
|
+
aria-modal="true"
|
|
33
|
+
...attributes
|
|
34
|
+
>
|
|
35
|
+
<div class="pix-modal__header">
|
|
36
|
+
<h1 id="modal-title--{{this.id}}" class="pix-modal__title">{{@title}}</h1>
|
|
37
|
+
<PixIconButton
|
|
38
|
+
@iconName="close"
|
|
39
|
+
@triggerAction={{@onCloseButtonClick}}
|
|
40
|
+
@ariaLabel="Fermer"
|
|
41
|
+
@size="small"
|
|
42
|
+
@withBackground={{true}}
|
|
43
|
+
class="pix-modal__close-button"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
<div id="modal-content--{{this.id}}" class="pix-modal__content">
|
|
47
|
+
{{yield to="content"}}
|
|
48
|
+
</div>
|
|
49
|
+
<div class="pix-modal__footer">
|
|
50
|
+
{{yield to="footer"}}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</PixOverlay>
|
|
54
|
+
</template>
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template><hr class="pix-navigation-separator" /></template>
|