@jumpgroup/jump-design-system 0.3.9 → 0.3.15
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/cjs/chunk.H33C3MRM-2c09acb5.js +547 -0
- package/dist/cjs/chunk.H33C3MRM-2c09acb5.js.map +1 -0
- package/dist/cjs/jump-button_2.cjs.entry.js +3 -525
- package/dist/cjs/jump-button_2.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-design-system.cjs.js +1 -1
- package/dist/cjs/jump-filter-checkbox.cjs.entry.js +845 -0
- package/dist/cjs/jump-filter-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/jump-filter.cjs.entry.js +5 -4
- package/dist/cjs/jump-filter.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-filtergroup.cjs.entry.js +32 -9
- package/dist/cjs/jump-filtergroup.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-pagination-table.cjs.entry.js +3 -3
- package/dist/cjs/jump-pagination.cjs.entry.js +3 -3
- package/dist/cjs/jump-quantity.cjs.entry.js +4 -4
- package/dist/cjs/jump-quantity.cjs.entry.js.map +1 -1
- package/dist/cjs/jump-tab-item.cjs.entry.js +2 -2
- package/dist/cjs/jump-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/jump-tab.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/jump-filter/jump-filter.css +8 -1
- package/dist/collection/components/jump-filter/jump-filter.js +5 -4
- package/dist/collection/components/jump-filter/jump-filter.js.map +1 -1
- package/dist/collection/components/jump-filter/jump-filter.stories.js +5 -4
- package/dist/collection/components/jump-filter/jump-filter.stories.js.map +1 -1
- package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.css +31 -0
- package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.js +161 -0
- package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.js.map +1 -0
- package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.stories.js +51 -0
- package/dist/collection/components/jump-filter-checkbox/jump-filter-checkbox.stories.js.map +1 -0
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.css +5 -4
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.js +33 -10
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.js.map +1 -1
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.stories.js +1 -1
- package/dist/collection/components/jump-filtergroup/jump-filtergroup.stories.js.map +1 -1
- package/dist/collection/components/jump-pagination/jump-pagination.js +3 -3
- package/dist/collection/components/jump-pagination-table/jump-pagination-table.js +3 -3
- package/dist/collection/components/jump-quantity/jump-quantity.css +6 -3
- package/dist/collection/components/jump-quantity/jump-quantity.js +3 -3
- package/dist/collection/components/jump-quantity/jump-quantity.js.map +1 -1
- package/dist/collection/components/jump-tab/jump-tab.js +1 -1
- package/dist/collection/components/jump-tab-item/jump-tab-item.js +2 -2
- package/dist/collection/components/jump-tab-panel/jump-tab-panel.js +1 -1
- package/dist/components/chunk.H33C3MRM.js +529 -0
- package/dist/components/chunk.H33C3MRM.js.map +1 -0
- package/dist/components/jump-filter-checkbox.d.ts +11 -0
- package/dist/components/jump-filter-checkbox.js +865 -0
- package/dist/components/jump-filter-checkbox.js.map +1 -0
- package/dist/components/jump-filter.js +5 -4
- package/dist/components/jump-filter.js.map +1 -1
- package/dist/components/jump-filtergroup.js +33 -10
- package/dist/components/jump-filtergroup.js.map +1 -1
- package/dist/components/jump-icon2.js +6 -528
- package/dist/components/jump-icon2.js.map +1 -1
- package/dist/components/jump-pagination-table.js +3 -3
- package/dist/components/jump-pagination.js +3 -3
- package/dist/components/jump-quantity.js +4 -4
- package/dist/components/jump-quantity.js.map +1 -1
- package/dist/components/jump-tab-item.js +2 -2
- package/dist/components/jump-tab-panel.js +1 -1
- package/dist/components/jump-tab.js +1 -1
- package/dist/esm/chunk.H33C3MRM-d1872e67.js +529 -0
- package/dist/esm/chunk.H33C3MRM-d1872e67.js.map +1 -0
- package/dist/esm/jump-button_2.entry.js +6 -528
- package/dist/esm/jump-button_2.entry.js.map +1 -1
- package/dist/esm/jump-design-system.js +1 -1
- package/dist/esm/jump-filter-checkbox.entry.js +841 -0
- package/dist/esm/jump-filter-checkbox.entry.js.map +1 -0
- package/dist/esm/jump-filter.entry.js +5 -4
- package/dist/esm/jump-filter.entry.js.map +1 -1
- package/dist/esm/jump-filtergroup.entry.js +32 -9
- package/dist/esm/jump-filtergroup.entry.js.map +1 -1
- package/dist/esm/jump-pagination-table.entry.js +3 -3
- package/dist/esm/jump-pagination.entry.js +3 -3
- package/dist/esm/jump-quantity.entry.js +4 -4
- package/dist/esm/jump-quantity.entry.js.map +1 -1
- package/dist/esm/jump-tab-item.entry.js +2 -2
- package/dist/esm/jump-tab-panel.entry.js +1 -1
- package/dist/esm/jump-tab.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js +1 -1
- package/dist/jump-design-system/jump-design-system.esm.js.map +1 -1
- package/dist/jump-design-system/{p-95460fa4.entry.js → p-4302b229.entry.js} +2 -2
- package/dist/jump-design-system/p-60849b83.entry.js +2 -0
- package/dist/jump-design-system/p-60849b83.entry.js.map +1 -0
- package/dist/jump-design-system/p-839e054d.entry.js +2 -0
- package/dist/jump-design-system/p-839e054d.entry.js.map +1 -0
- package/dist/jump-design-system/{p-d2ee7b9b.entry.js → p-9d9b0076.entry.js} +2 -2
- package/dist/jump-design-system/p-a00d20d8.entry.js +264 -0
- package/dist/jump-design-system/p-a00d20d8.entry.js.map +1 -0
- package/dist/jump-design-system/p-a4b9515b.js +66 -0
- package/dist/jump-design-system/p-a4b9515b.js.map +1 -0
- package/dist/jump-design-system/p-aee5a8c3.entry.js +2 -0
- package/dist/jump-design-system/p-b4e60ca4.entry.js +2 -0
- package/dist/jump-design-system/p-b4e60ca4.entry.js.map +1 -0
- package/dist/jump-design-system/{p-37114ce3.entry.js → p-c8733544.entry.js} +2 -2
- package/dist/jump-design-system/{p-8efeaa79.entry.js → p-ed897778.entry.js} +2 -2
- package/dist/jump-design-system/p-fde99383.entry.js +2 -0
- package/dist/jump-design-system/p-fde99383.entry.js.map +1 -0
- package/dist/jump-design-system-elements.json +29 -4
- package/dist/types/components/jump-filter-checkbox/jump-filter-checkbox.d.ts +15 -0
- package/dist/types/components/jump-filter-checkbox/jump-filter-checkbox.stories.d.ts +30 -0
- package/dist/types/components/jump-filtergroup/jump-filtergroup.d.ts +4 -2
- package/dist/types/components/jump-filtergroup/jump-filtergroup.stories.d.ts +1 -1
- package/dist/types/components.d.ts +40 -2
- package/package.json +1 -1
- package/dist/jump-design-system/p-529a09f6.entry.js +0 -2
- package/dist/jump-design-system/p-529a09f6.entry.js.map +0 -1
- package/dist/jump-design-system/p-5da7839d.entry.js +0 -2
- package/dist/jump-design-system/p-8628896f.entry.js +0 -2
- package/dist/jump-design-system/p-8628896f.entry.js.map +0 -1
- package/dist/jump-design-system/p-c2bc6395.entry.js +0 -66
- package/dist/jump-design-system/p-c2bc6395.entry.js.map +0 -1
- package/dist/jump-design-system/p-d1e411fd.entry.js +0 -2
- package/dist/jump-design-system/p-d1e411fd.entry.js.map +0 -1
- /package/dist/jump-design-system/{p-95460fa4.entry.js.map → p-4302b229.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-d2ee7b9b.entry.js.map → p-9d9b0076.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-5da7839d.entry.js.map → p-aee5a8c3.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-37114ce3.entry.js.map → p-c8733544.entry.js.map} +0 -0
- /package/dist/jump-design-system/{p-8efeaa79.entry.js.map → p-ed897778.entry.js.map} +0 -0
|
@@ -0,0 +1,845 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-674508e2.js');
|
|
6
|
+
const chunk_H33C3MRM = require('./chunk.H33C3MRM-2c09acb5.js');
|
|
7
|
+
|
|
8
|
+
// src/components/checkbox/checkbox.styles.ts
|
|
9
|
+
var checkbox_styles_default = chunk_H33C3MRM.i`
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-block;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.checkbox {
|
|
15
|
+
position: relative;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
align-items: flex-start;
|
|
18
|
+
font-family: var(--sl-input-font-family);
|
|
19
|
+
font-weight: var(--sl-input-font-weight);
|
|
20
|
+
color: var(--sl-input-label-color);
|
|
21
|
+
vertical-align: middle;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.checkbox--small {
|
|
26
|
+
--toggle-size: var(--sl-toggle-size-small);
|
|
27
|
+
font-size: var(--sl-input-font-size-small);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.checkbox--medium {
|
|
31
|
+
--toggle-size: var(--sl-toggle-size-medium);
|
|
32
|
+
font-size: var(--sl-input-font-size-medium);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.checkbox--large {
|
|
36
|
+
--toggle-size: var(--sl-toggle-size-large);
|
|
37
|
+
font-size: var(--sl-input-font-size-large);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.checkbox__control {
|
|
41
|
+
flex: 0 0 auto;
|
|
42
|
+
position: relative;
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
width: var(--toggle-size);
|
|
47
|
+
height: var(--toggle-size);
|
|
48
|
+
border: solid var(--sl-input-border-width) var(--sl-input-border-color);
|
|
49
|
+
border-radius: 2px;
|
|
50
|
+
background-color: var(--sl-input-background-color);
|
|
51
|
+
color: var(--sl-color-neutral-0);
|
|
52
|
+
transition:
|
|
53
|
+
var(--sl-transition-fast) border-color,
|
|
54
|
+
var(--sl-transition-fast) background-color,
|
|
55
|
+
var(--sl-transition-fast) color,
|
|
56
|
+
var(--sl-transition-fast) box-shadow;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.checkbox__input {
|
|
60
|
+
position: absolute;
|
|
61
|
+
opacity: 0;
|
|
62
|
+
padding: 0;
|
|
63
|
+
margin: 0;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.checkbox__checked-icon,
|
|
68
|
+
.checkbox__indeterminate-icon {
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
width: var(--toggle-size);
|
|
71
|
+
height: var(--toggle-size);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Hover */
|
|
75
|
+
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
|
|
76
|
+
border-color: var(--sl-input-border-color-hover);
|
|
77
|
+
background-color: var(--sl-input-background-color-hover);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Focus */
|
|
81
|
+
.checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
|
82
|
+
outline: var(--sl-focus-ring);
|
|
83
|
+
outline-offset: var(--sl-focus-ring-offset);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Checked/indeterminate */
|
|
87
|
+
.checkbox--checked .checkbox__control,
|
|
88
|
+
.checkbox--indeterminate .checkbox__control {
|
|
89
|
+
border-color: var(--sl-color-primary-600);
|
|
90
|
+
background-color: var(--sl-color-primary-600);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Checked/indeterminate + hover */
|
|
94
|
+
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
|
|
95
|
+
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
|
|
96
|
+
border-color: var(--sl-color-primary-500);
|
|
97
|
+
background-color: var(--sl-color-primary-500);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Checked/indeterminate + focus */
|
|
101
|
+
.checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control,
|
|
102
|
+
.checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
|
|
103
|
+
outline: var(--sl-focus-ring);
|
|
104
|
+
outline-offset: var(--sl-focus-ring-offset);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Disabled */
|
|
108
|
+
.checkbox--disabled {
|
|
109
|
+
opacity: 0.5;
|
|
110
|
+
cursor: not-allowed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.checkbox__label {
|
|
114
|
+
display: inline-block;
|
|
115
|
+
color: var(--sl-input-label-color);
|
|
116
|
+
line-height: var(--toggle-size);
|
|
117
|
+
margin-inline-start: 0.5em;
|
|
118
|
+
user-select: none;
|
|
119
|
+
-webkit-user-select: none;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([required]) .checkbox__label::after {
|
|
123
|
+
content: var(--sl-input-required-content);
|
|
124
|
+
color: var(--sl-input-required-content-color);
|
|
125
|
+
margin-inline-start: var(--sl-input-required-content-offset);
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
|
|
129
|
+
// src/internal/default-value.ts
|
|
130
|
+
var defaultValue = (propertyName = "value") => (proto, key) => {
|
|
131
|
+
const ctor = proto.constructor;
|
|
132
|
+
const attributeChangedCallback = ctor.prototype.attributeChangedCallback;
|
|
133
|
+
ctor.prototype.attributeChangedCallback = function(name, old, value) {
|
|
134
|
+
var _a;
|
|
135
|
+
const options = ctor.getPropertyOptions(propertyName);
|
|
136
|
+
const attributeName = typeof options.attribute === "string" ? options.attribute : propertyName;
|
|
137
|
+
if (name === attributeName) {
|
|
138
|
+
const converter = options.converter || chunk_H33C3MRM.u;
|
|
139
|
+
const fromAttribute = typeof converter === "function" ? converter : (_a = converter == null ? void 0 : converter.fromAttribute) != null ? _a : chunk_H33C3MRM.u.fromAttribute;
|
|
140
|
+
const newValue = fromAttribute(value, options.type);
|
|
141
|
+
if (this[propertyName] !== newValue) {
|
|
142
|
+
this[key] = newValue;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
attributeChangedCallback.call(this, name, old, value);
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// src/styles/form-control.styles.ts
|
|
150
|
+
var form_control_styles_default = chunk_H33C3MRM.i`
|
|
151
|
+
.form-control .form-control__label {
|
|
152
|
+
display: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.form-control .form-control__help-text {
|
|
156
|
+
display: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Label */
|
|
160
|
+
.form-control--has-label .form-control__label {
|
|
161
|
+
display: inline-block;
|
|
162
|
+
color: var(--sl-input-label-color);
|
|
163
|
+
margin-bottom: var(--sl-spacing-3x-small);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.form-control--has-label.form-control--small .form-control__label {
|
|
167
|
+
font-size: var(--sl-input-label-font-size-small);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.form-control--has-label.form-control--medium .form-control__label {
|
|
171
|
+
font-size: var(--sl-input-label-font-size-medium);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.form-control--has-label.form-control--large .form-control__label {
|
|
175
|
+
font-size: var(--sl-input-label-font-size-large);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
:host([required]) .form-control--has-label .form-control__label::after {
|
|
179
|
+
content: var(--sl-input-required-content);
|
|
180
|
+
margin-inline-start: var(--sl-input-required-content-offset);
|
|
181
|
+
color: var(--sl-input-required-content-color);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Help text */
|
|
185
|
+
.form-control--has-help-text .form-control__help-text {
|
|
186
|
+
display: block;
|
|
187
|
+
color: var(--sl-input-help-text-color);
|
|
188
|
+
margin-top: var(--sl-spacing-3x-small);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.form-control--has-help-text.form-control--small .form-control__help-text {
|
|
192
|
+
font-size: var(--sl-input-help-text-font-size-small);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.form-control--has-help-text.form-control--medium .form-control__help-text {
|
|
196
|
+
font-size: var(--sl-input-help-text-font-size-medium);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.form-control--has-help-text.form-control--large .form-control__help-text {
|
|
200
|
+
font-size: var(--sl-input-help-text-font-size-large);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.form-control--has-help-text.form-control--radio-group .form-control__help-text {
|
|
204
|
+
margin-top: var(--sl-spacing-2x-small);
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
// src/internal/form.ts
|
|
209
|
+
var formCollections = /* @__PURE__ */ new WeakMap();
|
|
210
|
+
var reportValidityOverloads = /* @__PURE__ */ new WeakMap();
|
|
211
|
+
var checkValidityOverloads = /* @__PURE__ */ new WeakMap();
|
|
212
|
+
var userInteractedControls = /* @__PURE__ */ new WeakSet();
|
|
213
|
+
var interactions = /* @__PURE__ */ new WeakMap();
|
|
214
|
+
var FormControlController = class {
|
|
215
|
+
constructor(host, options) {
|
|
216
|
+
this.handleFormData = (event) => {
|
|
217
|
+
const disabled = this.options.disabled(this.host);
|
|
218
|
+
const name = this.options.name(this.host);
|
|
219
|
+
const value = this.options.value(this.host);
|
|
220
|
+
const isButton = this.host.tagName.toLowerCase() === "sl-button";
|
|
221
|
+
if (this.host.isConnected && !disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
|
|
222
|
+
if (Array.isArray(value)) {
|
|
223
|
+
value.forEach((val) => {
|
|
224
|
+
event.formData.append(name, val.toString());
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
event.formData.append(name, value.toString());
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
this.handleFormSubmit = (event) => {
|
|
232
|
+
var _a;
|
|
233
|
+
const disabled = this.options.disabled(this.host);
|
|
234
|
+
const reportValidity = this.options.reportValidity;
|
|
235
|
+
if (this.form && !this.form.noValidate) {
|
|
236
|
+
(_a = formCollections.get(this.form)) == null ? void 0 : _a.forEach((control) => {
|
|
237
|
+
this.setUserInteracted(control, true);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
event.stopImmediatePropagation();
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
this.handleFormReset = () => {
|
|
246
|
+
this.options.setValue(this.host, this.options.defaultValue(this.host));
|
|
247
|
+
this.setUserInteracted(this.host, false);
|
|
248
|
+
interactions.set(this.host, []);
|
|
249
|
+
};
|
|
250
|
+
this.handleInteraction = (event) => {
|
|
251
|
+
const emittedEvents = interactions.get(this.host);
|
|
252
|
+
if (!emittedEvents.includes(event.type)) {
|
|
253
|
+
emittedEvents.push(event.type);
|
|
254
|
+
}
|
|
255
|
+
if (emittedEvents.length === this.options.assumeInteractionOn.length) {
|
|
256
|
+
this.setUserInteracted(this.host, true);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
this.checkFormValidity = () => {
|
|
260
|
+
if (this.form && !this.form.noValidate) {
|
|
261
|
+
const elements = this.form.querySelectorAll("*");
|
|
262
|
+
for (const element of elements) {
|
|
263
|
+
if (typeof element.checkValidity === "function") {
|
|
264
|
+
if (!element.checkValidity()) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return true;
|
|
271
|
+
};
|
|
272
|
+
this.reportFormValidity = () => {
|
|
273
|
+
if (this.form && !this.form.noValidate) {
|
|
274
|
+
const elements = this.form.querySelectorAll("*");
|
|
275
|
+
for (const element of elements) {
|
|
276
|
+
if (typeof element.reportValidity === "function") {
|
|
277
|
+
if (!element.reportValidity()) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return true;
|
|
284
|
+
};
|
|
285
|
+
(this.host = host).addController(this);
|
|
286
|
+
this.options = chunk_H33C3MRM.__spreadValues({
|
|
287
|
+
form: (input) => {
|
|
288
|
+
const formId = input.form;
|
|
289
|
+
if (formId) {
|
|
290
|
+
const root = input.getRootNode();
|
|
291
|
+
const form = root.querySelector(`#${formId}`);
|
|
292
|
+
if (form) {
|
|
293
|
+
return form;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return input.closest("form");
|
|
297
|
+
},
|
|
298
|
+
name: (input) => input.name,
|
|
299
|
+
value: (input) => input.value,
|
|
300
|
+
defaultValue: (input) => input.defaultValue,
|
|
301
|
+
disabled: (input) => {
|
|
302
|
+
var _a;
|
|
303
|
+
return (_a = input.disabled) != null ? _a : false;
|
|
304
|
+
},
|
|
305
|
+
reportValidity: (input) => typeof input.reportValidity === "function" ? input.reportValidity() : true,
|
|
306
|
+
checkValidity: (input) => typeof input.checkValidity === "function" ? input.checkValidity() : true,
|
|
307
|
+
setValue: (input, value) => input.value = value,
|
|
308
|
+
assumeInteractionOn: ["sl-input"]
|
|
309
|
+
}, options);
|
|
310
|
+
}
|
|
311
|
+
hostConnected() {
|
|
312
|
+
const form = this.options.form(this.host);
|
|
313
|
+
if (form) {
|
|
314
|
+
this.attachForm(form);
|
|
315
|
+
}
|
|
316
|
+
interactions.set(this.host, []);
|
|
317
|
+
this.options.assumeInteractionOn.forEach((event) => {
|
|
318
|
+
this.host.addEventListener(event, this.handleInteraction);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
hostDisconnected() {
|
|
322
|
+
this.detachForm();
|
|
323
|
+
interactions.delete(this.host);
|
|
324
|
+
this.options.assumeInteractionOn.forEach((event) => {
|
|
325
|
+
this.host.removeEventListener(event, this.handleInteraction);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
hostUpdated() {
|
|
329
|
+
const form = this.options.form(this.host);
|
|
330
|
+
if (!form) {
|
|
331
|
+
this.detachForm();
|
|
332
|
+
}
|
|
333
|
+
if (form && this.form !== form) {
|
|
334
|
+
this.detachForm();
|
|
335
|
+
this.attachForm(form);
|
|
336
|
+
}
|
|
337
|
+
if (this.host.hasUpdated) {
|
|
338
|
+
this.setValidity(this.host.validity.valid);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
attachForm(form) {
|
|
342
|
+
if (form) {
|
|
343
|
+
this.form = form;
|
|
344
|
+
if (formCollections.has(this.form)) {
|
|
345
|
+
formCollections.get(this.form).add(this.host);
|
|
346
|
+
} else {
|
|
347
|
+
formCollections.set(this.form, /* @__PURE__ */ new Set([this.host]));
|
|
348
|
+
}
|
|
349
|
+
this.form.addEventListener("formdata", this.handleFormData);
|
|
350
|
+
this.form.addEventListener("submit", this.handleFormSubmit);
|
|
351
|
+
this.form.addEventListener("reset", this.handleFormReset);
|
|
352
|
+
if (!reportValidityOverloads.has(this.form)) {
|
|
353
|
+
reportValidityOverloads.set(this.form, this.form.reportValidity);
|
|
354
|
+
this.form.reportValidity = () => this.reportFormValidity();
|
|
355
|
+
}
|
|
356
|
+
if (!checkValidityOverloads.has(this.form)) {
|
|
357
|
+
checkValidityOverloads.set(this.form, this.form.checkValidity);
|
|
358
|
+
this.form.checkValidity = () => this.checkFormValidity();
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
this.form = void 0;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
detachForm() {
|
|
365
|
+
if (!this.form)
|
|
366
|
+
return;
|
|
367
|
+
const formCollection = formCollections.get(this.form);
|
|
368
|
+
if (!formCollection) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
formCollection.delete(this.host);
|
|
372
|
+
if (formCollection.size <= 0) {
|
|
373
|
+
this.form.removeEventListener("formdata", this.handleFormData);
|
|
374
|
+
this.form.removeEventListener("submit", this.handleFormSubmit);
|
|
375
|
+
this.form.removeEventListener("reset", this.handleFormReset);
|
|
376
|
+
if (reportValidityOverloads.has(this.form)) {
|
|
377
|
+
this.form.reportValidity = reportValidityOverloads.get(this.form);
|
|
378
|
+
reportValidityOverloads.delete(this.form);
|
|
379
|
+
}
|
|
380
|
+
if (checkValidityOverloads.has(this.form)) {
|
|
381
|
+
this.form.checkValidity = checkValidityOverloads.get(this.form);
|
|
382
|
+
checkValidityOverloads.delete(this.form);
|
|
383
|
+
}
|
|
384
|
+
this.form = void 0;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
setUserInteracted(el, hasInteracted) {
|
|
388
|
+
if (hasInteracted) {
|
|
389
|
+
userInteractedControls.add(el);
|
|
390
|
+
} else {
|
|
391
|
+
userInteractedControls.delete(el);
|
|
392
|
+
}
|
|
393
|
+
el.requestUpdate();
|
|
394
|
+
}
|
|
395
|
+
doAction(type, submitter) {
|
|
396
|
+
if (this.form) {
|
|
397
|
+
const button = document.createElement("button");
|
|
398
|
+
button.type = type;
|
|
399
|
+
button.style.position = "absolute";
|
|
400
|
+
button.style.width = "0";
|
|
401
|
+
button.style.height = "0";
|
|
402
|
+
button.style.clipPath = "inset(50%)";
|
|
403
|
+
button.style.overflow = "hidden";
|
|
404
|
+
button.style.whiteSpace = "nowrap";
|
|
405
|
+
if (submitter) {
|
|
406
|
+
button.name = submitter.name;
|
|
407
|
+
button.value = submitter.value;
|
|
408
|
+
["formaction", "formenctype", "formmethod", "formnovalidate", "formtarget"].forEach((attr) => {
|
|
409
|
+
if (submitter.hasAttribute(attr)) {
|
|
410
|
+
button.setAttribute(attr, submitter.getAttribute(attr));
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
this.form.append(button);
|
|
415
|
+
button.click();
|
|
416
|
+
button.remove();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/** Returns the associated `<form>` element, if one exists. */
|
|
420
|
+
getForm() {
|
|
421
|
+
var _a;
|
|
422
|
+
return (_a = this.form) != null ? _a : null;
|
|
423
|
+
}
|
|
424
|
+
/** Resets the form, restoring all the control to their default value */
|
|
425
|
+
reset(submitter) {
|
|
426
|
+
this.doAction("reset", submitter);
|
|
427
|
+
}
|
|
428
|
+
/** Submits the form, triggering validation and form data injection. */
|
|
429
|
+
submit(submitter) {
|
|
430
|
+
this.doAction("submit", submitter);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Synchronously sets the form control's validity. Call this when you know the future validity but need to update
|
|
434
|
+
* the host element immediately, i.e. before Lit updates the component in the next update.
|
|
435
|
+
*/
|
|
436
|
+
setValidity(isValid) {
|
|
437
|
+
const host = this.host;
|
|
438
|
+
const hasInteracted = Boolean(userInteractedControls.has(host));
|
|
439
|
+
const required = Boolean(host.required);
|
|
440
|
+
host.toggleAttribute("data-required", required);
|
|
441
|
+
host.toggleAttribute("data-optional", !required);
|
|
442
|
+
host.toggleAttribute("data-invalid", !isValid);
|
|
443
|
+
host.toggleAttribute("data-valid", isValid);
|
|
444
|
+
host.toggleAttribute("data-user-invalid", !isValid && hasInteracted);
|
|
445
|
+
host.toggleAttribute("data-user-valid", isValid && hasInteracted);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
|
|
449
|
+
* that affects constraint validation changes so the component receives the correct validity states.
|
|
450
|
+
*/
|
|
451
|
+
updateValidity() {
|
|
452
|
+
const host = this.host;
|
|
453
|
+
this.setValidity(host.validity.valid);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Dispatches a non-bubbling, cancelable custom event of type `sl-invalid`.
|
|
457
|
+
* If the `sl-invalid` event will be cancelled then the original `invalid`
|
|
458
|
+
* event (which may have been passed as argument) will also be cancelled.
|
|
459
|
+
* If no original `invalid` event has been passed then the `sl-invalid`
|
|
460
|
+
* event will be cancelled before being dispatched.
|
|
461
|
+
*/
|
|
462
|
+
emitInvalidEvent(originalInvalidEvent) {
|
|
463
|
+
const slInvalidEvent = new CustomEvent("sl-invalid", {
|
|
464
|
+
bubbles: false,
|
|
465
|
+
composed: false,
|
|
466
|
+
cancelable: true,
|
|
467
|
+
detail: {}
|
|
468
|
+
});
|
|
469
|
+
if (!originalInvalidEvent) {
|
|
470
|
+
slInvalidEvent.preventDefault();
|
|
471
|
+
}
|
|
472
|
+
if (!this.host.dispatchEvent(slInvalidEvent)) {
|
|
473
|
+
originalInvalidEvent == null ? void 0 : originalInvalidEvent.preventDefault();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var validValidityState = Object.freeze({
|
|
478
|
+
badInput: false,
|
|
479
|
+
customError: false,
|
|
480
|
+
patternMismatch: false,
|
|
481
|
+
rangeOverflow: false,
|
|
482
|
+
rangeUnderflow: false,
|
|
483
|
+
stepMismatch: false,
|
|
484
|
+
tooLong: false,
|
|
485
|
+
tooShort: false,
|
|
486
|
+
typeMismatch: false,
|
|
487
|
+
valid: true,
|
|
488
|
+
valueMissing: false
|
|
489
|
+
});
|
|
490
|
+
Object.freeze(chunk_H33C3MRM.__spreadProps(chunk_H33C3MRM.__spreadValues({}, validValidityState), {
|
|
491
|
+
valid: false,
|
|
492
|
+
valueMissing: true
|
|
493
|
+
}));
|
|
494
|
+
Object.freeze(chunk_H33C3MRM.__spreadProps(chunk_H33C3MRM.__spreadValues({}, validValidityState), {
|
|
495
|
+
valid: false,
|
|
496
|
+
customError: true
|
|
497
|
+
}));
|
|
498
|
+
|
|
499
|
+
// src/internal/slot.ts
|
|
500
|
+
var HasSlotController = class {
|
|
501
|
+
constructor(host, ...slotNames) {
|
|
502
|
+
this.slotNames = [];
|
|
503
|
+
this.handleSlotChange = (event) => {
|
|
504
|
+
const slot = event.target;
|
|
505
|
+
if (this.slotNames.includes("[default]") && !slot.name || slot.name && this.slotNames.includes(slot.name)) {
|
|
506
|
+
this.host.requestUpdate();
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
(this.host = host).addController(this);
|
|
510
|
+
this.slotNames = slotNames;
|
|
511
|
+
}
|
|
512
|
+
hasDefaultSlot() {
|
|
513
|
+
return [...this.host.childNodes].some((node) => {
|
|
514
|
+
if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "") {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
518
|
+
const el = node;
|
|
519
|
+
const tagName = el.tagName.toLowerCase();
|
|
520
|
+
if (tagName === "sl-visually-hidden") {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
if (!el.hasAttribute("slot")) {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return false;
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
hasNamedSlot(name) {
|
|
531
|
+
return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
|
|
532
|
+
}
|
|
533
|
+
test(slotName) {
|
|
534
|
+
return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
|
|
535
|
+
}
|
|
536
|
+
hostConnected() {
|
|
537
|
+
this.host.shadowRoot.addEventListener("slotchange", this.handleSlotChange);
|
|
538
|
+
}
|
|
539
|
+
hostDisconnected() {
|
|
540
|
+
this.host.shadowRoot.removeEventListener("slotchange", this.handleSlotChange);
|
|
541
|
+
}
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* @license
|
|
546
|
+
* Copyright 2017 Google LLC
|
|
547
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
548
|
+
*/
|
|
549
|
+
const e$3=(e,t,c)=>(c.configurable=!0,c.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,c),c);
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* @license
|
|
553
|
+
* Copyright 2017 Google LLC
|
|
554
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
555
|
+
*/function e$2(e,r){return (n,s,i)=>{const o=t=>t.renderRoot?.querySelector(e)??null;if(r){const{get:e,set:r}="object"==typeof s?n:i??(()=>{const t=Symbol();return {get(){return this[t]},set(e){this[t]=e;}}})();return e$3(n,s,{get(){let t=e.call(this);return void 0===t&&(t=o(this),(null!==t||this.hasUpdated)&&r.call(this,t)),t}})}return e$3(n,s,{get(){return o(this)}})}}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* @license
|
|
559
|
+
* Copyright 2017 Google LLC
|
|
560
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
561
|
+
*/
|
|
562
|
+
const t={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$1=t=>(...e)=>({_$litDirective$:t,values:e});class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* @license
|
|
566
|
+
* Copyright 2018 Google LLC
|
|
567
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
568
|
+
*/const e=e$1(class extends i{constructor(t$1){if(super(t$1),t$1.type!==t.ATTRIBUTE||"class"!==t$1.name||t$1.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.st){this.st=new Set,void 0!==s.strings&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.st)t in i||(r.remove(t),this.st.delete(t));for(const t in i){const s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(r.add(t),this.st.add(t)):(r.remove(t),this.st.delete(t)));}return chunk_H33C3MRM.w}});
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @license
|
|
572
|
+
* Copyright 2018 Google LLC
|
|
573
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
574
|
+
*/const o=o=>o??chunk_H33C3MRM.T;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* @license
|
|
578
|
+
* Copyright 2020 Google LLC
|
|
579
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
580
|
+
*/const l=e$1(class extends i{constructor(r){if(super(r),r.type!==t.PROPERTY&&r.type!==t.ATTRIBUTE&&r.type!==t.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!chunk_H33C3MRM.f(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(i,[t$1]){if(t$1===chunk_H33C3MRM.w||t$1===chunk_H33C3MRM.T)return t$1;const o=i.element,l=i.name;if(i.type===t.PROPERTY){if(t$1===o[l])return chunk_H33C3MRM.w}else if(i.type===t.BOOLEAN_ATTRIBUTE){if(!!t$1===o.hasAttribute(l))return chunk_H33C3MRM.w}else if(i.type===t.ATTRIBUTE&&o.getAttribute(l)===t$1+"")return chunk_H33C3MRM.w;return chunk_H33C3MRM.m(i),t$1}});
|
|
581
|
+
|
|
582
|
+
var SlCheckbox = class extends chunk_H33C3MRM.ShoelaceElement {
|
|
583
|
+
constructor() {
|
|
584
|
+
super(...arguments);
|
|
585
|
+
this.formControlController = new FormControlController(this, {
|
|
586
|
+
value: (control) => control.checked ? control.value || "on" : void 0,
|
|
587
|
+
defaultValue: (control) => control.defaultChecked,
|
|
588
|
+
setValue: (control, checked) => control.checked = checked
|
|
589
|
+
});
|
|
590
|
+
this.hasSlotController = new HasSlotController(this, "help-text");
|
|
591
|
+
this.hasFocus = false;
|
|
592
|
+
this.title = "";
|
|
593
|
+
this.name = "";
|
|
594
|
+
this.size = "medium";
|
|
595
|
+
this.disabled = false;
|
|
596
|
+
this.checked = false;
|
|
597
|
+
this.indeterminate = false;
|
|
598
|
+
this.defaultChecked = false;
|
|
599
|
+
this.form = "";
|
|
600
|
+
this.required = false;
|
|
601
|
+
this.helpText = "";
|
|
602
|
+
}
|
|
603
|
+
/** Gets the validity state object */
|
|
604
|
+
get validity() {
|
|
605
|
+
return this.input.validity;
|
|
606
|
+
}
|
|
607
|
+
/** Gets the validation message */
|
|
608
|
+
get validationMessage() {
|
|
609
|
+
return this.input.validationMessage;
|
|
610
|
+
}
|
|
611
|
+
firstUpdated() {
|
|
612
|
+
this.formControlController.updateValidity();
|
|
613
|
+
}
|
|
614
|
+
handleClick() {
|
|
615
|
+
this.checked = !this.checked;
|
|
616
|
+
this.indeterminate = false;
|
|
617
|
+
this.emit("sl-change");
|
|
618
|
+
}
|
|
619
|
+
handleBlur() {
|
|
620
|
+
this.hasFocus = false;
|
|
621
|
+
this.emit("sl-blur");
|
|
622
|
+
}
|
|
623
|
+
handleInput() {
|
|
624
|
+
this.emit("sl-input");
|
|
625
|
+
}
|
|
626
|
+
handleInvalid(event) {
|
|
627
|
+
this.formControlController.setValidity(false);
|
|
628
|
+
this.formControlController.emitInvalidEvent(event);
|
|
629
|
+
}
|
|
630
|
+
handleFocus() {
|
|
631
|
+
this.hasFocus = true;
|
|
632
|
+
this.emit("sl-focus");
|
|
633
|
+
}
|
|
634
|
+
handleDisabledChange() {
|
|
635
|
+
this.formControlController.setValidity(this.disabled);
|
|
636
|
+
}
|
|
637
|
+
handleStateChange() {
|
|
638
|
+
this.input.checked = this.checked;
|
|
639
|
+
this.input.indeterminate = this.indeterminate;
|
|
640
|
+
this.formControlController.updateValidity();
|
|
641
|
+
}
|
|
642
|
+
/** Simulates a click on the checkbox. */
|
|
643
|
+
click() {
|
|
644
|
+
this.input.click();
|
|
645
|
+
}
|
|
646
|
+
/** Sets focus on the checkbox. */
|
|
647
|
+
focus(options) {
|
|
648
|
+
this.input.focus(options);
|
|
649
|
+
}
|
|
650
|
+
/** Removes focus from the checkbox. */
|
|
651
|
+
blur() {
|
|
652
|
+
this.input.blur();
|
|
653
|
+
}
|
|
654
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
655
|
+
checkValidity() {
|
|
656
|
+
return this.input.checkValidity();
|
|
657
|
+
}
|
|
658
|
+
/** Gets the associated form, if one exists. */
|
|
659
|
+
getForm() {
|
|
660
|
+
return this.formControlController.getForm();
|
|
661
|
+
}
|
|
662
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
663
|
+
reportValidity() {
|
|
664
|
+
return this.input.reportValidity();
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Sets a custom validation message. The value provided will be shown to the user when the form is submitted. To clear
|
|
668
|
+
* the custom validation message, call this method with an empty string.
|
|
669
|
+
*/
|
|
670
|
+
setCustomValidity(message) {
|
|
671
|
+
this.input.setCustomValidity(message);
|
|
672
|
+
this.formControlController.updateValidity();
|
|
673
|
+
}
|
|
674
|
+
render() {
|
|
675
|
+
const hasHelpTextSlot = this.hasSlotController.test("help-text");
|
|
676
|
+
const hasHelpText = this.helpText ? true : !!hasHelpTextSlot;
|
|
677
|
+
return chunk_H33C3MRM.x`
|
|
678
|
+
<div
|
|
679
|
+
class=${e({
|
|
680
|
+
"form-control": true,
|
|
681
|
+
"form-control--small": this.size === "small",
|
|
682
|
+
"form-control--medium": this.size === "medium",
|
|
683
|
+
"form-control--large": this.size === "large",
|
|
684
|
+
"form-control--has-help-text": hasHelpText
|
|
685
|
+
})}
|
|
686
|
+
>
|
|
687
|
+
<label
|
|
688
|
+
part="base"
|
|
689
|
+
class=${e({
|
|
690
|
+
checkbox: true,
|
|
691
|
+
"checkbox--checked": this.checked,
|
|
692
|
+
"checkbox--disabled": this.disabled,
|
|
693
|
+
"checkbox--focused": this.hasFocus,
|
|
694
|
+
"checkbox--indeterminate": this.indeterminate,
|
|
695
|
+
"checkbox--small": this.size === "small",
|
|
696
|
+
"checkbox--medium": this.size === "medium",
|
|
697
|
+
"checkbox--large": this.size === "large"
|
|
698
|
+
})}
|
|
699
|
+
>
|
|
700
|
+
<input
|
|
701
|
+
class="checkbox__input"
|
|
702
|
+
type="checkbox"
|
|
703
|
+
title=${this.title}
|
|
704
|
+
name=${this.name}
|
|
705
|
+
value=${o(this.value)}
|
|
706
|
+
.indeterminate=${l(this.indeterminate)}
|
|
707
|
+
.checked=${l(this.checked)}
|
|
708
|
+
.disabled=${this.disabled}
|
|
709
|
+
.required=${this.required}
|
|
710
|
+
aria-checked=${this.checked ? "true" : "false"}
|
|
711
|
+
aria-describedby="help-text"
|
|
712
|
+
@click=${this.handleClick}
|
|
713
|
+
@input=${this.handleInput}
|
|
714
|
+
@invalid=${this.handleInvalid}
|
|
715
|
+
@blur=${this.handleBlur}
|
|
716
|
+
@focus=${this.handleFocus}
|
|
717
|
+
/>
|
|
718
|
+
|
|
719
|
+
<span
|
|
720
|
+
part="control${this.checked ? " control--checked" : ""}${this.indeterminate ? " control--indeterminate" : ""}"
|
|
721
|
+
class="checkbox__control"
|
|
722
|
+
>
|
|
723
|
+
${this.checked ? chunk_H33C3MRM.x`
|
|
724
|
+
<sl-icon part="checked-icon" class="checkbox__checked-icon" library="system" name="check"></sl-icon>
|
|
725
|
+
` : ""}
|
|
726
|
+
${!this.checked && this.indeterminate ? chunk_H33C3MRM.x`
|
|
727
|
+
<sl-icon
|
|
728
|
+
part="indeterminate-icon"
|
|
729
|
+
class="checkbox__indeterminate-icon"
|
|
730
|
+
library="system"
|
|
731
|
+
name="indeterminate"
|
|
732
|
+
></sl-icon>
|
|
733
|
+
` : ""}
|
|
734
|
+
</span>
|
|
735
|
+
|
|
736
|
+
<div part="label" class="checkbox__label">
|
|
737
|
+
<slot></slot>
|
|
738
|
+
</div>
|
|
739
|
+
</label>
|
|
740
|
+
|
|
741
|
+
<div
|
|
742
|
+
aria-hidden=${hasHelpText ? "false" : "true"}
|
|
743
|
+
class="form-control__help-text"
|
|
744
|
+
id="help-text"
|
|
745
|
+
part="form-control-help-text"
|
|
746
|
+
>
|
|
747
|
+
<slot name="help-text">${this.helpText}</slot>
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
`;
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
SlCheckbox.styles = [chunk_H33C3MRM.component_styles_default, form_control_styles_default, checkbox_styles_default];
|
|
754
|
+
SlCheckbox.dependencies = { "sl-icon": chunk_H33C3MRM.SlIcon };
|
|
755
|
+
chunk_H33C3MRM.__decorateClass([
|
|
756
|
+
e$2('input[type="checkbox"]')
|
|
757
|
+
], SlCheckbox.prototype, "input", 2);
|
|
758
|
+
chunk_H33C3MRM.__decorateClass([
|
|
759
|
+
chunk_H33C3MRM.r()
|
|
760
|
+
], SlCheckbox.prototype, "hasFocus", 2);
|
|
761
|
+
chunk_H33C3MRM.__decorateClass([
|
|
762
|
+
chunk_H33C3MRM.n()
|
|
763
|
+
], SlCheckbox.prototype, "title", 2);
|
|
764
|
+
chunk_H33C3MRM.__decorateClass([
|
|
765
|
+
chunk_H33C3MRM.n()
|
|
766
|
+
], SlCheckbox.prototype, "name", 2);
|
|
767
|
+
chunk_H33C3MRM.__decorateClass([
|
|
768
|
+
chunk_H33C3MRM.n()
|
|
769
|
+
], SlCheckbox.prototype, "value", 2);
|
|
770
|
+
chunk_H33C3MRM.__decorateClass([
|
|
771
|
+
chunk_H33C3MRM.n({ reflect: true })
|
|
772
|
+
], SlCheckbox.prototype, "size", 2);
|
|
773
|
+
chunk_H33C3MRM.__decorateClass([
|
|
774
|
+
chunk_H33C3MRM.n({ type: Boolean, reflect: true })
|
|
775
|
+
], SlCheckbox.prototype, "disabled", 2);
|
|
776
|
+
chunk_H33C3MRM.__decorateClass([
|
|
777
|
+
chunk_H33C3MRM.n({ type: Boolean, reflect: true })
|
|
778
|
+
], SlCheckbox.prototype, "checked", 2);
|
|
779
|
+
chunk_H33C3MRM.__decorateClass([
|
|
780
|
+
chunk_H33C3MRM.n({ type: Boolean, reflect: true })
|
|
781
|
+
], SlCheckbox.prototype, "indeterminate", 2);
|
|
782
|
+
chunk_H33C3MRM.__decorateClass([
|
|
783
|
+
defaultValue("checked")
|
|
784
|
+
], SlCheckbox.prototype, "defaultChecked", 2);
|
|
785
|
+
chunk_H33C3MRM.__decorateClass([
|
|
786
|
+
chunk_H33C3MRM.n({ reflect: true })
|
|
787
|
+
], SlCheckbox.prototype, "form", 2);
|
|
788
|
+
chunk_H33C3MRM.__decorateClass([
|
|
789
|
+
chunk_H33C3MRM.n({ type: Boolean, reflect: true })
|
|
790
|
+
], SlCheckbox.prototype, "required", 2);
|
|
791
|
+
chunk_H33C3MRM.__decorateClass([
|
|
792
|
+
chunk_H33C3MRM.n({ attribute: "help-text" })
|
|
793
|
+
], SlCheckbox.prototype, "helpText", 2);
|
|
794
|
+
chunk_H33C3MRM.__decorateClass([
|
|
795
|
+
chunk_H33C3MRM.watch("disabled", { waitUntilFirstUpdate: true })
|
|
796
|
+
], SlCheckbox.prototype, "handleDisabledChange", 1);
|
|
797
|
+
chunk_H33C3MRM.__decorateClass([
|
|
798
|
+
chunk_H33C3MRM.watch(["checked", "indeterminate"], { waitUntilFirstUpdate: true })
|
|
799
|
+
], SlCheckbox.prototype, "handleStateChange", 1);
|
|
800
|
+
|
|
801
|
+
SlCheckbox.define("sl-checkbox");
|
|
802
|
+
|
|
803
|
+
const jumpFilterCheckboxCss = ":host{display:flex;width:100%}:host .count{color:var(--neutral-grey-secondary, #707070)}:host sl-checkbox{display:flex;width:100%}:host sl-checkbox::part(control){height:1rem;width:1rem;border:1px solid var(--neutral-grey-secondary, #707070);border-radius:3px}:host sl-checkbox::part(control--checked){background-color:var(--status-interaction-standard, #2C6ECB);border-color:var(--status-interaction-standard, #2C6ECB);color:var(--neutral-ultralight, #fff)}:host sl-checkbox::part(label){display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-grow:1;color:var(--neutral-grey-primary, #1d1d1d);font-family:var(--ff-primary), serif}";
|
|
804
|
+
const JumpFilterCheckboxStyle0 = jumpFilterCheckboxCss;
|
|
805
|
+
|
|
806
|
+
const JumpFilterCheckbox = class {
|
|
807
|
+
constructor(hostRef) {
|
|
808
|
+
index.registerInstance(this, hostRef);
|
|
809
|
+
this.toggleCheckbox = index.createEvent(this, "jump-checkbox-change", 7);
|
|
810
|
+
this.value = undefined;
|
|
811
|
+
this.label = undefined;
|
|
812
|
+
this.checked = false;
|
|
813
|
+
this.count = null;
|
|
814
|
+
}
|
|
815
|
+
componentDidLoad() {
|
|
816
|
+
this.listenSLChange();
|
|
817
|
+
}
|
|
818
|
+
listenSLChange() {
|
|
819
|
+
if (this.host) {
|
|
820
|
+
this.host.addEventListener('sl-change', () => {
|
|
821
|
+
//invert the checked value
|
|
822
|
+
this.checked = !this.checked;
|
|
823
|
+
this.toggleCheckbox.emit({
|
|
824
|
+
//@ts-ignore
|
|
825
|
+
value: this.el.value,
|
|
826
|
+
//@ts-ignore
|
|
827
|
+
checked: this.checked,
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
async isChecked() {
|
|
833
|
+
// @ts-ignore
|
|
834
|
+
return this.el.checked;
|
|
835
|
+
}
|
|
836
|
+
render() {
|
|
837
|
+
return (index.h(index.Host, { key: '8c7ea463a6e26c6f77962cd0295dcb41411fa074', ref: (host) => this.host = host }, this.value && this.label &&
|
|
838
|
+
index.h("sl-checkbox", { key: '7467e1c364d868c7d58a58937411daf4f8c4e397', value: this.value, ref: (el) => this.el = el, checked: this.checked }, this.label), this.count && index.h("span", { key: 'e3add7e4ad2024096d8484b93cb276ac714d57d8', class: "count" }, "(", this.count, ")")));
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
JumpFilterCheckbox.style = JumpFilterCheckboxStyle0;
|
|
842
|
+
|
|
843
|
+
exports.jump_filter_checkbox = JumpFilterCheckbox;
|
|
844
|
+
|
|
845
|
+
//# sourceMappingURL=jump-filter-checkbox.cjs.entry.js.map
|