@emuanalytics/flow-rdf-ui 4.0.18 → 4.1.0-preview.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.
- package/dist/components/alert/alert.styles.mjs +4 -4
- package/dist/components/avatar/avatar.styles.mjs +4 -2
- package/dist/components/badge/badge.styles.mjs +24 -19
- package/dist/components/base-control/base-control.component.mjs +188 -0
- package/dist/components/base-control/base-control.mjs +5 -0
- package/dist/components/base-control/base-control.styles.mjs +39 -0
- package/dist/components/button/button.component.mjs +3 -3
- package/dist/components/button/button.styles.mjs +53 -36
- package/dist/components/calendar/calendar.component.mjs +4 -0
- package/dist/components/calendar/calendar.styles.mjs +5 -11
- package/dist/components/card/card.styles.mjs +8 -4
- package/dist/components/checkbox/checkbox.component.mjs +9 -18
- package/dist/components/checkbox/checkbox.styles.mjs +29 -71
- package/dist/components/checkbox-group/checkbox-group.component.mjs +290 -0
- package/dist/components/checkbox-group/checkbox-group.mjs +5 -0
- package/dist/components/checkbox-group/checkbox-group.styles.mjs +73 -0
- package/dist/components/color-mapper/color-mapper.component.mjs +8 -2
- package/dist/components/color-mapper/color-mapper.styles.mjs +9 -11
- package/dist/components/color-picker/color-picker.styles.mjs +18 -12
- package/dist/components/color-stop/color-stop.styles.mjs +7 -12
- package/dist/components/date-time-picker/date-time-picker.component.mjs +48 -33
- package/dist/components/date-time-picker/date-time-picker.styles.mjs +59 -47
- package/dist/components/details/details.styles.mjs +27 -5
- package/dist/components/dialog/dialog.component.mjs +74 -29
- package/dist/components/dialog/dialog.styles.mjs +21 -6
- package/dist/components/drawer/drawer.styles.mjs +1 -1
- package/dist/components/form-group/form-group.component.mjs +132 -0
- package/dist/components/form-group/form-group.mjs +5 -0
- package/dist/components/form-group/form-group.styles.mjs +81 -0
- package/dist/components/gauge/gauge.component.mjs +6 -9
- package/dist/components/gauge/gauge.styles.mjs +7 -7
- package/dist/components/icon/library.system.mjs +2 -1
- package/dist/components/input/input.component.mjs +50 -35
- package/dist/components/input/input.styles.mjs +56 -187
- package/dist/components/menu/menu.styles.mjs +12 -2
- package/dist/components/menu-item/menu-item.component.mjs +9 -5
- package/dist/components/menu-item/menu-item.styles.mjs +4 -4
- package/dist/components/option/option.styles.mjs +7 -7
- package/dist/components/panel/panel.styles.mjs +1 -5
- package/dist/components/panel-header/panel-header.component.mjs +3 -3
- package/dist/components/panel-header/panel-header.styles.mjs +2 -2
- package/dist/components/popup/popup.styles.mjs +1 -1
- package/dist/components/progress-bar/progress-bar.component.mjs +1 -1
- package/dist/components/query-builder/default-value-templates.mjs +6 -0
- package/dist/components/query-builder/query-builder.component.mjs +132 -86
- package/dist/components/query-builder/query-builder.styles.mjs +56 -13
- package/dist/components/radio/radio.component.mjs +5 -5
- package/dist/components/radio/radio.styles.mjs +20 -64
- package/dist/components/radio-group/radio-group.component.mjs +23 -20
- package/dist/components/radio-group/radio-group.styles.mjs +35 -11
- package/dist/components/range/range.component.mjs +82 -63
- package/dist/components/range/range.styles.mjs +57 -65
- package/dist/components/select/select.component.mjs +79 -48
- package/dist/components/select/select.styles.mjs +94 -143
- package/dist/components/split-view-divider/split-view-divider.styles.mjs +2 -8
- package/dist/components/stepper/stepper.component.mjs +2 -1
- package/dist/components/stepper/stepper.styles.mjs +3 -2
- package/dist/components/stepper-panel/stepper-panel.component.mjs +0 -4
- package/dist/components/switch/switch.component.mjs +67 -33
- package/dist/components/switch/switch.styles.mjs +48 -102
- package/dist/components/tab/tab.component.mjs +3 -0
- package/dist/components/tab-group/tab-group.component.mjs +38 -33
- package/dist/components/tab-group/tab-group.styles.mjs +2 -9
- package/dist/components/tab-panel/tab-panel.styles.mjs +0 -4
- package/dist/components/tag/tag.styles.mjs +57 -70
- package/dist/components/textarea/textarea.component.mjs +12 -12
- package/dist/components/textarea/textarea.styles.mjs +41 -34
- package/dist/components/timer/timer.styles.mjs +2 -2
- package/dist/components/tool-button/tool-button.styles.mjs +8 -8
- package/dist/components/tool-button-group/tool-button-group.styles.mjs +6 -6
- package/dist/custom-elements.json +3471 -2059
- package/dist/index.d.mts +553 -258
- package/dist/index.d.ts +553 -258
- package/dist/index.mjs +3 -0
- package/dist/internal/computed-style.mjs +13 -0
- package/dist/internal/flow-ui-rdf-element.mjs +16 -1
- package/dist/internal/string.mjs +11 -3
- package/dist/package.json.mjs +1 -1
- package/dist/styles/form-control.styles.mjs +155 -33
- package/dist/utilities/register-components.mjs +6 -0
- package/dist/vscode.html-custom-data.json +288 -101
- package/package.json +2 -1
- package/themes/dark-new.css +723 -0
- package/themes/dark-new.styles.js +745 -0
- package/themes/dark.css +174 -117
- package/themes/dark.styles.js +188 -119
- package/themes/light.css +215 -121
- package/themes/light.styles.js +229 -123
|
@@ -5,18 +5,22 @@ const styles = css`
|
|
|
5
5
|
${componentStyles}
|
|
6
6
|
|
|
7
7
|
:host {
|
|
8
|
-
--border-color: var(--flow-ui-
|
|
9
|
-
--border-radius: var(--flow-ui-border-radius
|
|
10
|
-
--border-width:
|
|
8
|
+
--border-color: var(--flow-ui-card-border-color);
|
|
9
|
+
--border-radius: var(--flow-ui-card-border-radius);
|
|
10
|
+
--border-width: var(--flow-ui-card-border-width);
|
|
11
11
|
--padding: var(--flow-ui-spacing-large);
|
|
12
12
|
|
|
13
|
+
--background-color: var(--flow-ui-card-background-color);
|
|
14
|
+
--color: var(--flow-ui-card-color);
|
|
15
|
+
|
|
13
16
|
display: inline-block;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
.card {
|
|
17
20
|
display: flex;
|
|
18
21
|
flex-direction: column;
|
|
19
|
-
background-color: var(--
|
|
22
|
+
background-color: var(--background-color);
|
|
23
|
+
color: var(--color);
|
|
20
24
|
box-shadow: var(--flow-ui-shadow-x-small);
|
|
21
25
|
border: solid var(--border-width) var(--border-color);
|
|
22
26
|
border-radius: var(--border-radius);
|
|
@@ -32,16 +32,16 @@ class FlowUiCheckbox extends FlowRdfFormControl {
|
|
|
32
32
|
setValue: (control, checked) => control.checked = checked
|
|
33
33
|
});
|
|
34
34
|
this.hasFocus = false;
|
|
35
|
-
this.
|
|
35
|
+
this.label = "";
|
|
36
36
|
this.name = "";
|
|
37
37
|
this.size = "medium";
|
|
38
38
|
this.disabled = false;
|
|
39
39
|
this.checked = false;
|
|
40
40
|
this.indeterminate = false;
|
|
41
41
|
this.defaultChecked = false;
|
|
42
|
+
this.reverse = false;
|
|
42
43
|
this.form = "";
|
|
43
44
|
this.required = false;
|
|
44
|
-
this.fullWidth = false;
|
|
45
45
|
}
|
|
46
46
|
connectedCallback() {
|
|
47
47
|
super.connectedCallback();
|
|
@@ -49,7 +49,7 @@ class FlowUiCheckbox extends FlowRdfFormControl {
|
|
|
49
49
|
this.indeterminate = boolean(this.indeterminate, true);
|
|
50
50
|
this.disabled = boolean(this.disabled, true);
|
|
51
51
|
this.required = boolean(this.required, true);
|
|
52
|
-
this.
|
|
52
|
+
this.reverse = boolean(this.reverse, true);
|
|
53
53
|
}
|
|
54
54
|
/** Gets the validity state object */
|
|
55
55
|
get validity() {
|
|
@@ -135,19 +135,13 @@ class FlowUiCheckbox extends FlowRdfFormControl {
|
|
|
135
135
|
"checkbox--small": this.size === "small",
|
|
136
136
|
"checkbox--medium": this.size === "medium",
|
|
137
137
|
"checkbox--large": this.size === "large",
|
|
138
|
-
"checkbox--
|
|
139
|
-
"checkbox--secondary": this.variant === "secondary",
|
|
140
|
-
"checkbox--success": this.variant === "success",
|
|
141
|
-
"checkbox--warning": this.variant === "warning",
|
|
142
|
-
"checkbox--danger": this.variant === "danger",
|
|
143
|
-
"checkbox--neutral": this.variant === "neutral",
|
|
144
|
-
"checkbox--full-width": this.fullWidth
|
|
138
|
+
"checkbox--reverse": this.reverse
|
|
145
139
|
})}
|
|
146
140
|
>
|
|
147
141
|
<input
|
|
148
142
|
class="checkbox__input"
|
|
149
143
|
type="checkbox"
|
|
150
|
-
title=${this.
|
|
144
|
+
title=${this.label}
|
|
151
145
|
name=${this.name}
|
|
152
146
|
value=${ifDefined(this.value)}
|
|
153
147
|
.indeterminate=${live(this.indeterminate)}
|
|
@@ -202,7 +196,7 @@ __decorateClass([
|
|
|
202
196
|
], FlowUiCheckbox.prototype, "hasFocus", 2);
|
|
203
197
|
__decorateClass([
|
|
204
198
|
property()
|
|
205
|
-
], FlowUiCheckbox.prototype, "
|
|
199
|
+
], FlowUiCheckbox.prototype, "label", 2);
|
|
206
200
|
__decorateClass([
|
|
207
201
|
property()
|
|
208
202
|
], FlowUiCheckbox.prototype, "name", 2);
|
|
@@ -224,18 +218,15 @@ __decorateClass([
|
|
|
224
218
|
__decorateClass([
|
|
225
219
|
defaultValue("checked")
|
|
226
220
|
], FlowUiCheckbox.prototype, "defaultChecked", 2);
|
|
221
|
+
__decorateClass([
|
|
222
|
+
property({ type: Boolean, reflect: true })
|
|
223
|
+
], FlowUiCheckbox.prototype, "reverse", 2);
|
|
227
224
|
__decorateClass([
|
|
228
225
|
property({ reflect: true })
|
|
229
226
|
], FlowUiCheckbox.prototype, "form", 2);
|
|
230
227
|
__decorateClass([
|
|
231
228
|
property({ type: Boolean, reflect: true })
|
|
232
229
|
], FlowUiCheckbox.prototype, "required", 2);
|
|
233
|
-
__decorateClass([
|
|
234
|
-
property()
|
|
235
|
-
], FlowUiCheckbox.prototype, "variant", 2);
|
|
236
|
-
__decorateClass([
|
|
237
|
-
property({ type: Boolean, reflect: true, attribute: "full-width" })
|
|
238
|
-
], FlowUiCheckbox.prototype, "fullWidth", 2);
|
|
239
230
|
__decorateClass([
|
|
240
231
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
241
232
|
], FlowUiCheckbox.prototype, "handleDisabledChange", 1);
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
import componentStyles from '../../styles/component.styles.mjs';
|
|
3
|
+
import formControlStyles from '../../styles/form-control.styles.mjs';
|
|
3
4
|
|
|
4
5
|
const styles = css`
|
|
5
6
|
${componentStyles}
|
|
7
|
+
${formControlStyles}
|
|
6
8
|
|
|
7
9
|
:host {
|
|
8
10
|
display: inline-block;
|
|
9
11
|
|
|
10
|
-
--checkbox-color: var(--flow-ui-color-
|
|
11
|
-
--checkbox-check-color: var(--flow-ui-color-
|
|
12
|
-
--checkbox-hover-color: var(--flow-ui-color-secondary-400);
|
|
12
|
+
--checkbox-color: var(--flow-ui-checkbox-color, var(--flow-ui-color-primary-500));
|
|
13
|
+
--checkbox-check-color: var(--flow-ui-checkbox-check-color, var(--flow-ui-color-primary-contrast));
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.checkbox {
|
|
16
17
|
position: relative;
|
|
17
18
|
display: inline-flex;
|
|
19
|
+
width: 100%;
|
|
18
20
|
align-items: flex-start;
|
|
19
|
-
font-family: var(--flow-ui-
|
|
20
|
-
font-weight: var(--flow-ui-
|
|
21
|
-
color: var(--flow-ui-
|
|
21
|
+
font-family: var(--flow-ui-control-font-family);
|
|
22
|
+
font-weight: var(--flow-ui-control-font-weight);
|
|
23
|
+
color: var(--flow-ui-control-label-color);
|
|
22
24
|
vertical-align: middle;
|
|
23
25
|
cursor: pointer;
|
|
24
26
|
}
|
|
@@ -26,65 +28,17 @@ const styles = css`
|
|
|
26
28
|
/* Sizes */
|
|
27
29
|
.checkbox--small {
|
|
28
30
|
--toggle-size: var(--flow-ui-toggle-size-small);
|
|
29
|
-
font-size: var(--flow-ui-
|
|
31
|
+
font-size: var(--flow-ui-control-font-size-small);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
.checkbox--medium {
|
|
33
35
|
--toggle-size: var(--flow-ui-toggle-size-medium);
|
|
34
|
-
font-size: var(--flow-ui-
|
|
36
|
+
font-size: var(--flow-ui-control-font-size-medium);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.checkbox--large {
|
|
38
40
|
--toggle-size: var(--flow-ui-toggle-size-large);
|
|
39
|
-
font-size: var(--flow-ui-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/* Color variants */
|
|
43
|
-
.checkbox--primary {
|
|
44
|
-
--checkbox-color: var(--flow-ui-color-primary-500);
|
|
45
|
-
--checkbox-hover-color: var(--flow-ui-color-primary-400);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.checkbox--secondary {
|
|
49
|
-
--checkbox-color: var(--flow-ui-color-secondary-500);
|
|
50
|
-
--checkbox-hover-color: var(--flow-ui-color-secondary-400);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.checkbox--success {
|
|
54
|
-
--checkbox-color: var(--flow-ui-color-success-500);
|
|
55
|
-
--checkbox-hover-color: var(--flow-ui-color-success-400);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.checkbox--warning {
|
|
59
|
-
--checkbox-color: var(--flow-ui-color-warning-500);
|
|
60
|
-
--checkbox-hover-color: var(--flow-ui-color-warning-400);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.checkbox--danger {
|
|
64
|
-
--checkbox-color: var(--flow-ui-color-danger-500);
|
|
65
|
-
--checkbox-hover-color: var(--flow-ui-color-danger-400);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.checkbox--neutral {
|
|
69
|
-
--checkbox-color: var(--flow-ui-color-neutral-500);
|
|
70
|
-
--checkbox-hover-color: var(--flow-ui-color-neutral-400);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* Alternative 'full-width' style */
|
|
74
|
-
:host([full-width]) {
|
|
75
|
-
display: block;
|
|
76
|
-
margin-top: var(--flow-ui-spacing-small);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.checkbox--full-width {
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-direction: row-reverse;
|
|
82
|
-
align-items: center;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.checkbox--full-width .checkbox__label {
|
|
86
|
-
flex: 1;
|
|
87
|
-
margin: 0;
|
|
41
|
+
font-size: var(--flow-ui-control-font-size-large);
|
|
88
42
|
}
|
|
89
43
|
|
|
90
44
|
.checkbox__control {
|
|
@@ -95,9 +49,9 @@ const styles = css`
|
|
|
95
49
|
justify-content: center;
|
|
96
50
|
width: var(--toggle-size);
|
|
97
51
|
height: var(--toggle-size);
|
|
98
|
-
border: solid var(--flow-ui-
|
|
52
|
+
border: solid var(--flow-ui-control-border-width) var(--flow-ui-control-border-color);
|
|
99
53
|
border-radius: 2px;
|
|
100
|
-
background-color: var(--flow-ui-
|
|
54
|
+
background-color: var(--flow-ui-control-background-color);
|
|
101
55
|
color: var(--checkbox-check-color);
|
|
102
56
|
transition:
|
|
103
57
|
var(--flow-ui-transition-fast) border-color,
|
|
@@ -123,8 +77,8 @@ const styles = css`
|
|
|
123
77
|
|
|
124
78
|
/* Hover */
|
|
125
79
|
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
|
126
|
-
border-color: var(--flow-ui-
|
|
127
|
-
background-color: var(--flow-ui-
|
|
80
|
+
border-color: var(--flow-ui-control-border-color-hover);
|
|
81
|
+
background-color: var(--flow-ui-control-background-color-hover);
|
|
128
82
|
}
|
|
129
83
|
|
|
130
84
|
/* Focus */
|
|
@@ -140,13 +94,6 @@ const styles = css`
|
|
|
140
94
|
background-color: var(--checkbox-color);
|
|
141
95
|
}
|
|
142
96
|
|
|
143
|
-
/* Checked/indeterminate + hover */
|
|
144
|
-
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
|
|
145
|
-
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
|
|
146
|
-
border-color: var(--checkbox-hover-color);
|
|
147
|
-
background-color: var(--checkbox-hover-color);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
97
|
/* Checked/indeterminate + focus */
|
|
151
98
|
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control,
|
|
152
99
|
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
|
@@ -162,15 +109,26 @@ const styles = css`
|
|
|
162
109
|
|
|
163
110
|
.checkbox__label {
|
|
164
111
|
display: inline-block;
|
|
165
|
-
|
|
112
|
+
flex: 1;
|
|
113
|
+
color: var(--flow-ui-control-label-color);
|
|
166
114
|
line-height: var(--toggle-size);
|
|
167
115
|
margin-inline-start: 0.5em;
|
|
168
116
|
user-select: none;
|
|
169
117
|
}
|
|
170
118
|
|
|
119
|
+
/* Reverse layout */
|
|
120
|
+
.checkbox--reverse {
|
|
121
|
+
flex-direction: row-reverse;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.checkbox--reverse .checkbox__label {
|
|
125
|
+
margin-inline-start: 0;
|
|
126
|
+
margin-inline-end: 0.5em;
|
|
127
|
+
}
|
|
128
|
+
|
|
171
129
|
:host([required]) .checkbox__label::after {
|
|
172
|
-
content: var(--flow-ui-
|
|
173
|
-
margin-inline-start: var(--flow-ui-
|
|
130
|
+
content: var(--flow-ui-control-required-content);
|
|
131
|
+
margin-inline-start: var(--flow-ui-control-required-content-offset);
|
|
174
132
|
}
|
|
175
133
|
`;
|
|
176
134
|
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
import { query, state, property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { boolean } from '../../internal/boolean.mjs';
|
|
5
|
+
import { FlowRdfFormControl } from '../../internal/flow-ui-rdf-element.mjs';
|
|
6
|
+
import { FormControlController, customErrorValidityState, valueMissingValidityState, validValidityState } from '../../internal/form.mjs';
|
|
7
|
+
import { HasSlotController } from '../../internal/slot.mjs';
|
|
8
|
+
import { watch } from '../../internal/watch.mjs';
|
|
9
|
+
import styles from './checkbox-group.styles.mjs';
|
|
10
|
+
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result)
|
|
19
|
+
__defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
class FlowUiCheckboxGroup extends FlowRdfFormControl {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.formControlController = new FormControlController(this);
|
|
26
|
+
this.hasSlotController = new HasSlotController(this, "help-text", "label");
|
|
27
|
+
this.customValidityMessage = "";
|
|
28
|
+
this.errorMessage = "";
|
|
29
|
+
this.defaultValue = [];
|
|
30
|
+
this.label = "";
|
|
31
|
+
this.helpText = "";
|
|
32
|
+
this.name = "option";
|
|
33
|
+
this.value = [];
|
|
34
|
+
this.size = "medium";
|
|
35
|
+
this.form = "";
|
|
36
|
+
this.required = false;
|
|
37
|
+
this.reverse = false;
|
|
38
|
+
this.divider = false;
|
|
39
|
+
}
|
|
40
|
+
/** Gets the validity state object */
|
|
41
|
+
get validity() {
|
|
42
|
+
const isRequiredAndEmpty = this.required && !this.value;
|
|
43
|
+
const hasCustomValidityMessage = this.customValidityMessage !== "";
|
|
44
|
+
if (hasCustomValidityMessage) {
|
|
45
|
+
return customErrorValidityState;
|
|
46
|
+
} else if (isRequiredAndEmpty) {
|
|
47
|
+
return valueMissingValidityState;
|
|
48
|
+
}
|
|
49
|
+
return validValidityState;
|
|
50
|
+
}
|
|
51
|
+
/** Gets the validation message */
|
|
52
|
+
get validationMessage() {
|
|
53
|
+
const isRequiredAndEmpty = this.required && !this.value;
|
|
54
|
+
const hasCustomValidityMessage = this.customValidityMessage !== "";
|
|
55
|
+
if (hasCustomValidityMessage) {
|
|
56
|
+
return this.customValidityMessage;
|
|
57
|
+
} else if (isRequiredAndEmpty) {
|
|
58
|
+
return this.validationInput.validationMessage;
|
|
59
|
+
}
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
connectedCallback() {
|
|
63
|
+
super.connectedCallback();
|
|
64
|
+
this.required = boolean(this.required, true);
|
|
65
|
+
this.reverse = boolean(this.reverse, true);
|
|
66
|
+
this.divider = boolean(this.divider, true);
|
|
67
|
+
this.defaultValue = this.value;
|
|
68
|
+
}
|
|
69
|
+
firstUpdated() {
|
|
70
|
+
this.formControlController.updateValidity();
|
|
71
|
+
}
|
|
72
|
+
getAllCheckboxes() {
|
|
73
|
+
return [...this.querySelectorAll("flow-ui-checkbox")];
|
|
74
|
+
}
|
|
75
|
+
handleCheckboxClick(event) {
|
|
76
|
+
const target = event.target.closest("flow-ui-checkbox");
|
|
77
|
+
const checkboxes = this.getAllCheckboxes();
|
|
78
|
+
const oldValue = this.value;
|
|
79
|
+
if (target.disabled) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.value = checkboxes.filter((checkbox) => checkbox.checked).map((checkbox) => checkbox.value);
|
|
83
|
+
const arrayEqual = (arr1, arr2) => {
|
|
84
|
+
if (arr1.length !== arr2.length)
|
|
85
|
+
return false;
|
|
86
|
+
return arr2.every((arr2Item) => arr1.includes(arr2Item));
|
|
87
|
+
};
|
|
88
|
+
if (!arrayEqual(this.value, oldValue)) {
|
|
89
|
+
this.emit("flow-ui-change");
|
|
90
|
+
this.emit("flow-ui-input");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
handleLabelClick() {
|
|
94
|
+
const checkboxes = this.getAllCheckboxes();
|
|
95
|
+
checkboxes[0]?.focus();
|
|
96
|
+
}
|
|
97
|
+
handleInvalid(event) {
|
|
98
|
+
this.formControlController.setValidity(false);
|
|
99
|
+
this.formControlController.emitInvalidEvent(event);
|
|
100
|
+
}
|
|
101
|
+
syncCheckboxes() {
|
|
102
|
+
if (customElements.get("flow-ui-checkbox")) {
|
|
103
|
+
const checkboxes = this.getAllCheckboxes();
|
|
104
|
+
checkboxes.forEach((checkbox) => {
|
|
105
|
+
checkbox.size = this.size;
|
|
106
|
+
checkbox.reverse = this.reverse;
|
|
107
|
+
});
|
|
108
|
+
this.updateCheckedState();
|
|
109
|
+
} else {
|
|
110
|
+
customElements.whenDefined("flow-ui-checkbox").then(() => this.syncCheckboxes());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
updateCheckedState() {
|
|
114
|
+
const checkboxes = this.getAllCheckboxes();
|
|
115
|
+
checkboxes.forEach((checkbox) => checkbox.checked = this.value.includes(checkbox.value));
|
|
116
|
+
this.formControlController.setValidity(this.validity.valid);
|
|
117
|
+
}
|
|
118
|
+
handleStyleChange() {
|
|
119
|
+
this.syncCheckboxes();
|
|
120
|
+
}
|
|
121
|
+
handleValueChange() {
|
|
122
|
+
if (this.hasUpdated) {
|
|
123
|
+
this.updateCheckedState();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
127
|
+
checkValidity() {
|
|
128
|
+
const isRequiredAndEmpty = this.required && !this.value;
|
|
129
|
+
const hasCustomValidityMessage = this.customValidityMessage !== "";
|
|
130
|
+
if (isRequiredAndEmpty || hasCustomValidityMessage) {
|
|
131
|
+
this.formControlController.emitInvalidEvent();
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
/** Gets the associated form, if one exists. */
|
|
137
|
+
getForm() {
|
|
138
|
+
return this.formControlController.getForm();
|
|
139
|
+
}
|
|
140
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
141
|
+
reportValidity() {
|
|
142
|
+
const isValid = this.validity.valid;
|
|
143
|
+
this.errorMessage = this.customValidityMessage || isValid ? "" : this.validationInput.validationMessage;
|
|
144
|
+
this.formControlController.setValidity(isValid);
|
|
145
|
+
this.validationInput.hidden = true;
|
|
146
|
+
clearTimeout(this.validationTimeout);
|
|
147
|
+
if (!isValid) {
|
|
148
|
+
this.validationInput.hidden = false;
|
|
149
|
+
this.validationInput.reportValidity();
|
|
150
|
+
this.validationTimeout = setTimeout(() => this.validationInput.hidden = true, 1e4);
|
|
151
|
+
}
|
|
152
|
+
return isValid;
|
|
153
|
+
}
|
|
154
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
155
|
+
setCustomValidity(message = "") {
|
|
156
|
+
this.customValidityMessage = message;
|
|
157
|
+
this.errorMessage = message;
|
|
158
|
+
this.validationInput.setCustomValidity(message);
|
|
159
|
+
this.formControlController.updateValidity();
|
|
160
|
+
}
|
|
161
|
+
/** Stop propagation of flow-ui-input and flow-ui-change from child checkboxes */
|
|
162
|
+
handleChildEvents(event) {
|
|
163
|
+
event.stopPropagation();
|
|
164
|
+
}
|
|
165
|
+
render() {
|
|
166
|
+
const hasLabelSlot = this.hasSlotController.test("label");
|
|
167
|
+
const hasHelpTextSlot = this.hasSlotController.test("help-text");
|
|
168
|
+
const hasLabel = this.label ? true : !!hasLabelSlot;
|
|
169
|
+
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
|
|
170
|
+
const defaultSlot = html`
|
|
171
|
+
<slot @click=${this.handleCheckboxClick} @slotchange=${this.syncCheckboxes} role="presentation"></slot>
|
|
172
|
+
`;
|
|
173
|
+
return html`
|
|
174
|
+
<fieldset
|
|
175
|
+
part="form-control"
|
|
176
|
+
class=${classMap({
|
|
177
|
+
"form-control": true,
|
|
178
|
+
"form-control--small": this.size === "small",
|
|
179
|
+
"form-control--medium": this.size === "medium",
|
|
180
|
+
"form-control--large": this.size === "large",
|
|
181
|
+
"form-control--checkbox-group": true,
|
|
182
|
+
"form-control--has-label": hasLabel,
|
|
183
|
+
"form-control--has-help-text": hasHelpText,
|
|
184
|
+
"form-control--has-divider": this.divider
|
|
185
|
+
})}
|
|
186
|
+
role="radiogroup"
|
|
187
|
+
aria-labelledby="label"
|
|
188
|
+
aria-describedby="help-text"
|
|
189
|
+
aria-errormessage="error-message"
|
|
190
|
+
>
|
|
191
|
+
<label
|
|
192
|
+
part="form-control-label"
|
|
193
|
+
id="label"
|
|
194
|
+
class="form-control__label"
|
|
195
|
+
aria-hidden=${hasLabel ? "false" : "true"}
|
|
196
|
+
@click=${this.handleLabelClick}
|
|
197
|
+
>
|
|
198
|
+
<slot name="label">${this.label}</slot>
|
|
199
|
+
</label>
|
|
200
|
+
|
|
201
|
+
<slot
|
|
202
|
+
name="help-text"
|
|
203
|
+
part="form-control-help-text"
|
|
204
|
+
id="help-text"
|
|
205
|
+
class="form-control__help-text"
|
|
206
|
+
aria-hidden=${hasHelpText ? "false" : "true"}
|
|
207
|
+
>
|
|
208
|
+
${this.helpText}
|
|
209
|
+
</slot>
|
|
210
|
+
|
|
211
|
+
<div
|
|
212
|
+
part="form-control-input"
|
|
213
|
+
class="form-control-input"
|
|
214
|
+
@flow-ui-input=${this.handleChildEvents}
|
|
215
|
+
@flow-ui-change=${this.handleChildEvents}
|
|
216
|
+
>
|
|
217
|
+
<div class="visually-hidden">
|
|
218
|
+
<div id="error-message" aria-live="assertive">${this.errorMessage}</div>
|
|
219
|
+
<label class="checkbox-group__validation">
|
|
220
|
+
<input
|
|
221
|
+
type="text"
|
|
222
|
+
class="checkbox-group__validation-input"
|
|
223
|
+
?required=${this.required}
|
|
224
|
+
tabindex="-1"
|
|
225
|
+
hidden
|
|
226
|
+
@invalid=${this.handleInvalid}
|
|
227
|
+
/>
|
|
228
|
+
</label>
|
|
229
|
+
</div>
|
|
230
|
+
${defaultSlot}
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
${this.divider ? this.renderDivider() : nothing}
|
|
234
|
+
</fieldset>
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
FlowUiCheckboxGroup.styles = styles;
|
|
239
|
+
__decorateClass([
|
|
240
|
+
query("slot:not([name])")
|
|
241
|
+
], FlowUiCheckboxGroup.prototype, "defaultSlot", 2);
|
|
242
|
+
__decorateClass([
|
|
243
|
+
query(".checkbox-group__validation-input")
|
|
244
|
+
], FlowUiCheckboxGroup.prototype, "validationInput", 2);
|
|
245
|
+
__decorateClass([
|
|
246
|
+
state()
|
|
247
|
+
], FlowUiCheckboxGroup.prototype, "errorMessage", 2);
|
|
248
|
+
__decorateClass([
|
|
249
|
+
state()
|
|
250
|
+
], FlowUiCheckboxGroup.prototype, "defaultValue", 2);
|
|
251
|
+
__decorateClass([
|
|
252
|
+
property()
|
|
253
|
+
], FlowUiCheckboxGroup.prototype, "label", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property({ attribute: "help-text" })
|
|
256
|
+
], FlowUiCheckboxGroup.prototype, "helpText", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property()
|
|
259
|
+
], FlowUiCheckboxGroup.prototype, "name", 2);
|
|
260
|
+
__decorateClass([
|
|
261
|
+
property({
|
|
262
|
+
converter: {
|
|
263
|
+
fromAttribute: (value) => value.split(" "),
|
|
264
|
+
toAttribute: (value) => value.join(" ")
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
], FlowUiCheckboxGroup.prototype, "value", 2);
|
|
268
|
+
__decorateClass([
|
|
269
|
+
property({ reflect: true })
|
|
270
|
+
], FlowUiCheckboxGroup.prototype, "size", 2);
|
|
271
|
+
__decorateClass([
|
|
272
|
+
property({ reflect: true })
|
|
273
|
+
], FlowUiCheckboxGroup.prototype, "form", 2);
|
|
274
|
+
__decorateClass([
|
|
275
|
+
property({ type: Boolean, reflect: true })
|
|
276
|
+
], FlowUiCheckboxGroup.prototype, "required", 2);
|
|
277
|
+
__decorateClass([
|
|
278
|
+
property({ type: Boolean, reflect: true })
|
|
279
|
+
], FlowUiCheckboxGroup.prototype, "reverse", 2);
|
|
280
|
+
__decorateClass([
|
|
281
|
+
property({ type: Boolean, reflect: true })
|
|
282
|
+
], FlowUiCheckboxGroup.prototype, "divider", 2);
|
|
283
|
+
__decorateClass([
|
|
284
|
+
watch(["size", "reverse"], { waitUntilFirstUpdate: true })
|
|
285
|
+
], FlowUiCheckboxGroup.prototype, "handleStyleChange", 1);
|
|
286
|
+
__decorateClass([
|
|
287
|
+
watch("value")
|
|
288
|
+
], FlowUiCheckboxGroup.prototype, "handleValueChange", 1);
|
|
289
|
+
|
|
290
|
+
export { FlowUiCheckboxGroup as default };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import componentStyles from '../../styles/component.styles.mjs';
|
|
3
|
+
import formControlStyles from '../../styles/form-control.styles.mjs';
|
|
4
|
+
|
|
5
|
+
const styles = css`
|
|
6
|
+
${componentStyles}
|
|
7
|
+
${formControlStyles}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.form-control {
|
|
14
|
+
border: none;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-columns: 1fr;
|
|
20
|
+
grid-row-gap: var(--flow-ui-spacing-x-small);
|
|
21
|
+
align-items: center;
|
|
22
|
+
font-family: var(--flow-ui-control-font-family);
|
|
23
|
+
font-size: inherit;
|
|
24
|
+
font-weight: var(--flow-ui-control-font-weight);
|
|
25
|
+
line-height: var(--flow-ui-line-height-dense);
|
|
26
|
+
|
|
27
|
+
margin-bottom: calc(var(--control-spacing) * 0.5);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.form-control.form-control--has-divider {
|
|
31
|
+
margin-bottom: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.form-control__label {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Remove margins from label and help-text. Spacing is determined by row grid gap */
|
|
39
|
+
.form-control.form-control--has-label .form-control__label {
|
|
40
|
+
margin-top: 0 !important;
|
|
41
|
+
margin-bottom: 0 !important;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.form-control-input {
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
gap: calc(var(--control-spacing) * 0.8);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.form-control.form-control--has-help-text .form-control__help-text {
|
|
51
|
+
margin-top: 0 !important;
|
|
52
|
+
margin-bottom: 0 !important;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.checkbox-group--required .checkbox-group__label::after {
|
|
56
|
+
content: var(--flow-ui-control-required-content);
|
|
57
|
+
margin-inline-start: var(--flow-ui-control-required-content-offset);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.visually-hidden {
|
|
61
|
+
position: absolute;
|
|
62
|
+
width: 1px;
|
|
63
|
+
height: 1px;
|
|
64
|
+
padding: 0;
|
|
65
|
+
margin: -1px;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
clip: rect(0, 0, 0, 0);
|
|
68
|
+
white-space: nowrap;
|
|
69
|
+
border: 0;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export { styles as default };
|
|
@@ -132,6 +132,7 @@ class FlowUiColorMapper extends FlowRdfElement {
|
|
|
132
132
|
value=${ifDefined(this.value.field)}
|
|
133
133
|
size=${this.size}
|
|
134
134
|
placeholder="Data Attribute"
|
|
135
|
+
inline
|
|
135
136
|
>
|
|
136
137
|
${Object.keys(this.options?.fields || {}).map(
|
|
137
138
|
(field) => html`
|
|
@@ -183,7 +184,7 @@ class FlowUiColorMapper extends FlowRdfElement {
|
|
|
183
184
|
}
|
|
184
185
|
infoDialogTemplate() {
|
|
185
186
|
return html`
|
|
186
|
-
<flow-ui-dialog
|
|
187
|
+
<flow-ui-dialog heading="Color Mapping" class="dialog-info">
|
|
187
188
|
<slot name="info"></slot>
|
|
188
189
|
<flow-ui-button autofocus slot="footer" variant="primary" @click=${() => this.infoDialog.hide()}>
|
|
189
190
|
OK
|
|
@@ -206,7 +207,12 @@ class FlowUiColorMapper extends FlowRdfElement {
|
|
|
206
207
|
@flow-ui-change=${this.handleChange}
|
|
207
208
|
>
|
|
208
209
|
<div part="mode-selector">
|
|
209
|
-
<flow-ui-radio-group
|
|
210
|
+
<flow-ui-radio-group
|
|
211
|
+
id="mode-radio-group"
|
|
212
|
+
class="color-mode-radio-group"
|
|
213
|
+
size=${this.size}
|
|
214
|
+
value=${this.value.mode}
|
|
215
|
+
>
|
|
210
216
|
<flow-ui-radio value="fixed" class="color-mode-radio">${this.fixedColorTemplate()}</flow-ui-radio>
|
|
211
217
|
<flow-ui-radio value="data-driven" class="color-mode-radio">
|
|
212
218
|
${this.dataDrivenColorTemplate()}
|