@1024pix/pix-ui 20.2.3 → 22.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/.storybook/main.js +3 -0
- package/CHANGELOG.md +32 -0
- package/README.md +2 -2
- 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-toggle.hbs +24 -0
- package/addon/components/pix-toggle.js +23 -0
- 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-toggle.scss +63 -0
- package/addon/styles/addon.scss +4 -0
- package/app/components/pix-filterable-and-searchable-select.js +1 -0
- package/app/components/pix-toggle.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-toggle.stories.js +120 -0
- package/app/stories/pix-toggle.stories.mdx +38 -0
- package/app/stories/pix-tooltip.stories.js +41 -49
- package/package.json +60 -50
- package/.github/workflows/auto-merge.yml +0 -23
- package/.github/workflows/deploy-storybook.yml +0 -22
- package/.github/workflows/npm-publish.yml +0 -23
- package/.github/workflows/on-dev-merge.yml +0 -33
- package/.prettierignore +0 -1
|
@@ -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
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<label class={{this.className}}>
|
|
2
|
+
<span class="pix-toggle__label{{if @screenReaderOnly ' screen-reader-only'}}">{{@label}}</span>
|
|
3
|
+
<button
|
|
4
|
+
class="pix-toggle__button"
|
|
5
|
+
aria-pressed={{if @toggled "true" "false"}}
|
|
6
|
+
type="button"
|
|
7
|
+
{{on "click" this.onToggle}}
|
|
8
|
+
>
|
|
9
|
+
<span class="pix-toggle__on">
|
|
10
|
+
{{#if @onLabel}}
|
|
11
|
+
{{@onLabel}}
|
|
12
|
+
{{else}}
|
|
13
|
+
{{yield to="on"}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
</span>
|
|
16
|
+
<span class="pix-toggle__off">
|
|
17
|
+
{{#if @offLabel}}
|
|
18
|
+
{{@offLabel}}
|
|
19
|
+
{{else}}
|
|
20
|
+
{{yield to="off"}}
|
|
21
|
+
{{/if}}
|
|
22
|
+
</span>
|
|
23
|
+
</button>
|
|
24
|
+
</label>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
|
|
4
|
+
export default class PixToggle extends Component {
|
|
5
|
+
get className() {
|
|
6
|
+
const classes = ['pix-toggle'];
|
|
7
|
+
if (this.args.inline) {
|
|
8
|
+
classes.push('pix-toggle--inline');
|
|
9
|
+
}
|
|
10
|
+
if (this.args.toggled) {
|
|
11
|
+
classes.push('pix-toggle--pressed');
|
|
12
|
+
}
|
|
13
|
+
if (this.args.screenReaderOnly) {
|
|
14
|
+
classes.push('pix-toggle--screen-reader-only');
|
|
15
|
+
}
|
|
16
|
+
return classes.join(' ');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@action
|
|
20
|
+
onToggle() {
|
|
21
|
+
this.args.onChange(!this.args.toggled);
|
|
22
|
+
}
|
|
23
|
+
}
|
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
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
.pix-toggle {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
|
|
5
|
+
&__label {
|
|
6
|
+
color: $pix-neutral-90;
|
|
7
|
+
|
|
8
|
+
@include text;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&__button {
|
|
12
|
+
width: fit-content;
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
border: 1px solid $pix-neutral-30;
|
|
15
|
+
border-radius: 4px;
|
|
16
|
+
padding: $spacing-xxs;
|
|
17
|
+
margin-top: $spacing-xxs;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__on,
|
|
21
|
+
&__off {
|
|
22
|
+
display: inline-block;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
padding: $spacing-xs;
|
|
25
|
+
color: $pix-neutral-70;
|
|
26
|
+
|
|
27
|
+
@include text-small;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&__off {
|
|
31
|
+
background-color: $pix-neutral-45;
|
|
32
|
+
color: $white;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--inline {
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
align-items: center;
|
|
38
|
+
gap: $spacing-xxs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--inline,
|
|
42
|
+
&--screen-reader-only {
|
|
43
|
+
.pix-toggle {
|
|
44
|
+
&__button {
|
|
45
|
+
margin-top: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--pressed {
|
|
51
|
+
.pix-toggle {
|
|
52
|
+
&__on {
|
|
53
|
+
background-color: $pix-neutral-45;
|
|
54
|
+
color: $white;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__off {
|
|
58
|
+
background-color: transparent;
|
|
59
|
+
color: inherit;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
package/addon/styles/addon.scss
CHANGED
|
@@ -29,8 +29,12 @@
|
|
|
29
29
|
@import 'pix-dropdown';
|
|
30
30
|
@import 'pix-pagination';
|
|
31
31
|
@import 'pix-checkbox';
|
|
32
|
+
@import 'pix-toggle';
|
|
32
33
|
@import 'trap-focus';
|
|
33
34
|
|
|
35
|
+
// at the end so it can override it's children scss
|
|
36
|
+
@import 'pix-filterable-and-searchable-select';
|
|
37
|
+
|
|
34
38
|
html {
|
|
35
39
|
font-size: 16px;
|
|
36
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-filterable-and-searchable-select';
|