@scania/tegel 0.0.1-beta.2 → 0.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/dropdown-option.js +1 -0
- package/dist/components/dropdown.js +1 -0
- package/dist/components/icon.js +1 -0
- package/dist/components/sdds-accordion-item.js +1 -0
- package/dist/components/sdds-accordion.js +1 -0
- package/dist/components/sdds-badges.js +1 -0
- package/dist/components/sdds-button.js +1 -0
- package/dist/components/sdds-datetime.js +1 -0
- package/dist/components/sdds-dropdown-filter.js +1 -0
- package/dist/components/sdds-header-cell.js +1 -0
- package/dist/components/sdds-inline-tabs-fullbleed.js +1 -0
- package/dist/components/sdds-inline-tabs.js +1 -0
- package/dist/components/sdds-modal.js +1 -0
- package/dist/components/sdds-navigation-tabs.js +1 -0
- package/dist/components/sdds-popover-canvas.js +1 -0
- package/dist/components/sdds-popover-menu.js +1 -0
- package/dist/components/sdds-slider.js +1 -0
- package/dist/components/sdds-spinner.js +1 -0
- package/dist/components/sdds-table-body-row-expandable.js +1 -0
- package/dist/components/sdds-table-body.js +1 -0
- package/dist/components/sdds-table-footer.js +1 -0
- package/dist/components/sdds-table-header.js +1 -0
- package/dist/components/sdds-table-toolbar.js +1 -0
- package/dist/components/sdds-table.js +1 -0
- package/dist/components/sdds-textarea.js +1 -0
- package/dist/components/sdds-textfield.js +1 -0
- package/dist/components/sdds-tooltip.js +1 -0
- package/dist/components/table-body-cell.js +1 -0
- package/dist/components/table-body-row.js +1 -0
- package/package.json +2 -2
- package/dist/cjs/index-e1c79686.js +0 -1912
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/popper-11d5f714.js +0 -1801
- package/dist/cjs/sdds-accordion-item.cjs.entry.js +0 -34
- package/dist/cjs/sdds-accordion.cjs.entry.js +0 -21
- package/dist/cjs/sdds-badges.cjs.entry.js +0 -55
- package/dist/cjs/sdds-body-cell_2.cjs.entry.js +0 -173
- package/dist/cjs/sdds-button.cjs.entry.js +0 -36
- package/dist/cjs/sdds-datetime.cjs.entry.js +0 -66
- package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +0 -92
- package/dist/cjs/sdds-dropdown_2.cjs.entry.js +0 -335
- package/dist/cjs/sdds-header-cell.cjs.entry.js +0 -141
- package/dist/cjs/sdds-icon.cjs.entry.js +0 -42
- package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +0 -96
- package/dist/cjs/sdds-inline-tabs.cjs.entry.js +0 -211
- package/dist/cjs/sdds-modal.cjs.entry.js +0 -49
- package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +0 -95
- package/dist/cjs/sdds-popover-canvas.cjs.entry.js +0 -76
- package/dist/cjs/sdds-popover-menu.cjs.entry.js +0 -75
- package/dist/cjs/sdds-slider.cjs.entry.js +0 -336
- package/dist/cjs/sdds-spinner.cjs.entry.js +0 -21
- package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +0 -81
- package/dist/cjs/sdds-table-body.cjs.entry.js +0 -289
- package/dist/cjs/sdds-table-footer.cjs.entry.js +0 -165
- package/dist/cjs/sdds-table-header.cjs.entry.js +0 -100
- package/dist/cjs/sdds-table-toolbar.cjs.entry.js +0 -66
- package/dist/cjs/sdds-table.cjs.entry.js +0 -69
- package/dist/cjs/sdds-textarea.cjs.entry.js +0 -61
- package/dist/cjs/sdds-textfield.cjs.entry.js +0 -82
- package/dist/cjs/sdds-tooltip.cjs.entry.js +0 -95
- package/dist/cjs/tegel.cjs.js +0 -19
- package/dist/collection/collection-manifest.json +0 -40
- package/dist/collection/components/accordion/accordion-item/accordion-item.css +0 -134
- package/dist/collection/components/accordion/accordion-item/accordion-item.js +0 -146
- package/dist/collection/components/accordion/accordion.css +0 -77
- package/dist/collection/components/accordion/accordion.js +0 -62
- package/dist/collection/components/accordion/accordion.stories.js +0 -91
- package/dist/collection/components/badge/badge.stories.js +0 -101
- package/dist/collection/components/badge/badges.css +0 -42
- package/dist/collection/components/badge/badges.js +0 -150
- package/dist/collection/components/banner/banner.stories.js +0 -93
- package/dist/collection/components/block/block.stories.js +0 -46
- package/dist/collection/components/breadcrumb/breadcrumb.stories.js +0 -26
- package/dist/collection/components/button/button-component.js +0 -154
- package/dist/collection/components/button/button-native.stories.js +0 -183
- package/dist/collection/components/button/button-webcomponent.stories.js +0 -182
- package/dist/collection/components/button/button.css +0 -658
- package/dist/collection/components/card/card.stories.js +0 -181
- package/dist/collection/components/checkbox/checkbox.stories.js +0 -54
- package/dist/collection/components/chips/chips.stories.js +0 -124
- package/dist/collection/components/data-table/native-table.stories.js +0 -182
- package/dist/collection/components/data-table/table/table.css +0 -15
- package/dist/collection/components/data-table/table/table.js +0 -253
- package/dist/collection/components/data-table/table-body/table-body.css +0 -22
- package/dist/collection/components/data-table/table-body/table-body.js +0 -425
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +0 -40
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +0 -169
- package/dist/collection/components/data-table/table-body-row/table-body-row.css +0 -196
- package/dist/collection/components/data-table/table-body-row/table-body-row.js +0 -164
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +0 -79
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +0 -155
- package/dist/collection/components/data-table/table-component-basic.stories.js +0 -163
- package/dist/collection/components/data-table/table-component-batch-actions.stories.js +0 -129
- package/dist/collection/components/data-table/table-component-bodydata.stories.js +0 -58
- package/dist/collection/components/data-table/table-component-custom-width.stories.js +0 -198
- package/dist/collection/components/data-table/table-component-event-listeners.stories.js +0 -153
- package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +0 -137
- package/dist/collection/components/data-table/table-component-filtering.stories.js +0 -139
- package/dist/collection/components/data-table/table-component-multiselect.stories.js +0 -160
- package/dist/collection/components/data-table/table-component-pagination.stories.js +0 -129
- package/dist/collection/components/data-table/table-component-sorting.stories.js +0 -107
- package/dist/collection/components/data-table/table-footer/table-footer.css +0 -93
- package/dist/collection/components/data-table/table-footer/table-footer.js +0 -355
- package/dist/collection/components/data-table/table-header/table-header.css +0 -204
- package/dist/collection/components/data-table/table-header/table-header.js +0 -153
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +0 -126
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +0 -320
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +0 -92
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +0 -142
- package/dist/collection/components/datetime/datetime.css +0 -375
- package/dist/collection/components/datetime/datetime.js +0 -251
- package/dist/collection/components/datetime/datetime.stories.js +0 -149
- package/dist/collection/components/divider/divider.stories.js +0 -116
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +0 -339
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +0 -130
- package/dist/collection/components/dropdown/dropdown-native.stories.js +0 -90
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +0 -185
- package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +0 -151
- package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +0 -146
- package/dist/collection/components/dropdown/dropdown.css +0 -891
- package/dist/collection/components/dropdown/dropdown.js +0 -554
- package/dist/collection/components/footer/footer.stories.js +0 -100
- package/dist/collection/components/header/header-all.stories.js +0 -217
- package/dist/collection/components/header/header-default.stories.js +0 -47
- package/dist/collection/components/header/header-inline.stories.js +0 -113
- package/dist/collection/components/header/header-search.stories.js +0 -263
- package/dist/collection/components/header/header-toolbar.stories.js +0 -204
- package/dist/collection/components/icon/icon-font.stories.js +0 -57
- package/dist/collection/components/icon/icon-web-component.stories.js +0 -51
- package/dist/collection/components/icon/icon.css +0 -16
- package/dist/collection/components/icon/icon.js +0 -89
- package/dist/collection/components/icon/iconsArray.js +0 -2
- package/dist/collection/components/link/link.stories.js +0 -45
- package/dist/collection/components/message/message.stories.js +0 -117
- package/dist/collection/components/modal/modal-native.stories.js +0 -121
- package/dist/collection/components/modal/modal-webcomponent.stories.js +0 -78
- package/dist/collection/components/modal/modal.css +0 -324
- package/dist/collection/components/modal/modal.js +0 -146
- package/dist/collection/components/popover-canvas/popover-canvas.css +0 -20
- package/dist/collection/components/popover-canvas/popover-canvas.js +0 -190
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +0 -87
- package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +0 -132
- package/dist/collection/components/popover-menu/popover-menu.css +0 -19
- package/dist/collection/components/popover-menu/popover-menu.js +0 -189
- package/dist/collection/components/popover-menu/popover-menu.stories.js +0 -109
- package/dist/collection/components/radio-button/radio-button.stories.js +0 -68
- package/dist/collection/components/side-menu/side-menu.stories.js +0 -182
- package/dist/collection/components/slider/slider.css +0 -260
- package/dist/collection/components/slider/slider.js +0 -682
- package/dist/collection/components/slider/slider.stories.js +0 -251
- package/dist/collection/components/spinner/spinner.css +0 -79
- package/dist/collection/components/spinner/spinner.js +0 -61
- package/dist/collection/components/spinner/spinner.stories.js +0 -59
- package/dist/collection/components/stepper/stepper.stories.js +0 -139
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +0 -159
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +0 -302
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +0 -65
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +0 -172
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +0 -126
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +0 -43
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +0 -153
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +0 -103
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -32
- package/dist/collection/components/textarea/textarea.css +0 -283
- package/dist/collection/components/textarea/textarea.js +0 -336
- package/dist/collection/components/textarea/textarea.stories.js +0 -149
- package/dist/collection/components/textfield/textfield.css +0 -494
- package/dist/collection/components/textfield/textfield.js +0 -359
- package/dist/collection/components/textfield/textfield.stories.js +0 -222
- package/dist/collection/components/toast/toast.stories.js +0 -119
- package/dist/collection/components/toggle/toggle.stories.js +0 -62
- package/dist/collection/components/tooltip/tooltip.css +0 -46
- package/dist/collection/components/tooltip/tooltip.js +0 -200
- package/dist/collection/components/tooltip/tooltip.stories.js +0 -113
- package/dist/collection/components/utility/colour/background-color.stories.js +0 -96
- package/dist/collection/components/utility/colour/text-color.stories.js +0 -94
- package/dist/collection/foundations-stories/colour/colour-brand.stories.js +0 -38
- package/dist/collection/foundations-stories/colour/colour-scales.stories.js +0 -71
- package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +0 -40
- package/dist/collection/foundations-stories/grid/grid.stories.js +0 -386
- package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +0 -100
- package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +0 -94
- package/dist/collection/foundations-stories/typography/typography-body.stories.js +0 -16
- package/dist/collection/foundations-stories/typography/typography-detail.stories.js +0 -17
- package/dist/collection/foundations-stories/typography/typography-headline.stories.js +0 -39
- package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +0 -12
- package/dist/collection/index.js +0 -1
- package/dist/collection/stories/assets/code-brackets.svg +0 -1
- package/dist/collection/stories/assets/colors.svg +0 -1
- package/dist/collection/stories/assets/comments.svg +0 -1
- package/dist/collection/stories/assets/direction.svg +0 -1
- package/dist/collection/stories/assets/flow.svg +0 -1
- package/dist/collection/stories/assets/plugin.svg +0 -1
- package/dist/collection/stories/assets/repo.svg +0 -1
- package/dist/collection/stories/assets/stackalt.svg +0 -1
- package/dist/collection/utils/utils.js +0 -12
- package/dist/esm/index-b67b15a6.js +0 -1884
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/popper-f860750c.js +0 -1799
- package/dist/esm/sdds-accordion-item.entry.js +0 -30
- package/dist/esm/sdds-accordion.entry.js +0 -17
- package/dist/esm/sdds-badges.entry.js +0 -51
- package/dist/esm/sdds-body-cell_2.entry.js +0 -168
- package/dist/esm/sdds-button.entry.js +0 -32
- package/dist/esm/sdds-datetime.entry.js +0 -62
- package/dist/esm/sdds-dropdown-filter.entry.js +0 -88
- package/dist/esm/sdds-dropdown_2.entry.js +0 -330
- package/dist/esm/sdds-header-cell.entry.js +0 -137
- package/dist/esm/sdds-icon.entry.js +0 -38
- package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +0 -92
- package/dist/esm/sdds-inline-tabs.entry.js +0 -207
- package/dist/esm/sdds-modal.entry.js +0 -45
- package/dist/esm/sdds-navigation-tabs.entry.js +0 -91
- package/dist/esm/sdds-popover-canvas.entry.js +0 -72
- package/dist/esm/sdds-popover-menu.entry.js +0 -71
- package/dist/esm/sdds-slider.entry.js +0 -332
- package/dist/esm/sdds-spinner.entry.js +0 -17
- package/dist/esm/sdds-table-body-row-expandable.entry.js +0 -77
- package/dist/esm/sdds-table-body.entry.js +0 -285
- package/dist/esm/sdds-table-footer.entry.js +0 -161
- package/dist/esm/sdds-table-header.entry.js +0 -96
- package/dist/esm/sdds-table-toolbar.entry.js +0 -62
- package/dist/esm/sdds-table.entry.js +0 -65
- package/dist/esm/sdds-textarea.entry.js +0 -57
- package/dist/esm/sdds-textfield.entry.js +0 -78
- package/dist/esm/sdds-tooltip.entry.js +0 -91
- package/dist/esm/tegel.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/tegel/index.esm.js +0 -0
- package/dist/tegel/p-040efb32.entry.js +0 -1
- package/dist/tegel/p-12ca5cfa.entry.js +0 -1
- package/dist/tegel/p-157e1618.js +0 -2
- package/dist/tegel/p-1fe61cf6.entry.js +0 -1
- package/dist/tegel/p-2f376504.entry.js +0 -1
- package/dist/tegel/p-44ced895.entry.js +0 -1
- package/dist/tegel/p-4880f03d.entry.js +0 -1
- package/dist/tegel/p-4aba73a3.entry.js +0 -1
- package/dist/tegel/p-4b58a02c.entry.js +0 -1
- package/dist/tegel/p-4cb85347.entry.js +0 -1
- package/dist/tegel/p-52031b5a.entry.js +0 -1
- package/dist/tegel/p-677baf7f.entry.js +0 -1
- package/dist/tegel/p-71797eaf.entry.js +0 -1
- package/dist/tegel/p-7373284c.entry.js +0 -1
- package/dist/tegel/p-7451779b.entry.js +0 -1
- package/dist/tegel/p-77aeea3b.entry.js +0 -1
- package/dist/tegel/p-8582d6a7.entry.js +0 -1
- package/dist/tegel/p-96021bd0.entry.js +0 -1
- package/dist/tegel/p-9d8caf51.entry.js +0 -1
- package/dist/tegel/p-a5919930.entry.js +0 -1
- package/dist/tegel/p-b01cface.entry.js +0 -1
- package/dist/tegel/p-bf896643.entry.js +0 -1
- package/dist/tegel/p-c311725c.entry.js +0 -1
- package/dist/tegel/p-cf72dfd9.entry.js +0 -1
- package/dist/tegel/p-d91caec6.entry.js +0 -1
- package/dist/tegel/p-e10eec33.entry.js +0 -1
- package/dist/tegel/p-ec26fc38.js +0 -1
- package/dist/tegel/p-f2262a69.entry.js +0 -1
- package/dist/tegel/p-f2f7aa45.entry.js +0 -1
- package/dist/tegel/tegel.css +0 -101
- package/dist/tegel/tegel.esm.js +0 -1
- package/loader/cdn.js +0 -3
- package/loader/index.cjs.js +0 -3
- package/loader/index.d.ts +0 -12
- package/loader/index.es2017.js +0 -3
- package/loader/index.js +0 -4
- package/loader/package.json +0 -11
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
import { h, Host } from '@stencil/core';
|
|
2
|
-
export class DropdownFilter {
|
|
3
|
-
constructor() {
|
|
4
|
-
this.dataOptions = [];
|
|
5
|
-
this.filteredContent = [];
|
|
6
|
-
this.searchTerm = '';
|
|
7
|
-
this.selectedOptionState = undefined;
|
|
8
|
-
this.dropdownRef = undefined;
|
|
9
|
-
this.placeholder = '';
|
|
10
|
-
this.label = undefined;
|
|
11
|
-
this.defaultOption = undefined;
|
|
12
|
-
this.selectedOption = undefined;
|
|
13
|
-
this.disabled = undefined;
|
|
14
|
-
this.size = 'lg';
|
|
15
|
-
this.inline = false;
|
|
16
|
-
this.labelPosition = 'no-label';
|
|
17
|
-
this.state = 'default';
|
|
18
|
-
this.helper = '';
|
|
19
|
-
this.data = undefined;
|
|
20
|
-
this.selectedLabel = 'no-selected';
|
|
21
|
-
this.selectedValue = 'no-selected';
|
|
22
|
-
}
|
|
23
|
-
componentWillLoad() {
|
|
24
|
-
this.parseData(this.data);
|
|
25
|
-
if (this.defaultOption) {
|
|
26
|
-
this.selectedOptionState = this.defaultOption;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
parseData(newValue) {
|
|
30
|
-
if (newValue)
|
|
31
|
-
this.dataOptions = JSON.parse(newValue);
|
|
32
|
-
this.filteredContent = this.dataOptions;
|
|
33
|
-
}
|
|
34
|
-
updateOptionsContent(event) {
|
|
35
|
-
this.searchTerm = event.detail;
|
|
36
|
-
this.findData();
|
|
37
|
-
}
|
|
38
|
-
selectOptionHandler(event) {
|
|
39
|
-
this.selectedOptionState = event.detail.value;
|
|
40
|
-
this.selectedLabel = event.detail.label;
|
|
41
|
-
this.selectedValue = event.detail.value;
|
|
42
|
-
// Reset list when search is done and user have selected one option
|
|
43
|
-
// To match with animation time for option list to fadeout first
|
|
44
|
-
setTimeout(() => {
|
|
45
|
-
this.filteredContent = this.dataOptions;
|
|
46
|
-
}, 200);
|
|
47
|
-
}
|
|
48
|
-
findData() {
|
|
49
|
-
const searchAsRegEx = new RegExp(this.searchTerm, 'gmi');
|
|
50
|
-
this.filteredContent = this.dataOptions.filter(option => {
|
|
51
|
-
if (option.label) {
|
|
52
|
-
const listItem = option.label.toLowerCase();
|
|
53
|
-
const searchResultList = listItem.match(searchAsRegEx);
|
|
54
|
-
if (searchResultList) {
|
|
55
|
-
return searchResultList;
|
|
56
|
-
}
|
|
57
|
-
this.selectedOptionState = null;
|
|
58
|
-
this.selectedLabel = 'no-result';
|
|
59
|
-
this.selectedValue = 'no-result';
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
setOptionsContent() {
|
|
64
|
-
const newList = this.filteredContent.map(obj => (h("sdds-dropdown-option", { tabindex: "0", value: obj.value, class: `${this.selectedOptionState === obj.value ? 'selected' : ''}` }, obj.label)));
|
|
65
|
-
if (newList.length > 0) {
|
|
66
|
-
return newList;
|
|
67
|
-
}
|
|
68
|
-
return (h("sdds-dropdown-option", { tabindex: "-1", value: "no-result", class: "sdds-option--no-result" }, "No result"));
|
|
69
|
-
}
|
|
70
|
-
/** Use this method to reset the dropdown. Then it will go back to its initial state. */
|
|
71
|
-
async resetOption() {
|
|
72
|
-
var _a;
|
|
73
|
-
await ((_a = this.dropdownRef) === null || _a === void 0 ? void 0 : _a.resetOption());
|
|
74
|
-
}
|
|
75
|
-
render() {
|
|
76
|
-
return (h(Host, { "selected-value": this.selectedValue, "selected-text": this.selectedLabel }, h("sdds-dropdown", { ref: el => (this.dropdownRef = el), exportparts: "dropdown-filter-disabled", size: this.size, label: this.label, disabled: this.disabled, labelPosition: this.labelPosition, helper: this.helper, state: this.state, placeholder: this.placeholder, defaultOption: this.defaultOption, selectedOption: this.selectedOption, type: "filter", tabindex: this.disabled ? '-1' : null }, this.setOptionsContent())));
|
|
77
|
-
}
|
|
78
|
-
static get is() { return "sdds-dropdown-filter"; }
|
|
79
|
-
static get encapsulation() { return "shadow"; }
|
|
80
|
-
static get originalStyleUrls() {
|
|
81
|
-
return {
|
|
82
|
-
"$": ["./../dropdown.scss"]
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
static get styleUrls() {
|
|
86
|
-
return {
|
|
87
|
-
"$": ["../dropdown.css"]
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
static get properties() {
|
|
91
|
-
return {
|
|
92
|
-
"placeholder": {
|
|
93
|
-
"type": "string",
|
|
94
|
-
"mutable": false,
|
|
95
|
-
"complexType": {
|
|
96
|
-
"original": "string",
|
|
97
|
-
"resolved": "string",
|
|
98
|
-
"references": {}
|
|
99
|
-
},
|
|
100
|
-
"required": false,
|
|
101
|
-
"optional": false,
|
|
102
|
-
"docs": {
|
|
103
|
-
"tags": [],
|
|
104
|
-
"text": "Placeholder text for dropdown with no selected item"
|
|
105
|
-
},
|
|
106
|
-
"attribute": "placeholder",
|
|
107
|
-
"reflect": false,
|
|
108
|
-
"defaultValue": "''"
|
|
109
|
-
},
|
|
110
|
-
"label": {
|
|
111
|
-
"type": "string",
|
|
112
|
-
"mutable": false,
|
|
113
|
-
"complexType": {
|
|
114
|
-
"original": "string",
|
|
115
|
-
"resolved": "string",
|
|
116
|
-
"references": {}
|
|
117
|
-
},
|
|
118
|
-
"required": false,
|
|
119
|
-
"optional": false,
|
|
120
|
-
"docs": {
|
|
121
|
-
"tags": [],
|
|
122
|
-
"text": "Label for dropdown with no selected item"
|
|
123
|
-
},
|
|
124
|
-
"attribute": "label",
|
|
125
|
-
"reflect": false
|
|
126
|
-
},
|
|
127
|
-
"defaultOption": {
|
|
128
|
-
"type": "string",
|
|
129
|
-
"mutable": false,
|
|
130
|
-
"complexType": {
|
|
131
|
-
"original": "string",
|
|
132
|
-
"resolved": "string",
|
|
133
|
-
"references": {}
|
|
134
|
-
},
|
|
135
|
-
"required": false,
|
|
136
|
-
"optional": false,
|
|
137
|
-
"docs": {
|
|
138
|
-
"tags": [],
|
|
139
|
-
"text": "Add the value of the option to set it as default"
|
|
140
|
-
},
|
|
141
|
-
"attribute": "default-option",
|
|
142
|
-
"reflect": false
|
|
143
|
-
},
|
|
144
|
-
"selectedOption": {
|
|
145
|
-
"type": "string",
|
|
146
|
-
"mutable": false,
|
|
147
|
-
"complexType": {
|
|
148
|
-
"original": "string",
|
|
149
|
-
"resolved": "string",
|
|
150
|
-
"references": {}
|
|
151
|
-
},
|
|
152
|
-
"required": false,
|
|
153
|
-
"optional": false,
|
|
154
|
-
"docs": {
|
|
155
|
-
"tags": [],
|
|
156
|
-
"text": "Add the value of the option as string to set it as new selected value"
|
|
157
|
-
},
|
|
158
|
-
"attribute": "selected-option",
|
|
159
|
-
"reflect": false
|
|
160
|
-
},
|
|
161
|
-
"disabled": {
|
|
162
|
-
"type": "boolean",
|
|
163
|
-
"mutable": false,
|
|
164
|
-
"complexType": {
|
|
165
|
-
"original": "boolean",
|
|
166
|
-
"resolved": "boolean",
|
|
167
|
-
"references": {}
|
|
168
|
-
},
|
|
169
|
-
"required": false,
|
|
170
|
-
"optional": false,
|
|
171
|
-
"docs": {
|
|
172
|
-
"tags": [],
|
|
173
|
-
"text": "Add the value of the option to set it as default"
|
|
174
|
-
},
|
|
175
|
-
"attribute": "disabled",
|
|
176
|
-
"reflect": false
|
|
177
|
-
},
|
|
178
|
-
"size": {
|
|
179
|
-
"type": "string",
|
|
180
|
-
"mutable": false,
|
|
181
|
-
"complexType": {
|
|
182
|
-
"original": "'sm' | 'md' | 'lg' | 'small' | 'medium' | 'large'",
|
|
183
|
-
"resolved": "\"large\" | \"lg\" | \"md\" | \"medium\" | \"sm\" | \"small\"",
|
|
184
|
-
"references": {}
|
|
185
|
-
},
|
|
186
|
-
"required": false,
|
|
187
|
-
"optional": false,
|
|
188
|
-
"docs": {
|
|
189
|
-
"tags": [],
|
|
190
|
-
"text": "Controls the size of dropdown. 'sm', 'md' and 'lg' correct values and 'small', 'medium' and 'large' are deprecated"
|
|
191
|
-
},
|
|
192
|
-
"attribute": "size",
|
|
193
|
-
"reflect": false,
|
|
194
|
-
"defaultValue": "'lg'"
|
|
195
|
-
},
|
|
196
|
-
"inline": {
|
|
197
|
-
"type": "boolean",
|
|
198
|
-
"mutable": false,
|
|
199
|
-
"complexType": {
|
|
200
|
-
"original": "boolean",
|
|
201
|
-
"resolved": "boolean",
|
|
202
|
-
"references": {}
|
|
203
|
-
},
|
|
204
|
-
"required": false,
|
|
205
|
-
"optional": false,
|
|
206
|
-
"docs": {
|
|
207
|
-
"tags": [],
|
|
208
|
-
"text": "Set to true to make the width following the label text length"
|
|
209
|
-
},
|
|
210
|
-
"attribute": "inline",
|
|
211
|
-
"reflect": false,
|
|
212
|
-
"defaultValue": "false"
|
|
213
|
-
},
|
|
214
|
-
"labelPosition": {
|
|
215
|
-
"type": "string",
|
|
216
|
-
"mutable": false,
|
|
217
|
-
"complexType": {
|
|
218
|
-
"original": "'no-label' | 'inside' | 'outside'",
|
|
219
|
-
"resolved": "\"inside\" | \"no-label\" | \"outside\"",
|
|
220
|
-
"references": {}
|
|
221
|
-
},
|
|
222
|
-
"required": false,
|
|
223
|
-
"optional": false,
|
|
224
|
-
"docs": {
|
|
225
|
-
"tags": [],
|
|
226
|
-
"text": "Position of label: `no-label` (default), `inside`, `outside`"
|
|
227
|
-
},
|
|
228
|
-
"attribute": "label-position",
|
|
229
|
-
"reflect": false,
|
|
230
|
-
"defaultValue": "'no-label'"
|
|
231
|
-
},
|
|
232
|
-
"state": {
|
|
233
|
-
"type": "string",
|
|
234
|
-
"mutable": false,
|
|
235
|
-
"complexType": {
|
|
236
|
-
"original": "string",
|
|
237
|
-
"resolved": "string",
|
|
238
|
-
"references": {}
|
|
239
|
-
},
|
|
240
|
-
"required": false,
|
|
241
|
-
"optional": false,
|
|
242
|
-
"docs": {
|
|
243
|
-
"tags": [],
|
|
244
|
-
"text": "Support `error` state"
|
|
245
|
-
},
|
|
246
|
-
"attribute": "state",
|
|
247
|
-
"reflect": false,
|
|
248
|
-
"defaultValue": "'default'"
|
|
249
|
-
},
|
|
250
|
-
"helper": {
|
|
251
|
-
"type": "string",
|
|
252
|
-
"mutable": false,
|
|
253
|
-
"complexType": {
|
|
254
|
-
"original": "string",
|
|
255
|
-
"resolved": "string",
|
|
256
|
-
"references": {}
|
|
257
|
-
},
|
|
258
|
-
"required": false,
|
|
259
|
-
"optional": false,
|
|
260
|
-
"docs": {
|
|
261
|
-
"tags": [],
|
|
262
|
-
"text": "Add helper text in the bottom of dropdown"
|
|
263
|
-
},
|
|
264
|
-
"attribute": "helper",
|
|
265
|
-
"reflect": false,
|
|
266
|
-
"defaultValue": "''"
|
|
267
|
-
},
|
|
268
|
-
"data": {
|
|
269
|
-
"type": "string",
|
|
270
|
-
"mutable": false,
|
|
271
|
-
"complexType": {
|
|
272
|
-
"original": "string",
|
|
273
|
-
"resolved": "string",
|
|
274
|
-
"references": {}
|
|
275
|
-
},
|
|
276
|
-
"required": false,
|
|
277
|
-
"optional": false,
|
|
278
|
-
"docs": {
|
|
279
|
-
"tags": [],
|
|
280
|
-
"text": "Data is an array of objects that contains label and value\n`data = [{label:'Option 1', value:'opt-1'},{label:'Option 2', value:'opt-2'}]`"
|
|
281
|
-
},
|
|
282
|
-
"attribute": "data",
|
|
283
|
-
"reflect": false
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
static get states() {
|
|
288
|
-
return {
|
|
289
|
-
"dataOptions": {},
|
|
290
|
-
"filteredContent": {},
|
|
291
|
-
"searchTerm": {},
|
|
292
|
-
"selectedOptionState": {},
|
|
293
|
-
"dropdownRef": {},
|
|
294
|
-
"selectedLabel": {},
|
|
295
|
-
"selectedValue": {}
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
static get methods() {
|
|
299
|
-
return {
|
|
300
|
-
"resetOption": {
|
|
301
|
-
"complexType": {
|
|
302
|
-
"signature": "() => Promise<void>",
|
|
303
|
-
"parameters": [],
|
|
304
|
-
"references": {
|
|
305
|
-
"Promise": {
|
|
306
|
-
"location": "global"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
"return": "Promise<void>"
|
|
310
|
-
},
|
|
311
|
-
"docs": {
|
|
312
|
-
"text": "Use this method to reset the dropdown. Then it will go back to its initial state.",
|
|
313
|
-
"tags": []
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
static get watchers() {
|
|
319
|
-
return [{
|
|
320
|
-
"propName": "data",
|
|
321
|
-
"methodName": "parseData"
|
|
322
|
-
}];
|
|
323
|
-
}
|
|
324
|
-
static get listeners() {
|
|
325
|
-
return [{
|
|
326
|
-
"name": "inputSearch",
|
|
327
|
-
"method": "updateOptionsContent",
|
|
328
|
-
"target": undefined,
|
|
329
|
-
"capture": false,
|
|
330
|
-
"passive": false
|
|
331
|
-
}, {
|
|
332
|
-
"name": "selectOption",
|
|
333
|
-
"method": "selectOptionHandler",
|
|
334
|
-
"target": undefined,
|
|
335
|
-
"capture": false,
|
|
336
|
-
"passive": false
|
|
337
|
-
}];
|
|
338
|
-
}
|
|
339
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../../utils/utils';
|
|
2
|
-
import readme from './readme.md';
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/Dropdown Filter',
|
|
5
|
-
parameters: {
|
|
6
|
-
layout: 'centered',
|
|
7
|
-
notes: readme,
|
|
8
|
-
design: [
|
|
9
|
-
{
|
|
10
|
-
name: 'Figma',
|
|
11
|
-
type: 'figma',
|
|
12
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9754%3A22916&t=M7Ova7xZaoeMwb5e-1',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'Link',
|
|
16
|
-
type: 'link',
|
|
17
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9754%3A22916&t=M7Ova7xZaoeMwb5e-1',
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
size: {
|
|
23
|
-
name: 'Size',
|
|
24
|
-
control: {
|
|
25
|
-
type: 'radio',
|
|
26
|
-
},
|
|
27
|
-
options: ['Large', 'Medium', 'Small'],
|
|
28
|
-
description: 'Size of the dropdown',
|
|
29
|
-
},
|
|
30
|
-
placeholder: {
|
|
31
|
-
name: 'Placeholder',
|
|
32
|
-
type: 'string',
|
|
33
|
-
description: 'Placeholder text when no option is selected',
|
|
34
|
-
},
|
|
35
|
-
disabled: {
|
|
36
|
-
name: 'Disabled',
|
|
37
|
-
description: 'Disables the component',
|
|
38
|
-
control: {
|
|
39
|
-
type: 'boolean',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
helper: {
|
|
43
|
-
name: 'Helper text',
|
|
44
|
-
control: {
|
|
45
|
-
type: 'text',
|
|
46
|
-
},
|
|
47
|
-
description: 'Helper text assists the user with additional information about the dropdown',
|
|
48
|
-
},
|
|
49
|
-
defaultOption: {
|
|
50
|
-
description: 'Sets a pre-selected option and replaces placeholder',
|
|
51
|
-
name: 'Default option',
|
|
52
|
-
control: {
|
|
53
|
-
type: 'radio',
|
|
54
|
-
},
|
|
55
|
-
options: ['No default', 'Option 1', 'Option 2', 'Option 3'],
|
|
56
|
-
},
|
|
57
|
-
openDirection: {
|
|
58
|
-
name: 'Open direction',
|
|
59
|
-
description: 'The direction the dropdown will open.',
|
|
60
|
-
control: {
|
|
61
|
-
type: 'radio',
|
|
62
|
-
},
|
|
63
|
-
options: ['Up', 'Down', 'Auto'],
|
|
64
|
-
table: {
|
|
65
|
-
summary: {
|
|
66
|
-
defaultValue: 'auto',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
args: {
|
|
72
|
-
size: 'Large',
|
|
73
|
-
placeholder: 'Placeholder',
|
|
74
|
-
disabled: false,
|
|
75
|
-
helper: '',
|
|
76
|
-
defaultOption: 'Option 1',
|
|
77
|
-
state: 'Default',
|
|
78
|
-
openDirection: 'Auto',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
const FilterTemplate = ({ size, disabled = false, helper = '', label, state = 'default', placeholder, labelPosition, defaultOption, openDirection, }) => {
|
|
82
|
-
const stateValue = state === 'Error' ? 'error' : 'default';
|
|
83
|
-
const sizeLookup = { Large: 'lg', Medium: 'md', Small: 'sm' };
|
|
84
|
-
const labelPosLookup = { None: 'no-default', Outside: 'outside' };
|
|
85
|
-
const defaultOptionLookup = {
|
|
86
|
-
'No default': 'no-default',
|
|
87
|
-
'Option 1': 'option-1',
|
|
88
|
-
'Option 2': 'option-2',
|
|
89
|
-
'Option 3': 'option-3',
|
|
90
|
-
};
|
|
91
|
-
return formatHtmlPreview(`
|
|
92
|
-
<style>
|
|
93
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
94
|
-
.demo-wrapper {
|
|
95
|
-
width: 300px;
|
|
96
|
-
height:200px;
|
|
97
|
-
}
|
|
98
|
-
</style>
|
|
99
|
-
|
|
100
|
-
<div class="demo-wrapper">
|
|
101
|
-
<sdds-dropdown-filter
|
|
102
|
-
id="sdds-dropdown-filter"
|
|
103
|
-
size="${sizeLookup[size]}"
|
|
104
|
-
placeholder="${placeholder}"
|
|
105
|
-
disabled="${disabled}"
|
|
106
|
-
open-direction="${openDirection.toLowerCase()}"
|
|
107
|
-
label-position="${labelPosLookup[labelPosition]}"
|
|
108
|
-
${labelPosLookup[labelPosition] !== 'no-default' ? `label="${label}"` : ''}
|
|
109
|
-
${helper !== '' ? `helper="${helper}"` : ''}
|
|
110
|
-
state="${stateValue}"
|
|
111
|
-
data='[
|
|
112
|
-
{
|
|
113
|
-
"value": "option-1",
|
|
114
|
-
"label":"Jakarta"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"value":"option-2"
|
|
118
|
-
,"label":"Stockholm"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"value":"option-3",
|
|
122
|
-
"label":"Barcelona"
|
|
123
|
-
}
|
|
124
|
-
]'
|
|
125
|
-
default-option="${defaultOptionLookup[defaultOption]}">
|
|
126
|
-
</sdds-dropdown-filter>
|
|
127
|
-
</div>
|
|
128
|
-
`);
|
|
129
|
-
};
|
|
130
|
-
export const Default = FilterTemplate.bind({});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'Components/Dropdown',
|
|
4
|
-
parameters: {
|
|
5
|
-
layout: 'centered',
|
|
6
|
-
design: [
|
|
7
|
-
{
|
|
8
|
-
name: 'Figma',
|
|
9
|
-
type: 'figma',
|
|
10
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9754%3A22916&t=M7Ova7xZaoeMwb5e-1',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'Link',
|
|
14
|
-
type: 'link',
|
|
15
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9754%3A22916&t=M7Ova7xZaoeMwb5e-1',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
argTypes: {
|
|
20
|
-
label: {
|
|
21
|
-
name: 'Label',
|
|
22
|
-
type: 'string',
|
|
23
|
-
description: 'Label text helps to describe what the dropdown contains',
|
|
24
|
-
},
|
|
25
|
-
size: {
|
|
26
|
-
name: 'Size',
|
|
27
|
-
description: 'Size of the dropdown',
|
|
28
|
-
control: {
|
|
29
|
-
type: 'radio',
|
|
30
|
-
},
|
|
31
|
-
options: ['Large', 'Medium', 'Small'],
|
|
32
|
-
},
|
|
33
|
-
disabled: {
|
|
34
|
-
name: 'Disabled',
|
|
35
|
-
description: 'Disables the component',
|
|
36
|
-
control: {
|
|
37
|
-
type: 'boolean',
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
state: {
|
|
41
|
-
name: 'State',
|
|
42
|
-
control: {
|
|
43
|
-
type: 'radio',
|
|
44
|
-
},
|
|
45
|
-
options: ['Default', 'Error'],
|
|
46
|
-
description: 'Support error state',
|
|
47
|
-
},
|
|
48
|
-
helper: {
|
|
49
|
-
name: 'Helper text',
|
|
50
|
-
control: {
|
|
51
|
-
type: 'text',
|
|
52
|
-
},
|
|
53
|
-
description: 'Helper text assists the user with additional information about the dropdown',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
args: {
|
|
57
|
-
label: '',
|
|
58
|
-
size: 'Large',
|
|
59
|
-
disabled: false,
|
|
60
|
-
state: 'Default',
|
|
61
|
-
helper: '',
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const NativeTemplate = ({ disabled, size, helper, label, state }) => {
|
|
65
|
-
const sizeLookup = { Large: 'lg', Medium: 'md', Small: 'sm' };
|
|
66
|
-
return formatHtmlPreview(`
|
|
67
|
-
<style>
|
|
68
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
69
|
-
.demo-wrapper {
|
|
70
|
-
width: 300px;
|
|
71
|
-
}
|
|
72
|
-
</style>
|
|
73
|
-
|
|
74
|
-
<div class="demo-wrapper">
|
|
75
|
-
<div class="sdds-dropdown ${size !== 'Large' ? `sdds-dropdown-${sizeLookup[size]}` : ''} ${state === 'Error' ? 'sdds-dropdown--error' : ''}" >
|
|
76
|
-
${label !== '' ? `<span class="sdds-dropdown-label-outside">${label}</span> ` : ''}
|
|
77
|
-
<select
|
|
78
|
-
name="nativeDropdown"
|
|
79
|
-
id="mySelect"
|
|
80
|
-
${disabled ? `disabled` : ''} >
|
|
81
|
-
<option value="truck">Truck</option>
|
|
82
|
-
<option value="bus">Bus</option>
|
|
83
|
-
<option value="car">Car</option>
|
|
84
|
-
</select>
|
|
85
|
-
${helper !== '' ? `<span class="sdds-dropdown-helper">${helper}</span>` : ''}
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`);
|
|
89
|
-
};
|
|
90
|
-
export const Native = NativeTemplate.bind({});
|