@scania/tegel 0.0.1-beta.3 → 0.0.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index-e1c79686.js +1912 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/popper-11d5f714.js +1801 -0
- package/dist/cjs/sdds-accordion-item.cjs.entry.js +34 -0
- package/dist/cjs/sdds-accordion.cjs.entry.js +21 -0
- package/dist/cjs/sdds-badges.cjs.entry.js +55 -0
- package/dist/cjs/sdds-body-cell_2.cjs.entry.js +173 -0
- package/dist/cjs/sdds-button.cjs.entry.js +36 -0
- package/dist/cjs/sdds-datetime.cjs.entry.js +66 -0
- package/dist/cjs/sdds-dropdown-filter.cjs.entry.js +92 -0
- package/dist/cjs/sdds-dropdown_2.cjs.entry.js +335 -0
- package/dist/cjs/sdds-header-cell.cjs.entry.js +141 -0
- package/dist/cjs/sdds-icon.cjs.entry.js +42 -0
- package/dist/cjs/sdds-inline-tabs-fullbleed.cjs.entry.js +96 -0
- package/dist/cjs/sdds-inline-tabs.cjs.entry.js +211 -0
- package/dist/cjs/sdds-modal.cjs.entry.js +49 -0
- package/dist/cjs/sdds-navigation-tabs.cjs.entry.js +95 -0
- package/dist/cjs/sdds-popover-canvas.cjs.entry.js +76 -0
- package/dist/cjs/sdds-popover-menu.cjs.entry.js +75 -0
- package/dist/cjs/sdds-slider.cjs.entry.js +336 -0
- package/dist/cjs/sdds-spinner.cjs.entry.js +21 -0
- package/dist/cjs/sdds-table-body-row-expandable.cjs.entry.js +81 -0
- package/dist/cjs/sdds-table-body.cjs.entry.js +289 -0
- package/dist/cjs/sdds-table-footer.cjs.entry.js +165 -0
- package/dist/cjs/sdds-table-header.cjs.entry.js +100 -0
- package/dist/cjs/sdds-table-toolbar.cjs.entry.js +66 -0
- package/dist/cjs/sdds-table.cjs.entry.js +69 -0
- package/dist/cjs/sdds-textarea.cjs.entry.js +61 -0
- package/dist/cjs/sdds-textfield.cjs.entry.js +82 -0
- package/dist/cjs/sdds-tooltip.cjs.entry.js +95 -0
- package/dist/cjs/tegel.cjs.js +19 -0
- package/dist/collection/collection-manifest.json +40 -0
- package/dist/collection/components/accordion/accordion-item/accordion-item.css +134 -0
- package/dist/collection/components/accordion/accordion-item/accordion-item.js +146 -0
- package/dist/collection/components/accordion/accordion.css +77 -0
- package/dist/collection/components/accordion/accordion.js +62 -0
- package/dist/collection/components/accordion/accordion.stories.js +91 -0
- package/dist/collection/components/badge/badge.stories.js +101 -0
- package/dist/collection/components/badge/badges.css +42 -0
- package/dist/collection/components/badge/badges.js +150 -0
- package/dist/collection/components/banner/banner.stories.js +93 -0
- package/dist/collection/components/block/block.stories.js +46 -0
- package/dist/collection/components/breadcrumb/breadcrumb.stories.js +26 -0
- package/dist/collection/components/button/button-component.js +154 -0
- package/dist/collection/components/button/button-native.stories.js +183 -0
- package/dist/collection/components/button/button-webcomponent.stories.js +182 -0
- package/dist/collection/components/button/button.css +658 -0
- package/dist/collection/components/card/card.stories.js +181 -0
- package/dist/collection/components/checkbox/checkbox.stories.js +54 -0
- package/dist/collection/components/chips/chips.stories.js +124 -0
- package/dist/collection/components/data-table/native-table.stories.js +182 -0
- package/dist/collection/components/data-table/table/table.css +15 -0
- package/dist/collection/components/data-table/table/table.js +253 -0
- package/dist/collection/components/data-table/table-body/table-body.css +22 -0
- package/dist/collection/components/data-table/table-body/table-body.js +425 -0
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.css +40 -0
- package/dist/collection/components/data-table/table-body-cell/table-body-cell.js +169 -0
- package/dist/collection/components/data-table/table-body-row/table-body-row.css +196 -0
- package/dist/collection/components/data-table/table-body-row/table-body-row.js +164 -0
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.css +79 -0
- package/dist/collection/components/data-table/table-body-row-expandable/table-body-row-expandable.js +155 -0
- package/dist/collection/components/data-table/table-component-basic.stories.js +163 -0
- package/dist/collection/components/data-table/table-component-batch-actions.stories.js +129 -0
- package/dist/collection/components/data-table/table-component-bodydata.stories.js +58 -0
- package/dist/collection/components/data-table/table-component-custom-width.stories.js +198 -0
- package/dist/collection/components/data-table/table-component-event-listeners.stories.js +153 -0
- package/dist/collection/components/data-table/table-component-expandable-rows.stories.js +137 -0
- package/dist/collection/components/data-table/table-component-filtering.stories.js +139 -0
- package/dist/collection/components/data-table/table-component-multiselect.stories.js +160 -0
- package/dist/collection/components/data-table/table-component-pagination.stories.js +129 -0
- package/dist/collection/components/data-table/table-component-sorting.stories.js +107 -0
- package/dist/collection/components/data-table/table-footer/table-footer.css +93 -0
- package/dist/collection/components/data-table/table-footer/table-footer.js +355 -0
- package/dist/collection/components/data-table/table-header/table-header.css +204 -0
- package/dist/collection/components/data-table/table-header/table-header.js +153 -0
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.css +126 -0
- package/dist/collection/components/data-table/table-header-cell/table-header-cell.js +320 -0
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.css +92 -0
- package/dist/collection/components/data-table/table-toolbar/table-toolbar.js +142 -0
- package/dist/collection/components/datetime/datetime.css +375 -0
- package/dist/collection/components/datetime/datetime.js +251 -0
- package/dist/collection/components/datetime/datetime.stories.js +149 -0
- package/dist/collection/components/divider/divider.stories.js +116 -0
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.js +339 -0
- package/dist/collection/components/dropdown/dropdown-filter/dropdown-filter.stories.js +130 -0
- package/dist/collection/components/dropdown/dropdown-native.stories.js +90 -0
- package/dist/collection/components/dropdown/dropdown-option/dropdown-option.js +185 -0
- package/dist/collection/components/dropdown/dropdown-wc-default.stories.js +151 -0
- package/dist/collection/components/dropdown/dropdown-wc-multiselect.stories.js +146 -0
- package/dist/collection/components/dropdown/dropdown.css +891 -0
- package/dist/collection/components/dropdown/dropdown.js +554 -0
- package/dist/collection/components/footer/footer.stories.js +100 -0
- package/dist/collection/components/header/header-all.stories.js +217 -0
- package/dist/collection/components/header/header-default.stories.js +47 -0
- package/dist/collection/components/header/header-inline.stories.js +113 -0
- package/dist/collection/components/header/header-search.stories.js +263 -0
- package/dist/collection/components/header/header-toolbar.stories.js +204 -0
- package/dist/collection/components/icon/icon-font.stories.js +57 -0
- package/dist/collection/components/icon/icon-web-component.stories.js +51 -0
- package/dist/collection/components/icon/icon.css +16 -0
- package/dist/collection/components/icon/icon.js +89 -0
- package/dist/collection/components/icon/iconsArray.js +2 -0
- package/dist/collection/components/link/link.stories.js +45 -0
- package/dist/collection/components/message/message.stories.js +117 -0
- package/dist/collection/components/modal/modal-native.stories.js +121 -0
- package/dist/collection/components/modal/modal-webcomponent.stories.js +78 -0
- package/dist/collection/components/modal/modal.css +324 -0
- package/dist/collection/components/modal/modal.js +146 -0
- package/dist/collection/components/popover-canvas/popover-canvas.css +20 -0
- package/dist/collection/components/popover-canvas/popover-canvas.js +190 -0
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +87 -0
- package/dist/collection/components/popover-menu/popover-menu-icons.stories.js +132 -0
- package/dist/collection/components/popover-menu/popover-menu.css +19 -0
- package/dist/collection/components/popover-menu/popover-menu.js +189 -0
- package/dist/collection/components/popover-menu/popover-menu.stories.js +109 -0
- package/dist/collection/components/radio-button/radio-button.stories.js +68 -0
- package/dist/collection/components/side-menu/side-menu.stories.js +182 -0
- package/dist/collection/components/slider/slider.css +260 -0
- package/dist/collection/components/slider/slider.js +682 -0
- package/dist/collection/components/slider/slider.stories.js +251 -0
- package/dist/collection/components/spinner/spinner.css +79 -0
- package/dist/collection/components/spinner/spinner.js +61 -0
- package/dist/collection/components/spinner/spinner.stories.js +59 -0
- package/dist/collection/components/stepper/stepper.stories.js +139 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.css +159 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.js +302 -0
- package/dist/collection/components/tabs/inline-tabs-default/inline-tabs.stories.js +65 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.css +172 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.js +126 -0
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +43 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.css +153 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.js +103 -0
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +32 -0
- package/dist/collection/components/textarea/textarea.css +283 -0
- package/dist/collection/components/textarea/textarea.js +336 -0
- package/dist/collection/components/textarea/textarea.stories.js +149 -0
- package/dist/collection/components/textfield/textfield.css +494 -0
- package/dist/collection/components/textfield/textfield.js +359 -0
- package/dist/collection/components/textfield/textfield.stories.js +222 -0
- package/dist/collection/components/toast/toast.stories.js +119 -0
- package/dist/collection/components/toggle/toggle.stories.js +62 -0
- package/dist/collection/components/tooltip/tooltip.css +46 -0
- package/dist/collection/components/tooltip/tooltip.js +200 -0
- package/dist/collection/components/tooltip/tooltip.stories.js +113 -0
- package/dist/collection/components/utility/colour/background-color.stories.js +96 -0
- package/dist/collection/components/utility/colour/text-color.stories.js +94 -0
- package/dist/collection/foundations-stories/colour/colour-brand.stories.js +38 -0
- package/dist/collection/foundations-stories/colour/colour-scales.stories.js +71 -0
- package/dist/collection/foundations-stories/colour/colour-semantic.stories.js +40 -0
- package/dist/collection/foundations-stories/grid/grid.stories.js +386 -0
- package/dist/collection/foundations-stories/spacing/spacing-element.stories.js +100 -0
- package/dist/collection/foundations-stories/spacing/spacing-layout.stories.js +94 -0
- package/dist/collection/foundations-stories/typography/typography-body.stories.js +16 -0
- package/dist/collection/foundations-stories/typography/typography-detail.stories.js +17 -0
- package/dist/collection/foundations-stories/typography/typography-headline.stories.js +39 -0
- package/dist/collection/foundations-stories/typography/typography-paragraph.stories.js +12 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/stories/assets/code-brackets.svg +1 -0
- package/dist/collection/stories/assets/colors.svg +1 -0
- package/dist/collection/stories/assets/comments.svg +1 -0
- package/dist/collection/stories/assets/direction.svg +1 -0
- package/dist/collection/stories/assets/flow.svg +1 -0
- package/dist/collection/stories/assets/plugin.svg +1 -0
- package/dist/collection/stories/assets/repo.svg +1 -0
- package/dist/collection/stories/assets/stackalt.svg +1 -0
- package/dist/collection/utils/utils.js +12 -0
- package/dist/esm/index-b67b15a6.js +1884 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/popper-f860750c.js +1799 -0
- package/dist/esm/sdds-accordion-item.entry.js +30 -0
- package/dist/esm/sdds-accordion.entry.js +17 -0
- package/dist/esm/sdds-badges.entry.js +51 -0
- package/dist/esm/sdds-body-cell_2.entry.js +168 -0
- package/dist/esm/sdds-button.entry.js +32 -0
- package/dist/esm/sdds-datetime.entry.js +62 -0
- package/dist/esm/sdds-dropdown-filter.entry.js +88 -0
- package/dist/esm/sdds-dropdown_2.entry.js +330 -0
- package/dist/esm/sdds-header-cell.entry.js +137 -0
- package/dist/esm/sdds-icon.entry.js +38 -0
- package/dist/esm/sdds-inline-tabs-fullbleed.entry.js +92 -0
- package/dist/esm/sdds-inline-tabs.entry.js +207 -0
- package/dist/esm/sdds-modal.entry.js +45 -0
- package/dist/esm/sdds-navigation-tabs.entry.js +91 -0
- package/dist/esm/sdds-popover-canvas.entry.js +72 -0
- package/dist/esm/sdds-popover-menu.entry.js +71 -0
- package/dist/esm/sdds-slider.entry.js +332 -0
- package/dist/esm/sdds-spinner.entry.js +17 -0
- package/dist/esm/sdds-table-body-row-expandable.entry.js +77 -0
- package/dist/esm/sdds-table-body.entry.js +285 -0
- package/dist/esm/sdds-table-footer.entry.js +161 -0
- package/dist/esm/sdds-table-header.entry.js +96 -0
- package/dist/esm/sdds-table-toolbar.entry.js +62 -0
- package/dist/esm/sdds-table.entry.js +65 -0
- package/dist/esm/sdds-textarea.entry.js +57 -0
- package/dist/esm/sdds-textfield.entry.js +78 -0
- package/dist/esm/sdds-tooltip.entry.js +91 -0
- package/dist/esm/tegel.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/tegel/index.esm.js +0 -0
- package/dist/tegel/p-040efb32.entry.js +1 -0
- package/dist/tegel/p-12ca5cfa.entry.js +1 -0
- package/dist/tegel/p-157e1618.js +2 -0
- package/dist/tegel/p-1fe61cf6.entry.js +1 -0
- package/dist/tegel/p-2f376504.entry.js +1 -0
- package/dist/tegel/p-44ced895.entry.js +1 -0
- package/dist/tegel/p-4880f03d.entry.js +1 -0
- package/dist/tegel/p-4aba73a3.entry.js +1 -0
- package/dist/tegel/p-4b58a02c.entry.js +1 -0
- package/dist/tegel/p-4cb85347.entry.js +1 -0
- package/dist/tegel/p-52031b5a.entry.js +1 -0
- package/dist/tegel/p-677baf7f.entry.js +1 -0
- package/dist/tegel/p-71797eaf.entry.js +1 -0
- package/dist/tegel/p-7373284c.entry.js +1 -0
- package/dist/tegel/p-7451779b.entry.js +1 -0
- package/dist/tegel/p-77aeea3b.entry.js +1 -0
- package/dist/tegel/p-8582d6a7.entry.js +1 -0
- package/dist/tegel/p-96021bd0.entry.js +1 -0
- package/dist/tegel/p-9d8caf51.entry.js +1 -0
- package/dist/tegel/p-a5919930.entry.js +1 -0
- package/dist/tegel/p-b01cface.entry.js +1 -0
- package/dist/tegel/p-bf896643.entry.js +1 -0
- package/dist/tegel/p-c311725c.entry.js +1 -0
- package/dist/tegel/p-cf72dfd9.entry.js +1 -0
- package/dist/tegel/p-d91caec6.entry.js +1 -0
- package/dist/tegel/p-e10eec33.entry.js +1 -0
- package/dist/tegel/p-ec26fc38.js +1 -0
- package/dist/tegel/p-f2262a69.entry.js +1 -0
- package/dist/tegel/p-f2f7aa45.entry.js +1 -0
- package/dist/tegel/tegel.css +101 -0
- package/dist/tegel/tegel.esm.js +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
import { createPopper } from '@popperjs/core';
|
|
3
|
+
export class PopoverMenu {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.selector = '';
|
|
6
|
+
this.show = false;
|
|
7
|
+
this.placement = 'auto';
|
|
8
|
+
this.offsetSkidding = 0;
|
|
9
|
+
this.offsetDistance = 8;
|
|
10
|
+
this.target = undefined;
|
|
11
|
+
}
|
|
12
|
+
handleOutsideClick() {
|
|
13
|
+
if (this.show) {
|
|
14
|
+
this.show = false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
componentDidLoad() {
|
|
18
|
+
this.target = document.querySelector(this.selector);
|
|
19
|
+
const _this = this;
|
|
20
|
+
createPopper(this.target, this.popoverMenuElement, {
|
|
21
|
+
strategy: 'fixed',
|
|
22
|
+
placement: _this.placement,
|
|
23
|
+
modifiers: [
|
|
24
|
+
{
|
|
25
|
+
name: 'positionCalc',
|
|
26
|
+
enabled: true,
|
|
27
|
+
phase: 'main',
|
|
28
|
+
fn({}) { },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'offset',
|
|
32
|
+
options: {
|
|
33
|
+
offset: [this.offsetSkidding, this.offsetDistance],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
38
|
+
const showMenu = () => {
|
|
39
|
+
this.show = true;
|
|
40
|
+
};
|
|
41
|
+
const hideMenu = () => {
|
|
42
|
+
this.show = false;
|
|
43
|
+
};
|
|
44
|
+
this.target.addEventListener('mousedown', event => {
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
if (this.show) {
|
|
47
|
+
hideMenu();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
showMenu();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.popoverMenuElement.addEventListener('mousemove', event => {
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
});
|
|
56
|
+
this.popoverMenuElement.addEventListener('mousedown', event => {
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
render() {
|
|
61
|
+
return (h(Host, { class: `sdds-popover-menu ${this.show ? 'sdds-popover-menu-show' : ''}` }, h("slot", null)));
|
|
62
|
+
}
|
|
63
|
+
static get is() { return "sdds-popover-menu"; }
|
|
64
|
+
static get encapsulation() { return "shadow"; }
|
|
65
|
+
static get originalStyleUrls() {
|
|
66
|
+
return {
|
|
67
|
+
"$": ["popover-menu.scss"]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static get styleUrls() {
|
|
71
|
+
return {
|
|
72
|
+
"$": ["popover-menu.css"]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
static get properties() {
|
|
76
|
+
return {
|
|
77
|
+
"selector": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"mutable": false,
|
|
80
|
+
"complexType": {
|
|
81
|
+
"original": "string",
|
|
82
|
+
"resolved": "string",
|
|
83
|
+
"references": {}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": "The CSS-selector that will trigger this Popover Menu"
|
|
90
|
+
},
|
|
91
|
+
"attribute": "selector",
|
|
92
|
+
"reflect": false,
|
|
93
|
+
"defaultValue": "''"
|
|
94
|
+
},
|
|
95
|
+
"show": {
|
|
96
|
+
"type": "boolean",
|
|
97
|
+
"mutable": false,
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "boolean",
|
|
100
|
+
"resolved": "boolean",
|
|
101
|
+
"references": {}
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"optional": false,
|
|
105
|
+
"docs": {
|
|
106
|
+
"tags": [],
|
|
107
|
+
"text": "Decides if the Popover Menu should be visible from the start"
|
|
108
|
+
},
|
|
109
|
+
"attribute": "show",
|
|
110
|
+
"reflect": false,
|
|
111
|
+
"defaultValue": "false"
|
|
112
|
+
},
|
|
113
|
+
"placement": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "Placement",
|
|
118
|
+
"resolved": "\"auto\" | \"auto-end\" | \"auto-start\" | \"bottom\" | \"bottom-end\" | \"bottom-start\" | \"left\" | \"left-end\" | \"left-start\" | \"right\" | \"right-end\" | \"right-start\" | \"top\" | \"top-end\" | \"top-start\"",
|
|
119
|
+
"references": {
|
|
120
|
+
"Placement": {
|
|
121
|
+
"location": "import",
|
|
122
|
+
"path": "@popperjs/core"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Decides the placement of the Popover Menu"
|
|
131
|
+
},
|
|
132
|
+
"attribute": "placement",
|
|
133
|
+
"reflect": false,
|
|
134
|
+
"defaultValue": "'auto'"
|
|
135
|
+
},
|
|
136
|
+
"offsetSkidding": {
|
|
137
|
+
"type": "number",
|
|
138
|
+
"mutable": false,
|
|
139
|
+
"complexType": {
|
|
140
|
+
"original": "number",
|
|
141
|
+
"resolved": "number",
|
|
142
|
+
"references": {}
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"optional": false,
|
|
146
|
+
"docs": {
|
|
147
|
+
"tags": [],
|
|
148
|
+
"text": "Sets the offset skidding"
|
|
149
|
+
},
|
|
150
|
+
"attribute": "offset-skidding",
|
|
151
|
+
"reflect": false,
|
|
152
|
+
"defaultValue": "0"
|
|
153
|
+
},
|
|
154
|
+
"offsetDistance": {
|
|
155
|
+
"type": "number",
|
|
156
|
+
"mutable": false,
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "number",
|
|
159
|
+
"resolved": "number",
|
|
160
|
+
"references": {}
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"optional": false,
|
|
164
|
+
"docs": {
|
|
165
|
+
"tags": [],
|
|
166
|
+
"text": "Sets the offset distance"
|
|
167
|
+
},
|
|
168
|
+
"attribute": "offset-distance",
|
|
169
|
+
"reflect": false,
|
|
170
|
+
"defaultValue": "8"
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
static get states() {
|
|
175
|
+
return {
|
|
176
|
+
"target": {}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
static get elementRef() { return "popoverMenuElement"; }
|
|
180
|
+
static get listeners() {
|
|
181
|
+
return [{
|
|
182
|
+
"name": "mousedown",
|
|
183
|
+
"method": "handleOutsideClick",
|
|
184
|
+
"target": "window",
|
|
185
|
+
"capture": false,
|
|
186
|
+
"passive": true
|
|
187
|
+
}];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
import readme from './readme.md';
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/Popover Menu',
|
|
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=16794%3A59241&t=Ne6myqwca5m00de7-1',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'Link',
|
|
16
|
+
type: 'link',
|
|
17
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=16794%3A59241&t=Ne6myqwca5m00de7-1',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
menuPosition: {
|
|
23
|
+
name: 'Menu position',
|
|
24
|
+
description: 'Position of the Popover menu',
|
|
25
|
+
control: {
|
|
26
|
+
type: 'select',
|
|
27
|
+
},
|
|
28
|
+
options: [
|
|
29
|
+
'Bottom',
|
|
30
|
+
'Bottom start',
|
|
31
|
+
'Bottom end',
|
|
32
|
+
'Top',
|
|
33
|
+
'Top start',
|
|
34
|
+
'Top end',
|
|
35
|
+
'Left',
|
|
36
|
+
'Left-start',
|
|
37
|
+
'Left end',
|
|
38
|
+
'Right',
|
|
39
|
+
'Right start',
|
|
40
|
+
'Right end',
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
args: {
|
|
45
|
+
menuPosition: 'Bottom',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const Template = ({ menuPosition }) => {
|
|
49
|
+
const menuPosLookup = {
|
|
50
|
+
'Bottom': 'bottom',
|
|
51
|
+
'Bottom start': 'bottom-start',
|
|
52
|
+
'Bottom end': 'bottom-end',
|
|
53
|
+
'Top': 'top',
|
|
54
|
+
'Top start': 'top-start',
|
|
55
|
+
'Top end': 'top-end',
|
|
56
|
+
'Left': 'left',
|
|
57
|
+
'Left star': 'left-start',
|
|
58
|
+
'Left end': 'left-end',
|
|
59
|
+
'Right': 'right',
|
|
60
|
+
'Right start': 'right-start',
|
|
61
|
+
'Right end': 'right-end',
|
|
62
|
+
};
|
|
63
|
+
return formatHtmlPreview(`
|
|
64
|
+
<style>
|
|
65
|
+
/* demo-wrapper styles is for demonstration purposes only */
|
|
66
|
+
.demo-wrapper {
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-wrap: nowrap;
|
|
69
|
+
alignt-items: center;
|
|
70
|
+
}
|
|
71
|
+
sdds-icon:hover {
|
|
72
|
+
cursor:pointer;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
|
|
76
|
+
<sdds-popover-menu
|
|
77
|
+
placement="${menuPosLookup[menuPosition]}"
|
|
78
|
+
selector="#trigger">
|
|
79
|
+
<ul class="sdds-popover-menu-wrapper">
|
|
80
|
+
<li>
|
|
81
|
+
<a target="_blank" href="https://digitaldesign.scania.com">Menu item 1</a>
|
|
82
|
+
</li>
|
|
83
|
+
<li>
|
|
84
|
+
<a target="_blank" href="https://digitaldesign.scania.com">
|
|
85
|
+
Menu item 2
|
|
86
|
+
</a>
|
|
87
|
+
</li>
|
|
88
|
+
<li>
|
|
89
|
+
<a target="_blank" href="https://digitaldesign.scania.com">Menu item 3</a>
|
|
90
|
+
</li>
|
|
91
|
+
<li class="divider"></li>
|
|
92
|
+
<li>
|
|
93
|
+
<a target="_blank" href="https://digitaldesign.scania.com">Menu item 4</a>
|
|
94
|
+
</li>
|
|
95
|
+
<li>
|
|
96
|
+
<a target="_blank" href="https://digitaldesign.scania.com">Menu item 5</a>
|
|
97
|
+
</li>
|
|
98
|
+
</ul>
|
|
99
|
+
</sdds-popover-menu>
|
|
100
|
+
|
|
101
|
+
<!-- demo-wrapper code below is for demonstration purposes only -->
|
|
102
|
+
<div class="demo-wrapper">
|
|
103
|
+
<span style="user-select: none;margin-right: 16px;">Click icon for popover menu</span>
|
|
104
|
+
<sdds-icon id="trigger" name="kebab" size="16px"></sdds-icon>
|
|
105
|
+
</div>
|
|
106
|
+
`);
|
|
107
|
+
};
|
|
108
|
+
export const Default = Template.bind({});
|
|
109
|
+
Default.args = {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/Radio Button',
|
|
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=9266%3A17335&t=Ne6myqwca5m00de7-1',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'Link',
|
|
14
|
+
type: 'link',
|
|
15
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=9266%3A17335&t=Ne6myqwca5m00de7-1',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
label: {
|
|
21
|
+
name: 'Label',
|
|
22
|
+
description: 'The label for the radio button',
|
|
23
|
+
controls: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
name: 'Disabled',
|
|
29
|
+
description: 'Disables the radio button',
|
|
30
|
+
control: {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
checked: {
|
|
35
|
+
name: 'Checked',
|
|
36
|
+
description: 'Marks the radio button as checked',
|
|
37
|
+
control: {
|
|
38
|
+
type: 'boolean',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
label: 'Label text',
|
|
44
|
+
disabled: false,
|
|
45
|
+
checked: false,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const Template = (args) => formatHtmlPreview(`
|
|
49
|
+
<div class="sdds-radio-button-group">
|
|
50
|
+
<div class="sdds-radio-item">
|
|
51
|
+
<input class="sdds-form-input" type="radio" name="rb-example" id="rb-option-1" checked="" ${args.disabled ? 'disabled' : ''}>
|
|
52
|
+
<label class="sdds-form-label" for="rb-option-1">
|
|
53
|
+
${args.label} 1
|
|
54
|
+
</label>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
<div class="sdds-radio-button-group">
|
|
58
|
+
<div class="sdds-radio-item">
|
|
59
|
+
<input class="sdds-form-input" type="radio" name="rb-example" id="rb-option-1" ${args.checked ? 'checked="checked"' : ''} >
|
|
60
|
+
<label class="sdds-form-label" for="rb-option-1">
|
|
61
|
+
${args.label} 2
|
|
62
|
+
</label>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
`);
|
|
67
|
+
export const Default = Template.bind({});
|
|
68
|
+
Default.args = {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Components/Side Menu',
|
|
4
|
+
parameters: {
|
|
5
|
+
layout: 'fullscreen',
|
|
6
|
+
docs: {
|
|
7
|
+
source: {
|
|
8
|
+
state: 'closed',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
design: [
|
|
12
|
+
{
|
|
13
|
+
name: 'Figma',
|
|
14
|
+
type: 'figma',
|
|
15
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=3981%3A151372&t=Ne6myqwca5m00de7-1',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'Link',
|
|
19
|
+
type: 'link',
|
|
20
|
+
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=3981%3A151372&t=Ne6myqwca5m00de7-1',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
collapsed: {
|
|
26
|
+
name: 'Collapsed',
|
|
27
|
+
description: 'Toggle the side menus collapsed state.',
|
|
28
|
+
control: {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
showIcons: {
|
|
33
|
+
name: 'Show icons',
|
|
34
|
+
description: 'Toggle if icons for side menu options are displayed.',
|
|
35
|
+
control: {
|
|
36
|
+
type: 'boolean',
|
|
37
|
+
},
|
|
38
|
+
if: { arg: 'collapsed', neq: true },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
args: {
|
|
42
|
+
collapsed: false,
|
|
43
|
+
showIcons: false,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const Template = ({ showIcons, collapsed }) => {
|
|
47
|
+
const icons = showIcons || collapsed ? 'icons-enabled' : 'icons-disabled';
|
|
48
|
+
return formatHtmlPreview(`
|
|
49
|
+
<style>
|
|
50
|
+
/* demo-wrapper is for demonstration purposes only*/
|
|
51
|
+
.demo-wrapper {
|
|
52
|
+
align-items: stretch;
|
|
53
|
+
height: 100vh;
|
|
54
|
+
}
|
|
55
|
+
.sdds-container {
|
|
56
|
+
overflow-y: auto;
|
|
57
|
+
max-width: 10000px;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
|
|
61
|
+
<nav class="sdds-nav">
|
|
62
|
+
<div class="sdds-nav__left">
|
|
63
|
+
<button class="sdds-nav__mob-menu-btn">
|
|
64
|
+
<sdds-icon name="burger" size="20px"></sdds-icon>
|
|
65
|
+
</button>
|
|
66
|
+
<div class="sdds-nav__app-name">My application</div>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="sdds-nav__right">
|
|
69
|
+
<a class="sdds-nav__item sdds-nav__app-logo" href="#"></a>
|
|
70
|
+
</div>
|
|
71
|
+
</nav>
|
|
72
|
+
<div class="sdds-push demo-wrapper">
|
|
73
|
+
<div class="sdds-sidebar side-menu ${collapsed ? 'collapsed' : ''}">
|
|
74
|
+
<div class="sdds-sidebar-mheader">
|
|
75
|
+
<button class="sdds-sidebar-mheader__close">
|
|
76
|
+
<sdds-icon name="cross" size="20px"></sdds-icon>
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
<ul class="sdds-sidebar-nav sdds-sidebar-nav--main ${icons}">
|
|
80
|
+
<li class="sdds-sidebar-nav__item sdds-sidebar-nav__extended">
|
|
81
|
+
<button class="sdds-sidebar-nav__item-link">
|
|
82
|
+
<div>
|
|
83
|
+
<sdds-icon class="sdds-sidebar-nav__icon" name="truck" size="20px"></sdds-icon>
|
|
84
|
+
</div>
|
|
85
|
+
<span class="sdds-sidebar-nav__item-text">Sub-menu</span>
|
|
86
|
+
<div>
|
|
87
|
+
<sdds-icon class="sdds-sidebar-nav__chevron" name="chevron_down" size="16px"></sdds-icon>
|
|
88
|
+
</div>
|
|
89
|
+
</button>
|
|
90
|
+
<ul class="sdds-sidebar-nav-subnav">
|
|
91
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
92
|
+
<span class="sdds-sidebar-nav__item-title">Sub-menu</span>
|
|
93
|
+
</li>
|
|
94
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
95
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
96
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
97
|
+
>
|
|
98
|
+
</li>
|
|
99
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
100
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
101
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
102
|
+
>
|
|
103
|
+
</li>
|
|
104
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
105
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
106
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
107
|
+
>
|
|
108
|
+
</li>
|
|
109
|
+
</ul>
|
|
110
|
+
</li>
|
|
111
|
+
<li class="sdds-sidebar-nav__item sdds-sidebar-nav__extended">
|
|
112
|
+
<button class="sdds-sidebar-nav__item-link">
|
|
113
|
+
<div>
|
|
114
|
+
<sdds-icon class="sdds-sidebar-nav__icon" name="truck" size="20px"></sdds-icon>
|
|
115
|
+
</div>
|
|
116
|
+
<span class="sdds-sidebar-nav__item-text">Sub-menu</span>
|
|
117
|
+
<div>
|
|
118
|
+
<sdds-icon class="sdds-sidebar-nav__chevron" name="chevron_down" size="16px"></sdds-icon>
|
|
119
|
+
</div>
|
|
120
|
+
</button>
|
|
121
|
+
<ul class="sdds-sidebar-nav-subnav">
|
|
122
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
123
|
+
<span class="sdds-sidebar-nav__item-title">Sub-menu</span>
|
|
124
|
+
</li>
|
|
125
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
126
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
127
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
128
|
+
>
|
|
129
|
+
</li>
|
|
130
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
131
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
132
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
133
|
+
>
|
|
134
|
+
</li>
|
|
135
|
+
<li class="sdds-sidebar-nav-subnav__item">
|
|
136
|
+
<a class="sdds-sidebar-nav__item-link" href="#"
|
|
137
|
+
><span class="sdds-sidebar-nav__item-text">Sub Page name</span></a
|
|
138
|
+
>
|
|
139
|
+
</li>
|
|
140
|
+
</ul>
|
|
141
|
+
</li>
|
|
142
|
+
<li class="sdds-sidebar-nav__item">
|
|
143
|
+
<a class="sdds-sidebar-nav__item-link" href="#">
|
|
144
|
+
<div>
|
|
145
|
+
<sdds-icon class="sdds-sidebar-nav__icon" name="truck" size="20px"></sdds-icon>
|
|
146
|
+
</div>
|
|
147
|
+
<span class="sdds-sidebar-nav__item-text">Page link</span>
|
|
148
|
+
</a>
|
|
149
|
+
</li>
|
|
150
|
+
<li class="sdds-sidebar-nav__item">
|
|
151
|
+
<a class="sdds-sidebar-nav__item-link" href="#">
|
|
152
|
+
<div>
|
|
153
|
+
<sdds-icon class="sdds-sidebar-nav__icon" name="truck" size="20px"></sdds-icon>
|
|
154
|
+
</div>
|
|
155
|
+
<span class="sdds-sidebar-nav__item-text">Page link</span>
|
|
156
|
+
</a>
|
|
157
|
+
</li>
|
|
158
|
+
</ul>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="sdds-container" style="padding-top: 30px">
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
<script>
|
|
166
|
+
/* Note: Code below is used only for inspiration and presentation purposes in Storybook */
|
|
167
|
+
document.querySelector('button.sdds-nav__mob-menu-btn').addEventListener('click', () => {
|
|
168
|
+
document.querySelector('.side-menu').classList.toggle('mobile-menu-open')
|
|
169
|
+
})
|
|
170
|
+
document.querySelector('button.sdds-sidebar-mheader__close').addEventListener('click', () => {
|
|
171
|
+
document.querySelector('.side-menu').classList.toggle('mobile-menu-open')
|
|
172
|
+
})
|
|
173
|
+
expandableListItems = document.getElementsByClassName('sdds-sidebar-nav__extended');
|
|
174
|
+
for (let i = 0; i < expandableListItems.length; i++) {
|
|
175
|
+
expandableListItems[i].addEventListener('click', () => {
|
|
176
|
+
document.getElementsByClassName('sdds-sidebar-nav__extended')[i].classList.toggle('subnav-open');
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
`);
|
|
181
|
+
};
|
|
182
|
+
export const Default = Template.bind({});
|