@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
2
3
|
import { action } from '@ember/object';
|
|
3
4
|
import { guidFor } from '@ember/object/internals';
|
|
4
5
|
import { inject as service } from '@ember/service';
|
|
@@ -6,6 +7,8 @@ import Component from '@glimmer/component';
|
|
|
6
7
|
import { tracked } from '@glimmer/tracking';
|
|
7
8
|
|
|
8
9
|
import { formatMessage } from '../translations';
|
|
10
|
+
import PixButton from './pix-button';
|
|
11
|
+
import PixIconButton from './pix-icon-button';
|
|
9
12
|
|
|
10
13
|
export default class PixNavigation extends Component {
|
|
11
14
|
@service router;
|
|
@@ -75,4 +78,50 @@ export default class PixNavigation extends Component {
|
|
|
75
78
|
get footerId() {
|
|
76
79
|
return `${this._navigationId}-footer`;
|
|
77
80
|
}
|
|
81
|
+
|
|
82
|
+
<template>
|
|
83
|
+
<aside
|
|
84
|
+
...attributes
|
|
85
|
+
class="pix-navigation
|
|
86
|
+
{{if this.navigationMenuOpened 'pix-navigation--opened'}}
|
|
87
|
+
{{if this.shrinkNavigationService.isShrunk 'pix-navigation--shrunk'}}"
|
|
88
|
+
>
|
|
89
|
+
<header class="pix-navigation__brand">{{yield to="brand"}}
|
|
90
|
+
{{#if this.shrinkNavigationService.canNavigationBeShrunk}}
|
|
91
|
+
<div class="pix-navigation__shrunk-container">
|
|
92
|
+
<PixIconButton
|
|
93
|
+
class="pix-navigation-shrunk-button"
|
|
94
|
+
@iconName={{this.shrunkNavigationIcon}}
|
|
95
|
+
@triggerAction={{this.shrinkNavigation}}
|
|
96
|
+
@ariaLabel="{{this.shrunkNavigationAriaLabel}}"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
{{/if}}
|
|
100
|
+
<div class="pix-navigation__burger-menu"><PixButton
|
|
101
|
+
aria-controls="{{this.navigationId}} {{this.footerId}}"
|
|
102
|
+
aria-expanded={{this.navigationMenuOpened}}
|
|
103
|
+
@iconBefore={{if this.navigationMenuOpened "close" "menu"}}
|
|
104
|
+
@triggerAction={{this.toggleNavigationMenu}}
|
|
105
|
+
>
|
|
106
|
+
<span class="screen-reader-only">
|
|
107
|
+
{{#if this.navigationMenuOpened}}
|
|
108
|
+
{{@closeLabel}}
|
|
109
|
+
{{else}}
|
|
110
|
+
{{@openLabel}}
|
|
111
|
+
{{/if}}
|
|
112
|
+
</span>
|
|
113
|
+
</PixButton>
|
|
114
|
+
</div>
|
|
115
|
+
</header>
|
|
116
|
+
<nav
|
|
117
|
+
class="pix-navigation__nav"
|
|
118
|
+
{{on "click" this.closeNavigation}}
|
|
119
|
+
aria-label={{@navigationAriaLabel}}
|
|
120
|
+
id={{this.navigationId}}
|
|
121
|
+
>
|
|
122
|
+
{{yield to="navElements"}}
|
|
123
|
+
</nav>
|
|
124
|
+
<footer class="pix-navigation__footer" id={{this.footerId}}>{{yield to="footer"}}</footer>
|
|
125
|
+
</aside>
|
|
126
|
+
</template>
|
|
78
127
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { concat } from '@ember/helper';
|
|
1
2
|
import Component from '@glimmer/component';
|
|
2
3
|
|
|
4
|
+
import PixIcon from './pix-icon';
|
|
5
|
+
|
|
3
6
|
const TYPE_INFO = 'info';
|
|
4
7
|
const TYPE_SUCCESS = 'success';
|
|
5
8
|
const TYPE_WARNING = 'warning';
|
|
@@ -35,4 +38,20 @@ export default class PixNotificationAlert extends Component {
|
|
|
35
38
|
};
|
|
36
39
|
return classes[this.type];
|
|
37
40
|
}
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<p class="pix-notification-alert {{concat 'pix-notification-alert--' this.type}}" ...attributes>
|
|
44
|
+
{{#if @withIcon}}
|
|
45
|
+
<PixIcon
|
|
46
|
+
@name={{this.iconName}}
|
|
47
|
+
@ariaHidden={{true}}
|
|
48
|
+
@plainIcon={{true}}
|
|
49
|
+
class="pix-notification-alert__icon"
|
|
50
|
+
/>
|
|
51
|
+
{{/if}}
|
|
52
|
+
<span class="pix-notification-alert__content">
|
|
53
|
+
{{yield}}
|
|
54
|
+
</span>
|
|
55
|
+
</p>
|
|
56
|
+
</template>
|
|
38
57
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { on } from '@ember/modifier';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
|
|
5
|
+
import onEscapeAction from '../modifiers/on-escape-action';
|
|
6
|
+
import trapFocus from '../modifiers/trap-focus';
|
|
7
|
+
|
|
8
|
+
export default class PixOverlay extends Component {
|
|
9
|
+
@action
|
|
10
|
+
onClick(event) {
|
|
11
|
+
const isClickOnOverlay = event.target.classList.contains('pix-overlay');
|
|
12
|
+
|
|
13
|
+
if (this.args.onClose && isClickOnOverlay) {
|
|
14
|
+
this.args.onClose(event);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
<div
|
|
20
|
+
class="pix-overlay
|
|
21
|
+
{{unless @isVisible ' pix-overlay--hidden'}}
|
|
22
|
+
{{if @hasCenteredContent ' pix-overlay--with-centered-content'}}"
|
|
23
|
+
{{on "click" this.onClick}}
|
|
24
|
+
{{trapFocus @isVisible @focusOnClose}}
|
|
25
|
+
{{onEscapeAction @onClose}}
|
|
26
|
+
...attributes
|
|
27
|
+
>
|
|
28
|
+
{{yield}}
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { action } from '@ember/object';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
3
|
import Component from '@glimmer/component';
|
|
4
|
+
import { eq } from 'ember-truth-helpers';
|
|
4
5
|
|
|
5
6
|
import { formatMessage } from '../translations';
|
|
7
|
+
import PixIconButton from './pix-icon-button';
|
|
8
|
+
import PixSelect from './pix-select';
|
|
6
9
|
|
|
7
10
|
const DEFAULT_PAGE_OPTIONS = [
|
|
8
11
|
{ label: '10', value: 10 },
|
|
@@ -129,4 +132,59 @@ export default class PixPagination extends Component {
|
|
|
129
132
|
this.router.replaceWith({ queryParams: { pageNumber: this.previousPage } });
|
|
130
133
|
this.onChange();
|
|
131
134
|
}
|
|
135
|
+
|
|
136
|
+
<template>
|
|
137
|
+
<footer class={{this.isCondensed}}>
|
|
138
|
+
<section class="pix-pagination__size">
|
|
139
|
+
<span class="pagination-size__label">{{this.beforeResultsPerPage}}</span>
|
|
140
|
+
<PixSelect
|
|
141
|
+
@placeholder={{this.pageSize}}
|
|
142
|
+
@screenReaderOnly={{true}}
|
|
143
|
+
class="pagination-size__choice"
|
|
144
|
+
@value={{this.pageSize}}
|
|
145
|
+
@hideDefaultOption={{true}}
|
|
146
|
+
@onChange={{this.changePageSize}}
|
|
147
|
+
@options={{this.pageOptions}}
|
|
148
|
+
>
|
|
149
|
+
<:label>{{this.selectPageSizeLabel}}</:label>
|
|
150
|
+
</PixSelect>
|
|
151
|
+
</section>
|
|
152
|
+
<section class="pix-pagination__navigation">
|
|
153
|
+
<span>
|
|
154
|
+
{{#if (eq this.pageCount 1)}}
|
|
155
|
+
{{this.pageResults}}
|
|
156
|
+
{{else}}
|
|
157
|
+
{{this.pageInfo}}
|
|
158
|
+
{{/if}}
|
|
159
|
+
</span>
|
|
160
|
+
<div class="pix-pagination-navigation__action">
|
|
161
|
+
<PixIconButton
|
|
162
|
+
class="pix-pagination-navigation__action-button"
|
|
163
|
+
@iconName="arrowLeft"
|
|
164
|
+
@ariaLabel={{this.previousPageLabel}}
|
|
165
|
+
@triggerAction={{this.goToPreviousPage}}
|
|
166
|
+
@withBackground={{false}}
|
|
167
|
+
@size="big"
|
|
168
|
+
@color="dark-grey"
|
|
169
|
+
disabled={{this.isPreviousPageDisabled}}
|
|
170
|
+
aria-disabled="{{this.isPreviousPageDisabled}}"
|
|
171
|
+
/>
|
|
172
|
+
<span>
|
|
173
|
+
{{this.pageNumber}}
|
|
174
|
+
</span>
|
|
175
|
+
<PixIconButton
|
|
176
|
+
class="pix-pagination-navigation__action-button"
|
|
177
|
+
@iconName="arrowRight"
|
|
178
|
+
@ariaLabel={{this.nextPageLabel}}
|
|
179
|
+
@triggerAction={{this.goToNextPage}}
|
|
180
|
+
@withBackground={{false}}
|
|
181
|
+
@size="big"
|
|
182
|
+
@color="dark-grey"
|
|
183
|
+
disabled={{this.isNextPageDisabled}}
|
|
184
|
+
aria-disabled="{{this.isNextPageDisabled}}"
|
|
185
|
+
/>
|
|
186
|
+
</div>
|
|
187
|
+
</section>
|
|
188
|
+
</footer>
|
|
189
|
+
</template>
|
|
132
190
|
}
|
|
@@ -55,4 +55,26 @@ export default class PixProgressBar extends Component {
|
|
|
55
55
|
|
|
56
56
|
return `progress-bar--content-${color}`;
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<div
|
|
61
|
+
class="progress-bar {{this.themeMode}} {{this.colorClass}}"
|
|
62
|
+
aria-hidden={{if @isDecorative "true"}}
|
|
63
|
+
...attributes
|
|
64
|
+
>
|
|
65
|
+
{{#unless @hidePercentage}}
|
|
66
|
+
<div class="progress-bar__text" role="presentation">{{this.percentageValue}}</div>
|
|
67
|
+
{{/unless}}
|
|
68
|
+
<label for={{this.id}} class="screen-reader-only">{{@label}}</label>
|
|
69
|
+
<progress
|
|
70
|
+
class="progress-bar__bar"
|
|
71
|
+
id={{this.id}}
|
|
72
|
+
max="100"
|
|
73
|
+
value={{this.value}}
|
|
74
|
+
>{{this.value}}%</progress>
|
|
75
|
+
{{#if @subtitle}}
|
|
76
|
+
<p class="progress-bar__sub-title">{{@subtitle}}</p>
|
|
77
|
+
{{/if}}
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
58
80
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
2
3
|
import { action } from '@ember/object';
|
|
3
4
|
import { guidFor } from '@ember/object/internals';
|
|
4
5
|
import Component from '@glimmer/component';
|
|
5
6
|
|
|
6
7
|
import { formatMessage } from '../translations';
|
|
8
|
+
import PixLabelWrapped from './pix-label-wrapped';
|
|
7
9
|
|
|
8
10
|
export default class PixRadioButton extends Component {
|
|
9
11
|
text = 'pix-radio-button';
|
|
@@ -68,4 +70,44 @@ export default class PixRadioButton extends Component {
|
|
|
68
70
|
event.preventDefault();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<div class="pix-radio-button {{@class}}">
|
|
76
|
+
<PixLabelWrapped
|
|
77
|
+
@for={{this.id}}
|
|
78
|
+
@requiredLabel={{@requiredLabel}}
|
|
79
|
+
@subLabel={{@subLabel}}
|
|
80
|
+
@size={{@size}}
|
|
81
|
+
@screenReaderOnly={{@screenReaderOnly}}
|
|
82
|
+
@isDisabled={{this.isDisabled}}
|
|
83
|
+
@inlineLabel={{true}}
|
|
84
|
+
@variant={{@variant}}
|
|
85
|
+
@state={{@state}}
|
|
86
|
+
>
|
|
87
|
+
<:inputElement>
|
|
88
|
+
<input
|
|
89
|
+
type="radio"
|
|
90
|
+
id={{this.id}}
|
|
91
|
+
class={{this.inputClasses}}
|
|
92
|
+
value={{@value}}
|
|
93
|
+
aria-disabled={{this.isDisabled}}
|
|
94
|
+
aria-describedby={{this.stateId}}
|
|
95
|
+
{{on "click" this.avoidCheckedStateChangeIfIsDisabled}}
|
|
96
|
+
...attributes
|
|
97
|
+
/>
|
|
98
|
+
</:inputElement>
|
|
99
|
+
<:default>
|
|
100
|
+
{{yield to="label"}}
|
|
101
|
+
</:default>
|
|
102
|
+
</PixLabelWrapped>
|
|
103
|
+
|
|
104
|
+
<span class="screen-reader-only" id={{this.stateId}}>
|
|
105
|
+
{{#if this.hasSuccessState}}
|
|
106
|
+
{{this.stateSuccessMessage}}
|
|
107
|
+
{{else if this.hasErrorState}}
|
|
108
|
+
{{this.stateErrorMessage}}
|
|
109
|
+
{{/if}}
|
|
110
|
+
</span>
|
|
111
|
+
</div>
|
|
112
|
+
</template>
|
|
71
113
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { on } from '@ember/modifier';
|
|
1
2
|
import { action } from '@ember/object';
|
|
2
3
|
import { debounceTask } from 'ember-lifeline';
|
|
3
4
|
|
|
5
|
+
import PixIcon from './pix-icon';
|
|
4
6
|
import PixInputBase from './pix-input-base';
|
|
7
|
+
import PixLabel from './pix-label';
|
|
5
8
|
|
|
6
9
|
export default class PixSearchInput extends PixInputBase {
|
|
7
10
|
initialValue = this.args.value;
|
|
@@ -33,4 +36,32 @@ export default class PixSearchInput extends PixInputBase {
|
|
|
33
36
|
this.debounceTimeBeforeSearch,
|
|
34
37
|
);
|
|
35
38
|
}
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div class="pix-search-input {{if @inlineLabel ' pix-search-input--inline'}}">
|
|
42
|
+
<PixLabel
|
|
43
|
+
@for={{this.id}}
|
|
44
|
+
@requiredLabel={{@requiredLabel}}
|
|
45
|
+
@subLabel={{@subLabel}}
|
|
46
|
+
@size={{@size}}
|
|
47
|
+
@screenReaderOnly={{@screenReaderOnly}}
|
|
48
|
+
@inlineLabel={{@inlineLabel}}
|
|
49
|
+
>
|
|
50
|
+
{{yield to="label"}}
|
|
51
|
+
</PixLabel>
|
|
52
|
+
|
|
53
|
+
<div class="pix-search-input__input-container">
|
|
54
|
+
<PixIcon @name="search" @ariaHidden={{true}} />
|
|
55
|
+
<input
|
|
56
|
+
id={{this.id}}
|
|
57
|
+
class="pix-search-input__input"
|
|
58
|
+
name={{@inputName}}
|
|
59
|
+
placeholder={{@placeholder}}
|
|
60
|
+
value={{this.initialValue}}
|
|
61
|
+
{{on "input" this.onSearch}}
|
|
62
|
+
...attributes
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
36
67
|
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { concat, fn } from '@ember/helper';
|
|
2
|
+
import { on } from '@ember/modifier';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
import { eq } from 'ember-truth-helpers';
|
|
5
|
+
|
|
6
|
+
import onEnterAction from '../modifiers/on-enter-action';
|
|
7
|
+
import onSpaceAction from '../modifiers/on-space-action';
|
|
8
|
+
import PixIcon from './pix-icon';
|
|
9
|
+
|
|
10
|
+
export default class PixSelectList extends Component {
|
|
11
|
+
get categories() {
|
|
12
|
+
const uniqueCategories = new Set(
|
|
13
|
+
...this.args.options.map((option) => option.category).filter(Boolean),
|
|
14
|
+
);
|
|
15
|
+
return Array.from(uniqueCategories.values());
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get displayCategory() {
|
|
19
|
+
return this.categories.length > 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get isDefaultOptionHidden() {
|
|
23
|
+
return !this.args.isExpanded || this.args.hideDefaultOption;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get results() {
|
|
27
|
+
const results = [];
|
|
28
|
+
let options = this.args.options;
|
|
29
|
+
|
|
30
|
+
if (this.args.searchValue) {
|
|
31
|
+
options = this.args.options.filter((option) =>
|
|
32
|
+
option.label.toLowerCase().includes(this.args.searchValue.toLowerCase()),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!this.displayCategory) return options;
|
|
37
|
+
|
|
38
|
+
options.forEach(({ category, value, label, icon, iconTitle }) => {
|
|
39
|
+
const categoryIndex = results.findIndex((result) => result.category === category);
|
|
40
|
+
if (categoryIndex !== -1) {
|
|
41
|
+
results[categoryIndex].options.push({ value, label, icon, iconTitle });
|
|
42
|
+
} else {
|
|
43
|
+
results.push({ category, options: [{ label, value, icon, iconTitle }] });
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return results;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<ul role="listbox" id={{@listId}} class="pix-select_list" ...attributes>
|
|
51
|
+
{{#if @displayDefaultOption}}
|
|
52
|
+
<li
|
|
53
|
+
class="pix-select-list-category__option{{unless
|
|
54
|
+
@value
|
|
55
|
+
' pix-select-list-category__option--selected'
|
|
56
|
+
}}"
|
|
57
|
+
role="option"
|
|
58
|
+
tabindex={{if this.isDefaultOptionHidden "-1" "0"}}
|
|
59
|
+
aria-selected={{if @value "false" "true"}}
|
|
60
|
+
{{on "click" (fn @onChange @defaultOption)}}
|
|
61
|
+
{{onEnterAction (fn @onChange @defaultOption)}}
|
|
62
|
+
{{onSpaceAction (fn @onChange @defaultOption)}}
|
|
63
|
+
>
|
|
64
|
+
{{@defaultOptionValue}}
|
|
65
|
+
</li>
|
|
66
|
+
{{/if}}
|
|
67
|
+
{{#if this.results}}
|
|
68
|
+
{{#if this.displayCategory}}
|
|
69
|
+
{{#each this.results as |element index|}}
|
|
70
|
+
<ul
|
|
71
|
+
class="pix-select-list-category"
|
|
72
|
+
role="group"
|
|
73
|
+
aria-labelledby={{if this.displayCategory (concat "cat-" @selectId "-" index)}}
|
|
74
|
+
>
|
|
75
|
+
{{#if this.displayCategory}}
|
|
76
|
+
<li
|
|
77
|
+
class="pix-select-list-category__name"
|
|
78
|
+
role="presentation"
|
|
79
|
+
id={{concat "cat-" @selectId "-" index}}
|
|
80
|
+
title={{element.label}}
|
|
81
|
+
>
|
|
82
|
+
{{element.category}}
|
|
83
|
+
</li>
|
|
84
|
+
{{/if}}
|
|
85
|
+
|
|
86
|
+
{{#each element.options as |option|}}
|
|
87
|
+
{{! template-lint-disable require-context-role }}
|
|
88
|
+
{{!https://www.w3.org/WAI/ARIA/apg/example-index/listbox/listbox-grouped.html}}
|
|
89
|
+
<li
|
|
90
|
+
class="pix-select-list-category__option{{if
|
|
91
|
+
(eq option.value @value)
|
|
92
|
+
' pix-select-list-category__option--selected'
|
|
93
|
+
}}"
|
|
94
|
+
role="option"
|
|
95
|
+
tabindex={{if @isExpanded "0" "-1"}}
|
|
96
|
+
title={{option.label}}
|
|
97
|
+
aria-selected={{if (eq option.value @value) "true" "false"}}
|
|
98
|
+
{{on "click" (fn @onChange option)}}
|
|
99
|
+
{{onEnterAction (fn @onChange option)}}
|
|
100
|
+
{{onSpaceAction (fn @onChange option)}}
|
|
101
|
+
>
|
|
102
|
+
|
|
103
|
+
{{#if option.icon}}
|
|
104
|
+
<PixIcon
|
|
105
|
+
role="presentation"
|
|
106
|
+
@name={{option.icon}}
|
|
107
|
+
@title={{option.iconTitle}}
|
|
108
|
+
class="pix-icon--no-shrink"
|
|
109
|
+
/>
|
|
110
|
+
{{/if}}
|
|
111
|
+
|
|
112
|
+
{{option.label}}
|
|
113
|
+
|
|
114
|
+
{{#if (eq option.value @value)}}
|
|
115
|
+
<PixIcon
|
|
116
|
+
@name="check"
|
|
117
|
+
role="presentation"
|
|
118
|
+
class="pix-select-list-category__option-checked"
|
|
119
|
+
/>
|
|
120
|
+
{{/if}}
|
|
121
|
+
</li>
|
|
122
|
+
{{/each}}
|
|
123
|
+
</ul>
|
|
124
|
+
{{/each}}
|
|
125
|
+
{{else}}
|
|
126
|
+
{{#each this.results as |option|}}
|
|
127
|
+
<li
|
|
128
|
+
class="pix-select-list-category__option{{if
|
|
129
|
+
(eq option.value @value)
|
|
130
|
+
' pix-select-list-category__option--selected'
|
|
131
|
+
}}"
|
|
132
|
+
role="option"
|
|
133
|
+
tabindex={{if @isExpanded "0" "-1"}}
|
|
134
|
+
aria-selected={{if (eq option.value @value) "true" "false"}}
|
|
135
|
+
title={{option.label}}
|
|
136
|
+
{{on "click" (fn @onChange option)}}
|
|
137
|
+
{{onEnterAction (fn @onChange option)}}
|
|
138
|
+
{{onSpaceAction (fn @onChange option)}}
|
|
139
|
+
>
|
|
140
|
+
{{#if option.icon}}
|
|
141
|
+
<PixIcon
|
|
142
|
+
role="presentation"
|
|
143
|
+
@name={{option.icon}}
|
|
144
|
+
@title={{option.iconTitle}}
|
|
145
|
+
class="pix-icon--no-shrink"
|
|
146
|
+
/>
|
|
147
|
+
{{/if}}
|
|
148
|
+
|
|
149
|
+
{{option.label}}
|
|
150
|
+
|
|
151
|
+
{{#if (eq option.value @value)}}
|
|
152
|
+
<PixIcon
|
|
153
|
+
@name="check"
|
|
154
|
+
role="presentation"
|
|
155
|
+
class="pix-select-list-category__option-checked"
|
|
156
|
+
/>
|
|
157
|
+
{{/if}}
|
|
158
|
+
</li>
|
|
159
|
+
{{/each}}
|
|
160
|
+
{{/if}}
|
|
161
|
+
{{else}}
|
|
162
|
+
<li class="pix-select-list__empty-search-message">{{@emptySearchMessage}}</li>
|
|
163
|
+
{{/if}}
|
|
164
|
+
</ul>
|
|
165
|
+
</template>
|
|
166
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { on } from '@ember/modifier';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import Component from '@glimmer/component';
|
|
4
|
+
|
|
5
|
+
export default class PixSelectableTag extends Component {
|
|
6
|
+
@action
|
|
7
|
+
toggleIsChecked() {
|
|
8
|
+
return this.args.onChange(!this.args.checked);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<div class="pix-selectable-tag {{if @checked ' pix-selectable-tag--checked'}}">
|
|
13
|
+
<input
|
|
14
|
+
type="checkbox"
|
|
15
|
+
id={{@id}}
|
|
16
|
+
{{on "change" this.toggleIsChecked}}
|
|
17
|
+
checked={{@checked}}
|
|
18
|
+
...attributes
|
|
19
|
+
/>
|
|
20
|
+
<label for={{@id}}>{{@label}}</label>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
export default class PixSidebar extends Component {
|
|
7
|
+
constructor(...args) {
|
|
8
|
+
super(...args);
|
|
9
|
+
|
|
10
|
+
if (!this.args.title) {
|
|
11
|
+
throw new Error('ERROR in PixSidebar component: @title argument is required.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get id() {
|
|
16
|
+
return guidFor(this);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<PixOverlay @isVisible={{@showSidebar}} @onClose={{@onClose}} @focusOnClose={{@focusOnClose}}>
|
|
21
|
+
<div
|
|
22
|
+
class="pix-sidebar {{unless @showSidebar ' pix-sidebar--hidden'}}"
|
|
23
|
+
role="dialog"
|
|
24
|
+
aria-labelledby="sidebar-title--{{this.id}}"
|
|
25
|
+
aria-describedby="sidebar-content--{{this.id}}"
|
|
26
|
+
aria-modal="true"
|
|
27
|
+
...attributes
|
|
28
|
+
>
|
|
29
|
+
<div class="pix-sidebar__header">
|
|
30
|
+
<h1 id="sidebar-title--{{this.id}}" class="pix-sidebar__title">{{@title}}</h1>
|
|
31
|
+
<PixIconButton
|
|
32
|
+
@iconName="close"
|
|
33
|
+
@triggerAction={{@onClose}}
|
|
34
|
+
@ariaLabel="Fermer"
|
|
35
|
+
@size="small"
|
|
36
|
+
@withBackground={{true}}
|
|
37
|
+
class="pix-sidebar__close-button"
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
<div id="sidebar-content--{{this.id}}" class="pix-sidebar__content">
|
|
41
|
+
{{yield to="content"}}
|
|
42
|
+
</div>
|
|
43
|
+
<div class="pix-sidebar__footer">
|
|
44
|
+
{{yield to="footer"}}
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</PixOverlay>
|
|
48
|
+
</template>
|
|
49
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { lt } from 'ember-truth-helpers';
|
|
3
|
+
|
|
4
|
+
export default class PixStars extends Component {
|
|
5
|
+
get starsCount() {
|
|
6
|
+
if (!this.args.total && !this.args.count) return [];
|
|
7
|
+
return this.args.total ? Array(this.args.total) : Array(this.args.count);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get itemClasses() {
|
|
11
|
+
if (!this.args.color) return 'pix-stars__item';
|
|
12
|
+
return `pix-stars__item pix-stars__item--color-${this.args.color}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div class="pix-stars" ...attributes>
|
|
17
|
+
<span class="screen-reader-only">{{@alt}}</span>
|
|
18
|
+
{{#each this.starsCount as |item index|}}
|
|
19
|
+
<svg
|
|
20
|
+
role="img"
|
|
21
|
+
class={{this.itemClasses}}
|
|
22
|
+
data-acquired={{lt index @count}}
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
viewBox="0 0 36 36"
|
|
25
|
+
>
|
|
26
|
+
<path
|
|
27
|
+
d="M19.2828 2.10285L19.2859 2.1094L19.2891 2.11591L23.2657 10.1293C23.7043 11.0131 24.5494 11.6248 25.5259 11.7652L34.3061 13.0281C34.3075 13.0283 34.3089 13.0285 34.3102 13.0287C35.2023 13.1692 35.6257 14.3013 34.8986 15.0326C34.8976 15.0336 34.8966 15.0346 34.8956 15.0356L28.5817 21.2292C27.8785 21.919 27.5588 22.9099 27.7261 23.8806L29.2294 32.5994C29.3684 33.5432 28.3298 34.2646 27.5175 33.8437C27.5166 33.8432 27.5157 33.8428 27.5148 33.8423L19.7026 29.6958C18.8261 29.2305 17.7761 29.2289 16.8981 29.6914L9.01736 33.8423C9.01683 33.8426 9.01631 33.8428 9.01578 33.8431C8.20337 34.2653 7.16367 33.5437 7.30279 32.5994L8.80604 23.8806C8.97339 22.9099 8.65362 21.919 7.95048 21.2292L1.63355 15.0326C0.90651 14.3014 1.32978 13.1695 2.22156 13.0288L11.0636 11.7656C12.0477 11.6251 12.8982 11.0062 13.3347 10.1131L17.2434 2.11512C17.6777 1.2532 18.8988 1.30004 19.2828 2.10285Z"
|
|
28
|
+
stroke-width="2"
|
|
29
|
+
></path>
|
|
30
|
+
</svg>
|
|
31
|
+
{{/each}}
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
}
|