@otto-de/b2b-core-components 1.34.0 → 1.35.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/dist/b2b-core-components/b2b-core-components.esm.js +1 -1
- package/dist/b2b-core-components/{p-8aba659a.entry.js → p-18bb4d69.entry.js} +1 -1
- package/dist/b2b-core-components/{p-13d37dec.entry.js → p-21644e6c.entry.js} +1 -1
- package/dist/b2b-core-components/{p-66c435c1.entry.js → p-23af5193.entry.js} +1 -1
- package/dist/b2b-core-components/{p-81cffff6.entry.js → p-419de188.entry.js} +1 -1
- package/dist/b2b-core-components/{p-8ae9c2fe.entry.js → p-670e355a.entry.js} +1 -1
- package/dist/b2b-core-components/{p-e512628d.entry.js → p-7889e94a.entry.js} +1 -1
- package/dist/b2b-core-components/{p-371df3f8.entry.js → p-8cb6813a.entry.js} +1 -1
- package/dist/b2b-core-components/p-abcbd1cc.entry.js +1 -0
- package/dist/b2b-core-components/p-ae7a752e.entry.js +1 -0
- package/dist/b2b-core-components/p-c430b5ba.entry.js +1 -0
- package/dist/b2b-core-components/{p-c43e067a.entry.js → p-dcaff8ab.entry.js} +1 -1
- package/dist/cjs/b2b-core-components.cjs.js +1 -1
- package/dist/cjs/b2b-custom-dropdown.cjs.entry.js +9 -5
- package/dist/cjs/b2b-dropdown.cjs.entry.js +27 -4
- package/dist/cjs/b2b-time-picker.cjs.entry.js +157 -0
- package/dist/cjs/b2b-toggle-button.cjs.entry.js +3 -3
- package/dist/cjs/b2b-toggle-chip.cjs.entry.js +3 -3
- package/dist/cjs/b2b-toggle-group.cjs.entry.js +2 -2
- package/dist/cjs/b2b-toggle-switch.cjs.entry.js +4 -4
- package/dist/cjs/b2b-tooltip.cjs.entry.js +3 -3
- package/dist/cjs/b2b-wizard-icon.cjs.entry.js +1 -1
- package/dist/cjs/b2b-wizard-step.cjs.entry.js +2 -2
- package/dist/cjs/b2b-wizard.cjs.entry.js +1 -1
- package/dist/cjs/index-668808fd.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/custom-dropdown/custom-dropdown.css +13 -1
- package/dist/collection/components/custom-dropdown/custom-dropdown.e2e.js +69 -0
- package/dist/collection/components/custom-dropdown/custom-dropdown.js +26 -4
- package/dist/collection/components/custom-dropdown/custom-dropdown.stories.js +11 -0
- package/dist/collection/components/dropdown/dropdown.js +27 -4
- package/dist/collection/components/time-picker/time-picker.css +345 -0
- package/dist/collection/components/time-picker/time-picker.e2e.js +135 -0
- package/dist/collection/components/time-picker/time-picker.js +411 -0
- package/dist/collection/components/time-picker/time-picker.stories.js +80 -0
- package/dist/collection/components/toggle-button/toggle-button.js +3 -3
- package/dist/collection/components/toggle-chip/toggle-chip.js +3 -3
- package/dist/collection/components/toggle-group/toggle-group.js +2 -2
- package/dist/collection/components/toggle-switch/toggle-switch.js +4 -4
- package/dist/collection/components/tooltip/tooltip.js +3 -3
- package/dist/collection/components/wizard/wizard-step.js +2 -2
- package/dist/collection/components/wizard/wizard.js +1 -1
- package/dist/collection/components/wizard-icon/wizard-icon.js +1 -1
- package/dist/components/b2b-custom-dropdown.js +10 -5
- package/dist/components/b2b-dropdown.js +27 -4
- package/dist/components/b2b-time-picker.d.ts +11 -0
- package/dist/components/b2b-time-picker.js +200 -0
- package/dist/components/b2b-toggle-button.js +3 -3
- package/dist/components/b2b-toggle-chip.js +3 -3
- package/dist/components/b2b-toggle-group.js +2 -2
- package/dist/components/b2b-toggle-switch.js +4 -4
- package/dist/components/b2b-tooltip.js +3 -3
- package/dist/components/b2b-wizard-step.js +2 -2
- package/dist/components/b2b-wizard.js +1 -1
- package/dist/components/wizard-icon.js +1 -1
- package/dist/custom-elements.json +56 -0
- package/dist/esm/b2b-core-components.js +1 -1
- package/dist/esm/b2b-custom-dropdown.entry.js +9 -5
- package/dist/esm/b2b-dropdown.entry.js +27 -4
- package/dist/esm/b2b-time-picker.entry.js +153 -0
- package/dist/esm/b2b-toggle-button.entry.js +3 -3
- package/dist/esm/b2b-toggle-chip.entry.js +3 -3
- package/dist/esm/b2b-toggle-group.entry.js +2 -2
- package/dist/esm/b2b-toggle-switch.entry.js +4 -4
- package/dist/esm/b2b-tooltip.entry.js +3 -3
- package/dist/esm/b2b-wizard-icon.entry.js +1 -1
- package/dist/esm/b2b-wizard-step.entry.js +2 -2
- package/dist/esm/b2b-wizard.entry.js +1 -1
- package/dist/esm/index-ab9eb36d.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/custom-dropdown/custom-dropdown.d.ts +2 -0
- package/dist/types/components/custom-dropdown/custom-dropdown.stories.d.ts +3 -0
- package/dist/types/components/dropdown/dropdown.d.ts +1 -0
- package/dist/types/components/time-picker/time-picker.d.ts +50 -0
- package/dist/types/components/time-picker/time-picker.stories.d.ts +10 -0
- package/dist/types/components.d.ts +124 -0
- package/dist/web-types.json +152 -1
- package/package.json +2 -2
- package/dist/b2b-core-components/p-24c6aa56.entry.js +0 -1
- package/dist/b2b-core-components/p-e90d3aba.entry.js +0 -1
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { h, Host, } from "@stencil/core";
|
|
2
|
+
export class TimePickerComponent {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.onFocus = (ev) => {
|
|
5
|
+
this.hasFocus = true;
|
|
6
|
+
this.isOpen = true;
|
|
7
|
+
this.b2bFocus.emit(ev);
|
|
8
|
+
};
|
|
9
|
+
this.onBlur = (ev) => {
|
|
10
|
+
this.hasFocus = false;
|
|
11
|
+
this.isOpen = false;
|
|
12
|
+
this.b2bBlur.emit(ev);
|
|
13
|
+
};
|
|
14
|
+
this.onInput = (ev) => {
|
|
15
|
+
this.isOpen = false;
|
|
16
|
+
const input = ev.target;
|
|
17
|
+
this.value = input.value;
|
|
18
|
+
this.b2bInput.emit({ value: this.value });
|
|
19
|
+
};
|
|
20
|
+
this.validateInput = (value) => {
|
|
21
|
+
const match = value.match(/^(\d{2}):(\d{2})$/);
|
|
22
|
+
let isValid = false;
|
|
23
|
+
if (match) {
|
|
24
|
+
const hour = parseInt(match[1], 10);
|
|
25
|
+
const minute = parseInt(match[2], 10);
|
|
26
|
+
isValid = hour >= 0 && hour <= 23 && minute >= 0 && minute <= 59;
|
|
27
|
+
}
|
|
28
|
+
if (!isValid && value.length > 0) {
|
|
29
|
+
this.internalErrorMessage = 'Invalid format';
|
|
30
|
+
this.internalInvalid = true;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.internalErrorMessage = '';
|
|
34
|
+
this.internalInvalid = false;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.onSelect = (event) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const target = event.target;
|
|
40
|
+
const selectedValue = target.getAttribute('data-value');
|
|
41
|
+
if (selectedValue !== null) {
|
|
42
|
+
this.value = selectedValue;
|
|
43
|
+
this.b2bChange.emit(selectedValue);
|
|
44
|
+
this.internalInvalid = false;
|
|
45
|
+
this.internalErrorMessage = '';
|
|
46
|
+
this.hasFocus = false;
|
|
47
|
+
this.isOpen = false;
|
|
48
|
+
(_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.blur();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
this.onClear = () => {
|
|
52
|
+
this.value = '';
|
|
53
|
+
this.internalInvalid = false;
|
|
54
|
+
this.internalErrorMessage = '';
|
|
55
|
+
this.hasFocus = false;
|
|
56
|
+
this.b2bClear.emit();
|
|
57
|
+
};
|
|
58
|
+
this.toggleDropdown = () => {
|
|
59
|
+
var _a;
|
|
60
|
+
this.isOpen = !this.isOpen;
|
|
61
|
+
if (this.isOpen) {
|
|
62
|
+
(_a = this.inputRef) === null || _a === void 0 ? void 0 : _a.focus();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
this.label = undefined;
|
|
66
|
+
this.required = false;
|
|
67
|
+
this.placeholder = 'hh:mm';
|
|
68
|
+
this.invalid = false;
|
|
69
|
+
this.hint = undefined;
|
|
70
|
+
this.interval = 15;
|
|
71
|
+
this.error = undefined;
|
|
72
|
+
this.value = null;
|
|
73
|
+
this.hasFocus = false;
|
|
74
|
+
this.isOpen = false;
|
|
75
|
+
this.availableTimes = [];
|
|
76
|
+
this.internalErrorMessage = '';
|
|
77
|
+
this.internalInvalid = false;
|
|
78
|
+
}
|
|
79
|
+
componentWillLoad() {
|
|
80
|
+
this.availableTimes = this.getAvailableTimes();
|
|
81
|
+
if (this.value) {
|
|
82
|
+
this.validateInput(this.value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
handleIntervalChange() {
|
|
86
|
+
this.availableTimes = this.getAvailableTimes();
|
|
87
|
+
}
|
|
88
|
+
validateValue(newValue) {
|
|
89
|
+
this.value = newValue;
|
|
90
|
+
this.validateInput(newValue);
|
|
91
|
+
}
|
|
92
|
+
get isInvalid() {
|
|
93
|
+
return this.invalid || this.internalInvalid;
|
|
94
|
+
}
|
|
95
|
+
get currentErrorMessage() {
|
|
96
|
+
return this.error || this.internalErrorMessage;
|
|
97
|
+
}
|
|
98
|
+
getAvailableTimes() {
|
|
99
|
+
const times = [];
|
|
100
|
+
const step = this.interval || 15;
|
|
101
|
+
for (let hour = 0; hour < 24; hour++) {
|
|
102
|
+
for (let minute = 0; minute < 60; minute += step) {
|
|
103
|
+
const time = `${hour.toString().padStart(2, '0')}:${minute
|
|
104
|
+
.toString()
|
|
105
|
+
.padStart(2, '0')}`;
|
|
106
|
+
times.push(time);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return times;
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
return (h(Host, { key: '82d85e61e12453aa332eb1771c2ecacf84a93bce', class: {
|
|
113
|
+
'b2b-time-picker': true,
|
|
114
|
+
'b2b-time-picker--error': this.isInvalid,
|
|
115
|
+
} }, this.label && (h("b2b-input-label", { id: this.label, required: this.required }, this.label)), h("div", { key: 'e6e70210043bd5c220c03610ab4681378889b075', class: {
|
|
116
|
+
'b2b-time-picker__wrapper': true,
|
|
117
|
+
'b2b-time-picker__wrapper--focused': this.hasFocus,
|
|
118
|
+
'b2b-time-picker__wrapper--filled': !this.hasFocus && !this.invalid && this.value !== '',
|
|
119
|
+
'b2b-time-picker__wrapper--error': this.isInvalid,
|
|
120
|
+
} }, h("input", { key: '91994a1908b2c5dd5886c442fd5a3ca6415f3619', ref: el => (this.inputRef = el), class: {
|
|
121
|
+
'b2b-time-picker__native-input': true,
|
|
122
|
+
}, type: "text", placeholder: this.placeholder, value: this.value, onFocus: this.onFocus, onBlur: this.onBlur, onInput: this.onInput }), h("div", { key: '4052c5c017944c767ccbf286dd4de11e74509848', class: "b2b-icons" }, this.value && (h("div", { class: "b2b-close-icon", onClick: this.onClear }, h("b2b-icon-100", { icon: "b2b_icon-close", "aria-label": "clear input", clickable: true }))), h("div", { key: '92996f5e06fc7e325088d09185b4496a00df68f5', class: "b2b-duration-icon", onMouseDown: e => {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
this.toggleDropdown();
|
|
125
|
+
} }, h("b2b-icon-100", { key: 'e24b25b79ef06002af8ce83ecf41e88b967ca4ed', icon: "b2b_icon-duration", clickable: true })))), h("div", { key: 'e3154f9b414215660041e6779668c0bb50f06284', class: {
|
|
126
|
+
'b2b-time-picker__options-container': true,
|
|
127
|
+
'b2b-time-picker__options-container--visible': this.isOpen && this.hasFocus,
|
|
128
|
+
}, onMouseDown: e => e.preventDefault() }, h("div", { key: '92e172240eaae8ddb7cef7dab5aaf02b55df44ea', class: "b2b-time-picker__options", role: "listbox", "aria-label": this.label, tabIndex: -1 }, this.availableTimes.map(time => (h("div", { key: time, class: {
|
|
129
|
+
'b2b-time-picker__option': true,
|
|
130
|
+
'b2b-time-picker__option--selected': time === this.value,
|
|
131
|
+
}, "data-value": time, onClick: this.onSelect, role: "option", "aria-selected": time === this.value ? 'true' : 'false' }, time))))), h("span", { class: {
|
|
132
|
+
'b2b-time-picker__hint': true,
|
|
133
|
+
'b2b-time-picker__hint--error': this.isInvalid,
|
|
134
|
+
} }, this.isInvalid ? this.currentErrorMessage : this.hint)));
|
|
135
|
+
}
|
|
136
|
+
static get is() { return "b2b-time-picker"; }
|
|
137
|
+
static get encapsulation() { return "shadow"; }
|
|
138
|
+
static get originalStyleUrls() {
|
|
139
|
+
return {
|
|
140
|
+
"$": ["time-picker.scss"]
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
static get styleUrls() {
|
|
144
|
+
return {
|
|
145
|
+
"$": ["time-picker.css"]
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
static get properties() {
|
|
149
|
+
return {
|
|
150
|
+
"label": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"mutable": false,
|
|
153
|
+
"complexType": {
|
|
154
|
+
"original": "string",
|
|
155
|
+
"resolved": "string",
|
|
156
|
+
"references": {}
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"optional": true,
|
|
160
|
+
"docs": {
|
|
161
|
+
"tags": [],
|
|
162
|
+
"text": "The time picker label."
|
|
163
|
+
},
|
|
164
|
+
"attribute": "label",
|
|
165
|
+
"reflect": false
|
|
166
|
+
},
|
|
167
|
+
"required": {
|
|
168
|
+
"type": "boolean",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "boolean",
|
|
172
|
+
"resolved": "boolean",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [],
|
|
179
|
+
"text": "Adds an asterisk at the end of the label to signify that the field is required."
|
|
180
|
+
},
|
|
181
|
+
"attribute": "required",
|
|
182
|
+
"reflect": true,
|
|
183
|
+
"defaultValue": "false"
|
|
184
|
+
},
|
|
185
|
+
"placeholder": {
|
|
186
|
+
"type": "string",
|
|
187
|
+
"mutable": false,
|
|
188
|
+
"complexType": {
|
|
189
|
+
"original": "string",
|
|
190
|
+
"resolved": "string",
|
|
191
|
+
"references": {}
|
|
192
|
+
},
|
|
193
|
+
"required": false,
|
|
194
|
+
"optional": false,
|
|
195
|
+
"docs": {
|
|
196
|
+
"tags": [],
|
|
197
|
+
"text": "The placeholder for the time picker input field."
|
|
198
|
+
},
|
|
199
|
+
"attribute": "placeholder",
|
|
200
|
+
"reflect": true,
|
|
201
|
+
"defaultValue": "'hh:mm'"
|
|
202
|
+
},
|
|
203
|
+
"invalid": {
|
|
204
|
+
"type": "boolean",
|
|
205
|
+
"mutable": false,
|
|
206
|
+
"complexType": {
|
|
207
|
+
"original": "boolean",
|
|
208
|
+
"resolved": "boolean",
|
|
209
|
+
"references": {}
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"optional": false,
|
|
213
|
+
"docs": {
|
|
214
|
+
"tags": [],
|
|
215
|
+
"text": "Whether the time picker is currently invalid. If true, the time picker is rendered with error styles. Per default, it is false."
|
|
216
|
+
},
|
|
217
|
+
"attribute": "invalid",
|
|
218
|
+
"reflect": true,
|
|
219
|
+
"defaultValue": "false"
|
|
220
|
+
},
|
|
221
|
+
"hint": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"mutable": false,
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "string",
|
|
226
|
+
"resolved": "string",
|
|
227
|
+
"references": {}
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"optional": true,
|
|
231
|
+
"docs": {
|
|
232
|
+
"tags": [],
|
|
233
|
+
"text": "The hint text that appears underneath the time picker field."
|
|
234
|
+
},
|
|
235
|
+
"attribute": "hint",
|
|
236
|
+
"reflect": false
|
|
237
|
+
},
|
|
238
|
+
"interval": {
|
|
239
|
+
"type": "number",
|
|
240
|
+
"mutable": false,
|
|
241
|
+
"complexType": {
|
|
242
|
+
"original": "number",
|
|
243
|
+
"resolved": "number",
|
|
244
|
+
"references": {}
|
|
245
|
+
},
|
|
246
|
+
"required": false,
|
|
247
|
+
"optional": true,
|
|
248
|
+
"docs": {
|
|
249
|
+
"tags": [],
|
|
250
|
+
"text": "The interval in minutes for the time options. Default is 15 minutes."
|
|
251
|
+
},
|
|
252
|
+
"attribute": "interval",
|
|
253
|
+
"reflect": false,
|
|
254
|
+
"defaultValue": "15"
|
|
255
|
+
},
|
|
256
|
+
"error": {
|
|
257
|
+
"type": "string",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "string",
|
|
261
|
+
"resolved": "string",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": true,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "The error message that is shown if the input is invalid."
|
|
269
|
+
},
|
|
270
|
+
"attribute": "error",
|
|
271
|
+
"reflect": false
|
|
272
|
+
},
|
|
273
|
+
"value": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"mutable": true,
|
|
276
|
+
"complexType": {
|
|
277
|
+
"original": "string",
|
|
278
|
+
"resolved": "string",
|
|
279
|
+
"references": {}
|
|
280
|
+
},
|
|
281
|
+
"required": false,
|
|
282
|
+
"optional": false,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": "The value of the time picker. It has to be in the format \"hh:mm\"."
|
|
286
|
+
},
|
|
287
|
+
"attribute": "value",
|
|
288
|
+
"reflect": true,
|
|
289
|
+
"defaultValue": "null"
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
static get states() {
|
|
294
|
+
return {
|
|
295
|
+
"hasFocus": {},
|
|
296
|
+
"isOpen": {},
|
|
297
|
+
"availableTimes": {},
|
|
298
|
+
"internalErrorMessage": {},
|
|
299
|
+
"internalInvalid": {}
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
static get events() {
|
|
303
|
+
return [{
|
|
304
|
+
"method": "b2bFocus",
|
|
305
|
+
"name": "b2b-focus",
|
|
306
|
+
"bubbles": true,
|
|
307
|
+
"cancelable": true,
|
|
308
|
+
"composed": true,
|
|
309
|
+
"docs": {
|
|
310
|
+
"tags": [],
|
|
311
|
+
"text": "Emits whenever the time picker receives focus."
|
|
312
|
+
},
|
|
313
|
+
"complexType": {
|
|
314
|
+
"original": "FocusEvent",
|
|
315
|
+
"resolved": "FocusEvent",
|
|
316
|
+
"references": {
|
|
317
|
+
"FocusEvent": {
|
|
318
|
+
"location": "global",
|
|
319
|
+
"id": "global::FocusEvent"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}, {
|
|
324
|
+
"method": "b2bBlur",
|
|
325
|
+
"name": "b2b-blur",
|
|
326
|
+
"bubbles": true,
|
|
327
|
+
"cancelable": true,
|
|
328
|
+
"composed": true,
|
|
329
|
+
"docs": {
|
|
330
|
+
"tags": [],
|
|
331
|
+
"text": "Emits whenever the time picker loses focus."
|
|
332
|
+
},
|
|
333
|
+
"complexType": {
|
|
334
|
+
"original": "FocusEvent",
|
|
335
|
+
"resolved": "FocusEvent",
|
|
336
|
+
"references": {
|
|
337
|
+
"FocusEvent": {
|
|
338
|
+
"location": "global",
|
|
339
|
+
"id": "global::FocusEvent"
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}, {
|
|
344
|
+
"method": "b2bInput",
|
|
345
|
+
"name": "b2b-input",
|
|
346
|
+
"bubbles": true,
|
|
347
|
+
"cancelable": true,
|
|
348
|
+
"composed": true,
|
|
349
|
+
"docs": {
|
|
350
|
+
"tags": [],
|
|
351
|
+
"text": "Emits whenever the input value changes."
|
|
352
|
+
},
|
|
353
|
+
"complexType": {
|
|
354
|
+
"original": "InputChangeEvent",
|
|
355
|
+
"resolved": "InputChangeEvent",
|
|
356
|
+
"references": {
|
|
357
|
+
"InputChangeEvent": {
|
|
358
|
+
"location": "import",
|
|
359
|
+
"path": "../../utils/interfaces/form.interface",
|
|
360
|
+
"id": "src/utils/interfaces/form.interface.d.ts::InputChangeEvent"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}, {
|
|
365
|
+
"method": "b2bChange",
|
|
366
|
+
"name": "b2b-selected",
|
|
367
|
+
"bubbles": true,
|
|
368
|
+
"cancelable": true,
|
|
369
|
+
"composed": true,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": "Emits whenever a time is selected from the dropdown."
|
|
373
|
+
},
|
|
374
|
+
"complexType": {
|
|
375
|
+
"original": "string",
|
|
376
|
+
"resolved": "string",
|
|
377
|
+
"references": {}
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
"method": "b2bClear",
|
|
381
|
+
"name": "b2b-clear",
|
|
382
|
+
"bubbles": true,
|
|
383
|
+
"cancelable": true,
|
|
384
|
+
"composed": true,
|
|
385
|
+
"docs": {
|
|
386
|
+
"tags": [],
|
|
387
|
+
"text": "Emits when the user clicks the clear button."
|
|
388
|
+
},
|
|
389
|
+
"complexType": {
|
|
390
|
+
"original": "DateClear",
|
|
391
|
+
"resolved": "DateClear",
|
|
392
|
+
"references": {
|
|
393
|
+
"DateClear": {
|
|
394
|
+
"location": "import",
|
|
395
|
+
"path": "../../utils/interfaces/form.interface",
|
|
396
|
+
"id": "src/utils/interfaces/form.interface.d.ts::DateClear"
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}];
|
|
401
|
+
}
|
|
402
|
+
static get watchers() {
|
|
403
|
+
return [{
|
|
404
|
+
"propName": "interval",
|
|
405
|
+
"methodName": "handleIntervalChange"
|
|
406
|
+
}, {
|
|
407
|
+
"propName": "value",
|
|
408
|
+
"methodName": "validateValue"
|
|
409
|
+
}];
|
|
410
|
+
}
|
|
411
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s)
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { getArgTypes } from "../../docs/config/utils";
|
|
14
|
+
import { html } from "lit-html";
|
|
15
|
+
import { userEvent } from "@storybook/test";
|
|
16
|
+
getArgTypes('b2b-time-picker');
|
|
17
|
+
const meta = {
|
|
18
|
+
title: 'Components/Form/Time Picker',
|
|
19
|
+
component: 'b2b-time-picker',
|
|
20
|
+
args: {
|
|
21
|
+
required: false,
|
|
22
|
+
invalid: false,
|
|
23
|
+
error: '',
|
|
24
|
+
label: 'Uhrzeit auswählen',
|
|
25
|
+
placeholder: 'hh:mm',
|
|
26
|
+
value: '',
|
|
27
|
+
interval: 15,
|
|
28
|
+
hint: 'A hint',
|
|
29
|
+
},
|
|
30
|
+
argTypes: Object.assign(Object.assign({}, getArgTypes('b2b-time-picker')), { value: Object.assign(Object.assign({}, getArgTypes('b2b-time-picker').value), { control: false }), interval: Object.assign(Object.assign({}, getArgTypes('b2b-time-picker').interval), { control: { type: 'range', min: 15, max: 60, step: 5 } }) }),
|
|
31
|
+
render: (_a) => {
|
|
32
|
+
var args = __rest(_a, []);
|
|
33
|
+
return html ` <div style="margin-left: 2px">
|
|
34
|
+
<b2b-time-picker
|
|
35
|
+
label=${args.label}
|
|
36
|
+
required=${args.required}
|
|
37
|
+
hint=${args.hint}
|
|
38
|
+
placeholder=${args.placeholder}
|
|
39
|
+
error=${args.error}
|
|
40
|
+
interval=${args.interval}
|
|
41
|
+
value=${args.value}
|
|
42
|
+
invalid=${args.invalid}></b2b-time-picker>
|
|
43
|
+
</div>`;
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
export default meta;
|
|
47
|
+
export const Default = {
|
|
48
|
+
args: Object.assign(Object.assign({}, meta.args), { required: true }),
|
|
49
|
+
};
|
|
50
|
+
export const Focused = {
|
|
51
|
+
args: Object.assign({}, meta.args),
|
|
52
|
+
play: async ({ canvasElement }) => {
|
|
53
|
+
setTimeout(async () => {
|
|
54
|
+
var _a;
|
|
55
|
+
const timePicker = canvasElement.querySelector('b2b-time-picker');
|
|
56
|
+
const b2bTimePickerWrapper = (_a = timePicker.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
|
57
|
+
await userEvent.click(b2bTimePickerWrapper);
|
|
58
|
+
}, 500);
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
export const Filled = {
|
|
62
|
+
args: Object.assign(Object.assign({}, meta.args), { value: '10:30' }),
|
|
63
|
+
};
|
|
64
|
+
export const Error = {
|
|
65
|
+
args: Object.assign(Object.assign({}, meta.args), { invalid: true, error: 'This is an error message' }),
|
|
66
|
+
};
|
|
67
|
+
export const FilledWithIncorrectTime = {
|
|
68
|
+
args: Object.assign(Object.assign({}, meta.args), { invalid: true, error: 'This is an error message', value: '25:61' }),
|
|
69
|
+
};
|
|
70
|
+
export const CustomIntervalSet = {
|
|
71
|
+
args: Object.assign(Object.assign({}, meta.args), { interval: 60 }),
|
|
72
|
+
play: async ({ canvasElement }) => {
|
|
73
|
+
setTimeout(async () => {
|
|
74
|
+
var _a;
|
|
75
|
+
const timePicker = canvasElement.querySelector('b2b-time-picker');
|
|
76
|
+
const b2bTimePickerWrapper = (_a = timePicker.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
|
77
|
+
await userEvent.click(b2bTimePickerWrapper);
|
|
78
|
+
}, 500);
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -31,13 +31,13 @@ export class B2bToggleButtonComponent {
|
|
|
31
31
|
return Array.from(document.querySelectorAll(`b2b-toggle-button[name="${this.name}"]`)).filter((toggle) => toggle.value !== this.value);
|
|
32
32
|
}
|
|
33
33
|
render() {
|
|
34
|
-
return (h(Host, { key: '
|
|
34
|
+
return (h(Host, { key: '087925aae07f41b1fe50efb4dceda7e3e48849bc', onClick: this.onClick }, h("span", { key: 'e85fea0b039ff481a18a8e194480e5432fcc6b80', class: {
|
|
35
35
|
'b2b-toggle-button': true,
|
|
36
36
|
'b2b-toggle-button--disabled': this.disabled,
|
|
37
|
-
} }, h("input", { key: '
|
|
37
|
+
} }, h("input", { key: 'd50119c68578e8db12e49a8a408c8b7b2611ea29', tabindex: 0, class: {
|
|
38
38
|
'b2b-toggle-button__input': true,
|
|
39
39
|
'b2b-toggle-button__input--disabled': this.disabled,
|
|
40
|
-
}, "aria-labelledby": this.name, type: "radio", checked: this.checked && !this.disabled, disabled: this.disabled, name: this.name, value: this.value }), h("label", { key: '
|
|
40
|
+
}, "aria-labelledby": this.name, type: "radio", checked: this.checked && !this.disabled, disabled: this.disabled, name: this.name, value: this.value }), h("label", { key: 'bc66888b0740d13031c0467717af4e76c4d19a67', id: this.name, tabindex: -1, class: {
|
|
41
41
|
'b2b-toggle-button__label': true,
|
|
42
42
|
'b2b-toggle-button__label--disabled': this.disabled,
|
|
43
43
|
'b2b-toggle-button__label--checked': this.checked && !this.disabled,
|
|
@@ -32,11 +32,11 @@ export class B2BToggleChipComponent {
|
|
|
32
32
|
this.disabled = false;
|
|
33
33
|
}
|
|
34
34
|
render() {
|
|
35
|
-
return (h(Host, { key: '
|
|
35
|
+
return (h(Host, { key: '9b02a8f340b5531879187d4ac97fccb6ae619a69' }, h("span", { key: '59994cb3e4c28bdf673d329d12d0e56e628c140b', onClick: this.onClick, onKeyDown: this.onKeyDown, class: {
|
|
36
36
|
'b2b-toggle-chip': true,
|
|
37
|
-
} }, h("input", { key: '
|
|
37
|
+
} }, h("input", { key: '7492ffd930e3ebb62f3df0cece70b2cc232444df', "aria-labelledby": this.name, tabindex: this.disabled ? -1 : 0, class: {
|
|
38
38
|
'b2b-toggle-chip__input': true,
|
|
39
|
-
}, type: "checkbox", checked: this.active && !this.disabled, disabled: this.disabled, name: this.name, value: this.value }), h("label", { key: '
|
|
39
|
+
}, type: "checkbox", checked: this.active && !this.disabled, disabled: this.disabled, name: this.name, value: this.value }), h("label", { key: 'c47d4a9483d9bccdd16722af2fd74e50f8a10257', id: this.name, tabIndex: -1, class: {
|
|
40
40
|
'b2b-toggle-chip__label': true,
|
|
41
41
|
'b2b-toggle-chip__label--active': this.active && !this.disabled,
|
|
42
42
|
'b2b-toggle-chip__label--disabled': this.disabled,
|
|
@@ -45,10 +45,10 @@ export class B2BToggleGroup {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
render() {
|
|
48
|
-
return (h(Host, { key: '
|
|
48
|
+
return (h(Host, { key: '99ff703edae5a8759af9e4b9093c2db32108d2cd' }, h("div", { key: 'f4b20d4fcf809ec622688866ae736233d16d90ee', class: {
|
|
49
49
|
'b2b-toggle-group': true,
|
|
50
50
|
'b2b-toggle-group--disabled': this.disabled,
|
|
51
|
-
} }, h("fieldset", { key: '
|
|
51
|
+
} }, h("fieldset", { key: '97ec3070e1935d8803c8e3b7bac17f3eb92864f1' }, h("slot", { key: '787e72239b2f2300a1150787044ad5fe38c6588e' })))));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "b2b-toggle-group"; }
|
|
54
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -38,17 +38,17 @@ export class B2bToggleSwitchComponent {
|
|
|
38
38
|
render() {
|
|
39
39
|
// workaround for purgecss as safelist doesn't work
|
|
40
40
|
const isLeft = this.labelPosition === 'left';
|
|
41
|
-
return (h(Host, { key: '
|
|
41
|
+
return (h(Host, { key: '5a9a846632b7b3cca02a79a9ed043f5ab9d1c6fa' }, h("div", { key: '115479ac6e5df73f04d6f73e01a541c805a31a63', class: {
|
|
42
42
|
'b2b-toggle': true,
|
|
43
43
|
'b2b-toggle--disabled': this.disabled,
|
|
44
44
|
'b2b-toggle--checked': this.state,
|
|
45
|
-
} }, h("div", { key: '
|
|
45
|
+
} }, h("div", { key: 'cf530d51f4fd327135935ea500193031dedefe4e', class: {
|
|
46
46
|
'b2b-toggle__label': true,
|
|
47
47
|
'b2b-toggle__label--left': isLeft,
|
|
48
|
-
} }, h("span", { key: '
|
|
48
|
+
} }, h("span", { key: 'f758117b3dbf6256bfc810dc818c63e7aa5f5597', class: "b2b-toggle__switch", role: "switch", tabIndex: 0, onKeyDown: this.onKeyDown, onClick: this.onClick }, h("svg", { key: '08626107d93016092543c78e25c82abd0fea42f3', class: {
|
|
49
49
|
'b2b-toggle__icon': true,
|
|
50
50
|
'b2b-toggle__icon--show': this.state,
|
|
51
|
-
}, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 30 30" }, h("path", { key: '
|
|
51
|
+
}, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 30 30" }, h("path", { key: 'a57ece77901fca3e09462f88cedd7d9407d7a91c', d: "M11.798 25.082c-.341 0-.681-.13-.942-.389l-7.132-7.115a1.334 1.334 0 0 1 1.884-1.888l6.19 6.175L26.391 7.307a1.334 1.334 0 0 1 1.884 1.888L12.74 24.693c-.26.259-.601.389-.942.389z" }))), this.label && (h("span", { class: {
|
|
52
52
|
'b2b-toggle__text': true,
|
|
53
53
|
'b2b-toggle__text--left': isLeft,
|
|
54
54
|
} }, this.label))))));
|
|
@@ -59,13 +59,13 @@ export class B2BTooltipComponent {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
render() {
|
|
62
|
-
return (h(Host, { key: '
|
|
62
|
+
return (h(Host, { key: 'd433aa3cbd4216722933e50fd2613afb8be0a32a', onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave }, h("span", { key: '31a5bc21f1adc031dc0d92732659138bf4e27681', class: {
|
|
63
63
|
[`b2b-tooltip--${this.position}`]: true,
|
|
64
64
|
'b2b-tooltip__trigger': true,
|
|
65
|
-
} }, h("slot", { key: '
|
|
65
|
+
} }, h("slot", { key: 'bbec9da1933c391822594f5d555bcefe316c02f3' }), h("div", { key: '4697390b2e16363008a437b9b1af37ea82ee2660', class: {
|
|
66
66
|
'b2b-tooltip__content': true,
|
|
67
67
|
'b2b-tooltip--visible': this.opened,
|
|
68
|
-
} }, h("slot", { key: '
|
|
68
|
+
} }, h("slot", { key: '2e78f5e154563a7c0e9d2e1067e00aa56991ae0c', name: "content" }, this.content)))));
|
|
69
69
|
}
|
|
70
70
|
static get is() { return "b2b-tooltip"; }
|
|
71
71
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,10 +7,10 @@ export class WizardStepComponent {
|
|
|
7
7
|
this.checkIcon = true;
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: '6748e7f67b3cec569003e9b99c413dbdfb99f402' }, h("div", { key: '2ab2e6f5f76238bbe5e943551c7b0fb36df9d121', class: "b2b_wizard__step" }, h("b2b-wizard-icon", { key: '13b0071f3d02918551d65e22fb1511f3ca666926', step: this.step, state: this.state, checkIcon: this.checkIcon }), h("div", { key: '416cef0fe8bee41e1ee1b566ed5b9b7bc6469fb4', class: {
|
|
11
11
|
'b2b_wizard__step__label': true,
|
|
12
12
|
'b2b_wizard__step__label--default': this.state === WizardStatus.DEFAULT,
|
|
13
|
-
} }, h("slot", { key: '
|
|
13
|
+
} }, h("slot", { key: 'f06b1de799fc54b8ece414795b7ab0750a382108' })))));
|
|
14
14
|
}
|
|
15
15
|
static get is() { return "b2b-wizard-step"; }
|
|
16
16
|
static get encapsulation() { return "shadow"; }
|
|
@@ -44,7 +44,7 @@ export class WizardComponent {
|
|
|
44
44
|
this.setStepsState();
|
|
45
45
|
}
|
|
46
46
|
render() {
|
|
47
|
-
return (h(Host, { key: '
|
|
47
|
+
return (h(Host, { key: '489668ca4d9f27816d504f8238131697c0fe3857' }, h("div", { key: '984c7faaaf101d267b9fb89e2dd60ef4046a6443', class: "b2b_wizard" }, h("slot", { key: '87ab15ff841b158a6874cec12c4ab8c19f78df01' }))));
|
|
48
48
|
}
|
|
49
49
|
static get is() { return "b2b-wizard"; }
|
|
50
50
|
static get encapsulation() { return "shadow"; }
|
|
@@ -7,7 +7,7 @@ export class WizardIconComponent {
|
|
|
7
7
|
this.checkIcon = true;
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
|
-
return (h(Host, { key: '
|
|
10
|
+
return (h(Host, { key: '364653c4305a1b9a2fe5deb3ec866d98e281cee4' }, h("div", { key: '20adef4ae0389dfd7167df3876bcdeccda855073', class: {
|
|
11
11
|
'b2b-wizard-icon': true,
|
|
12
12
|
} }, this.state === WizardStatus.COMPLETED && (h("b2b-rounded-icon", { color: "var(--b2b-color-success-50)", "content-color": "var(--b2b-color-success-100)" }, this.checkIcon ? (h("b2b-icon-100", { slot: "icon", icon: "b2b_icon-check" })) : (h("span", { slot: "text" }, this.step)))), this.state === WizardStatus.PENDING && (h("b2b-rounded-icon", { color: "var(--b2b-color-icon-default)", "content-color": "var(--b2b-color-icon-inverted)" }, h("span", { slot: "text" }, this.step))), this.state === WizardStatus.DISABLED && (h("b2b-rounded-icon", { color: "var(--b2b-color-grey-100)", "content-color": "var(--b2b-color-grey-400)" }, h("span", { slot: "text" }, this.step))), this.state === WizardStatus.DEFAULT && (h("b2b-rounded-icon", { color: "transparent", "border-color": "var(--b2b-color-icon-secondary)", "content-color": "var(--b2b-color-icon-secondary)" }, h("span", { slot: "text" }, this.step))))));
|
|
13
13
|
}
|