@otto-de/b2b-core-components 1.34.0 → 1.36.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-d2f4db88.entry.js → p-01f2aca4.entry.js} +1 -1
- package/dist/b2b-core-components/p-02bb4145.entry.js +1 -0
- package/dist/b2b-core-components/{p-e512628d.entry.js → p-0cd95c1e.entry.js} +1 -1
- package/dist/b2b-core-components/{p-04f5748b.entry.js → p-0e994814.entry.js} +1 -1
- package/dist/b2b-core-components/p-0f0fcb25.entry.js +1 -0
- package/dist/b2b-core-components/{p-81cffff6.entry.js → p-121ead75.entry.js} +1 -1
- package/dist/b2b-core-components/{p-b9a6ad5d.entry.js → p-1875aef7.entry.js} +1 -1
- package/dist/b2b-core-components/{p-d163d252.entry.js → p-1a232e86.entry.js} +1 -1
- package/dist/b2b-core-components/{p-e3877fc1.entry.js → p-1e5732bb.entry.js} +1 -1
- package/dist/b2b-core-components/{p-a46674a7.entry.js → p-212d2e61.entry.js} +1 -1
- package/dist/b2b-core-components/p-22967672.entry.js +1 -0
- package/dist/b2b-core-components/{p-8aba659a.entry.js → p-253502a0.entry.js} +1 -1
- package/dist/b2b-core-components/{p-13d37dec.entry.js → p-2aaa326b.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c8b5c7e2.entry.js → p-3752cc70.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c086532b.entry.js → p-3b52a3fb.entry.js} +1 -1
- package/dist/b2b-core-components/{p-997a232e.entry.js → p-3c6abe16.entry.js} +1 -1
- package/dist/b2b-core-components/p-470378e2.entry.js +1 -0
- package/dist/b2b-core-components/{p-f9f9820a.entry.js → p-4b8c879e.entry.js} +1 -1
- package/dist/b2b-core-components/p-51086123.entry.js +1 -0
- package/dist/b2b-core-components/{p-0648230f.entry.js → p-696b9e54.entry.js} +1 -1
- package/dist/b2b-core-components/{p-d62e615b.entry.js → p-6b3788ae.entry.js} +1 -1
- package/dist/b2b-core-components/{p-371df3f8.entry.js → p-6f5dbb23.entry.js} +1 -1
- package/dist/b2b-core-components/{p-b4310b58.entry.js → p-6f607a94.entry.js} +1 -1
- package/dist/b2b-core-components/{p-66c435c1.entry.js → p-73db8251.entry.js} +1 -1
- package/dist/b2b-core-components/p-7d2fb5f3.entry.js +1 -0
- package/dist/b2b-core-components/{p-540a8b9c.entry.js → p-80104e55.entry.js} +1 -1
- package/dist/b2b-core-components/{p-0aa0c59a.entry.js → p-861dba01.entry.js} +1 -1
- package/dist/b2b-core-components/{p-17778cfc.entry.js → p-96211730.entry.js} +1 -1
- package/dist/b2b-core-components/{p-f3c0fe56.entry.js → p-98ee5fd5.entry.js} +1 -1
- package/dist/b2b-core-components/{p-2486830b.entry.js → p-9f0dbb21.entry.js} +1 -1
- package/dist/b2b-core-components/p-a2d97f5d.entry.js +1 -0
- package/dist/b2b-core-components/{p-a9c9552f.entry.js → p-a5cc60f3.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c25832e1.entry.js → p-a95ed002.entry.js} +1 -1
- package/dist/b2b-core-components/p-abcbd1cc.entry.js +1 -0
- package/dist/b2b-core-components/{p-0ab41eb5.entry.js → p-acdcb8c8.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c8cc1797.entry.js → p-b0abf9e3.entry.js} +1 -1
- package/dist/b2b-core-components/p-b95b2de3.entry.js +1 -0
- package/dist/b2b-core-components/{p-433a3f3e.entry.js → p-bb0f31a9.entry.js} +1 -1
- package/dist/b2b-core-components/{p-89e817e9.entry.js → p-bf1d5618.entry.js} +1 -1
- package/dist/b2b-core-components/{p-79a01d0d.entry.js → p-db898e98.entry.js} +1 -1
- package/dist/b2b-core-components/p-e52728b3.entry.js +1 -0
- package/dist/b2b-core-components/{p-8ae9c2fe.entry.js → p-ef93e944.entry.js} +1 -1
- package/dist/b2b-core-components/{p-4b27240b.entry.js → p-f9e61af5.entry.js} +1 -1
- package/dist/b2b-core-components/{p-c43e067a.entry.js → p-fa050815.entry.js} +1 -1
- package/dist/b2b-core-components/p-fdb7d12c.entry.js +1 -0
- package/dist/cjs/b2b-background-box.cjs.entry.js +1 -1
- package/dist/cjs/b2b-button_2.cjs.entry.js +1 -1
- package/dist/cjs/b2b-chip-component_2.cjs.entry.js +2 -2
- 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 +72 -7
- package/dist/cjs/b2b-flyout-menu-option.cjs.entry.js +1 -1
- package/dist/cjs/b2b-flyout-menu.cjs.entry.js +3 -3
- package/dist/cjs/b2b-grid-col.cjs.entry.js +1 -1
- package/dist/cjs/b2b-grid-row.cjs.entry.js +2 -2
- package/dist/cjs/b2b-grid.cjs.entry.js +1 -1
- package/dist/cjs/b2b-input-group_2.cjs.entry.js +16 -3
- package/dist/cjs/b2b-input-label.cjs.entry.js +2 -2
- package/dist/cjs/b2b-input-list-option.cjs.entry.js +30 -0
- package/dist/cjs/{b2b-input_2.cjs.entry.js → b2b-input.cjs.entry.js} +4 -28
- package/dist/cjs/b2b-label.cjs.entry.js +2 -2
- package/dist/cjs/b2b-modal.cjs.entry.js +2 -2
- package/dist/cjs/b2b-multiselect-dropdown.cjs.entry.js +3 -3
- package/dist/cjs/b2b-pagination.cjs.entry.js +1 -1
- package/dist/cjs/b2b-progress-bar.cjs.entry.js +3 -3
- package/dist/cjs/b2b-radio-button.cjs.entry.js +2 -2
- package/dist/cjs/b2b-radio-group.cjs.entry.js +2 -2
- package/dist/cjs/b2b-required-separator.cjs.entry.js +1 -1
- package/dist/cjs/b2b-rounded-icon.cjs.entry.js +4 -4
- package/dist/cjs/b2b-scrollable-container.cjs.entry.js +1 -1
- package/dist/cjs/b2b-search.cjs.entry.js +1 -1
- package/dist/cjs/b2b-separator.cjs.entry.js +1 -1
- package/dist/cjs/b2b-shimmer.cjs.entry.js +1 -1
- package/dist/cjs/b2b-snackbar.cjs.entry.js +4 -4
- package/dist/cjs/b2b-tab-group.cjs.entry.js +1 -1
- package/dist/cjs/b2b-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/b2b-tab.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table-cell_2.cjs.entry.js +3 -3
- package/dist/cjs/b2b-table-row.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table-rowgroup.cjs.entry.js +2 -2
- package/dist/cjs/b2b-table.cjs.entry.js +2 -2
- package/dist/cjs/b2b-textarea.cjs.entry.js +2 -2
- 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 +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/background-box/background-box.css +2 -2
- package/dist/collection/components/background-box/background-box.e2e.js +1 -1
- package/dist/collection/components/background-box/background-box.stories.js +1 -1
- 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.css +11 -0
- package/dist/collection/components/dropdown/dropdown.e2e.js +54 -0
- package/dist/collection/components/dropdown/dropdown.js +90 -6
- package/dist/collection/components/dropdown/dropdown.stories.js +7 -2
- package/dist/collection/components/flyout-menu/flyout-menu-option.js +1 -1
- package/dist/collection/components/flyout-menu/flyout-menu.js +3 -3
- package/dist/collection/components/grid/column.js +1 -1
- package/dist/collection/components/grid/grid.js +1 -1
- package/dist/collection/components/grid/row.js +2 -2
- package/dist/collection/components/input/input.js +4 -4
- package/dist/collection/components/input-group/input-group.js +1 -1
- package/dist/collection/components/input-label/input-label.js +2 -2
- package/dist/collection/components/input-list/input-list-option.js +1 -1
- package/dist/collection/components/input-list/input-list.e2e.js +5 -5
- package/dist/collection/components/input-list/input-list.js +23 -6
- package/dist/collection/components/label/label.js +2 -2
- package/dist/collection/components/modal/modal.js +2 -2
- package/dist/collection/components/multiselect-dropdown/multiselect-dropdown.js +3 -3
- package/dist/collection/components/multiselect-dropdown/multiselect-option/multiselect-option.js +2 -2
- package/dist/collection/components/pagination/pagination.js +1 -1
- package/dist/collection/components/progress-bar/progress-bar.js +3 -3
- package/dist/collection/components/radio/radio.js +2 -2
- package/dist/collection/components/radio-group/radio-group.js +2 -2
- package/dist/collection/components/required-separator/required-separator.js +1 -1
- package/dist/collection/components/rounded-icon/rounded-icon.js +4 -4
- package/dist/collection/components/scrollable-container/scrollable-container.js +1 -1
- package/dist/collection/components/search/search.e2e.js +1 -1
- package/dist/collection/components/search/search.js +1 -1
- package/dist/collection/components/separator/separator.js +1 -1
- package/dist/collection/components/shimmer/shimmer.js +1 -1
- package/dist/collection/components/snackbar/snackbar.js +4 -4
- package/dist/collection/components/spinner/spinner.js +1 -1
- package/dist/collection/components/tab/tab.js +2 -2
- package/dist/collection/components/tab-group/tab-group.js +1 -1
- package/dist/collection/components/tab-panel/tab-panel.js +1 -1
- package/dist/collection/components/table/table-cell/table-cell.js +2 -2
- package/dist/collection/components/table/table-header/table-header.js +1 -1
- package/dist/collection/components/table/table-row/table-row.js +2 -2
- package/dist/collection/components/table/table-rowgroup/table-rowgroup.js +2 -2
- package/dist/collection/components/table/table.js +2 -2
- package/dist/collection/components/textarea/textarea.js +2 -2
- 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 +87 -8
- package/dist/components/b2b-flyout-menu-option.js +1 -1
- package/dist/components/b2b-flyout-menu.js +3 -3
- package/dist/components/b2b-grid-col.js +1 -1
- package/dist/components/b2b-grid-row.js +2 -2
- package/dist/components/b2b-grid.js +1 -1
- package/dist/components/b2b-label.js +2 -2
- package/dist/components/b2b-modal.js +2 -2
- package/dist/components/b2b-multiselect-dropdown.js +3 -3
- package/dist/components/b2b-pagination.js +1 -1
- package/dist/components/b2b-progress-bar.js +3 -3
- package/dist/components/b2b-radio-button.js +2 -2
- package/dist/components/b2b-radio-group.js +2 -2
- package/dist/components/b2b-required-separator.js +1 -1
- package/dist/components/b2b-scrollable-container.js +1 -1
- package/dist/components/b2b-search.js +1 -1
- package/dist/components/b2b-shimmer.js +1 -1
- package/dist/components/b2b-snackbar.js +4 -4
- package/dist/components/b2b-tab-group.js +1 -1
- package/dist/components/b2b-tab-panel.js +1 -1
- package/dist/components/b2b-tab.js +2 -2
- package/dist/components/b2b-table-row.js +2 -2
- package/dist/components/b2b-table-rowgroup.js +2 -2
- package/dist/components/b2b-table.js +2 -2
- package/dist/components/b2b-textarea.js +2 -2
- 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/background-box.js +1 -1
- package/dist/components/input-group.js +1 -1
- package/dist/components/input-label.js +2 -2
- package/dist/components/input-list-option.js +1 -1
- package/dist/components/input-list.js +19 -4
- package/dist/components/input.js +4 -4
- package/dist/components/multiselect-option.js +2 -2
- package/dist/components/rounded-icon.js +4 -4
- package/dist/components/separator.js +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/table-cell.js +2 -2
- package/dist/components/table-header.js +1 -1
- package/dist/components/wizard-icon.js +1 -1
- package/dist/custom-elements.json +64 -0
- package/dist/esm/b2b-background-box.entry.js +1 -1
- package/dist/esm/b2b-button_2.entry.js +1 -1
- package/dist/esm/b2b-chip-component_2.entry.js +2 -2
- 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 +72 -7
- package/dist/esm/b2b-flyout-menu-option.entry.js +1 -1
- package/dist/esm/b2b-flyout-menu.entry.js +3 -3
- package/dist/esm/b2b-grid-col.entry.js +1 -1
- package/dist/esm/b2b-grid-row.entry.js +2 -2
- package/dist/esm/b2b-grid.entry.js +1 -1
- package/dist/esm/b2b-input-group_2.entry.js +16 -3
- package/dist/esm/b2b-input-label.entry.js +2 -2
- package/dist/esm/b2b-input-list-option.entry.js +26 -0
- package/dist/esm/{b2b-input_2.entry.js → b2b-input.entry.js} +5 -28
- package/dist/esm/b2b-label.entry.js +2 -2
- package/dist/esm/b2b-modal.entry.js +2 -2
- package/dist/esm/b2b-multiselect-dropdown.entry.js +3 -3
- package/dist/esm/b2b-pagination.entry.js +1 -1
- package/dist/esm/b2b-progress-bar.entry.js +3 -3
- package/dist/esm/b2b-radio-button.entry.js +2 -2
- package/dist/esm/b2b-radio-group.entry.js +2 -2
- package/dist/esm/b2b-required-separator.entry.js +1 -1
- package/dist/esm/b2b-rounded-icon.entry.js +4 -4
- package/dist/esm/b2b-scrollable-container.entry.js +1 -1
- package/dist/esm/b2b-search.entry.js +1 -1
- package/dist/esm/b2b-separator.entry.js +1 -1
- package/dist/esm/b2b-shimmer.entry.js +1 -1
- package/dist/esm/b2b-snackbar.entry.js +4 -4
- package/dist/esm/b2b-tab-group.entry.js +1 -1
- package/dist/esm/b2b-tab-panel.entry.js +1 -1
- package/dist/esm/b2b-tab.entry.js +2 -2
- package/dist/esm/b2b-table-cell_2.entry.js +3 -3
- package/dist/esm/b2b-table-row.entry.js +2 -2
- package/dist/esm/b2b-table-rowgroup.entry.js +2 -2
- package/dist/esm/b2b-table.entry.js +2 -2
- package/dist/esm/b2b-textarea.entry.js +2 -2
- 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 +10 -2
- 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 +9 -1
- package/dist/types/components/dropdown/dropdown.stories.d.ts +1 -0
- package/dist/types/components/input-list/input-list.d.ts +4 -1
- 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 +134 -2
- package/dist/web-types.json +165 -4
- package/package.json +2 -2
- package/dist/b2b-core-components/p-04ac661d.entry.js +0 -1
- package/dist/b2b-core-components/p-24c6aa56.entry.js +0 -1
- package/dist/b2b-core-components/p-260dcc05.entry.js +0 -1
- package/dist/b2b-core-components/p-4e0ed246.entry.js +0 -1
- package/dist/b2b-core-components/p-b175fb79.entry.js +0 -1
- package/dist/b2b-core-components/p-b481eb09.entry.js +0 -1
- package/dist/b2b-core-components/p-dff37884.entry.js +0 -1
- package/dist/b2b-core-components/p-e8151556.entry.js +0 -1
- package/dist/b2b-core-components/p-e90d3aba.entry.js +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { newE2EPage } from "@stencil/core/testing";
|
|
2
|
+
describe('B2B-TimePicker', () => {
|
|
3
|
+
it('should render the time picker component', async () => {
|
|
4
|
+
const page = await newE2EPage();
|
|
5
|
+
await page.setContent(`<b2b-time-picker label="Time Picker"></b2b-time-picker>`);
|
|
6
|
+
const element = await page.find('b2b-time-picker');
|
|
7
|
+
expect(element).toHaveClass('hydrated');
|
|
8
|
+
});
|
|
9
|
+
it('should display the label', async () => {
|
|
10
|
+
const page = await newE2EPage();
|
|
11
|
+
await page.setContent(`<b2b-time-picker label="Time Picker"></b2b-time-picker>`);
|
|
12
|
+
const label = await page.find('b2b-time-picker >>> b2b-input-label');
|
|
13
|
+
expect(label).not.toBeNull();
|
|
14
|
+
expect(label.textContent).toContain('Time Picker');
|
|
15
|
+
});
|
|
16
|
+
it('should open the dropdown on input focus', async () => {
|
|
17
|
+
const page = await newE2EPage();
|
|
18
|
+
await page.setContent(`<b2b-time-picker></b2b-time-picker>`);
|
|
19
|
+
await page.$eval('b2b-time-picker', el => {
|
|
20
|
+
const input = el.shadowRoot.querySelector('input');
|
|
21
|
+
input.dispatchEvent(new FocusEvent('focus', { bubbles: true }));
|
|
22
|
+
});
|
|
23
|
+
await page.waitForChanges();
|
|
24
|
+
const optionsContainer = await page.find('b2b-time-picker >>> .b2b-time-picker__options-container--visible');
|
|
25
|
+
expect(optionsContainer).not.toBeNull();
|
|
26
|
+
});
|
|
27
|
+
it('should select a time from the dropdown', async () => {
|
|
28
|
+
const page = await newE2EPage();
|
|
29
|
+
await page.setContent(`<b2b-time-picker></b2b-time-picker>`);
|
|
30
|
+
await page.$eval('b2b-time-picker', el => {
|
|
31
|
+
const input = el.shadowRoot.querySelector('input');
|
|
32
|
+
input.dispatchEvent(new FocusEvent('focus', { bubbles: true }));
|
|
33
|
+
});
|
|
34
|
+
await page.waitForChanges();
|
|
35
|
+
const option = await page.find('b2b-time-picker >>> .b2b-time-picker__option[data-value="09:00"]');
|
|
36
|
+
await option.click();
|
|
37
|
+
await page.waitForChanges();
|
|
38
|
+
const value = await page.$eval('b2b-time-picker', el => el.value);
|
|
39
|
+
expect(value).toBe('09:00');
|
|
40
|
+
});
|
|
41
|
+
it('should clear the input when clear icon is clicked', async () => {
|
|
42
|
+
const page = await newE2EPage();
|
|
43
|
+
await page.setContent(`<b2b-time-picker value="10:15"></b2b-time-picker>`);
|
|
44
|
+
const clearIcon = await page.find('b2b-time-picker >>> .b2b-close-icon');
|
|
45
|
+
await clearIcon.click();
|
|
46
|
+
await page.waitForChanges();
|
|
47
|
+
const value = await page.$eval('b2b-time-picker', el => el.value);
|
|
48
|
+
expect(value).toBe('');
|
|
49
|
+
});
|
|
50
|
+
it('should show error message for invalid input', async () => {
|
|
51
|
+
const page = await newE2EPage();
|
|
52
|
+
await page.setContent(`<b2b-time-picker></b2b-time-picker>`);
|
|
53
|
+
const input = await page.find('b2b-time-picker >>> input');
|
|
54
|
+
await input.type('99:99');
|
|
55
|
+
await page.evaluate(() => {
|
|
56
|
+
const el = document
|
|
57
|
+
.querySelector('b2b-time-picker')
|
|
58
|
+
.shadowRoot.querySelector('input');
|
|
59
|
+
el.blur();
|
|
60
|
+
});
|
|
61
|
+
await page.waitForChanges();
|
|
62
|
+
const error = await page.find('b2b-time-picker >>> .b2b-time-picker__hint--error');
|
|
63
|
+
expect(error).not.toBeNull();
|
|
64
|
+
expect(error.textContent).toContain('Invalid format');
|
|
65
|
+
});
|
|
66
|
+
it('should generate correct time options for a custom interval', async () => {
|
|
67
|
+
const page = await newE2EPage();
|
|
68
|
+
await page.setContent(`<b2b-time-picker interval="30"></b2b-time-picker>`);
|
|
69
|
+
await page.$eval('b2b-time-picker', el => {
|
|
70
|
+
const input = el.shadowRoot.querySelector('input');
|
|
71
|
+
input.dispatchEvent(new FocusEvent('focus', { bubbles: true }));
|
|
72
|
+
});
|
|
73
|
+
await page.waitForChanges();
|
|
74
|
+
const options = await page.findAll('b2b-time-picker >>> .b2b-time-picker__option');
|
|
75
|
+
expect(options.length).toBe(48);
|
|
76
|
+
expect(options[0].textContent).toBe('00:00');
|
|
77
|
+
expect(options[1].textContent).toBe('00:30');
|
|
78
|
+
expect(options[2].textContent).toBe('01:00');
|
|
79
|
+
});
|
|
80
|
+
it('should not break when selecting an already selected time', async () => {
|
|
81
|
+
const page = await newE2EPage();
|
|
82
|
+
await page.setContent(`<b2b-time-picker value="08:00"></b2b-time-picker>`);
|
|
83
|
+
await page.$eval('b2b-time-picker', el => {
|
|
84
|
+
const input = el.shadowRoot.querySelector('input');
|
|
85
|
+
input.dispatchEvent(new FocusEvent('focus', { bubbles: true }));
|
|
86
|
+
});
|
|
87
|
+
await page.waitForChanges();
|
|
88
|
+
const option = await page.find('b2b-time-picker >>> .b2b-time-picker__option[data-value="08:00"]');
|
|
89
|
+
await option.click();
|
|
90
|
+
await page.waitForChanges();
|
|
91
|
+
const value = await page.$eval('b2b-time-picker', el => el.value);
|
|
92
|
+
expect(value).toBe('08:00');
|
|
93
|
+
});
|
|
94
|
+
it('should toggle dropdown on duration icon click', async () => {
|
|
95
|
+
const page = await newE2EPage();
|
|
96
|
+
await page.setContent(`<b2b-time-picker></b2b-time-picker>`);
|
|
97
|
+
const icon = await page.find('b2b-time-picker >>> .b2b-duration-icon');
|
|
98
|
+
await icon.click();
|
|
99
|
+
await page.waitForChanges();
|
|
100
|
+
let optionsContainer = await page.find('b2b-time-picker >>> .b2b-time-picker__options-container--visible');
|
|
101
|
+
expect(optionsContainer).not.toBeNull();
|
|
102
|
+
await icon.click();
|
|
103
|
+
await page.waitForChanges();
|
|
104
|
+
optionsContainer = await page.find('b2b-time-picker >>> .b2b-time-picker__options-container--visible');
|
|
105
|
+
expect(optionsContainer).toBeNull();
|
|
106
|
+
});
|
|
107
|
+
it('should close the dropdown on blur', async () => {
|
|
108
|
+
const page = await newE2EPage();
|
|
109
|
+
await page.setContent(`<b2b-time-picker></b2b-time-picker>`);
|
|
110
|
+
await page.$eval('b2b-time-picker', el => {
|
|
111
|
+
const input = el.shadowRoot.querySelector('input');
|
|
112
|
+
input.dispatchEvent(new FocusEvent('focus', { bubbles: true }));
|
|
113
|
+
});
|
|
114
|
+
await page.waitForChanges();
|
|
115
|
+
await page.$eval('b2b-time-picker', el => {
|
|
116
|
+
const input = el.shadowRoot.querySelector('input');
|
|
117
|
+
input.dispatchEvent(new FocusEvent('blur', { bubbles: true }));
|
|
118
|
+
});
|
|
119
|
+
await new Promise(res => setTimeout(res, 200));
|
|
120
|
+
const optionsContainer = await page.find('b2b-time-picker >>> .b2b-time-picker__options-container--visible');
|
|
121
|
+
expect(optionsContainer).toBeNull();
|
|
122
|
+
});
|
|
123
|
+
it('should show custom error message via error prop', async () => {
|
|
124
|
+
const page = await newE2EPage();
|
|
125
|
+
await page.setContent(`<b2b-time-picker error="Custom error" invalid></b2b-time-picker>`);
|
|
126
|
+
const error = await page.find('b2b-time-picker >>> .b2b-time-picker__hint--error');
|
|
127
|
+
expect(error.textContent).toContain('Custom error');
|
|
128
|
+
});
|
|
129
|
+
it('should display the hint text when provided', async () => {
|
|
130
|
+
const page = await newE2EPage();
|
|
131
|
+
await page.setContent(`<b2b-time-picker hint="Pick a time"></b2b-time-picker>`);
|
|
132
|
+
const hint = await page.find('b2b-time-picker >>> .b2b-time-picker__hint');
|
|
133
|
+
expect(hint.textContent).toContain('Pick a time');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -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: '60186f73f9b29e97a12cae3d21677a93e9d2cc2e', 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: 'ba780bb83b8b29fbf954a3fcc9d3d24e1fb00d47', 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: 'b7c954dcc95b39ba1243c0594af865aeb8f5e556', 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: '2174ef2f4795544c109934bba08b5bf5589ad970', 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: '6a0b79eeb95e89fd4e1ae7650fc6894fe9995716', class: "b2b-duration-icon", onMouseDown: e => {
|
|
123
|
+
e.preventDefault();
|
|
124
|
+
this.toggleDropdown();
|
|
125
|
+
} }, h("b2b-icon-100", { key: '4d2c4ac3c85e7186f02c1ace46e0f52b32b3867e', icon: "b2b_icon-duration", clickable: true })))), h("div", { key: '05643f9d3d325a0d145b5f75a5295e3772b317a2', 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: '2f3d104f3c8b91f828195d17a493ae085098ffb2', 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: '653a99cf2670e048d4486f4c58a6b362777f1542', onClick: this.onClick }, h("span", { key: 'bf6c3226b73ac9d033c6479e5ddf0a2366c51a65', class: {
|
|
35
35
|
'b2b-toggle-button': true,
|
|
36
36
|
'b2b-toggle-button--disabled': this.disabled,
|
|
37
|
-
} }, h("input", { key: '
|
|
37
|
+
} }, h("input", { key: '74ac055cf0fc0cb192c38fa288d20892a77eb662', 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: '56246f69a36f044a58e735a3a2e3bbacc95d285c', 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: '9ccaee0a0cef686481b529812736efebdda24ccf' }, h("span", { key: 'df149ca80ecabd2696d7f794577881128c85cb96', onClick: this.onClick, onKeyDown: this.onKeyDown, class: {
|
|
36
36
|
'b2b-toggle-chip': true,
|
|
37
|
-
} }, h("input", { key: '
|
|
37
|
+
} }, h("input", { key: 'b4402e6fce941fef4e60278df3e4997d33e15ac4', "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: 'a178fcabcba44be3fff977fe9236d6e46783bcb1', 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,
|