@scania/tegel 0.0.1-beta.5 → 0.0.1-beta.7
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/loader.cjs.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/package.json +5 -5
- package/readme.md +135 -0
- package/dist/collection/components/accordion/accordion.stories.js +0 -91
- package/dist/collection/components/badge/badge.stories.js +0 -101
- 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-native.stories.js +0 -183
- package/dist/collection/components/button/button-webcomponent.stories.js +0 -182
- 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-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/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.stories.js +0 -130
- package/dist/collection/components/dropdown/dropdown-native.stories.js +0 -90
- 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/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/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/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.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.stories.js +0 -251
- 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.stories.js +0 -65
- package/dist/collection/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.js +0 -43
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -32
- package/dist/collection/components/textarea/textarea.stories.js +0 -149
- 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.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/types/components/accordion/accordion.stories.d.ts +0 -77
- package/dist/types/components/badge/badge.stories.d.ts +0 -66
- package/dist/types/components/banner/banner.stories.d.ts +0 -68
- package/dist/types/components/block/block.stories.d.ts +0 -31
- package/dist/types/components/breadcrumb/breadcrumb.stories.d.ts +0 -12
- package/dist/types/components/button/button-native.stories.d.ts +0 -144
- package/dist/types/components/button/button-webcomponent.stories.d.ts +0 -143
- package/dist/types/components/card/card.stories.d.ts +0 -114
- package/dist/types/components/checkbox/checkbox.stories.d.ts +0 -39
- package/dist/types/components/chips/chips.stories.d.ts +0 -81
- package/dist/types/components/data-table/native-table.stories.d.ts +0 -147
- package/dist/types/components/data-table/table-component-basic.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-batch-actions.stories.d.ts +0 -98
- package/dist/types/components/data-table/table-component-bodydata.stories.d.ts +0 -38
- package/dist/types/components/data-table/table-component-custom-width.stories.d.ts +0 -147
- package/dist/types/components/data-table/table-component-event-listeners.stories.d.ts +0 -87
- package/dist/types/components/data-table/table-component-expandable-rows.stories.d.ts +0 -87
- package/dist/types/components/data-table/table-component-filtering.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-multiselect.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-pagination.stories.d.ts +0 -100
- package/dist/types/components/data-table/table-component-sorting.stories.d.ts +0 -79
- package/dist/types/components/datetime/datetime.stories.d.ts +0 -80
- package/dist/types/components/divider/divider.stories.d.ts +0 -72
- package/dist/types/components/dropdown/dropdown-filter/dropdown-filter.stories.d.ts +0 -73
- package/dist/types/components/dropdown/dropdown-native.stories.d.ts +0 -57
- package/dist/types/components/dropdown/dropdown-wc-default.stories.d.ts +0 -115
- package/dist/types/components/dropdown/dropdown-wc-multiselect.stories.d.ts +0 -115
- package/dist/types/components/footer/footer.stories.d.ts +0 -23
- package/dist/types/components/header/header-all.stories.d.ts +0 -29
- package/dist/types/components/header/header-default.stories.d.ts +0 -29
- package/dist/types/components/header/header-inline.stories.d.ts +0 -29
- package/dist/types/components/header/header-search.stories.d.ts +0 -29
- package/dist/types/components/header/header-toolbar.stories.d.ts +0 -29
- package/dist/types/components/icon/icon-font.stories.d.ts +0 -38
- package/dist/types/components/icon/icon-web-component.stories.d.ts +0 -38
- package/dist/types/components/link/link.stories.d.ts +0 -33
- package/dist/types/components/message/message.stories.d.ts +0 -67
- package/dist/types/components/modal/modal-native.stories.d.ts +0 -51
- package/dist/types/components/modal/modal-webcomponent.stories.d.ts +0 -44
- package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +0 -25
- package/dist/types/components/popover-menu/popover-menu-icons.stories.d.ts +0 -27
- package/dist/types/components/popover-menu/popover-menu.stories.d.ts +0 -27
- package/dist/types/components/radio-button/radio-button.stories.d.ts +0 -41
- package/dist/types/components/side-menu/side-menu.stories.d.ts +0 -42
- package/dist/types/components/slider/slider.stories.d.ts +0 -156
- package/dist/types/components/spinner/spinner.stories.d.ts +0 -37
- package/dist/types/components/stepper/stepper.stories.d.ts +0 -56
- package/dist/types/components/tabs/inline-tabs-default/inline-tabs.stories.d.ts +0 -41
- package/dist/types/components/tabs/inline-tabs-fullbleed/inline-tabs-fullbleed.stories.d.ts +0 -25
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +0 -13
- package/dist/types/components/textarea/textarea.stories.d.ts +0 -111
- package/dist/types/components/textfield/textfield.stories.d.ts +0 -176
- package/dist/types/components/toast/toast.stories.d.ts +0 -58
- package/dist/types/components/toggle/toggle.stories.d.ts +0 -42
- package/dist/types/components/tooltip/tooltip.stories.d.ts +0 -54
- package/dist/types/components/utility/colour/background-color.stories.d.ts +0 -58
- package/dist/types/components/utility/colour/text-color.stories.d.ts +0 -58
- package/dist/types/foundations-stories/colour/colour-brand.stories.d.ts +0 -13
- package/dist/types/foundations-stories/colour/colour-scales.stories.d.ts +0 -13
- package/dist/types/foundations-stories/colour/colour-semantic.stories.d.ts +0 -13
- package/dist/types/foundations-stories/grid/grid.stories.d.ts +0 -35
- package/dist/types/foundations-stories/spacing/spacing-element.stories.d.ts +0 -8
- package/dist/types/foundations-stories/spacing/spacing-layout.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-body.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-detail.stories.d.ts +0 -8
- package/dist/types/foundations-stories/typography/typography-headline.stories.d.ts +0 -21
- package/dist/types/foundations-stories/typography/typography-paragraph.stories.d.ts +0 -8
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
import sddsTable from './table/readme.md';
|
|
3
|
-
import sddsTableToolbar from './table-toolbar/readme.md';
|
|
4
|
-
import sddsHeader from './table-header/readme.md';
|
|
5
|
-
import sddsHeaderCell from './table-header-cell/readme.md';
|
|
6
|
-
import sddsTableBody from './table-body/readme.md';
|
|
7
|
-
import sddsBodyRow from './table-body-row/readme.md';
|
|
8
|
-
import sddsBodyRowExpandable from './table-body-row-expandable/readme.md';
|
|
9
|
-
import sddsBodyCell from './table-body-cell/readme.md';
|
|
10
|
-
import sddsTableFooter from './table-footer/readme.md';
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Components/Data Table/Web Component',
|
|
13
|
-
parameters: {
|
|
14
|
-
notes: {
|
|
15
|
-
'sdds-table': sddsTable,
|
|
16
|
-
'sdds-table-toolbar': sddsTableToolbar,
|
|
17
|
-
'sdds-header': sddsHeader,
|
|
18
|
-
'sdds-header-cell': sddsHeaderCell,
|
|
19
|
-
'sdds-table-body': sddsTableBody,
|
|
20
|
-
'sdds-body-row': sddsBodyRow,
|
|
21
|
-
'sdds-body-row-expandable': sddsBodyRowExpandable,
|
|
22
|
-
'sdds-body-cell': sddsBodyCell,
|
|
23
|
-
'sdds-table-footer': sddsTableFooter,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
enableMultiselect: {
|
|
28
|
-
name: 'Enable multiselect',
|
|
29
|
-
description: 'Enable row selection.',
|
|
30
|
-
control: {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
},
|
|
33
|
-
table: {
|
|
34
|
-
defaultValue: {
|
|
35
|
-
summary: true,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
verticalDivider: {
|
|
40
|
-
name: 'Vertical dividers',
|
|
41
|
-
description: 'When enabled, table has vertical dividers between columns.',
|
|
42
|
-
control: {
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
},
|
|
45
|
-
table: {
|
|
46
|
-
defaultValue: {
|
|
47
|
-
summary: false,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
compactDesign: {
|
|
52
|
-
name: 'Compact design',
|
|
53
|
-
description: 'Enables compact design of the table, rows with less height.',
|
|
54
|
-
control: {
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
},
|
|
57
|
-
table: {
|
|
58
|
-
defaultValue: {
|
|
59
|
-
summary: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
onWhiteBackground: {
|
|
64
|
-
name: 'On white background',
|
|
65
|
-
description: 'Changes BG color of table element to grey variation for better visibility on white layouts',
|
|
66
|
-
control: {
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
},
|
|
69
|
-
table: {
|
|
70
|
-
defaultValue: {
|
|
71
|
-
summary: false,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
responsiveDesign: {
|
|
76
|
-
name: 'Responsive table',
|
|
77
|
-
description: 'Table takes 100% of available width. For column values less then 192px, "No minimum width" has to be enabled too. ',
|
|
78
|
-
control: {
|
|
79
|
-
type: 'boolean',
|
|
80
|
-
},
|
|
81
|
-
table: {
|
|
82
|
-
defaultValue: {
|
|
83
|
-
summary: false,
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
noMinWidth: {
|
|
88
|
-
name: 'No column minimum width limitation',
|
|
89
|
-
description: 'If columns should be able to shrink below 192px width.',
|
|
90
|
-
control: {
|
|
91
|
-
type: 'boolean',
|
|
92
|
-
},
|
|
93
|
-
table: {
|
|
94
|
-
defaultValue: {
|
|
95
|
-
summary: 'false',
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
args: {
|
|
101
|
-
compactDesign: false,
|
|
102
|
-
onWhiteBackground: false,
|
|
103
|
-
verticalDivider: false,
|
|
104
|
-
responsiveDesign: false,
|
|
105
|
-
noMinWidth: false,
|
|
106
|
-
enableMultiselect: true,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
const MultiselectTemplate = ({ verticalDivider, compactDesign, onWhiteBackground, responsiveDesign, enableMultiselect, noMinWidth, }) => formatHtmlPreview(`
|
|
110
|
-
<script>
|
|
111
|
-
// Note: Script here is only for demo purposes
|
|
112
|
-
function getValue() {
|
|
113
|
-
const element = document.querySelector('#multiselect-table > sdds-table-body');
|
|
114
|
-
const textArea = document.getElementById('selected-rows-value-textarea');
|
|
115
|
-
const observer = new MutationObserver(mutations => {
|
|
116
|
-
mutations.forEach(mutation => {
|
|
117
|
-
if (mutation.type === 'attributes') {
|
|
118
|
-
textArea.value = element.getAttribute('data-selected-rows');
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
observer.observe(element, {
|
|
123
|
-
attributes: true,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
window.addEventListener('click', () => {
|
|
127
|
-
getValue();
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
</script>
|
|
131
|
-
|
|
132
|
-
<h3>Multiselect</h3>
|
|
133
|
-
<sdds-table
|
|
134
|
-
id="multiselect-table"
|
|
135
|
-
${enableMultiselect ? 'enable-multiselect' : ''}
|
|
136
|
-
vertical-dividers="${verticalDivider}"
|
|
137
|
-
compact-design="${compactDesign}"
|
|
138
|
-
white-background="${onWhiteBackground}"
|
|
139
|
-
enable-responsive="${responsiveDesign}"
|
|
140
|
-
${noMinWidth ? 'no-min-width' : ''}
|
|
141
|
-
>
|
|
142
|
-
<sdds-table-header>
|
|
143
|
-
<sdds-header-cell column-key='truck' column-title='Truck type'></sdds-header-cell>
|
|
144
|
-
<sdds-header-cell column-key='driver' column-title='Driver name'></sdds-header-cell>
|
|
145
|
-
<sdds-header-cell column-key='country' column-title='Country'></sdds-header-cell>
|
|
146
|
-
<sdds-header-cell column-key='mileage' column-title='Mileage' text-align='right'></sdds-header-cell>
|
|
147
|
-
</sdds-table-header>
|
|
148
|
-
<sdds-table-body enable-dummy-data>
|
|
149
|
-
</sdds-table-body>
|
|
150
|
-
</sdds-table>
|
|
151
|
-
|
|
152
|
-
<!-- Note: Code below is just for demo purposes -->
|
|
153
|
-
<div class="sdds-u-mt1" style="width: 450px; background-color: lightblue; padding: 16px;">
|
|
154
|
-
<p class="sdds-u-mt0">Note: This box works only in "Canvas" tab.</p>
|
|
155
|
-
<h6 class="sdds-u-pb0 sdds-u-mb0 sdds-u-mt0">Selected rows data</h6>
|
|
156
|
-
<small>Values here are values found in data-selected-rows attribute of sdds-table-body element. They are shown here just for presentation purposes.</small>
|
|
157
|
-
<textarea id="selected-rows-value-textarea" rows="5" cols="50" readonly></textarea>
|
|
158
|
-
</div>`);
|
|
159
|
-
export const Multiselect = MultiselectTemplate.bind({});
|
|
160
|
-
Multiselect.args = {};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
import sddsTable from './table/readme.md';
|
|
3
|
-
import sddsTableToolbar from './table-toolbar/readme.md';
|
|
4
|
-
import sddsHeader from './table-header/readme.md';
|
|
5
|
-
import sddsHeaderCell from './table-header-cell/readme.md';
|
|
6
|
-
import sddsTableBody from './table-body/readme.md';
|
|
7
|
-
import sddsBodyRow from './table-body-row/readme.md';
|
|
8
|
-
import sddsBodyRowExpandable from './table-body-row-expandable/readme.md';
|
|
9
|
-
import sddsBodyCell from './table-body-cell/readme.md';
|
|
10
|
-
import sddsTableFooter from './table-footer/readme.md';
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Components/Data Table/Web Component',
|
|
13
|
-
parameters: {
|
|
14
|
-
notes: {
|
|
15
|
-
'sdds-table': sddsTable,
|
|
16
|
-
'sdds-table-toolbar': sddsTableToolbar,
|
|
17
|
-
'sdds-header': sddsHeader,
|
|
18
|
-
'sdds-header-cell': sddsHeaderCell,
|
|
19
|
-
'sdds-table-body': sddsTableBody,
|
|
20
|
-
'sdds-body-row': sddsBodyRow,
|
|
21
|
-
'sdds-body-row-expandable': sddsBodyRowExpandable,
|
|
22
|
-
'sdds-body-cell': sddsBodyCell,
|
|
23
|
-
'sdds-table-footer': sddsTableFooter,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
verticalDivider: {
|
|
28
|
-
name: 'Vertical dividers',
|
|
29
|
-
description: 'When enabled, table has vertical dividers between columns.',
|
|
30
|
-
control: {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
},
|
|
33
|
-
table: {
|
|
34
|
-
defaultValue: {
|
|
35
|
-
summary: false,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
compactDesign: {
|
|
40
|
-
name: 'Compact design',
|
|
41
|
-
description: 'Enables compact design of the table, rows with less height.',
|
|
42
|
-
control: {
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
},
|
|
45
|
-
table: {
|
|
46
|
-
defaultValue: {
|
|
47
|
-
summary: false,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
onWhiteBackground: {
|
|
52
|
-
name: 'On white background',
|
|
53
|
-
description: 'Changes BG color of table element to grey variation for better visibility on white layouts',
|
|
54
|
-
control: {
|
|
55
|
-
type: 'boolean',
|
|
56
|
-
},
|
|
57
|
-
table: {
|
|
58
|
-
defaultValue: {
|
|
59
|
-
summary: false,
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
responsiveDesign: {
|
|
64
|
-
name: 'Responsive table',
|
|
65
|
-
description: 'Table takes 100% of available width. For column values less then 192px, "No minimum width" has to be enabled too. ',
|
|
66
|
-
control: {
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
},
|
|
69
|
-
table: {
|
|
70
|
-
defaultValue: {
|
|
71
|
-
summary: false,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
noMinWidth: {
|
|
76
|
-
name: 'No column minimum width limitation',
|
|
77
|
-
description: 'If columns should be able to shrink below 192px width.',
|
|
78
|
-
control: {
|
|
79
|
-
type: 'boolean',
|
|
80
|
-
},
|
|
81
|
-
table: {
|
|
82
|
-
defaultValue: {
|
|
83
|
-
summary: 'false',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
rowsPerPageControl: {
|
|
88
|
-
name: 'Rows per page',
|
|
89
|
-
description: 'Specify how many rows per page user would like to see',
|
|
90
|
-
control: {
|
|
91
|
-
type: 'number',
|
|
92
|
-
},
|
|
93
|
-
table: {
|
|
94
|
-
defaultValue: {
|
|
95
|
-
summary: 4,
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
args: {
|
|
101
|
-
compactDesign: false,
|
|
102
|
-
onWhiteBackground: false,
|
|
103
|
-
verticalDivider: false,
|
|
104
|
-
responsiveDesign: false,
|
|
105
|
-
rowsPerPageControl: 4,
|
|
106
|
-
noMinWidth: false,
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
const PaginationTemplate = ({ verticalDivider, compactDesign, onWhiteBackground, rowsPerPageControl, responsiveDesign, noMinWidth, }) => formatHtmlPreview(`
|
|
110
|
-
<h3>Pagination</h3>
|
|
111
|
-
<sdds-table
|
|
112
|
-
vertical-dividers="${verticalDivider}"
|
|
113
|
-
compact-design="${compactDesign}"
|
|
114
|
-
white-background="${onWhiteBackground}"
|
|
115
|
-
enable-responsive="${responsiveDesign}"
|
|
116
|
-
${noMinWidth ? 'no-min-width' : ''}
|
|
117
|
-
>
|
|
118
|
-
<sdds-table-header>
|
|
119
|
-
<sdds-header-cell column-key='truck' column-title='Truck type'></sdds-header-cell>
|
|
120
|
-
<sdds-header-cell column-key='driver' column-title='Driver name'></sdds-header-cell>
|
|
121
|
-
<sdds-header-cell column-key='country' column-title='Country'></sdds-header-cell>
|
|
122
|
-
<sdds-header-cell column-key='mileage' column-title='Mileage' text-align='right'></sdds-header-cell>
|
|
123
|
-
</sdds-table-header>
|
|
124
|
-
<sdds-table-body enable-dummy-data>
|
|
125
|
-
</sdds-table-body>
|
|
126
|
-
<sdds-table-footer enable-pagination rows-per-page="${rowsPerPageControl}"></sdds-table-footer>
|
|
127
|
-
</sdds-table>`);
|
|
128
|
-
export const Pagination = PaginationTemplate.bind({});
|
|
129
|
-
Pagination.args = {};
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
import sddsTable from './table/readme.md';
|
|
3
|
-
import sddsTableToolbar from './table-toolbar/readme.md';
|
|
4
|
-
import sddsHeader from './table-header/readme.md';
|
|
5
|
-
import sddsHeaderCell from './table-header-cell/readme.md';
|
|
6
|
-
import sddsTableBody from './table-body/readme.md';
|
|
7
|
-
import sddsBodyRow from './table-body-row/readme.md';
|
|
8
|
-
import sddsBodyRowExpandable from './table-body-row-expandable/readme.md';
|
|
9
|
-
import sddsBodyCell from './table-body-cell/readme.md';
|
|
10
|
-
import sddsTableFooter from './table-footer/readme.md';
|
|
11
|
-
export default {
|
|
12
|
-
title: 'Components/Data Table/Web Component',
|
|
13
|
-
parameters: {
|
|
14
|
-
notes: {
|
|
15
|
-
'sdds-table': sddsTable,
|
|
16
|
-
'sdds-table-toolbar': sddsTableToolbar,
|
|
17
|
-
'sdds-header': sddsHeader,
|
|
18
|
-
'sdds-header-cell': sddsHeaderCell,
|
|
19
|
-
'sdds-table-body': sddsTableBody,
|
|
20
|
-
'sdds-body-row': sddsBodyRow,
|
|
21
|
-
'sdds-body-row-expandable': sddsBodyRowExpandable,
|
|
22
|
-
'sdds-body-cell': sddsBodyCell,
|
|
23
|
-
'sdds-table-footer': sddsTableFooter,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
verticalDivider: {
|
|
28
|
-
name: 'Vertical dividers',
|
|
29
|
-
control: {
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
compactDesign: {
|
|
34
|
-
name: 'Compact Design',
|
|
35
|
-
control: {
|
|
36
|
-
type: 'boolean',
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
onWhiteBackground: {
|
|
40
|
-
name: 'On white background',
|
|
41
|
-
control: {
|
|
42
|
-
type: 'boolean',
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
responsiveDesign: {
|
|
46
|
-
name: 'Responsive design',
|
|
47
|
-
control: {
|
|
48
|
-
type: 'boolean',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
column1sortable: {
|
|
52
|
-
name: 'Column 1 is sortable',
|
|
53
|
-
control: {
|
|
54
|
-
type: 'boolean',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
column2sortable: {
|
|
58
|
-
name: 'Column 2 is sortable',
|
|
59
|
-
control: {
|
|
60
|
-
type: 'boolean',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
column3sortable: {
|
|
64
|
-
name: 'Column 3 is sortable',
|
|
65
|
-
control: {
|
|
66
|
-
type: 'boolean',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
column4sortable: {
|
|
70
|
-
name: 'Column 4 is sortable',
|
|
71
|
-
control: {
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
args: {
|
|
77
|
-
verticalDivider: false,
|
|
78
|
-
compactDesign: false,
|
|
79
|
-
onWhiteBackground: false,
|
|
80
|
-
responsiveDesign: false,
|
|
81
|
-
column1sortable: true,
|
|
82
|
-
column2sortable: true,
|
|
83
|
-
column3sortable: true,
|
|
84
|
-
column4sortable: true,
|
|
85
|
-
noMinWidth: false,
|
|
86
|
-
},
|
|
87
|
-
};
|
|
88
|
-
const SortingTemplate = ({ verticalDivider, compactDesign, onWhiteBackground, responsiveDesign, column1sortable, column2sortable, column3sortable, column4sortable, noMinWidth, }) => formatHtmlPreview(`
|
|
89
|
-
<h3>Sorting example</h3>
|
|
90
|
-
<sdds-table
|
|
91
|
-
vertical-dividers="${verticalDivider}"
|
|
92
|
-
compact-design="${compactDesign}"
|
|
93
|
-
white-background="${onWhiteBackground}"
|
|
94
|
-
enable-responsive="${responsiveDesign}"
|
|
95
|
-
${noMinWidth ? 'no-min-width' : ''}
|
|
96
|
-
>
|
|
97
|
-
<sdds-table-header>
|
|
98
|
-
<sdds-header-cell column-key='truck' column-title='Truck type' sortable="${column1sortable}"></sdds-header-cell>
|
|
99
|
-
<sdds-header-cell column-key='driver' column-title='Driver name' sortable="${column2sortable}"></sdds-header-cell>
|
|
100
|
-
<sdds-header-cell column-key='country' column-title='Country' sortable="${column3sortable}"></sdds-header-cell>
|
|
101
|
-
<sdds-header-cell column-key='mileage' column-title='Mileage' sortable="${column4sortable}" text-align='right'></sdds-header-cell>
|
|
102
|
-
</sdds-table-header>
|
|
103
|
-
<sdds-table-body enable-dummy-data>
|
|
104
|
-
</sdds-table-body>
|
|
105
|
-
</sdds-table>`);
|
|
106
|
-
export const Sorting = SortingTemplate.bind({});
|
|
107
|
-
Sorting.args = {};
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import readme from './readme.md';
|
|
2
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Components/Datetime',
|
|
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=10241%3A40193&t=rVXuTOgTmXPauyHd-1',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: 'Link',
|
|
16
|
-
type: 'link',
|
|
17
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=10241%3A40193&t=rVXuTOgTmXPauyHd-1',
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
argTypes: {
|
|
22
|
-
type: {
|
|
23
|
-
name: 'Type',
|
|
24
|
-
description: 'Set the field to display date, time or both',
|
|
25
|
-
control: {
|
|
26
|
-
type: 'radio',
|
|
27
|
-
},
|
|
28
|
-
options: ['Datetime', 'Date', 'Time'],
|
|
29
|
-
},
|
|
30
|
-
size: {
|
|
31
|
-
name: 'Size',
|
|
32
|
-
description: 'Switch between different sizes',
|
|
33
|
-
control: {
|
|
34
|
-
type: 'radio',
|
|
35
|
-
// todo: make consistent with other sizes, for example 'xs', 'sm', etc
|
|
36
|
-
},
|
|
37
|
-
options: ['Large', 'Medium', 'Small'],
|
|
38
|
-
},
|
|
39
|
-
minWidth: {
|
|
40
|
-
name: 'Min width',
|
|
41
|
-
description: 'Toggle min width',
|
|
42
|
-
control: {
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
disabled: {
|
|
47
|
-
description: 'Set textfield to disabled state',
|
|
48
|
-
name: 'Disabled',
|
|
49
|
-
control: {
|
|
50
|
-
type: 'boolean',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
label: {
|
|
54
|
-
description: 'Label text for specific textfield',
|
|
55
|
-
name: 'Label text',
|
|
56
|
-
control: {
|
|
57
|
-
type: 'text',
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
helper: {
|
|
61
|
-
name: 'Helper text',
|
|
62
|
-
description: 'Add helper text for the textfield',
|
|
63
|
-
control: {
|
|
64
|
-
type: 'text',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
state: {
|
|
68
|
-
name: 'State',
|
|
69
|
-
description: 'Switch between success or error state',
|
|
70
|
-
control: {
|
|
71
|
-
type: 'radio',
|
|
72
|
-
},
|
|
73
|
-
options: ['None', 'Success', 'Error'],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
args: {
|
|
77
|
-
type: 'Datetime',
|
|
78
|
-
size: 'Large',
|
|
79
|
-
minWidth: 'Default',
|
|
80
|
-
disabled: false,
|
|
81
|
-
state: 'None',
|
|
82
|
-
label: 'Label text',
|
|
83
|
-
helper: 'Helper text',
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
const datetimeTemplate = ({ type, size, minWidth, disabled, label, state, helper }) => {
|
|
87
|
-
const typeLookup = {
|
|
88
|
-
Datetime: 'datetime-local',
|
|
89
|
-
Date: 'date',
|
|
90
|
-
Time: 'time',
|
|
91
|
-
};
|
|
92
|
-
const sizeLookup = {
|
|
93
|
-
Large: 'lg',
|
|
94
|
-
Medium: 'md',
|
|
95
|
-
Small: 'sm',
|
|
96
|
-
};
|
|
97
|
-
const stateLookup = {
|
|
98
|
-
None: 'none',
|
|
99
|
-
Success: 'success',
|
|
100
|
-
Error: 'error',
|
|
101
|
-
};
|
|
102
|
-
return formatHtmlPreview(`
|
|
103
|
-
|
|
104
|
-
<style>
|
|
105
|
-
/* Note: Demo classes used here are just for demo purposes in Storybook */
|
|
106
|
-
.demo-wrapper {
|
|
107
|
-
width: 208px;
|
|
108
|
-
}
|
|
109
|
-
</style>
|
|
110
|
-
|
|
111
|
-
<div class="demo-wrapper">
|
|
112
|
-
|
|
113
|
-
<sdds-datetime
|
|
114
|
-
id="datetime"
|
|
115
|
-
type="${typeLookup[type]}"
|
|
116
|
-
size="${sizeLookup[size]}"
|
|
117
|
-
state="${stateLookup[state]}"
|
|
118
|
-
${disabled ? 'disabled' : ''}
|
|
119
|
-
${minWidth ? 'no-min-width' : ''}>
|
|
120
|
-
${label ? `<label slot='sdds-label'>${label}</label>` : ''}
|
|
121
|
-
${helper ? `<span slot='sdds-helper'>${helper}</span>` : ''}
|
|
122
|
-
</sdds-datetime>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
<script>
|
|
126
|
-
/* You can listen for the 'customChange' event to get value updates. */
|
|
127
|
-
const datetimeEl = document.getElementById('datetime');
|
|
128
|
-
datetimeEl.addEventListener('customChange', (event) => {
|
|
129
|
-
console.log(event.target.value);
|
|
130
|
-
});
|
|
131
|
-
</script>
|
|
132
|
-
</div>`);
|
|
133
|
-
};
|
|
134
|
-
export const Default = datetimeTemplate.bind({});
|
|
135
|
-
Default.args = {};
|
|
136
|
-
export const ErrorState = datetimeTemplate.bind({});
|
|
137
|
-
ErrorState.args = {
|
|
138
|
-
state: 'Error',
|
|
139
|
-
helper: 'Helper text',
|
|
140
|
-
label: 'Label text',
|
|
141
|
-
};
|
|
142
|
-
export const Time = datetimeTemplate.bind({});
|
|
143
|
-
Time.args = {
|
|
144
|
-
type: 'time',
|
|
145
|
-
};
|
|
146
|
-
export const Date = datetimeTemplate.bind({});
|
|
147
|
-
Date.args = {
|
|
148
|
-
type: 'date',
|
|
149
|
-
};
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { formatHtmlPreview } from '../../utils/utils';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'Components/Divider',
|
|
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=993%3A47555&t=M7Ova7xZaoeMwb5e-1',
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
name: 'Link',
|
|
14
|
-
type: 'link',
|
|
15
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=993%3A47555&t=M7Ova7xZaoeMwb5e-1',
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
argTypes: {
|
|
20
|
-
style: {
|
|
21
|
-
name: 'Style',
|
|
22
|
-
description: 'Set the style of the divider.',
|
|
23
|
-
control: {
|
|
24
|
-
type: 'select',
|
|
25
|
-
},
|
|
26
|
-
options: ['Light', 'Dark', 'Coloured'],
|
|
27
|
-
},
|
|
28
|
-
type: {
|
|
29
|
-
name: 'Type',
|
|
30
|
-
description: 'Choose divider type.',
|
|
31
|
-
control: {
|
|
32
|
-
type: 'radio',
|
|
33
|
-
},
|
|
34
|
-
options: ['Horizontal', 'Vertical', 'Border'],
|
|
35
|
-
},
|
|
36
|
-
width: {
|
|
37
|
-
name: 'Width',
|
|
38
|
-
description: 'Choose divider width.',
|
|
39
|
-
control: {
|
|
40
|
-
type: 'number',
|
|
41
|
-
},
|
|
42
|
-
if: { arg: 'type', eq: 'Horizontal' },
|
|
43
|
-
},
|
|
44
|
-
height: {
|
|
45
|
-
name: 'Height',
|
|
46
|
-
description: 'Choose divider height.',
|
|
47
|
-
control: {
|
|
48
|
-
type: 'number',
|
|
49
|
-
},
|
|
50
|
-
if: { arg: 'type', eq: 'Vertical' },
|
|
51
|
-
},
|
|
52
|
-
direction: {
|
|
53
|
-
name: 'Direction',
|
|
54
|
-
description: 'Set the direction of the divider',
|
|
55
|
-
control: {
|
|
56
|
-
type: 'select',
|
|
57
|
-
},
|
|
58
|
-
options: ['Top', 'Right', 'Bottom', 'Left'],
|
|
59
|
-
if: { arg: 'type', eq: 'Border' },
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
args: {
|
|
63
|
-
style: 'Dark',
|
|
64
|
-
type: 'Horizontal',
|
|
65
|
-
width: 100,
|
|
66
|
-
height: 100,
|
|
67
|
-
direction: 'Top',
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
const styleLookup = {
|
|
71
|
-
Light: 'light',
|
|
72
|
-
Dark: 'dark',
|
|
73
|
-
Coloured: 'coloured',
|
|
74
|
-
};
|
|
75
|
-
const directionLookup = {
|
|
76
|
-
Top: 'top',
|
|
77
|
-
Right: 'right',
|
|
78
|
-
Bottom: 'bottom',
|
|
79
|
-
Left: 'left',
|
|
80
|
-
};
|
|
81
|
-
const Template = ({ type, style, width, direction, height }) => {
|
|
82
|
-
const classLookup = {
|
|
83
|
-
Horizontal: `sdds-divider-${styleLookup[style]}`,
|
|
84
|
-
Vertical: `sdds-divider-${styleLookup[style]}-vertical`,
|
|
85
|
-
Border: `divider-border-demo sdds-divider-${styleLookup[style]}-border-${directionLookup[direction]}`,
|
|
86
|
-
};
|
|
87
|
-
return formatHtmlPreview(`
|
|
88
|
-
<style>
|
|
89
|
-
${direction
|
|
90
|
-
? `/* demo-wrapper is for demonstration purposes only*/
|
|
91
|
-
.demo-wrapper {
|
|
92
|
-
height: 200px;
|
|
93
|
-
width: 200px;
|
|
94
|
-
background-color: var(--sdds-grey-100);
|
|
95
|
-
}
|
|
96
|
-
`
|
|
97
|
-
: ''} ${height
|
|
98
|
-
? `/* demo-wrapper is for demonstration purposes only*/
|
|
99
|
-
.demo-wrapper {
|
|
100
|
-
height: ${height}px;
|
|
101
|
-
}`
|
|
102
|
-
: ''} ${width
|
|
103
|
-
? `/* demo-wrapper is for demonstration purposes only*/
|
|
104
|
-
.demo-wrapper {
|
|
105
|
-
width: ${width}px;
|
|
106
|
-
}`
|
|
107
|
-
: ''}
|
|
108
|
-
</style>
|
|
109
|
-
|
|
110
|
-
<div
|
|
111
|
-
class="${classLookup[type]} demo-wrapper ">
|
|
112
|
-
${direction ? 'DEMO' : ''}</div>
|
|
113
|
-
`);
|
|
114
|
-
};
|
|
115
|
-
export const Default = Template.bind({});
|
|
116
|
-
Default.args = {};
|