@1024pix/pix-ui 57.0.0 → 57.0.2
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.
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
|
|
3
|
+
export default class PixLabel extends Component {
|
|
4
|
+
get className() {
|
|
5
|
+
const classes = ['pix-label'];
|
|
6
|
+
|
|
7
|
+
if (this.args.screenReaderOnly) classes.push('screen-reader-only');
|
|
8
|
+
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
|
|
9
|
+
if (this.args.isDisabled) classes.push('pix-label--disabled');
|
|
10
|
+
|
|
11
|
+
const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
|
|
12
|
+
|
|
13
|
+
classes.push(`pix-label--${size}`);
|
|
14
|
+
|
|
15
|
+
return classes.join(' ');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
<template>
|
|
19
|
+
{{#if @useAsLegend}}
|
|
20
|
+
<legend class={{this.className}} ...attributes>
|
|
21
|
+
<ChoreLabel @requiredLabel={{@requiredLabel}} @subLabel={{@subLabel}}>{{yield}}</ChoreLabel>
|
|
22
|
+
</legend>
|
|
23
|
+
{{else}}
|
|
24
|
+
<label for={{@for}} class={{this.className}} ...attributes>
|
|
25
|
+
<ChoreLabel @requiredLabel={{@requiredLabel}} @subLabel={{@subLabel}}>{{yield}}</ChoreLabel>
|
|
26
|
+
</label>
|
|
27
|
+
{{/if}}
|
|
28
|
+
</template>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ChoreLabel = <template>
|
|
32
|
+
{{yield}}
|
|
33
|
+
{{#if @requiredLabel}}
|
|
34
|
+
<abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
|
|
35
|
+
{{/if}}
|
|
36
|
+
|
|
37
|
+
{{#if @subLabel}}
|
|
38
|
+
<span class="pix-label__sub-label">{{@subLabel}}</span>
|
|
39
|
+
{{/if}}
|
|
40
|
+
</template>;
|
|
@@ -63,9 +63,9 @@ export default class PixSegmentedControl extends Component {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
<template>
|
|
66
|
-
<
|
|
66
|
+
<fieldset class={{this.className}} role="radiogroup">
|
|
67
67
|
<PixLabel
|
|
68
|
-
@
|
|
68
|
+
@useAsLegend={{true}}
|
|
69
69
|
@screenReaderOnly={{@screenReaderOnly}}
|
|
70
70
|
@subLabel={{@subLabel}}
|
|
71
71
|
@size={{@size}}
|
|
@@ -73,36 +73,39 @@ export default class PixSegmentedControl extends Component {
|
|
|
73
73
|
>
|
|
74
74
|
{{yield to="label"}}
|
|
75
75
|
</PixLabel>
|
|
76
|
+
|
|
76
77
|
<div class="pix-segmented-control__radio">
|
|
77
|
-
<
|
|
78
|
-
{{on "change" this.onChange}}
|
|
79
|
-
id={{this.idViewA}}
|
|
80
|
-
type="radio"
|
|
81
|
-
name={{this.toggleName}}
|
|
82
|
-
value="viewA"
|
|
83
|
-
checked={{this.stateViewA}}
|
|
84
|
-
/>
|
|
85
|
-
<label for={{this.idViewA}}>
|
|
78
|
+
<label class="pix-segmented-control__radio-label" for={{this.idViewA}}>
|
|
86
79
|
{{#if @iconA}}
|
|
87
80
|
<PixIcon @name={{@iconA}} @plainIcon={{this.stateViewA}} @ariaHidden={{true}} />
|
|
88
81
|
{{/if}}
|
|
89
82
|
{{yield to="viewA"}}
|
|
83
|
+
<input
|
|
84
|
+
class="screen-reader-only"
|
|
85
|
+
{{on "change" this.onChange}}
|
|
86
|
+
id={{this.idViewA}}
|
|
87
|
+
type="radio"
|
|
88
|
+
name={{this.toggleName}}
|
|
89
|
+
value="viewA"
|
|
90
|
+
checked={{this.stateViewA}}
|
|
91
|
+
/>
|
|
90
92
|
</label>
|
|
91
|
-
<
|
|
92
|
-
{{on "change" this.onChange}}
|
|
93
|
-
id={{this.idViewB}}
|
|
94
|
-
type="radio"
|
|
95
|
-
name={{this.toggleName}}
|
|
96
|
-
value="viewB"
|
|
97
|
-
checked={{this.stateViewB}}
|
|
98
|
-
/>
|
|
99
|
-
<label for={{this.idViewB}}>
|
|
93
|
+
<label class="pix-segmented-control__radio-label" for={{this.idViewB}}>
|
|
100
94
|
{{#if @iconB}}
|
|
101
95
|
<PixIcon @name={{@iconB}} @plainIcon={{this.stateViewB}} @ariaHidden={{true}} />
|
|
102
96
|
{{/if}}
|
|
103
97
|
{{yield to="viewB"}}
|
|
98
|
+
<input
|
|
99
|
+
class="screen-reader-only"
|
|
100
|
+
{{on "change" this.onChange}}
|
|
101
|
+
id={{this.idViewB}}
|
|
102
|
+
type="radio"
|
|
103
|
+
name={{this.toggleName}}
|
|
104
|
+
value="viewB"
|
|
105
|
+
checked={{this.stateViewB}}
|
|
106
|
+
/>
|
|
104
107
|
</label>
|
|
105
108
|
</div>
|
|
106
|
-
</
|
|
109
|
+
</fieldset>
|
|
107
110
|
</template>
|
|
108
111
|
}
|
|
@@ -7,6 +7,12 @@
|
|
|
7
7
|
color: var(--pix-neutral-900);
|
|
8
8
|
font-size: 1rem;
|
|
9
9
|
|
|
10
|
+
&--inline {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
gap: var(--pix-spacing-2x);
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
&--primary .pix-segmented-control__radio {
|
|
11
17
|
background-color: rgb(var(--pix-primary-100-inline), 0.50);
|
|
12
18
|
}
|
|
@@ -26,40 +32,29 @@
|
|
|
26
32
|
align-items: flex-start;
|
|
27
33
|
padding: var(--pix-spacing-1x, 4px);
|
|
28
34
|
border-radius: 8px;
|
|
35
|
+
}
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
label {
|
|
41
|
-
display: flex;
|
|
42
|
-
gap: 10px;
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
padding: var(--pix-spacing-1x, 4px) 8px;
|
|
46
|
-
border: 1px solid transparent;
|
|
47
|
-
border-radius: 8px;
|
|
48
|
-
}
|
|
37
|
+
&__radio-label {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-grow: 1;
|
|
40
|
+
gap: var(--pix-spacing-3x);
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
padding: var(--pix-spacing-1x, 4px) 8px;
|
|
44
|
+
border: 1px solid transparent;
|
|
45
|
+
border-radius: 8px;
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
47
|
+
&:hover {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
&:has(input[type="radio"]:checked) {
|
|
52
|
+
font-weight: var(--pix-font-bold);
|
|
53
|
+
background: var(--pix-neutral-0);
|
|
58
54
|
}
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
align-items: center;
|
|
56
|
+
&:has(input[type="radio"]:focus) {
|
|
57
|
+
border-color: var(--pix-neutral-900);
|
|
58
|
+
}
|
|
64
59
|
}
|
|
65
60
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<label for={{@for}} class={{this.className}} ...attributes>
|
|
2
|
-
{{yield}}
|
|
3
|
-
|
|
4
|
-
{{#if @requiredLabel}}
|
|
5
|
-
<abbr title={{@requiredLabel}} class="mandatory-mark">*</abbr>
|
|
6
|
-
{{/if}}
|
|
7
|
-
|
|
8
|
-
{{#if @subLabel}}
|
|
9
|
-
<span class="pix-label__sub-label">{{@subLabel}}</span>
|
|
10
|
-
{{/if}}
|
|
11
|
-
</label>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Component from '@glimmer/component';
|
|
2
|
-
|
|
3
|
-
export default class PixLabel extends Component {
|
|
4
|
-
get className() {
|
|
5
|
-
const classes = ['pix-label'];
|
|
6
|
-
|
|
7
|
-
if (this.args.screenReaderOnly) classes.push('screen-reader-only');
|
|
8
|
-
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
|
|
9
|
-
if (this.args.isDisabled) classes.push('pix-label--disabled');
|
|
10
|
-
|
|
11
|
-
const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';
|
|
12
|
-
|
|
13
|
-
classes.push(`pix-label--${size}`);
|
|
14
|
-
|
|
15
|
-
return classes.join(' ');
|
|
16
|
-
}
|
|
17
|
-
}
|