@scania/tegel 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/tds-dropdown.cjs.entry.js +17 -13
- package/dist/cjs/tds-header-cell.cjs.entry.js +2 -2
- package/dist/cjs/tds-icon.cjs.entry.js +3 -2
- package/dist/cjs/tds-modal.cjs.entry.js +1 -1
- package/dist/cjs/tegel.cjs.js +1 -1
- package/dist/collection/components/dropdown/dropdown.css +1 -0
- package/dist/collection/components/dropdown/dropdown.js +16 -12
- package/dist/collection/components/icon/icon.js +23 -5
- package/dist/collection/components/modal/modal.css +1 -1
- package/dist/collection/components/table/table-header-cell/table-header-cell.js +13 -10
- package/dist/components/icon.js +4 -2
- package/dist/components/tds-dropdown.js +17 -13
- package/dist/components/tds-header-cell.js +2 -2
- package/dist/components/tds-modal.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tds-dropdown.entry.js +17 -13
- package/dist/esm/tds-header-cell.entry.js +2 -2
- package/dist/esm/tds-icon.entry.js +3 -2
- package/dist/esm/tds-modal.entry.js +1 -1
- package/dist/esm/tegel.js +1 -1
- package/dist/tegel/p-15f8ac46.entry.js +1 -0
- package/dist/tegel/p-3b597a64.entry.js +1 -0
- package/dist/tegel/{p-6dc8f2dd.entry.js → p-78853c02.entry.js} +1 -1
- package/dist/tegel/p-7d93c35b.entry.js +1 -0
- package/dist/tegel/tegel.esm.js +1 -1
- package/dist/types/components/dropdown/dropdown.d.ts +2 -0
- package/dist/types/components/icon/icon.d.ts +6 -3
- package/dist/types/components/table/table-header-cell/table-header-cell.d.ts +14 -8
- package/dist/types/components.d.ts +20 -12
- package/package.json +1 -1
- package/dist/collection/components/accordion/accordion.stories.js +0 -100
- package/dist/collection/components/accordion/test/basic/accordion.e2e.js +0 -19
- package/dist/collection/components/accordion/test/disabled/accordion.e2e.js +0 -19
- package/dist/collection/components/accordion/test/expanded/accordion.e2e.js +0 -24
- package/dist/collection/components/accordion/test/padding-reset/accordion.e2e.js +0 -24
- package/dist/collection/components/badge/badge.stories.js +0 -106
- package/dist/collection/components/badge/test/basic/badge.e2e.js +0 -10
- package/dist/collection/components/badge/test/value/badge.e2e.js +0 -11
- package/dist/collection/components/banner/banner.stories.js +0 -92
- package/dist/collection/components/banner/test/basic/banner.e2e.js +0 -15
- package/dist/collection/components/banner/test/default/banner.e2e.js +0 -37
- package/dist/collection/components/banner/test/error/banner.e2e.js +0 -15
- package/dist/collection/components/banner/test/information/banner.e2e.js +0 -15
- package/dist/collection/components/block/block.stories.js +0 -49
- package/dist/collection/components/breadcrumbs/breadcrumbs.stories.js +0 -36
- package/dist/collection/components/breadcrumbs/test/default/breadcrumbs.e2e.js +0 -33
- package/dist/collection/components/button/button.stories.js +0 -185
- package/dist/collection/components/button/test/basic/button.e2e.js +0 -35
- package/dist/collection/components/button/test/danger/button.e2e.js +0 -18
- package/dist/collection/components/button/test/disabled/button.e2e.js +0 -24
- package/dist/collection/components/button/test/ghost/button.e2e.js +0 -18
- package/dist/collection/components/button/test/icon/button.e2e.js +0 -38
- package/dist/collection/components/button/test/secondary/button.e2e.js +0 -18
- package/dist/collection/components/card/card.stories.js +0 -163
- package/dist/collection/components/card/test/basic/card.e2e.js +0 -10
- package/dist/collection/components/card/test/clickable/card.e2e.js +0 -21
- package/dist/collection/components/card/test/default/card.e2e.js +0 -33
- package/dist/collection/components/checkbox/checkbox.stories.js +0 -93
- package/dist/collection/components/chip/chip.stories.js +0 -230
- package/dist/collection/components/datetime/datetime.stories.js +0 -219
- package/dist/collection/components/divider/divider.stories.js +0 -62
- package/dist/collection/components/dropdown/dropdown.stories.js +0 -260
- package/dist/collection/components/dropdown/test/basic/dropdown.e2e.js +0 -41
- package/dist/collection/components/dropdown/test/default/dropdown.e2e.js +0 -76
- package/dist/collection/components/dropdown/test/error/dropdown.e2e.js +0 -36
- package/dist/collection/components/dropdown/test/filter/dropdown.e2e.js +0 -56
- package/dist/collection/components/dropdown/test/filter/hide-no-result-message/dropdown.e2e.js +0 -23
- package/dist/collection/components/dropdown/test/filter/normalize-text-false/dropdown.e2e.js +0 -43
- package/dist/collection/components/dropdown/test/multiselect/dropdown.e2e.js +0 -81
- package/dist/collection/components/footer/footer.stories.js +0 -145
- package/dist/collection/components/footer/test/default/footer.e2e.js +0 -34
- package/dist/collection/components/header/header.stories.js +0 -82
- package/dist/collection/components/header/test/default/header.e2e.js +0 -44
- package/dist/collection/components/icon/icon.stories.js +0 -48
- package/dist/collection/components/link/link.stories.js +0 -59
- package/dist/collection/components/message/message.stories.js +0 -109
- package/dist/collection/components/message/test/basic/message.e2e.js +0 -16
- package/dist/collection/components/message/test/error/message.e2e.js +0 -28
- package/dist/collection/components/message/test/information/message.e2e.js +0 -10
- package/dist/collection/components/message/test/success/message.e2e.js +0 -10
- package/dist/collection/components/message/test/warning/message.e2e.js +0 -10
- package/dist/collection/components/modal/modal.stories.js +0 -119
- package/dist/collection/components/modal/test/default/modal.e2e.js +0 -28
- package/dist/collection/components/modal/test/open-close/modal.e2e.js +0 -63
- package/dist/collection/components/modal/test/prevent-true/modal.e2e.js +0 -13
- package/dist/collection/components/popover-canvas/popover-canvas.stories.js +0 -92
- package/dist/collection/components/popover-canvas/test/default/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-canvas/test/show-false/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-canvas/test/show-true/popover-canvas.e2e.js +0 -30
- package/dist/collection/components/popover-menu/popover-menu.stories.js +0 -146
- package/dist/collection/components/popover-menu/test/default/popover-menu.e2e.js +0 -60
- package/dist/collection/components/popover-menu/test/icons-fluid/popover-menu.e2e.js +0 -27
- package/dist/collection/components/popover-menu/test/show/popover-menu.e2e.js +0 -20
- package/dist/collection/components/popover-menu/test/show-false/popover-menu.e2e.js +0 -20
- package/dist/collection/components/radio-button/radio-button.stories.js +0 -91
- package/dist/collection/components/side-menu/side-menu.stories.js +0 -224
- package/dist/collection/components/side-menu/test/collapsible/side-menu.e2e.js +0 -28
- package/dist/collection/components/side-menu/test/default/side-menu.e2e.js +0 -38
- package/dist/collection/components/slider/slider.stories.js +0 -243
- package/dist/collection/components/spinner/spinner.stories.js +0 -61
- package/dist/collection/components/stepper/stepper.stories.js +0 -95
- package/dist/collection/components/table/table/test/batch/table.e2e.js +0 -24
- package/dist/collection/components/table/table/test/default/table.e2e.js +0 -46
- package/dist/collection/components/table/table/test/expandable-row/table.e2e.js +0 -64
- package/dist/collection/components/table/table/test/filtering/table.e2e.js +0 -41
- package/dist/collection/components/table/table/test/multiselect/table.e2e.js +0 -47
- package/dist/collection/components/table/table/test/pagination/table.e2e.js +0 -53
- package/dist/collection/components/table/table/test/sorting/table.e2e.js +0 -36
- package/dist/collection/components/table/table-component-basic.stories.js +0 -184
- package/dist/collection/components/table/table-component-batch-actions.stories.js +0 -188
- package/dist/collection/components/table/table-component-custom-width.stories.js +0 -174
- package/dist/collection/components/table/table-component-expandable-rows.stories.js +0 -160
- package/dist/collection/components/table/table-component-filtering.stories.js +0 -195
- package/dist/collection/components/table/table-component-multiselect.stories.js +0 -211
- package/dist/collection/components/table/table-component-pagination.stories.js +0 -196
- package/dist/collection/components/table/table-component-sorting.stories.js +0 -240
- package/dist/collection/components/tabs/folder-tabs/folder-tabs.stories.js +0 -105
- package/dist/collection/components/tabs/inline-tabs/inline-tabs.stories.js +0 -99
- package/dist/collection/components/tabs/navigation-tabs/navigation-tabs.stories.js +0 -101
- package/dist/collection/components/text-field/text-field.stories.js +0 -247
- package/dist/collection/components/textarea/test/basic/textarea.e2e.js +0 -26
- package/dist/collection/components/textarea/test/default/textarea.e2e.js +0 -34
- package/dist/collection/components/textarea/test/read-only/textarea.e2e.js +0 -26
- package/dist/collection/components/textarea/textarea.stories.js +0 -188
- package/dist/collection/components/toast/toast.stories.js +0 -90
- package/dist/collection/components/toggle/toggle.stories.js +0 -95
- package/dist/collection/components/tooltip/tooltip.stories.js +0 -126
- package/dist/collection/stories/Installation/angular.stories.js +0 -111
- package/dist/collection/stories/Installation/javascript.stories.js +0 -99
- package/dist/collection/stories/Installation/react.stories.js +0 -117
- package/dist/collection/stories/announcements/announce-tegel.stories.js +0 -262
- package/dist/collection/stories/announcements/prefix-change.stories.js +0 -93
- package/dist/collection/stories/formatHtmlPreview.js +0 -10
- package/dist/collection/stories/foundations/color/color-brand.stories.js +0 -38
- package/dist/collection/stories/foundations/color/color-scales.stories.js +0 -71
- package/dist/collection/stories/foundations/color/color-semantic.stories.js +0 -40
- package/dist/collection/stories/foundations/grid/grid.stories.js +0 -386
- package/dist/collection/stories/foundations/spacing/spacing-element.stories.js +0 -100
- package/dist/collection/stories/foundations/spacing/spacing-layout.stories.js +0 -94
- package/dist/collection/stories/foundations/typography/typography-body.stories.js +0 -16
- package/dist/collection/stories/foundations/typography/typography-detail.stories.js +0 -17
- package/dist/collection/stories/foundations/typography/typography-headline.stories.js +0 -39
- package/dist/collection/stories/foundations/typography/typography-paragraph.stories.js +0 -12
- package/dist/collection/stories/patterns/navigation/navigation-basic.stories.js +0 -85
- package/dist/collection/stories/patterns/navigation/navigation-fewitems.stories.js +0 -259
- package/dist/collection/stories/patterns/navigation/navigation-manyitems.stories.js +0 -247
- package/dist/collection/stories/patterns/navigation/navigation-user-menu.stories.js +0 -140
- package/dist/collection/stories/tegel.stories.js +0 -283
- package/dist/collection/stories/utility/color/background-color.stories.js +0 -96
- package/dist/collection/stories/utility/color/text-color.stories.js +0 -94
- package/dist/tegel/p-556600b1.entry.js +0 -1
- package/dist/tegel/p-c6553022.entry.js +0 -1
- package/dist/tegel/p-f801cf0e.entry.js +0 -1
- package/dist/types/components/accordion/accordion.stories.d.ts +0 -77
- package/dist/types/components/badge/badge.stories.d.ts +0 -73
- package/dist/types/components/banner/banner.stories.d.ts +0 -69
- package/dist/types/components/block/block.stories.d.ts +0 -32
- package/dist/types/components/breadcrumbs/breadcrumbs.stories.d.ts +0 -16
- package/dist/types/components/button/button.stories.d.ts +0 -147
- package/dist/types/components/card/card.stories.d.ts +0 -128
- package/dist/types/components/checkbox/checkbox.stories.d.ts +0 -65
- package/dist/types/components/chip/chip.stories.d.ts +0 -99
- package/dist/types/components/datetime/datetime.stories.d.ts +0 -151
- package/dist/types/components/divider/divider.stories.d.ts +0 -58
- package/dist/types/components/dropdown/dropdown.stories.d.ts +0 -205
- package/dist/types/components/footer/footer.stories.d.ts +0 -44
- package/dist/types/components/header/header.stories.d.ts +0 -32
- package/dist/types/components/icon/icon.stories.d.ts +0 -36
- package/dist/types/components/link/link.stories.d.ts +0 -44
- package/dist/types/components/message/message.stories.d.ts +0 -88
- package/dist/types/components/modal/modal.stories.d.ts +0 -78
- package/dist/types/components/popover-canvas/popover-canvas.stories.d.ts +0 -27
- package/dist/types/components/popover-menu/popover-menu.stories.d.ts +0 -51
- package/dist/types/components/radio-button/radio-button.stories.d.ts +0 -39
- package/dist/types/components/side-menu/side-menu.stories.d.ts +0 -65
- package/dist/types/components/slider/slider.stories.d.ts +0 -235
- package/dist/types/components/spinner/spinner.stories.d.ts +0 -46
- package/dist/types/components/stepper/stepper.stories.d.ts +0 -80
- package/dist/types/components/table/table-component-basic.stories.d.ts +0 -144
- package/dist/types/components/table/table-component-batch-actions.stories.d.ts +0 -139
- package/dist/types/components/table/table-component-custom-width.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-expandable-rows.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-filtering.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-multiselect.stories.d.ts +0 -147
- package/dist/types/components/table/table-component-pagination.stories.d.ts +0 -131
- package/dist/types/components/table/table-component-sorting.stories.d.ts +0 -183
- package/dist/types/components/tabs/folder-tabs/folder-tabs.stories.d.ts +0 -69
- package/dist/types/components/tabs/inline-tabs/inline-tabs.stories.d.ts +0 -61
- package/dist/types/components/tabs/navigation-tabs/navigation-tabs.stories.d.ts +0 -61
- package/dist/types/components/text-field/text-field.stories.d.ts +0 -201
- package/dist/types/components/textarea/textarea.stories.d.ts +0 -139
- package/dist/types/components/toast/toast.stories.d.ts +0 -64
- package/dist/types/components/toggle/toggle.stories.d.ts +0 -74
- package/dist/types/components/tooltip/tooltip.stories.d.ts +0 -66
- package/dist/types/stories/Installation/angular.stories.d.ts +0 -6
- package/dist/types/stories/Installation/javascript.stories.d.ts +0 -7
- package/dist/types/stories/Installation/react.stories.d.ts +0 -6
- package/dist/types/stories/announcements/announce-tegel.stories.d.ts +0 -6
- package/dist/types/stories/announcements/prefix-change.stories.d.ts +0 -6
- package/dist/types/stories/formatHtmlPreview.d.ts +0 -2
- package/dist/types/stories/foundations/color/color-brand.stories.d.ts +0 -13
- package/dist/types/stories/foundations/color/color-scales.stories.d.ts +0 -30
- package/dist/types/stories/foundations/color/color-semantic.stories.d.ts +0 -13
- package/dist/types/stories/foundations/grid/grid.stories.d.ts +0 -35
- package/dist/types/stories/foundations/spacing/spacing-element.stories.d.ts +0 -8
- package/dist/types/stories/foundations/spacing/spacing-layout.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-body.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-detail.stories.d.ts +0 -8
- package/dist/types/stories/foundations/typography/typography-headline.stories.d.ts +0 -21
- package/dist/types/stories/foundations/typography/typography-paragraph.stories.d.ts +0 -8
- package/dist/types/stories/patterns/navigation/navigation-basic.stories.d.ts +0 -23
- package/dist/types/stories/patterns/navigation/navigation-fewitems.stories.d.ts +0 -23
- package/dist/types/stories/patterns/navigation/navigation-manyitems.stories.d.ts +0 -38
- package/dist/types/stories/patterns/navigation/navigation-user-menu.stories.d.ts +0 -33
- package/dist/types/stories/tegel.stories.d.ts +0 -6
- package/dist/types/stories/utility/color/background-color.stories.d.ts +0 -64
- package/dist/types/stories/utility/color/text-color.stories.d.ts +0 -64
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import readme from "./readme.md";
|
|
2
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
3
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
4
|
-
export default {
|
|
5
|
-
title: `${ComponentsFolder}/Text Field`,
|
|
6
|
-
parameters: {
|
|
7
|
-
notes: readme,
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
design: [
|
|
10
|
-
{
|
|
11
|
-
name: 'Figma',
|
|
12
|
-
type: 'figma',
|
|
13
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1675%3A76544&t=Ne6myqwca5m00de7-1',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'Link',
|
|
17
|
-
type: 'link',
|
|
18
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1675%3A76544&t=Ne6myqwca5m00de7-1',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
modeVariant: {
|
|
24
|
-
name: 'Mode variant',
|
|
25
|
-
description: 'Mode variant adjusts component colors to have better visibility depending on global mode and background.',
|
|
26
|
-
control: {
|
|
27
|
-
type: 'radio',
|
|
28
|
-
},
|
|
29
|
-
options: ['Inherit from parent', 'Primary', 'Secondary'],
|
|
30
|
-
table: {
|
|
31
|
-
defaultValue: { summary: 'Inherit from parent' },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
state: {
|
|
35
|
-
name: 'State',
|
|
36
|
-
description: 'Switches between success and error state.',
|
|
37
|
-
control: {
|
|
38
|
-
type: 'radio',
|
|
39
|
-
},
|
|
40
|
-
options: ['Default', 'Success', 'Error'],
|
|
41
|
-
table: {
|
|
42
|
-
defaultValue: { summary: 'default' },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
type: {
|
|
46
|
-
name: 'Type',
|
|
47
|
-
description: 'Which type of Text Field',
|
|
48
|
-
control: {
|
|
49
|
-
type: 'radio',
|
|
50
|
-
},
|
|
51
|
-
options: ['Text', 'Password'],
|
|
52
|
-
table: {
|
|
53
|
-
defaultValue: { summary: 'text' },
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
size: {
|
|
57
|
-
name: 'Size',
|
|
58
|
-
description: 'Switches between different sizes.',
|
|
59
|
-
control: {
|
|
60
|
-
type: 'radio',
|
|
61
|
-
},
|
|
62
|
-
options: ['Large', 'Medium', 'Small'],
|
|
63
|
-
table: {
|
|
64
|
-
defaultValue: { summary: 'lg' },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
label: {
|
|
68
|
-
name: 'Label text',
|
|
69
|
-
description: 'Sets the label text.',
|
|
70
|
-
control: {
|
|
71
|
-
type: 'text',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
labelPosition: {
|
|
75
|
-
name: 'Label position',
|
|
76
|
-
description: 'Sets the label text position.',
|
|
77
|
-
control: {
|
|
78
|
-
type: 'radio',
|
|
79
|
-
},
|
|
80
|
-
options: ['No label', 'Inside', 'Outside'],
|
|
81
|
-
table: {
|
|
82
|
-
defaultValue: { summary: 'no-label' },
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
placeholderText: {
|
|
86
|
-
name: 'Placeholder',
|
|
87
|
-
description: 'Sets the placeholder text.',
|
|
88
|
-
control: {
|
|
89
|
-
type: 'text',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
helper: {
|
|
93
|
-
name: 'Helper text',
|
|
94
|
-
description: 'Sets the helper text.',
|
|
95
|
-
control: {
|
|
96
|
-
type: 'text',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
prefix: {
|
|
100
|
-
name: 'Prefix',
|
|
101
|
-
description: 'Adds a prefix symbol or text before the Text Field.',
|
|
102
|
-
control: {
|
|
103
|
-
type: 'boolean',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
prefixType: {
|
|
107
|
-
name: 'Prefix type',
|
|
108
|
-
description: 'Switches between icon and text for the prefix.',
|
|
109
|
-
control: {
|
|
110
|
-
type: 'radio',
|
|
111
|
-
},
|
|
112
|
-
options: ['Icon', 'Text'],
|
|
113
|
-
if: { arg: 'prefix', eq: true },
|
|
114
|
-
},
|
|
115
|
-
suffix: {
|
|
116
|
-
name: 'Suffix',
|
|
117
|
-
description: 'Adds a suffix symbol or text after the Text Field.',
|
|
118
|
-
control: {
|
|
119
|
-
type: 'boolean',
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
suffixType: {
|
|
123
|
-
name: 'Suffix type',
|
|
124
|
-
description: 'Swithces between icon or text for the suffix.',
|
|
125
|
-
control: {
|
|
126
|
-
type: 'radio',
|
|
127
|
-
},
|
|
128
|
-
options: ['Icon', 'Text'],
|
|
129
|
-
if: { arg: 'suffix', eq: true },
|
|
130
|
-
},
|
|
131
|
-
maxLength: {
|
|
132
|
-
name: 'Max length',
|
|
133
|
-
description: 'Sets a maximum value of how long the text can be.',
|
|
134
|
-
control: {
|
|
135
|
-
type: 'number',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
noMinWidth: {
|
|
139
|
-
name: 'No minimum width',
|
|
140
|
-
description: 'Enables component to shrink below 208px which is the default width.',
|
|
141
|
-
control: {
|
|
142
|
-
type: 'boolean',
|
|
143
|
-
},
|
|
144
|
-
table: {
|
|
145
|
-
defaultValue: { summary: false },
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
readonly: {
|
|
149
|
-
description: 'Sets the Text Field to read-only state.',
|
|
150
|
-
name: 'Read Only',
|
|
151
|
-
control: {
|
|
152
|
-
type: 'boolean',
|
|
153
|
-
},
|
|
154
|
-
table: {
|
|
155
|
-
defaultValue: { summary: false },
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
disabled: {
|
|
159
|
-
description: 'Disables the Text Field.',
|
|
160
|
-
name: 'Disabled',
|
|
161
|
-
control: {
|
|
162
|
-
type: 'boolean',
|
|
163
|
-
},
|
|
164
|
-
table: {
|
|
165
|
-
defaultValue: { summary: false },
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
args: {
|
|
170
|
-
modeVariant: 'Inherit from parent',
|
|
171
|
-
state: 'Default',
|
|
172
|
-
type: 'Text',
|
|
173
|
-
size: 'Large',
|
|
174
|
-
label: 'Label',
|
|
175
|
-
labelPosition: 'No label',
|
|
176
|
-
placeholderText: 'Placeholder',
|
|
177
|
-
helper: '',
|
|
178
|
-
prefix: false,
|
|
179
|
-
prefixType: 'Icon',
|
|
180
|
-
suffix: false,
|
|
181
|
-
suffixType: 'Icon',
|
|
182
|
-
maxLength: 0,
|
|
183
|
-
noMinWidth: 'Default',
|
|
184
|
-
readonly: false,
|
|
185
|
-
disabled: false,
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
const Template = ({ modeVariant, state, type, size, label, labelPosition, placeholderText, helper, prefix, prefixType, suffix, suffixType, maxLength, noMinWidth, readonly, disabled, }) => {
|
|
189
|
-
const maxlength = maxLength > 0 ? `max-length="${maxLength}"` : '';
|
|
190
|
-
const stateValue = state.toLowerCase();
|
|
191
|
-
const sizeLookUp = {
|
|
192
|
-
Large: 'lg',
|
|
193
|
-
Medium: 'md',
|
|
194
|
-
Small: 'sm',
|
|
195
|
-
};
|
|
196
|
-
return formatHtmlPreview(`
|
|
197
|
-
<style>
|
|
198
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
199
|
-
.demo-wrapper {
|
|
200
|
-
width: 200px;
|
|
201
|
-
height: 150px;
|
|
202
|
-
}
|
|
203
|
-
</style>
|
|
204
|
-
|
|
205
|
-
<div class="demo-wrapper">
|
|
206
|
-
<tds-text-field
|
|
207
|
-
type="${type.toLowerCase()}"
|
|
208
|
-
size="${sizeLookUp[size]}"
|
|
209
|
-
${modeVariant !== 'Inherit from parent' ? `mode-variant="${modeVariant.toLowerCase()}"` : ''}
|
|
210
|
-
state="${stateValue}"
|
|
211
|
-
label="${label}"
|
|
212
|
-
label-position="${labelPosition.toLowerCase()}"
|
|
213
|
-
${helper ? `helper="${helper}"` : ''}
|
|
214
|
-
${maxlength}
|
|
215
|
-
${disabled ? 'disabled' : ''}
|
|
216
|
-
${readonly ? 'read-only' : ''}
|
|
217
|
-
${noMinWidth ? 'no-min-width' : ''}
|
|
218
|
-
placeholder="${placeholderText}" >
|
|
219
|
-
${prefix || suffix
|
|
220
|
-
? `
|
|
221
|
-
${prefixType || suffixType === 'Text'
|
|
222
|
-
? `<span slot="${prefix ? 'prefix' : 'suffix'}">$</span>`
|
|
223
|
-
: `<tds-icon slot="${prefix ? 'prefix' : 'suffix'}" name="truck" size="20px"></tds-icon>`}
|
|
224
|
-
`
|
|
225
|
-
: ''}
|
|
226
|
-
|
|
227
|
-
</tds-text-field>
|
|
228
|
-
</div>
|
|
229
|
-
<!-- Script tag for demo purposes -->
|
|
230
|
-
<script>
|
|
231
|
-
textElement = document.querySelector('tds-text-field')
|
|
232
|
-
textElement.addEventListener('tdsFocus',(event) => {
|
|
233
|
-
console.log(event)
|
|
234
|
-
})
|
|
235
|
-
textElement.addEventListener('tdsBlur',(event) => {
|
|
236
|
-
console.log(event)
|
|
237
|
-
})
|
|
238
|
-
textElement.addEventListener('tdsInput',(event) => {
|
|
239
|
-
console.log(event)
|
|
240
|
-
})
|
|
241
|
-
textElement.addEventListener('tdsChange',(event) => {
|
|
242
|
-
console.log(event)
|
|
243
|
-
})
|
|
244
|
-
</script>
|
|
245
|
-
`);
|
|
246
|
-
};
|
|
247
|
-
export const Default = Template.bind({});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/textarea/test/basic/index.html';
|
|
4
|
-
test.describe('tds-textarea', () => {
|
|
5
|
-
test('renders default textarea correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const tdsTextarea = page.getByTestId('tds-textarea-testid');
|
|
8
|
-
await expect(tdsTextarea).toHaveCount(1);
|
|
9
|
-
/* Expect no difference in screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('test if able to type in textarea', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const textarea = page.getByRole('textbox');
|
|
15
|
-
/* Expect to have received an event from clicking on the textarea */
|
|
16
|
-
const myEventSpy = await page.spyOnEvent('click');
|
|
17
|
-
await textarea.click();
|
|
18
|
-
expect(myEventSpy).toHaveReceivedEvent();
|
|
19
|
-
/* Expect the textbox to have the cursor text style */
|
|
20
|
-
const textareaCursorState = await textarea.evaluate((style) => getComputedStyle(style).cursor);
|
|
21
|
-
expect(textareaCursorState).toBe('text');
|
|
22
|
-
/* Expect the inputValue of textarea to have "Adding some text" after it has been typed */
|
|
23
|
-
await textarea.fill('Adding some text');
|
|
24
|
-
expect(await textarea.inputValue()).toBe('Adding some text');
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/textarea/test/default/index.html';
|
|
4
|
-
test.describe('tds-textarea-default', () => {
|
|
5
|
-
test('renders default textarea correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const tdsTextarea = page.getByTestId('tds-textarea-testid');
|
|
8
|
-
await expect(tdsTextarea).toHaveCount(1);
|
|
9
|
-
/* Expect no difference in screenshot */
|
|
10
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
11
|
-
});
|
|
12
|
-
test('test if able to type in textarea', async ({ page }) => {
|
|
13
|
-
await page.goto(componentTestPath);
|
|
14
|
-
const textarea = page.getByRole('textbox');
|
|
15
|
-
/* Expect to have received an event from clicking on the textarea */
|
|
16
|
-
const myEventSpy = await page.spyOnEvent('click');
|
|
17
|
-
await textarea.click();
|
|
18
|
-
expect(myEventSpy).toHaveReceivedEvent();
|
|
19
|
-
/* Expect the textbox to have the cursor text style */
|
|
20
|
-
const textareaCursorState = await textarea.evaluate((style) => getComputedStyle(style).cursor);
|
|
21
|
-
expect(textareaCursorState).toBe('text');
|
|
22
|
-
/* Expect the inputValue of textarea to have "Adding some text" after it has been typed */
|
|
23
|
-
await textarea.fill('Adding some text');
|
|
24
|
-
expect(await textarea.inputValue()).toBe('Adding some text');
|
|
25
|
-
/* Expect no difference in screenshot */
|
|
26
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
27
|
-
});
|
|
28
|
-
test('not able to find label if "no-label" is set', async ({ page }) => {
|
|
29
|
-
await page.goto(componentTestPath);
|
|
30
|
-
const textareaLabel = page.getByText('Label');
|
|
31
|
-
await expect(textareaLabel).toHaveCount(0);
|
|
32
|
-
await expect(textareaLabel).toBeHidden();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { test } from "stencil-playwright";
|
|
2
|
-
import { expect } from "@playwright/test";
|
|
3
|
-
const componentTestPath = 'src/components/textarea/test/read-only/index.html';
|
|
4
|
-
test.describe('tds-textarea-read-only', () => {
|
|
5
|
-
test('renders read-only textarea correctly', async ({ page }) => {
|
|
6
|
-
await page.goto(componentTestPath);
|
|
7
|
-
const tdsTextarea = page.getByTestId('tds-textarea-testid');
|
|
8
|
-
await expect(tdsTextarea).toHaveCount(1);
|
|
9
|
-
/* Expect the tds-textarea to have the read-only attribute */
|
|
10
|
-
await expect(tdsTextarea).toHaveAttribute('read-only');
|
|
11
|
-
/* Expect no diff on screenshot */
|
|
12
|
-
await expect(page).toHaveScreenshot({ maxDiffPixels: 0 });
|
|
13
|
-
});
|
|
14
|
-
test('read-only textarea - native textarea should have readonly attribute', async ({ page }) => {
|
|
15
|
-
await page.goto(componentTestPath);
|
|
16
|
-
const textarea = page.getByRole('textbox');
|
|
17
|
-
/* Expect the textarea within tds-textarea to have the readonly attribute */
|
|
18
|
-
await expect(textarea).toHaveAttribute('readonly');
|
|
19
|
-
});
|
|
20
|
-
test('be able to find label if "outside" is set', async ({ page }) => {
|
|
21
|
-
await page.goto(componentTestPath);
|
|
22
|
-
const textareaLabel = page.getByText('Label');
|
|
23
|
-
await expect(textareaLabel).toHaveCount(1);
|
|
24
|
-
await expect(textareaLabel).toBeVisible();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import readme from "./readme.md";
|
|
2
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
3
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
4
|
-
export default {
|
|
5
|
-
title: `${ComponentsFolder}/Textarea`,
|
|
6
|
-
parameters: {
|
|
7
|
-
notes: readme,
|
|
8
|
-
layout: 'centered',
|
|
9
|
-
design: [
|
|
10
|
-
{
|
|
11
|
-
name: 'Figma',
|
|
12
|
-
type: 'figma',
|
|
13
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1828%3A85238&t=Ne6myqwca5m00de7-1',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'Link',
|
|
17
|
-
type: 'link',
|
|
18
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=1828%3A85238&t=Ne6myqwca5m00de7-1',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
modeVariant: {
|
|
24
|
-
name: 'Mode variant',
|
|
25
|
-
description: 'Mode variant adjusts component colors to have better visibility depending on global mode and background.',
|
|
26
|
-
control: {
|
|
27
|
-
type: 'radio',
|
|
28
|
-
},
|
|
29
|
-
options: ['Inherit from parent', 'Primary', 'Secondary'],
|
|
30
|
-
table: {
|
|
31
|
-
defaultValue: { summary: 'Inherit from parent' },
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
state: {
|
|
35
|
-
name: 'State',
|
|
36
|
-
description: 'Switches between success and error state.',
|
|
37
|
-
control: {
|
|
38
|
-
type: 'radio',
|
|
39
|
-
},
|
|
40
|
-
options: ['Default', 'Success', 'Error'],
|
|
41
|
-
table: {
|
|
42
|
-
defaultValue: { summary: 'default' },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
label: {
|
|
46
|
-
name: 'Label text',
|
|
47
|
-
description: 'Sets the label text.',
|
|
48
|
-
control: {
|
|
49
|
-
type: 'text',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
labelPosition: {
|
|
53
|
-
name: 'Label position',
|
|
54
|
-
description: 'Sets the label text position.',
|
|
55
|
-
control: {
|
|
56
|
-
type: 'radio',
|
|
57
|
-
},
|
|
58
|
-
options: ['No label', 'Inside', 'Outside'],
|
|
59
|
-
table: {
|
|
60
|
-
defaultValue: { summary: 'no-label' },
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
placeholder: {
|
|
64
|
-
name: 'Placeholder',
|
|
65
|
-
description: 'Sets the placeholder text.',
|
|
66
|
-
control: {
|
|
67
|
-
type: 'text',
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
helper: {
|
|
71
|
-
name: 'Helper text',
|
|
72
|
-
description: 'Sets the helper text.',
|
|
73
|
-
control: {
|
|
74
|
-
type: 'text',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
rows: {
|
|
78
|
-
name: 'Rows',
|
|
79
|
-
description: 'Sets the number of rows.',
|
|
80
|
-
control: {
|
|
81
|
-
type: 'number',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
maxLength: {
|
|
85
|
-
name: 'Max length',
|
|
86
|
-
description: 'Sets a maximum value of how long the text can be.',
|
|
87
|
-
control: {
|
|
88
|
-
type: 'number',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
noMinWidth: {
|
|
92
|
-
name: 'No minimum width',
|
|
93
|
-
description: 'Enables component to shrink below 208px which is the default width.',
|
|
94
|
-
control: {
|
|
95
|
-
type: 'boolean',
|
|
96
|
-
},
|
|
97
|
-
table: {
|
|
98
|
-
defaultValue: { summary: false },
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
readonly: {
|
|
102
|
-
name: 'Read only',
|
|
103
|
-
description: 'Sets the Textarea to read-only state.',
|
|
104
|
-
control: {
|
|
105
|
-
type: 'boolean',
|
|
106
|
-
},
|
|
107
|
-
table: {
|
|
108
|
-
defaultValue: { summary: false },
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
disabled: {
|
|
112
|
-
name: 'Disabled',
|
|
113
|
-
description: 'Disables the Textarea.',
|
|
114
|
-
control: {
|
|
115
|
-
type: 'boolean',
|
|
116
|
-
},
|
|
117
|
-
table: {
|
|
118
|
-
defaultValue: { summary: false },
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
args: {
|
|
123
|
-
modeVariant: 'Inherit from parent',
|
|
124
|
-
state: 'Default',
|
|
125
|
-
label: 'Label',
|
|
126
|
-
labelPosition: 'No label',
|
|
127
|
-
placeholder: 'Placeholder',
|
|
128
|
-
helper: '',
|
|
129
|
-
rows: 5,
|
|
130
|
-
maxLength: 0,
|
|
131
|
-
noMinWidth: false,
|
|
132
|
-
readonly: false,
|
|
133
|
-
disabled: false,
|
|
134
|
-
},
|
|
135
|
-
};
|
|
136
|
-
const Template = ({ modeVariant, state, label, labelPosition, placeholder, helper, rows, maxLength, noMinWidth, readonly, disabled, }) => {
|
|
137
|
-
const maxlength = maxLength > 0 ? `max-length="${maxLength}"` : '';
|
|
138
|
-
const stateValue = state.toLowerCase();
|
|
139
|
-
const labelPosLookup = {
|
|
140
|
-
'No label': 'no-label',
|
|
141
|
-
'Inside': 'inside',
|
|
142
|
-
'Outside': 'outside',
|
|
143
|
-
};
|
|
144
|
-
return formatHtmlPreview(`
|
|
145
|
-
<style>
|
|
146
|
-
/* demo-wrapper is for demonstration purposes only*/
|
|
147
|
-
.demo-wrapper {
|
|
148
|
-
width: 400px;
|
|
149
|
-
}
|
|
150
|
-
</style>
|
|
151
|
-
|
|
152
|
-
<div class="demo-wrapper">
|
|
153
|
-
<tds-textarea
|
|
154
|
-
rows="${rows}"
|
|
155
|
-
state="${stateValue}"
|
|
156
|
-
label="${label}"
|
|
157
|
-
helper="${helper}"
|
|
158
|
-
${modeVariant !== 'Inherit from parent'
|
|
159
|
-
? `mode-variant="${modeVariant.toLowerCase()}"`
|
|
160
|
-
: ''}
|
|
161
|
-
label-position="${labelPosLookup[labelPosition]}"
|
|
162
|
-
${disabled ? 'disabled' : ''}
|
|
163
|
-
${readonly ? 'read-only' : ''}
|
|
164
|
-
${noMinWidth ? 'no-min-width' : ''}
|
|
165
|
-
placeholder="${placeholder}"
|
|
166
|
-
${maxlength}>
|
|
167
|
-
</tds-textarea>
|
|
168
|
-
</div>
|
|
169
|
-
<!-- Script tag for demo purposes -->
|
|
170
|
-
<script>
|
|
171
|
-
textElement = document.querySelector('tds-textarea')
|
|
172
|
-
|
|
173
|
-
textElement.addEventListener('tdsFocus',(event) => {
|
|
174
|
-
console.log(event)
|
|
175
|
-
})
|
|
176
|
-
textElement.addEventListener('tdsBlur',(event) => {
|
|
177
|
-
console.log(event)
|
|
178
|
-
})
|
|
179
|
-
textElement.addEventListener('tdsInput',(event) => {
|
|
180
|
-
console.log(event)
|
|
181
|
-
})
|
|
182
|
-
textElement.addEventListener('tdsChange',(event) => {
|
|
183
|
-
console.log(event)
|
|
184
|
-
})
|
|
185
|
-
</script>
|
|
186
|
-
`);
|
|
187
|
-
};
|
|
188
|
-
export const Default = Template.bind({});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import formatHtmlPreview from "../../stories/formatHtmlPreview";
|
|
2
|
-
import readme from "./readme.md";
|
|
3
|
-
import { ComponentsFolder } from "../../utils/constants";
|
|
4
|
-
export default {
|
|
5
|
-
title: `${ComponentsFolder}/Toast`,
|
|
6
|
-
parameters: {
|
|
7
|
-
layout: 'centered',
|
|
8
|
-
notes: readme,
|
|
9
|
-
design: [
|
|
10
|
-
{
|
|
11
|
-
name: 'Figma',
|
|
12
|
-
type: 'figma',
|
|
13
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=5903%3A245536&t=Ne6myqwca5m00de7-1',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'Link',
|
|
17
|
-
type: 'link',
|
|
18
|
-
url: 'https://www.figma.com/file/d8bTgEx7h694MSesi2CTLF/Tegel-UI-Library?node-id=5903%3A245536&t=Ne6myqwca5m00de7-1',
|
|
19
|
-
},
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
argTypes: {
|
|
23
|
-
variant: {
|
|
24
|
-
name: 'Message variant',
|
|
25
|
-
description: 'Changes the variant of Toast.',
|
|
26
|
-
control: {
|
|
27
|
-
type: 'radio',
|
|
28
|
-
},
|
|
29
|
-
options: ['Information', 'Success', 'Warning', 'Error'],
|
|
30
|
-
table: {
|
|
31
|
-
defaultValue: {
|
|
32
|
-
summary: 'information',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
header: {
|
|
37
|
-
name: 'Header',
|
|
38
|
-
description: 'Adds a header text.',
|
|
39
|
-
control: {
|
|
40
|
-
type: 'text',
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
subheader: {
|
|
44
|
-
name: 'Subheader',
|
|
45
|
-
description: 'Adds a subheader text.',
|
|
46
|
-
control: {
|
|
47
|
-
type: 'text',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
actions: {
|
|
51
|
-
name: 'Actions slot',
|
|
52
|
-
description: 'Slot for the bottom part of the Toast, used for links.',
|
|
53
|
-
control: {
|
|
54
|
-
type: 'text',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
hidden: {
|
|
58
|
-
name: 'Hidden',
|
|
59
|
-
description: 'Hides the Toast.',
|
|
60
|
-
control: {
|
|
61
|
-
type: 'boolean',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
args: {
|
|
66
|
-
variant: 'Information',
|
|
67
|
-
header: 'Header',
|
|
68
|
-
subheader: 'Subheader',
|
|
69
|
-
actions: `<tds-link slot="actions">
|
|
70
|
-
<a href="https://tegel.scania.com/home" target="_blank">Tegel</a>
|
|
71
|
-
</tds-link>`,
|
|
72
|
-
hidden: false,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
const Template = ({ variant, header, subheader, actions, hidden }) => formatHtmlPreview(`<tds-toast
|
|
76
|
-
variant="${variant.toLowerCase()}"
|
|
77
|
-
header="${header}"
|
|
78
|
-
${subheader ? `subheader="${subheader}"` : ''}
|
|
79
|
-
${hidden ? 'hidden' : ''}
|
|
80
|
-
>
|
|
81
|
-
${actions || ''}
|
|
82
|
-
</tds-toast>
|
|
83
|
-
|
|
84
|
-
<script>
|
|
85
|
-
document.addEventListener('tdsClose', (event) => {
|
|
86
|
-
console.log(event)
|
|
87
|
-
})
|
|
88
|
-
</script>
|
|
89
|
-
`);
|
|
90
|
-
export const Default = Template.bind({});
|