@1024pix/pix-ui 20.2.2 → 21.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.
- package/CHANGELOG.md +29 -0
- package/addon/components/pix-dropdown.hbs +3 -4
- package/addon/components/pix-filterable-and-searchable-select.hbs +45 -0
- package/addon/components/pix-filterable-and-searchable-select.js +48 -0
- package/addon/components/pix-multi-select.hbs +19 -23
- package/addon/components/pix-multi-select.js +26 -44
- package/addon/components/pix-pagination.hbs +2 -1
- package/addon/components/pix-select.hbs +133 -44
- package/addon/components/pix-select.js +134 -31
- package/addon/components/pix-stars.hbs +1 -1
- package/addon/components/pix-tooltip.hbs +3 -2
- package/addon/styles/_form.scss +16 -3
- package/addon/styles/_pix-filterable-and-searchable-select.scss +57 -0
- package/addon/styles/_pix-multi-select.scss +15 -14
- package/addon/styles/_pix-select.scss +152 -45
- package/addon/styles/_pix-tooltip.scss +7 -5
- package/addon/styles/addon.scss +3 -0
- package/app/components/pix-filterable-and-searchable-select.js +1 -0
- package/app/modifiers/on-arrow-down-up-action.js +3 -3
- package/app/modifiers/on-enter-action.js +2 -2
- package/app/modifiers/on-space-action.js +20 -0
- package/app/stories/form.stories.js +86 -80
- package/app/stories/pix-background-header.stories.js +17 -9
- package/app/stories/pix-banner.stories.js +9 -10
- package/app/stories/pix-block.stories.js +3 -5
- package/app/stories/pix-button-link.stories.js +23 -27
- package/app/stories/pix-button-upload.stories.js +10 -12
- package/app/stories/pix-button.stories.js +30 -31
- package/app/stories/pix-checkbox.stories.js +9 -10
- package/app/stories/pix-collapsible.stories.js +22 -37
- package/app/stories/pix-dropdown.stories.js +17 -19
- package/app/stories/pix-filter-banner.stories.js +11 -8
- package/app/stories/pix-filterable-and-searchable-select.stories.js +212 -0
- package/app/stories/pix-filterable-and-searchable-select.stories.mdx +71 -0
- package/app/stories/pix-icon-button.stories.js +10 -12
- package/app/stories/pix-input-code.stories.js +7 -9
- package/app/stories/pix-input-password.stories.js +9 -11
- package/app/stories/pix-input.stories.js +9 -11
- package/app/stories/pix-message.stories.js +7 -8
- package/app/stories/pix-modal.stories.js +27 -20
- package/app/stories/pix-multi-select.stories.js +105 -81
- package/app/stories/pix-multi-select.stories.mdx +14 -9
- package/app/stories/pix-pagination.stories.js +6 -8
- package/app/stories/pix-progress-gauge.stories.js +16 -20
- package/app/stories/pix-radio-button.stories.js +2 -14
- package/app/stories/pix-return-to.stories.js +4 -8
- package/app/stories/pix-select.stories.js +235 -74
- package/app/stories/pix-select.stories.mdx +46 -20
- package/app/stories/pix-selectable-tag.stories.js +7 -38
- package/app/stories/pix-sidebar.stories.js +26 -19
- package/app/stories/pix-stars.stories.js +1 -8
- package/app/stories/pix-tag.stories.js +6 -10
- package/app/stories/pix-textarea.stories.js +7 -9
- package/app/stories/pix-tooltip.stories.js +41 -49
- package/package.json +43 -44
- package/addon/components/pix-tooltip-deprecated.hbs +0 -18
- package/addon/components/pix-tooltip-deprecated.js +0 -26
- package/app/components/pix-tooltip-deprecated.js +0 -1
- package/app/stories/pix-tooltip-deprecated.stories.js +0 -136
- package/app/stories/pix-tooltip-deprecated.stories.mdx +0 -143
|
@@ -1,58 +1,161 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
-
import { guidFor } from '@ember/object/internals';
|
|
3
2
|
import { tracked } from '@glimmer/tracking';
|
|
4
3
|
import { action } from '@ember/object';
|
|
4
|
+
import { guidFor } from '@ember/object/internals';
|
|
5
5
|
|
|
6
6
|
export default class PixSelect extends Component {
|
|
7
|
-
@tracked
|
|
7
|
+
@tracked isExpanded = false;
|
|
8
|
+
@tracked searchValue = null;
|
|
9
|
+
searchId = 'search-input-' + guidFor(this);
|
|
10
|
+
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args);
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
if (!this.args.label && !this.args.id)
|
|
15
|
+
throw new Error('ERROR in PixSelect, a @label or an @id was not provided');
|
|
16
|
+
|
|
17
|
+
const categories = [];
|
|
18
|
+
this.args.options.forEach((element) => {
|
|
19
|
+
if (!categories.includes(element.category) && element.category !== undefined) {
|
|
20
|
+
categories.push(element.category);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
this.displayCategory = categories.length > 0;
|
|
25
|
+
}
|
|
11
26
|
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
get selectId() {
|
|
28
|
+
if (this.args.id) return this.args.id;
|
|
29
|
+
return 'select-' + guidFor(this);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get displayDefaultOption() {
|
|
33
|
+
return !this.searchValue && !this.args.hideDefaultOption;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get className() {
|
|
37
|
+
const classes = ['pix-select-button'];
|
|
38
|
+
if (this.args.className) {
|
|
39
|
+
classes.push(this.args.className);
|
|
40
|
+
}
|
|
41
|
+
if (this.args.errorMessage) {
|
|
42
|
+
classes.push('pix-select-button--error');
|
|
14
43
|
}
|
|
44
|
+
return classes.join(' ');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get isAriaExpanded() {
|
|
48
|
+
return this.isExpanded ? 'true' : 'false';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get listId() {
|
|
52
|
+
return `listbox-${this.selectId}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get dropDownId() {
|
|
56
|
+
return `dropdown-${this.selectId}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get placeholder() {
|
|
60
|
+
if (!this.args.value) return this.args.placeholder;
|
|
61
|
+
const option = this.args.options.find((option) => option.value === this.args.value);
|
|
62
|
+
return option ? option.label : this.args.placeholder;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get defaultOption() {
|
|
66
|
+
return {
|
|
67
|
+
value: '',
|
|
68
|
+
};
|
|
15
69
|
}
|
|
16
70
|
|
|
17
|
-
get
|
|
18
|
-
|
|
19
|
-
|
|
71
|
+
get results() {
|
|
72
|
+
let results = [];
|
|
73
|
+
let options = this.args.options;
|
|
20
74
|
|
|
21
|
-
if (
|
|
22
|
-
|
|
75
|
+
if (this.searchValue) {
|
|
76
|
+
options = this.args.options.filter((option) =>
|
|
77
|
+
option.label.toLowerCase().includes(this.searchValue.toLowerCase())
|
|
78
|
+
);
|
|
23
79
|
}
|
|
24
|
-
|
|
80
|
+
|
|
81
|
+
if (!this.displayCategory) return options;
|
|
82
|
+
|
|
83
|
+
options.forEach(({ category, value, label }) => {
|
|
84
|
+
const categoryIndex = results.findIndex((result) => result.category === category);
|
|
85
|
+
if (categoryIndex !== -1) {
|
|
86
|
+
results[categoryIndex].options.push({ value, label });
|
|
87
|
+
} else {
|
|
88
|
+
results.push({ category, options: [{ label, value }] });
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return results;
|
|
25
92
|
}
|
|
26
93
|
|
|
27
|
-
|
|
28
|
-
|
|
94
|
+
@action
|
|
95
|
+
toggleDropdown(event) {
|
|
96
|
+
if (this.isExpanded) {
|
|
97
|
+
this.hideDropdown(event);
|
|
98
|
+
} else {
|
|
99
|
+
this.showDropdown(event);
|
|
100
|
+
}
|
|
29
101
|
}
|
|
30
102
|
|
|
31
|
-
|
|
32
|
-
|
|
103
|
+
@action
|
|
104
|
+
showDropdown(event) {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
|
|
107
|
+
this.isExpanded = true;
|
|
33
108
|
}
|
|
34
109
|
|
|
35
110
|
@action
|
|
36
|
-
|
|
37
|
-
if (this.
|
|
38
|
-
|
|
111
|
+
hideDropdown(event) {
|
|
112
|
+
if (this.isExpanded) {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
|
|
115
|
+
this.isExpanded = false;
|
|
39
116
|
}
|
|
117
|
+
}
|
|
40
118
|
|
|
41
|
-
|
|
42
|
-
|
|
119
|
+
@action
|
|
120
|
+
onChange(option, event) {
|
|
121
|
+
this.args.onChange(option.value);
|
|
122
|
+
|
|
123
|
+
this.hideDropdown(event);
|
|
124
|
+
document.getElementById(this.selectId).focus();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@action
|
|
128
|
+
setSearchValue(event) {
|
|
129
|
+
this.searchValue = event.target.value.trim();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@action
|
|
133
|
+
lockTab(event) {
|
|
134
|
+
if (event.code === 'Tab' && this.isExpanded) {
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
document.getElementById(this.searchId).focus();
|
|
43
137
|
}
|
|
138
|
+
}
|
|
44
139
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
140
|
+
@action
|
|
141
|
+
focus() {
|
|
142
|
+
if (this.isExpanded) {
|
|
143
|
+
if (this.args.value) {
|
|
144
|
+
document.querySelector("[aria-selected='true']").focus();
|
|
145
|
+
} else if (this.args.isSearchable) {
|
|
146
|
+
document.getElementById(this.searchId).focus();
|
|
147
|
+
} else if (this.displayDefaultOption) {
|
|
148
|
+
document.querySelector("[aria-selected='true']").focus();
|
|
149
|
+
}
|
|
50
150
|
}
|
|
51
151
|
}
|
|
52
|
-
}
|
|
53
152
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
153
|
+
@action
|
|
154
|
+
setSelectWidth() {
|
|
155
|
+
const baseFontRemRatio = 16;
|
|
156
|
+
const checkIconWidth = 16;
|
|
157
|
+
const listWidth = document.getElementById(this.listId).getBoundingClientRect().width;
|
|
158
|
+
const selectWidth = (listWidth + checkIconWidth) / baseFontRemRatio;
|
|
159
|
+
document.getElementById(`container-${this.selectId}`).style.width = `${selectWidth}rem`;
|
|
160
|
+
}
|
|
58
161
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
...attributes
|
|
9
9
|
>
|
|
10
10
|
{{#if (has-block "triggerElement")}}
|
|
11
|
-
<
|
|
11
|
+
<span class="pix-tooltip__trigger-element">
|
|
12
12
|
{{yield to="triggerElement"}}
|
|
13
|
-
</
|
|
13
|
+
</span>
|
|
14
14
|
{{/if}}
|
|
15
15
|
|
|
16
16
|
{{#if (has-block "tooltip")}}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
id={{@id}}
|
|
20
20
|
role="tooltip"
|
|
21
21
|
class="pix-tooltip__content pix-tooltip__content--{{this.position}}
|
|
22
|
+
{{if this.isVisible 'pix-tooltip__content--visible'}}
|
|
22
23
|
{{if @isInline 'pix-tooltip__content--inline'}}
|
|
23
24
|
{{if @isLight 'pix-tooltip__content--light'}}
|
|
24
25
|
{{if @isWide 'pix-tooltip__content--wide'}}"
|
package/addon/styles/_form.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@mixin hoverFormElement() {
|
|
2
2
|
&:hover {
|
|
3
|
-
box-shadow: inset 0px 0px 0px 0.6px $pix-neutral-
|
|
3
|
+
box-shadow: inset 0px 0px 0px 0.6px $pix-neutral-70;
|
|
4
|
+
background-color: $pix-neutral-5;
|
|
4
5
|
}
|
|
5
6
|
}
|
|
6
7
|
|
|
@@ -24,14 +25,26 @@
|
|
|
24
25
|
display: block;
|
|
25
26
|
font-family: $font-roboto;
|
|
26
27
|
font-size: 0.875rem;
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
line-height: 1.375rem;
|
|
29
|
+
color: $pix-neutral-90;
|
|
30
|
+
margin-bottom: $spacing-xxs;
|
|
31
|
+
font-weight: $font-medium;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@mixin subLabel() {
|
|
35
|
+
@include label();
|
|
36
|
+
|
|
37
|
+
font-size: 0.813rem;
|
|
38
|
+
line-height: 1rem;
|
|
39
|
+
color: $pix-neutral-60;
|
|
40
|
+
font-weight: $font-normal;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
@mixin errorMessage() {
|
|
32
44
|
font-family: $font-roboto;
|
|
33
45
|
font-size: 0.75rem;
|
|
34
46
|
color: $pix-error-70;
|
|
47
|
+
margin-top: $spacing-xxs;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
@mixin formElementInError() {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.pix-filterable-and-searchable-select {
|
|
2
|
+
display: flex;
|
|
3
|
+
width: fit-content;
|
|
4
|
+
border: 1px $pix-neutral-45 solid;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
|
|
7
|
+
&--error {
|
|
8
|
+
@include formElementInError();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__label {
|
|
12
|
+
@include label();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&__sub-label {
|
|
16
|
+
@include subLabel();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__pix-multi-select,
|
|
20
|
+
&__pix-select {
|
|
21
|
+
border: none;
|
|
22
|
+
&:hover {
|
|
23
|
+
border: none;
|
|
24
|
+
box-shadow: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&__error-message {
|
|
29
|
+
@include errorMessage();
|
|
30
|
+
}
|
|
31
|
+
.pix-multi-select {
|
|
32
|
+
margin-right: 2px;
|
|
33
|
+
|
|
34
|
+
[role="menu"] {
|
|
35
|
+
width: fit-content;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&__pix-multi-select {
|
|
40
|
+
border-radius: 4px 0px 0px 4px;
|
|
41
|
+
position: relative;
|
|
42
|
+
|
|
43
|
+
&:after {
|
|
44
|
+
height: 22px;
|
|
45
|
+
width: 2px;
|
|
46
|
+
content: '';
|
|
47
|
+
background-color: $pix-neutral-22;
|
|
48
|
+
position: absolute;
|
|
49
|
+
right: -2px;
|
|
50
|
+
border-radius: 50px;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&__pix-select {
|
|
55
|
+
border-radius: 0px 4px 4px 0px;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -56,16 +56,13 @@
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
&__dropdown-icon {
|
|
59
|
-
|
|
60
|
-
color: $pix-neutral-
|
|
59
|
+
@include text-small();
|
|
60
|
+
color: $pix-neutral-60;
|
|
61
|
+
font-weight: $font-heavy;
|
|
61
62
|
right: 10px;
|
|
62
63
|
top: calc(50% - 6px);
|
|
63
64
|
position: absolute;
|
|
64
65
|
pointer-events: none;
|
|
65
|
-
|
|
66
|
-
&--expand {
|
|
67
|
-
color: $pix-primary;
|
|
68
|
-
}
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
|
|
@@ -81,8 +78,9 @@
|
|
|
81
78
|
max-height: 200px;
|
|
82
79
|
list-style-type: none;
|
|
83
80
|
padding: 0;
|
|
84
|
-
box-shadow: 0px
|
|
85
|
-
transition: all .1s ease-in-out;
|
|
81
|
+
box-shadow: 0px 6px 12px rgba(7, 20, 46, 0.08);
|
|
82
|
+
transition: all 0.1s ease-in-out;
|
|
83
|
+
margin-top: $spacing-xxs;
|
|
86
84
|
|
|
87
85
|
&--hidden {
|
|
88
86
|
visibility: hidden;
|
|
@@ -106,15 +104,18 @@
|
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
li.pix-multi-select-list__item {
|
|
109
|
-
font-family: $font-roboto;
|
|
110
107
|
position: relative;
|
|
111
|
-
border-bottom: 1px solid $pix-neutral-15;
|
|
112
108
|
list-style: none;
|
|
113
|
-
|
|
114
|
-
|
|
109
|
+
padding: $spacing-xs $spacing-m;
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
&:hover,
|
|
113
|
+
&:focus {
|
|
114
|
+
outline: none;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
background-color: $pix-neutral-10;
|
|
117
|
+
}
|
|
115
118
|
|
|
116
|
-
@include hoverFormElement();
|
|
117
|
-
|
|
118
119
|
&--no-result {
|
|
119
120
|
text-align: center;
|
|
120
121
|
padding: 12px 0;
|
|
@@ -1,70 +1,177 @@
|
|
|
1
1
|
.pix-select {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
display: inline-block;
|
|
4
3
|
position: relative;
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
border-radius: 4px;
|
|
10
|
-
color: $pix-neutral-90;
|
|
11
|
-
font-family: $font-roboto;
|
|
12
|
-
font-size: 0.875rem;
|
|
13
|
-
height: 36px;
|
|
14
|
-
width: 100%;
|
|
15
|
-
text-overflow: ellipsis;
|
|
5
|
+
&__label {
|
|
6
|
+
@include label();
|
|
7
|
+
}
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
@include
|
|
19
|
-
@include focusWithinFormElement();
|
|
9
|
+
&__sub-label {
|
|
10
|
+
@include subLabel();
|
|
20
11
|
}
|
|
21
12
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
&__dropdown {
|
|
14
|
+
z-index: 200;
|
|
15
|
+
position: absolute;
|
|
16
|
+
border-top: none;
|
|
17
|
+
border-radius: 0 0 4px 4px;
|
|
18
|
+
overflow-y: auto;
|
|
19
|
+
max-height: 200px;
|
|
20
|
+
width: inherit;
|
|
21
|
+
list-style-type: none;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background-color: $pix-neutral-0;
|
|
24
|
+
box-shadow: 0px 6px 12px rgba(7, 20, 46, 0.08);
|
|
25
|
+
transition: all 0.1s ease-in-out;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
margin-top: $spacing-xxs;
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
&::-webkit-scrollbar {
|
|
30
|
+
width: 0.5rem;
|
|
31
|
+
}
|
|
32
|
+
&::-webkit-scrollbar-track {
|
|
33
|
+
border-radius: 4px;
|
|
34
|
+
border: 1px solid $pix-neutral-20;
|
|
35
|
+
background: $pix-neutral-20;
|
|
36
|
+
}
|
|
37
|
+
&::-webkit-scrollbar-thumb {
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
width: 0.375rem;
|
|
40
|
+
background: $pix-neutral-30;
|
|
41
|
+
}
|
|
42
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
43
|
+
background: $pix-neutral-35;
|
|
28
44
|
}
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
&--closed {
|
|
47
|
+
visibility: hidden;
|
|
48
|
+
opacity: 0;
|
|
32
49
|
}
|
|
33
50
|
}
|
|
34
51
|
|
|
35
|
-
|
|
36
|
-
@include
|
|
37
|
-
|
|
52
|
+
&__empty-search-message {
|
|
53
|
+
@include text-small();
|
|
54
|
+
color: $pix-neutral-70;
|
|
55
|
+
text-align: center;
|
|
56
|
+
}
|
|
38
57
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
58
|
+
&__search {
|
|
59
|
+
display: flex;
|
|
60
|
+
border-bottom: 2px solid $pix-neutral-22;
|
|
61
|
+
margin: $spacing-s $spacing-m;
|
|
62
|
+
color: $pix-neutral-30;
|
|
63
|
+
border-radius: 4px 4px 0 0;
|
|
42
64
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
65
|
+
&:focus-within {
|
|
66
|
+
background: $pix-neutral-10;
|
|
67
|
+
border-bottom: 2px solid $pix-primary;
|
|
46
68
|
}
|
|
69
|
+
}
|
|
47
70
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
border-color: $green;
|
|
51
|
-
}
|
|
71
|
+
&__options {
|
|
72
|
+
border-top: 1px solid $pix-neutral-20;
|
|
52
73
|
}
|
|
53
74
|
|
|
54
|
-
&
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
&__error-message {
|
|
76
|
+
@include errorMessage();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pix-select-button {
|
|
81
|
+
display: flex;
|
|
82
|
+
flex-direction: row;
|
|
83
|
+
align-items: center;
|
|
84
|
+
font-family: $font-roboto;
|
|
85
|
+
font-weight: $font-normal;
|
|
86
|
+
position: relative;
|
|
87
|
+
border: 1px $pix-neutral-45 solid;
|
|
88
|
+
padding: 0px $spacing-s 0px $spacing-s;
|
|
89
|
+
width: 100%;
|
|
90
|
+
background-color: $pix-neutral-0;
|
|
91
|
+
border-radius: 4px;
|
|
92
|
+
outline: none;
|
|
93
|
+
height: 2.25rem;
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
color: $pix-neutral-90;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
|
|
98
|
+
@include text-small();
|
|
99
|
+
@include hoverFormElement();
|
|
100
|
+
@include focusWithinFormElement();
|
|
101
|
+
|
|
102
|
+
&--error {
|
|
103
|
+
@include formElementInError();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
&__dropdown-icon {
|
|
107
|
+
@include text-small();
|
|
108
|
+
color: $pix-neutral-60;
|
|
109
|
+
font-weight: $font-heavy;
|
|
60
110
|
pointer-events: none;
|
|
61
111
|
}
|
|
112
|
+
}
|
|
62
113
|
|
|
63
|
-
|
|
64
|
-
|
|
114
|
+
.pix-select-options__category {
|
|
115
|
+
list-style: none;
|
|
116
|
+
padding: 0;
|
|
117
|
+
margin: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.pix-select-options-category {
|
|
121
|
+
&__name {
|
|
122
|
+
@include text-small();
|
|
123
|
+
padding: $spacing-s $spacing-m $spacing-xs $spacing-m;
|
|
124
|
+
text-transform: uppercase;
|
|
125
|
+
font-family: $font-roboto;
|
|
126
|
+
color: $pix-neutral-45;
|
|
65
127
|
}
|
|
66
128
|
|
|
67
|
-
|
|
68
|
-
|
|
129
|
+
&__option {
|
|
130
|
+
@include text-small();
|
|
131
|
+
display: flex;
|
|
132
|
+
justify-content: space-between;
|
|
133
|
+
padding: $spacing-xs $spacing-m;
|
|
134
|
+
color: $pix-neutral-70;
|
|
135
|
+
|
|
136
|
+
&:hover,
|
|
137
|
+
&:focus {
|
|
138
|
+
outline: none;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
background-color: $pix-neutral-10;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
svg {
|
|
144
|
+
visibility: hidden;
|
|
145
|
+
opacity: 0;
|
|
146
|
+
font-size: 1.125rem;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&--selected {
|
|
150
|
+
background-color: $pix-primary-5;
|
|
151
|
+
align-items: center;
|
|
152
|
+
|
|
153
|
+
svg {
|
|
154
|
+
visibility: visible;
|
|
155
|
+
opacity: 1;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.pix-select-search {
|
|
162
|
+
&__input {
|
|
163
|
+
@include text-small();
|
|
164
|
+
width: 100%;
|
|
165
|
+
border: none;
|
|
166
|
+
padding-left: $spacing-xs;
|
|
167
|
+
margin: $spacing-xxs;
|
|
168
|
+
&:focus {
|
|
169
|
+
outline: none;
|
|
170
|
+
background: $pix-neutral-10;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
&__icon {
|
|
175
|
+
margin: auto $spacing-xxs;
|
|
69
176
|
}
|
|
70
177
|
}
|
|
@@ -6,12 +6,9 @@
|
|
|
6
6
|
justify-content: center;
|
|
7
7
|
align-items: center;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
.pix-tooltip--visible {
|
|
12
|
-
+ .pix-tooltip__content {
|
|
9
|
+
&__trigger-element {
|
|
13
10
|
display: block;
|
|
14
|
-
|
|
11
|
+
width: 100%;
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
|
|
@@ -31,6 +28,11 @@
|
|
|
31
28
|
line-height: 1.4rem;
|
|
32
29
|
transition: opacity 0.3s;
|
|
33
30
|
|
|
31
|
+
&--visible {
|
|
32
|
+
display: block;
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
|
|
34
36
|
&--inline {
|
|
35
37
|
white-space: nowrap;
|
|
36
38
|
}
|
package/addon/styles/addon.scss
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-filterable-and-searchable-select';
|
|
@@ -34,7 +34,7 @@ export default modifier((element, [elementId, callback, isExpanded]) => {
|
|
|
34
34
|
document.activeElement === lastFocusableElement ||
|
|
35
35
|
activeIndexElement === -1
|
|
36
36
|
) {
|
|
37
|
-
firstFocusableElement
|
|
37
|
+
firstFocusableElement?.focus();
|
|
38
38
|
} else {
|
|
39
39
|
focusableElements[activeIndexElement + 1].focus();
|
|
40
40
|
}
|
|
@@ -46,7 +46,7 @@ export default modifier((element, [elementId, callback, isExpanded]) => {
|
|
|
46
46
|
document.activeElement === firstFocusableElement ||
|
|
47
47
|
activeIndexElement === -1
|
|
48
48
|
) {
|
|
49
|
-
lastFocusableElement
|
|
49
|
+
lastFocusableElement?.focus();
|
|
50
50
|
} else {
|
|
51
51
|
focusableElements[activeIndexElement - 1].focus();
|
|
52
52
|
}
|
|
@@ -62,7 +62,7 @@ export default modifier((element, [elementId, callback, isExpanded]) => {
|
|
|
62
62
|
if (!isExpanded) {
|
|
63
63
|
elementToTarget.addEventListener('transitionend', focusElement);
|
|
64
64
|
|
|
65
|
-
callback();
|
|
65
|
+
callback(event);
|
|
66
66
|
|
|
67
67
|
return () => {
|
|
68
68
|
elementToTarget.removeEventListener('transitionend', focusElement);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { modifier } from 'ember-modifier';
|
|
2
2
|
|
|
3
|
-
export default modifier((element, [callback, focusId = null]) => {
|
|
3
|
+
export default modifier((element, [callback = null, focusId = null]) => {
|
|
4
4
|
function handleKeyUp(event) {
|
|
5
5
|
const ENTER_KEY = 'Enter';
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export default modifier((element, [callback, focusId = null]) => {
|
|
|
17
17
|
document.getElementById(focusId).focus();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
callback(event);
|
|
20
|
+
if (callback) callback(event);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
element.addEventListener('keydown', handleKeyUp);
|