@1024pix/pix-ui 54.2.0 → 54.4.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/addon/components/pix-code.hbs +31 -0
- package/addon/components/pix-code.js +24 -0
- package/addon/components/pix-select-list.hbs +16 -14
- package/addon/styles/_pix-code.scss +37 -0
- package/addon/styles/_pix-select-list.scss +23 -30
- package/addon/styles/_pix-select.scss +1 -1
- package/addon/styles/_pix-structure-switcher.scss +0 -1
- package/addon/styles/addon.scss +1 -0
- package/app/components/pix-code.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
{{#if (has-block "label")}}
|
|
3
|
+
<PixLabel
|
|
4
|
+
@for={{this.id}}
|
|
5
|
+
@requiredLabel={{@requiredLabel}}
|
|
6
|
+
@subLabel={{@subLabel}}
|
|
7
|
+
@size={{@size}}
|
|
8
|
+
@screenReaderOnly={{@screenReaderOnly}}
|
|
9
|
+
>
|
|
10
|
+
{{yield to="label"}}
|
|
11
|
+
</PixLabel>
|
|
12
|
+
{{/if}}
|
|
13
|
+
<div>
|
|
14
|
+
<input
|
|
15
|
+
id={{this.id}}
|
|
16
|
+
class="pix-code"
|
|
17
|
+
style={{this.style}}
|
|
18
|
+
value={{@value}}
|
|
19
|
+
aria-required="{{if @requiredLabel true false}}"
|
|
20
|
+
required={{if @requiredLabel true false}}
|
|
21
|
+
maxlength={{this.length}}
|
|
22
|
+
minlength={{this.length}}
|
|
23
|
+
aria-describedby={{this.ariaDescribedBy}}
|
|
24
|
+
...attributes
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
{{#if this.hasErrorMessage}}
|
|
28
|
+
<p id={{this.ariaDescribedBy}} class="pix-code__error-message">{{@errorMessage}}</p>
|
|
29
|
+
{{/if}}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { warn } from '@ember/debug';
|
|
2
|
+
import { htmlSafe } from '@ember/template';
|
|
3
|
+
|
|
4
|
+
import PixInputBase from './pix-input-base';
|
|
5
|
+
|
|
6
|
+
export default class PixCode extends PixInputBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
|
|
10
|
+
this.prefix = 'pix-code';
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get length() {
|
|
14
|
+
warn('PixCode: @length is required.', !['', null, undefined].includes(this.args.length), {
|
|
15
|
+
id: 'pix-ui.code.length.required',
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return this.args.length || 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get style() {
|
|
22
|
+
return htmlSafe('--nb-characters:' + this.length);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<ul role="listbox" id={{@listId}} class="pix-select_list" ...attributes>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
{{#if @displayDefaultOption}}
|
|
3
|
+
<li
|
|
4
|
+
class="pix-select-list-category__option{{unless
|
|
5
|
+
@value
|
|
6
|
+
' pix-select-list-category__option--selected'
|
|
7
|
+
}}"
|
|
8
|
+
role="option"
|
|
9
|
+
tabindex={{if this.isDefaultOptionHidden "-1" "0"}}
|
|
10
|
+
aria-selected={{if @value "false" "true"}}
|
|
11
|
+
{{on "click" (fn @onChange @defaultOption)}}
|
|
12
|
+
{{on-enter-action (fn @onChange @defaultOption)}}
|
|
13
|
+
{{on-space-action (fn @onChange @defaultOption)}}
|
|
14
|
+
>
|
|
15
|
+
{{@defaultOptionValue}}
|
|
16
|
+
</li>
|
|
17
|
+
{{/if}}
|
|
16
18
|
{{#if this.results}}
|
|
17
19
|
{{#if this.displayCategory}}
|
|
18
20
|
{{#each this.results as |element index|}}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use "pix-design-tokens/typography";
|
|
2
|
+
@use "component-state/form";
|
|
3
|
+
|
|
4
|
+
.pix-code {
|
|
5
|
+
@extend %pix-monospace;
|
|
6
|
+
@extend %pix-form-element-state;
|
|
7
|
+
|
|
8
|
+
$space-between-dashes: 0.6ch;
|
|
9
|
+
$total-width: calc(var(--nb-characters) * (1ch + $space-between-dashes));
|
|
10
|
+
|
|
11
|
+
display: inline-block;
|
|
12
|
+
box-sizing: content-box;
|
|
13
|
+
width: $total-width;
|
|
14
|
+
height: 3.125rem;
|
|
15
|
+
padding: 0 0.2ch 1px 0.5ch;
|
|
16
|
+
color: var(--pix-neutral-900);
|
|
17
|
+
font-size: 1.875rem;
|
|
18
|
+
letter-spacing: $space-between-dashes;
|
|
19
|
+
text-transform: uppercase;
|
|
20
|
+
background: repeating-linear-gradient(
|
|
21
|
+
90deg,
|
|
22
|
+
var(--pix-neutral-500) 0,
|
|
23
|
+
var(--pix-neutral-500) 1ch,
|
|
24
|
+
transparent 0,
|
|
25
|
+
transparent 1ch + $space-between-dashes
|
|
26
|
+
)
|
|
27
|
+
0 100% / calc($total-width - $space-between-dashes) 1px no-repeat;
|
|
28
|
+
background-position-x: 0.5ch;
|
|
29
|
+
background-position-y: 2.5ch;
|
|
30
|
+
border: solid 1px var(--pix-neutral-500);
|
|
31
|
+
border-radius: var(--pix-spacing-1x);
|
|
32
|
+
outline: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.pix-code__error-message {
|
|
36
|
+
@extend %pix-input-error-message;
|
|
37
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
@use "pix-design-tokens/typography";
|
|
2
2
|
|
|
3
3
|
.pix-select_list {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
--
|
|
8
|
-
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: var(--pix-spacing-1x);
|
|
7
|
+
padding: var(--pix-spacing-2x) var(--pix-spacing-1x);
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
.pix-select-list-category {
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: var(--pix-spacing-1x);
|
|
12
14
|
margin: 0;
|
|
13
15
|
padding: 0;
|
|
14
16
|
list-style: none;
|
|
@@ -16,26 +18,30 @@
|
|
|
16
18
|
&__name {
|
|
17
19
|
@extend %pix-body-s;
|
|
18
20
|
|
|
19
|
-
padding: var(--pix-spacing-
|
|
20
|
-
color: var(--pix-neutral-
|
|
21
|
-
|
|
21
|
+
padding: var(--pix-spacing-1x) var(--pix-spacing-3x);
|
|
22
|
+
color: var(--pix-neutral-800);
|
|
23
|
+
font-weight: var(--pix-font-bold);
|
|
24
|
+
text-transform: capitalize;
|
|
25
|
+
background-color: var(--pix-neutral-20);
|
|
26
|
+
border-radius: 0.25rem;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
&__option {
|
|
25
30
|
@extend %pix-body-s;
|
|
26
31
|
|
|
27
32
|
position: relative;
|
|
28
|
-
padding: var(--pix-spacing-2x) var(--pix-spacing-
|
|
33
|
+
padding: var(--pix-spacing-2x) var(--pix-spacing-10x) var(--pix-spacing-2x) var(--pix-spacing-3x);
|
|
29
34
|
color: var(--pix-neutral-900);
|
|
30
|
-
border-radius:
|
|
35
|
+
border-radius: 0.25rem;
|
|
31
36
|
|
|
32
|
-
&:
|
|
33
|
-
background-color: var(--pix-neutral-
|
|
37
|
+
&:hover {
|
|
38
|
+
background-color: rgba(var(--pix-neutral-100-inline), 0.60);
|
|
39
|
+
outline: none;
|
|
40
|
+
cursor: pointer;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
&:hover,
|
|
37
43
|
&:focus {
|
|
38
|
-
background-color: var(--pix-primary-
|
|
44
|
+
background-color: var(--pix-primary-100);
|
|
39
45
|
outline: none;
|
|
40
46
|
cursor: pointer;
|
|
41
47
|
}
|
|
@@ -43,27 +49,14 @@
|
|
|
43
49
|
svg {
|
|
44
50
|
position: absolute;
|
|
45
51
|
top: 50%;
|
|
46
|
-
right: var(--pix-spacing-
|
|
52
|
+
right: var(--pix-spacing-3x);
|
|
47
53
|
transform: translateY(-50%);
|
|
48
|
-
visibility: hidden;
|
|
49
|
-
opacity: 0;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
&--selected {
|
|
53
|
-
|
|
57
|
+
color: var(--pix-primary-900);
|
|
58
|
+
font-weight: var(--pix-font-bold);
|
|
54
59
|
background-color: var(--pix-primary-10);
|
|
55
|
-
|
|
56
|
-
svg {
|
|
57
|
-
visibility: visible;
|
|
58
|
-
opacity: 1;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&--hidden {
|
|
63
|
-
height: 0;
|
|
64
|
-
padding-top: 0;
|
|
65
|
-
padding-bottom: 0;
|
|
66
|
-
visibility: hidden;
|
|
67
60
|
}
|
|
68
61
|
}
|
|
69
62
|
}
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
&__search {
|
|
66
66
|
display: flex;
|
|
67
|
-
margin: var(--pix-spacing-
|
|
67
|
+
margin: var(--pix-spacing-2x) var(--pix-spacing-3x);
|
|
68
68
|
color: var(--pix-neutral-100);
|
|
69
69
|
border-bottom: 2px solid var(--pix-neutral-100);
|
|
70
70
|
border-radius: var(--pix-spacing-1x) var(--pix-spacing-1x) 0 0;
|
package/addon/styles/addon.scss
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@1024pix/pix-ui/components/pix-code';
|