@3t-transform/threeteeui 0.0.15 → 0.0.16
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-864b7110.js +1531 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +22 -0
- package/dist/cjs/tttx-button.cjs.entry.js +28 -0
- package/dist/cjs/tttx-checkbox.cjs.entry.js +28 -0
- package/dist/cjs/tttx-form.cjs.entry.js +374 -0
- package/dist/cjs/tttx-icon.cjs.entry.js +1863 -0
- package/dist/cjs/tttx-list.cjs.entry.js +198 -0
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +26 -0
- package/dist/cjs/tttx-popover-content.cjs.entry.js +23 -0
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +136 -0
- package/dist/cjs/tttx-table.cjs.entry.js +60 -0
- package/dist/cjs/tttx.cjs.js +23 -0
- package/dist/collection/collection-manifest.json +20 -0
- package/dist/collection/components/atoms/tttx-button/tttx-button.css +62 -0
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +93 -0
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +27 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +105 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +116 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +47 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.css +48 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +66 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -0
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.css +30 -0
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.js +96 -0
- package/dist/collection/components/atoms/tttx-popover-content/tttx-popover-content.stories.js +23 -0
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.css +181 -0
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.js +101 -0
- package/dist/collection/components/atoms/ttx-checkbox/tttx-checkbox.stories.js +13 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +230 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +451 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +109 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.css +56 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +311 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +37 -0
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +177 -0
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +569 -0
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +156 -0
- package/dist/collection/components/molecules/tttx-table/tttx-table.css +166 -0
- package/dist/collection/components/molecules/tttx-table/tttx-table.js +177 -0
- package/dist/collection/components/molecules/tttx-table/tttx-table.stories.js +81 -0
- package/dist/collection/components/palette.stories.js +88 -0
- package/dist/collection/docs/gettingstarted-developer.stories.js +9 -0
- package/dist/collection/icons.js +2838 -0
- package/dist/collection/index.js +1 -0
- package/dist/components/index.d.ts +39 -0
- package/dist/components/index.js +10 -0
- package/dist/components/tttx-button.d.ts +11 -0
- package/dist/components/tttx-button.js +45 -0
- package/dist/components/tttx-checkbox.d.ts +11 -0
- package/dist/components/tttx-checkbox.js +46 -0
- package/dist/components/tttx-form.d.ts +11 -0
- package/dist/components/tttx-form.js +391 -0
- package/dist/components/tttx-icon.d.ts +11 -0
- package/dist/components/tttx-icon.js +6 -0
- package/dist/components/tttx-icon2.js +1877 -0
- package/dist/components/tttx-list.d.ts +11 -0
- package/dist/components/tttx-list.js +225 -0
- package/dist/components/tttx-loading-spinner.d.ts +11 -0
- package/dist/components/tttx-loading-spinner.js +6 -0
- package/dist/components/tttx-loading-spinner2.js +40 -0
- package/dist/components/tttx-popover-content.d.ts +11 -0
- package/dist/components/tttx-popover-content.js +6 -0
- package/dist/components/tttx-popover-content2.js +39 -0
- package/dist/components/tttx-standalone-input.d.ts +11 -0
- package/dist/components/tttx-standalone-input.js +179 -0
- package/dist/components/tttx-table.d.ts +11 -0
- package/dist/components/tttx-table.js +91 -0
- package/dist/esm/index-232e347b.js +1502 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +18 -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/tttx-button.entry.js +24 -0
- package/dist/esm/tttx-checkbox.entry.js +24 -0
- package/dist/esm/tttx-form.entry.js +370 -0
- package/dist/esm/tttx-icon.entry.js +1859 -0
- package/dist/esm/tttx-list.entry.js +194 -0
- package/dist/esm/tttx-loading-spinner.entry.js +22 -0
- package/dist/esm/tttx-popover-content.entry.js +19 -0
- package/dist/esm/tttx-standalone-input.entry.js +132 -0
- package/dist/esm/tttx-table.entry.js +56 -0
- package/dist/esm/tttx.js +18 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/tttx/index.esm.js +0 -0
- package/dist/tttx/p-01e1894e.entry.js +1 -0
- package/dist/tttx/p-10316ff1.entry.js +1 -0
- package/dist/tttx/p-125f06b3.entry.js +1 -0
- package/dist/tttx/p-184c4fae.js +2 -0
- package/dist/tttx/p-3973b7dd.entry.js +1 -0
- package/dist/tttx/p-5ce1ba22.entry.js +1 -0
- package/dist/tttx/p-6828fe6f.entry.js +1 -0
- package/dist/tttx/p-b1c22f5f.entry.js +1 -0
- package/dist/tttx/p-c7f9be65.entry.js +1 -0
- package/dist/tttx/p-fe4c70b2.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -0
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +9 -0
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +20 -0
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +14 -0
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +21 -0
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -0
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -0
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.d.ts +7 -0
- package/dist/types/components/atoms/tttx-popover-content/tttx-popover-content.stories.d.ts +18 -0
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.d.ts +9 -0
- package/dist/types/components/atoms/ttx-checkbox/tttx-checkbox.stories.d.ts +6 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +134 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +12 -0
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +51 -0
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +13 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +38 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +106 -0
- package/dist/types/components/molecules/tttx-table/tttx-table.d.ts +15 -0
- package/dist/types/components/molecules/tttx-table/tttx-table.stories.d.ts +21 -0
- package/dist/types/components/palette.stories.d.ts +6 -0
- package/dist/types/components.d.ts +264 -0
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -0
- package/dist/types/icons.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1637 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -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
package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import icons from '../../../icons';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'Molecules/Standalone Input',
|
|
4
|
+
component: 'tttx-standalone-input',
|
|
5
|
+
argTypes: {
|
|
6
|
+
iconleft: {
|
|
7
|
+
options: icons,
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
},
|
|
10
|
+
iconright: {
|
|
11
|
+
options: icons,
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
},
|
|
14
|
+
label: {
|
|
15
|
+
control: { type: 'text' },
|
|
16
|
+
},
|
|
17
|
+
errormsg: {
|
|
18
|
+
control: { type: 'text' },
|
|
19
|
+
},
|
|
20
|
+
showerrormsg: {
|
|
21
|
+
control: { type: 'boolean' },
|
|
22
|
+
},
|
|
23
|
+
checked: {
|
|
24
|
+
control: { type: 'boolean' },
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
control: { type: 'boolean' },
|
|
28
|
+
},
|
|
29
|
+
max: {
|
|
30
|
+
control: { type: 'text' },
|
|
31
|
+
},
|
|
32
|
+
maxlength: {
|
|
33
|
+
control: { type: 'text' },
|
|
34
|
+
},
|
|
35
|
+
min: {
|
|
36
|
+
control: { type: 'text' },
|
|
37
|
+
},
|
|
38
|
+
minlength: {
|
|
39
|
+
control: { type: 'text' },
|
|
40
|
+
},
|
|
41
|
+
name: {
|
|
42
|
+
control: { type: 'text' },
|
|
43
|
+
},
|
|
44
|
+
pattern: {
|
|
45
|
+
control: { type: 'text' },
|
|
46
|
+
},
|
|
47
|
+
placeholder: {
|
|
48
|
+
control: { type: 'text' },
|
|
49
|
+
},
|
|
50
|
+
readonly: {
|
|
51
|
+
control: { type: 'boolean' },
|
|
52
|
+
},
|
|
53
|
+
required: {
|
|
54
|
+
control: { type: 'boolean' },
|
|
55
|
+
},
|
|
56
|
+
step: {
|
|
57
|
+
control: { type: 'text' },
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
options: ['text', 'password', 'email', 'number'],
|
|
61
|
+
control: { type: 'radio' },
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
control: { type: 'text' },
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const TemplateTextInput = ({ iconleft, iconright, label, errormsg, showerrormsg, checked, disabled, max, maxlength, min, minlength, name, pattern, placeholder, readonly, required, step, type, value, }) => `
|
|
69
|
+
<tttx-standalone-input
|
|
70
|
+
iconleft="${iconleft || ''}"
|
|
71
|
+
iconright="${iconright || ''}"
|
|
72
|
+
label="${label}"
|
|
73
|
+
errormsg="${errormsg}"
|
|
74
|
+
${showerrormsg ? 'showerrormsg' : ''}
|
|
75
|
+
${checked ? 'checked' : ''}
|
|
76
|
+
${disabled ? 'disabled' : ''}
|
|
77
|
+
${max ? `max=${max}` : ''}
|
|
78
|
+
${maxlength ? `maxlength=${maxlength}` : ''}
|
|
79
|
+
${min ? `min=${min}` : ''}
|
|
80
|
+
${minlength ? `minlength=${minlength}` : ''}
|
|
81
|
+
${name ? `name=${name}` : ''}
|
|
82
|
+
${pattern ? `pattern=${pattern}` : ''}
|
|
83
|
+
${placeholder ? `placeholder=${placeholder}` : ''}
|
|
84
|
+
${readonly ? 'readonly' : ''}
|
|
85
|
+
${required ? 'required' : ''}
|
|
86
|
+
${step ? 'step' : ''}
|
|
87
|
+
type="${type}"
|
|
88
|
+
value="${value}"
|
|
89
|
+
/>
|
|
90
|
+
`;
|
|
91
|
+
export const InputField = TemplateTextInput.bind({});
|
|
92
|
+
InputField.args = {
|
|
93
|
+
value: '',
|
|
94
|
+
label: 'First name',
|
|
95
|
+
type: 'text',
|
|
96
|
+
errormsg: 'Please enter your first name',
|
|
97
|
+
required: false,
|
|
98
|
+
showerrormsg: false,
|
|
99
|
+
placeholder: 'Enter first name',
|
|
100
|
+
};
|
|
101
|
+
// export const TextInputIconLeft = TemplateTextInput.bind({});
|
|
102
|
+
// TextInputIconLeft.args = {
|
|
103
|
+
// value: 'Uh egg',
|
|
104
|
+
// label: 'Please tell me about your egg',
|
|
105
|
+
// iconleft: 'egg',
|
|
106
|
+
// type: 'text',
|
|
107
|
+
// errormsg: 'Incorrect egg, please egg again.',
|
|
108
|
+
// required: true,
|
|
109
|
+
// showerrormsg: true,
|
|
110
|
+
// placeholder: 'Please for the love of god tell me about your egg',
|
|
111
|
+
// };
|
|
112
|
+
// export const TextInputIconRight = TemplateTextInput.bind({});
|
|
113
|
+
// TextInputIconRight.args = {
|
|
114
|
+
// value: 'Uh egg',
|
|
115
|
+
// label: 'Please tell me about your egg',
|
|
116
|
+
// iconright: 'egg',
|
|
117
|
+
// type: 'text',
|
|
118
|
+
// errormsg: 'Incorrect egg, please egg again.',
|
|
119
|
+
// required: true,
|
|
120
|
+
// showerrormsg: true,
|
|
121
|
+
// placeholder: 'Please for the love of god tell me about your egg',
|
|
122
|
+
// };
|
|
123
|
+
// export const PasswordInputBasic = TemplateTextInput.bind({});
|
|
124
|
+
// PasswordInputBasic.args = {
|
|
125
|
+
// value: 'qwefdweferg',
|
|
126
|
+
// label: 'Input your Password',
|
|
127
|
+
// iconleft: 'lock',
|
|
128
|
+
// type: 'password',
|
|
129
|
+
// errormsg: 'Password is not strong enough',
|
|
130
|
+
// required: true,
|
|
131
|
+
// showerrormsg: true,
|
|
132
|
+
// placeholder: 'Your password',
|
|
133
|
+
// };
|
|
134
|
+
// export const EmailInputBasic = TemplateTextInput.bind({});
|
|
135
|
+
// EmailInputBasic.args = {
|
|
136
|
+
// value: 'email.address@website.com',
|
|
137
|
+
// label: 'Choose an email address',
|
|
138
|
+
// iconleft: 'mail',
|
|
139
|
+
// type: 'email',
|
|
140
|
+
// errormsg: 'This email smells funny',
|
|
141
|
+
// required: true,
|
|
142
|
+
// valid: false,
|
|
143
|
+
// showerrormsg: true,
|
|
144
|
+
// placeholder: 'Your email address',
|
|
145
|
+
// };
|
|
146
|
+
// export const NumberInputBasic = TemplateTextInput.bind({});
|
|
147
|
+
// NumberInputBasic.args = {
|
|
148
|
+
// value: '42069',
|
|
149
|
+
// label: 'What is your favourite number?',
|
|
150
|
+
// iconleft: '123',
|
|
151
|
+
// type: 'number',
|
|
152
|
+
// errormsg: 'This number feels wrong',
|
|
153
|
+
// required: true,
|
|
154
|
+
// showerrormsg: true,
|
|
155
|
+
// placeholder: 'Your favourite number',
|
|
156
|
+
// };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
// SPACING
|
|
2
|
+
$spacing-unit: 4px;
|
|
3
|
+
|
|
4
|
+
// REGULAR
|
|
5
|
+
$horizontal-spacing: $spacing-unit * 4;
|
|
6
|
+
$vertical-spacing: $spacing-unit * 2;
|
|
7
|
+
$base-padding: $vertical-spacing $horizontal-spacing;
|
|
8
|
+
$base-height: $spacing-unit * 9;
|
|
9
|
+
$component-spacing: $spacing-unit * 4;
|
|
10
|
+
|
|
11
|
+
// SMALL
|
|
12
|
+
$horizontal-spacing-sm: $spacing-unit * 2;
|
|
13
|
+
$vertical-spacing-sm: $spacing-unit * 1;
|
|
14
|
+
$base-padding-sm: $vertical-spacing-sm $horizontal-spacing-sm;
|
|
15
|
+
$base-height-sm: $spacing-unit * 7;
|
|
16
|
+
|
|
17
|
+
// COLOURS
|
|
18
|
+
$grey-0: #212121;
|
|
19
|
+
$grey-1: #363636;
|
|
20
|
+
$grey-2: #4c4c4c;
|
|
21
|
+
$grey-3: #636363;
|
|
22
|
+
$grey-4: #757575;
|
|
23
|
+
$grey-5: #9e9e9e;
|
|
24
|
+
$grey-6: #aeaeae;
|
|
25
|
+
$grey-7: #c8c8c8;
|
|
26
|
+
$grey-8: #e3e3e3;
|
|
27
|
+
$grey-9: #f0f0f0;
|
|
28
|
+
|
|
29
|
+
$white: white;
|
|
30
|
+
$black: $grey-0;
|
|
31
|
+
$transparent: transparent;
|
|
32
|
+
|
|
33
|
+
$blue-0: #00187c;
|
|
34
|
+
$blue-1: #032e8c;
|
|
35
|
+
$blue-2: #0849a3;
|
|
36
|
+
$blue-3: #0951a8;
|
|
37
|
+
$blue-4: #1169ba;
|
|
38
|
+
$blue-5: #1479c6;
|
|
39
|
+
$blue-6: #5194d2;
|
|
40
|
+
$blue-7: #7aacdd;
|
|
41
|
+
$blue-8: #b9d5ed;
|
|
42
|
+
$blue-9: #e7f1f9;
|
|
43
|
+
|
|
44
|
+
$red-0: #7c0000;
|
|
45
|
+
$red-1: #8c0000;
|
|
46
|
+
$red-2: #a30000;
|
|
47
|
+
$red-3: #a80000;
|
|
48
|
+
$red-4: #ba0000;
|
|
49
|
+
$red-5: #dc0000;
|
|
50
|
+
$red-6: #d25151;
|
|
51
|
+
$red-7: #dd7a7a;
|
|
52
|
+
$red-8: #edc1c1;
|
|
53
|
+
$red-9: #f9e7e7;
|
|
54
|
+
|
|
55
|
+
$black-1: #e6e6e6;
|
|
56
|
+
|
|
57
|
+
$brand: $blue-0;
|
|
58
|
+
$accent: $blue-5;
|
|
59
|
+
$accent-selected: $blue-9;
|
|
60
|
+
$error: $red-5;
|
|
61
|
+
|
|
62
|
+
$severity-critical: #dc0000;
|
|
63
|
+
$severity-warning: #f59500;
|
|
64
|
+
$severity-success: #a2bb31;
|
|
65
|
+
$severity-info: $accent;
|
|
66
|
+
|
|
67
|
+
$ui-primary: $black;
|
|
68
|
+
$ui-secondary: $grey-4;
|
|
69
|
+
$ui-disabled: $grey-2;
|
|
70
|
+
$ui-placeholder: $grey-5;
|
|
71
|
+
|
|
72
|
+
$ui-background: $grey-9;
|
|
73
|
+
$ui-sheet: $white;
|
|
74
|
+
$ui-border: #d5d5d5;
|
|
75
|
+
|
|
76
|
+
// BORDERS
|
|
77
|
+
$ui-border-radius: 4px;
|
|
78
|
+
$ui-border-width: 1px;
|
|
79
|
+
|
|
80
|
+
// TYPOGRAPHY
|
|
81
|
+
$font-size-default: 16px;
|
|
82
|
+
$font-size-small: 14px;
|
|
83
|
+
|
|
84
|
+
.material-symbols-rounded {
|
|
85
|
+
font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.skeleton {
|
|
89
|
+
animation: skeleton-loading 1s linear infinite alternate;
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@keyframes skeleton-loading {
|
|
95
|
+
0% {
|
|
96
|
+
background-color: hsl(200, 20%, 80%);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
100% {
|
|
100
|
+
background-color: hsl(200, 20%, 95%);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
:host {
|
|
105
|
+
display: block;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
table {
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
width: 100%;
|
|
111
|
+
border-collapse: collapse;
|
|
112
|
+
border-spacing: 0;
|
|
113
|
+
border: 1px solid #ddd;
|
|
114
|
+
border-bottom: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
thead tr {
|
|
118
|
+
height: 52px;
|
|
119
|
+
color: #757575;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
tbody tr {
|
|
123
|
+
height: 48px;
|
|
124
|
+
color: #212121;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
tr {
|
|
128
|
+
|
|
129
|
+
/* Cell typography */
|
|
130
|
+
font-family: 'Roboto', sans-serif;
|
|
131
|
+
font-weight: 400;
|
|
132
|
+
font-size: 16px;
|
|
133
|
+
|
|
134
|
+
/* center the contents vertically */
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
|
|
138
|
+
/* Border */
|
|
139
|
+
border-bottom: 1px solid #ddd;
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.selected {
|
|
144
|
+
background-color: #F0F0F0;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.checked {
|
|
148
|
+
background-color: #e7f1f9;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
td,
|
|
152
|
+
th {
|
|
153
|
+
min-width: 300px;
|
|
154
|
+
margin-left: 16px;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: left;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.skeleton {
|
|
160
|
+
height: 24px;
|
|
161
|
+
display: block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.align-right {
|
|
165
|
+
margin-left: auto;
|
|
166
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Host, h } from '@stencil/core';
|
|
2
|
+
export class TttxTable {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.headers = [];
|
|
5
|
+
this.data = {};
|
|
6
|
+
this.loading = false;
|
|
7
|
+
this.selected = -1;
|
|
8
|
+
}
|
|
9
|
+
handleKeyDown(ev) {
|
|
10
|
+
if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') {
|
|
11
|
+
this.updateSelectedIndex(ev.key);
|
|
12
|
+
this.emitRowSelected();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
updateSelectedIndex(key) {
|
|
16
|
+
if (this.selected === -1) {
|
|
17
|
+
this.selected = 0;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const isArrowDown = key === 'ArrowDown';
|
|
21
|
+
const isArrowUp = key === 'ArrowUp';
|
|
22
|
+
if (isArrowDown && this.selected < this.data.length - 1) {
|
|
23
|
+
this.selected++;
|
|
24
|
+
}
|
|
25
|
+
else if (isArrowUp && this.selected > 0) {
|
|
26
|
+
this.selected--;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
emitRowSelected() {
|
|
31
|
+
this.rowSelected.emit(this.data[this.selected]);
|
|
32
|
+
}
|
|
33
|
+
rowSelectedHandler(row) {
|
|
34
|
+
this.rowSelected.emit(row);
|
|
35
|
+
this.selected = this.data.findIndex((item) => item === row);
|
|
36
|
+
}
|
|
37
|
+
headerClickedHandler(key) {
|
|
38
|
+
this.headerClicked.emit(key);
|
|
39
|
+
}
|
|
40
|
+
render() {
|
|
41
|
+
return (h(Host, null, h("table", null, h("thead", null, h("tr", null, this.loading ?
|
|
42
|
+
[1, 2, 3].map(() => (h("th", null, h("div", { class: "skeleton" })))) :
|
|
43
|
+
this.headers && this.headers.map((header) => (h("th", { scope: "col", onClick: () => this.headerClickedHandler(header.key) }, header.label))))), h("tbody", null, this.loading ?
|
|
44
|
+
[1, 2, 3].map(() => (h("tr", null, h("td", null, h("div", { class: "skeleton" })), h("td", null, h("div", { class: "skeleton" })), h("td", null, h("div", { class: "skeleton" }))))) :
|
|
45
|
+
Object.keys(this.data).map((key, index) => (h("tr", { class: index === this.selected ? 'selected' : '', onClick: () => this.rowSelectedHandler(this.data[key]) }, this.headers.map((header) => (h("td", null, this.data[key][header.key], " ", header.actions && h("tttx-icon", { class: "align-right", icon: "more_vert" }, h("div", { slot: "popover" }, h("tttx-popover-content", { header: "The humble egg", body: "Most arthropods such as insects, vertebrates (excluding live-bearing mammals), and mollusks lay eggs, although some, such as scorpions, do not.", linkcontext: "Wikipedia_egg", linktext: "Learn more about eggs" })))))))))))));
|
|
46
|
+
}
|
|
47
|
+
static get is() { return "tttx-table"; }
|
|
48
|
+
static get encapsulation() { return "shadow"; }
|
|
49
|
+
static get originalStyleUrls() {
|
|
50
|
+
return {
|
|
51
|
+
"$": ["tttx-table.css"]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
static get styleUrls() {
|
|
55
|
+
return {
|
|
56
|
+
"$": ["tttx-table.css"]
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
static get properties() {
|
|
60
|
+
return {
|
|
61
|
+
"headers": {
|
|
62
|
+
"type": "any",
|
|
63
|
+
"mutable": false,
|
|
64
|
+
"complexType": {
|
|
65
|
+
"original": "any",
|
|
66
|
+
"resolved": "any",
|
|
67
|
+
"references": {}
|
|
68
|
+
},
|
|
69
|
+
"required": false,
|
|
70
|
+
"optional": false,
|
|
71
|
+
"docs": {
|
|
72
|
+
"tags": [],
|
|
73
|
+
"text": ""
|
|
74
|
+
},
|
|
75
|
+
"attribute": "headers",
|
|
76
|
+
"reflect": false,
|
|
77
|
+
"defaultValue": "[]"
|
|
78
|
+
},
|
|
79
|
+
"data": {
|
|
80
|
+
"type": "any",
|
|
81
|
+
"mutable": false,
|
|
82
|
+
"complexType": {
|
|
83
|
+
"original": "any",
|
|
84
|
+
"resolved": "any",
|
|
85
|
+
"references": {}
|
|
86
|
+
},
|
|
87
|
+
"required": false,
|
|
88
|
+
"optional": false,
|
|
89
|
+
"docs": {
|
|
90
|
+
"tags": [],
|
|
91
|
+
"text": ""
|
|
92
|
+
},
|
|
93
|
+
"attribute": "data",
|
|
94
|
+
"reflect": false,
|
|
95
|
+
"defaultValue": "{}"
|
|
96
|
+
},
|
|
97
|
+
"loading": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"mutable": false,
|
|
100
|
+
"complexType": {
|
|
101
|
+
"original": "boolean",
|
|
102
|
+
"resolved": "boolean",
|
|
103
|
+
"references": {}
|
|
104
|
+
},
|
|
105
|
+
"required": false,
|
|
106
|
+
"optional": false,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"attribute": "loading",
|
|
112
|
+
"reflect": false,
|
|
113
|
+
"defaultValue": "false"
|
|
114
|
+
},
|
|
115
|
+
"selected": {
|
|
116
|
+
"type": "number",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "number",
|
|
120
|
+
"resolved": "number",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": ""
|
|
128
|
+
},
|
|
129
|
+
"attribute": "selected",
|
|
130
|
+
"reflect": false,
|
|
131
|
+
"defaultValue": "-1"
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
static get events() {
|
|
136
|
+
return [{
|
|
137
|
+
"method": "rowSelected",
|
|
138
|
+
"name": "rowSelected",
|
|
139
|
+
"bubbles": true,
|
|
140
|
+
"cancelable": true,
|
|
141
|
+
"composed": true,
|
|
142
|
+
"docs": {
|
|
143
|
+
"tags": [],
|
|
144
|
+
"text": ""
|
|
145
|
+
},
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "any",
|
|
148
|
+
"resolved": "any",
|
|
149
|
+
"references": {}
|
|
150
|
+
}
|
|
151
|
+
}, {
|
|
152
|
+
"method": "headerClicked",
|
|
153
|
+
"name": "headerClicked",
|
|
154
|
+
"bubbles": true,
|
|
155
|
+
"cancelable": true,
|
|
156
|
+
"composed": true,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": ""
|
|
160
|
+
},
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "any",
|
|
163
|
+
"resolved": "any",
|
|
164
|
+
"references": {}
|
|
165
|
+
}
|
|
166
|
+
}];
|
|
167
|
+
}
|
|
168
|
+
static get listeners() {
|
|
169
|
+
return [{
|
|
170
|
+
"name": "keydown",
|
|
171
|
+
"method": "handleKeyDown",
|
|
172
|
+
"target": "document",
|
|
173
|
+
"capture": false,
|
|
174
|
+
"passive": false
|
|
175
|
+
}];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
const templateData = [
|
|
3
|
+
{ name: 'John', age: 25, faveColor: 'blue' },
|
|
4
|
+
{ name: 'Jane', age: 30, faveColor: 'green' },
|
|
5
|
+
{ name: 'Bob', age: 40, faveColor: 'red' },
|
|
6
|
+
];
|
|
7
|
+
const templateHeaders = [
|
|
8
|
+
{
|
|
9
|
+
key: 'name',
|
|
10
|
+
label: 'Name'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
key: 'age',
|
|
14
|
+
label: 'Age'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'faveColor',
|
|
18
|
+
label: '',
|
|
19
|
+
actions: [
|
|
20
|
+
{
|
|
21
|
+
label: 'Edit',
|
|
22
|
+
icon: 'edit',
|
|
23
|
+
action: 'edit'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Delete',
|
|
27
|
+
icon: 'delete',
|
|
28
|
+
action: 'delete'
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
export default {
|
|
34
|
+
title: 'Molecules/Table',
|
|
35
|
+
component: 'tttx-table',
|
|
36
|
+
argTypes: {
|
|
37
|
+
loading: {
|
|
38
|
+
control: { type: 'boolean' },
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
parameters: {
|
|
42
|
+
actions: {
|
|
43
|
+
handles: ['rowSelected', 'headerClicked'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
decorators: [withActions],
|
|
47
|
+
};
|
|
48
|
+
const TemplateTable = ({ headers, data, loading, selected }) => `
|
|
49
|
+
|
|
50
|
+
<tttx-table
|
|
51
|
+
id="table"
|
|
52
|
+
></tttx-table>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
if (!table) {
|
|
56
|
+
const table = document.getElementById('table');
|
|
57
|
+
}
|
|
58
|
+
table.headers = ${JSON.stringify(headers)};
|
|
59
|
+
table.data = ${JSON.stringify(data)};
|
|
60
|
+
table.loading = ${loading};
|
|
61
|
+
table.selected = ${selected};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
`;
|
|
65
|
+
export const BasicTable = TemplateTable.bind({});
|
|
66
|
+
BasicTable.args = {
|
|
67
|
+
headers: templateHeaders,
|
|
68
|
+
data: templateData
|
|
69
|
+
};
|
|
70
|
+
export const TablePreSelected = TemplateTable.bind({});
|
|
71
|
+
TablePreSelected.args = {
|
|
72
|
+
headers: templateHeaders,
|
|
73
|
+
data: templateData,
|
|
74
|
+
selected: 1
|
|
75
|
+
};
|
|
76
|
+
export const TableLoading = TemplateTable.bind({});
|
|
77
|
+
TableLoading.args = {
|
|
78
|
+
headers: templateHeaders,
|
|
79
|
+
data: templateData,
|
|
80
|
+
loading: true
|
|
81
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
title: 'Foundations/Palette',
|
|
3
|
+
component: 'tttx-palette',
|
|
4
|
+
};
|
|
5
|
+
const Swatch = (colour, name = '') => `
|
|
6
|
+
<div class="swatch">
|
|
7
|
+
<div class="swatchcontent" style="background-color:${colour};">
|
|
8
|
+
<div class="pill">${colour}</div>
|
|
9
|
+
</div>
|
|
10
|
+
<p>${name}</p>
|
|
11
|
+
</div>
|
|
12
|
+
`;
|
|
13
|
+
const Template = () => `
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
h2 { clear:both; margin-top: 2em; display: block; }
|
|
17
|
+
.swatch { width:130px; height:130px; float:left; font-size: 12px; }
|
|
18
|
+
.swatchcontent { width:120px; height:80px; }
|
|
19
|
+
.pill {
|
|
20
|
+
margin: 0.5em;
|
|
21
|
+
display: inline-block;
|
|
22
|
+
padding: 0.25em 0.5em;
|
|
23
|
+
border-radius: 1em;
|
|
24
|
+
background-color: #FFFFFF;
|
|
25
|
+
color: #000000;
|
|
26
|
+
font-size: 1em;
|
|
27
|
+
font-weight: bold;
|
|
28
|
+
}
|
|
29
|
+
p { margin: 8px 0 0 0; }
|
|
30
|
+
</style>
|
|
31
|
+
|
|
32
|
+
<h2>Primary</h2>
|
|
33
|
+
${Swatch('#111111', '$black')}
|
|
34
|
+
${Swatch('#FFFFFF', '$white')}
|
|
35
|
+
${Swatch('#00187C', '$brand')}
|
|
36
|
+
${Swatch('#1579C6', '$accent')}
|
|
37
|
+
${Swatch('#E7F1F9', '$selected')}
|
|
38
|
+
|
|
39
|
+
<h2>Text and icons</h2>
|
|
40
|
+
${Swatch('#212121', '$ui-primary')}
|
|
41
|
+
${Swatch('#757575', '$ui-secondary')}
|
|
42
|
+
${Swatch('#9E9E9E', '$ui-placeholder')}
|
|
43
|
+
${Swatch('#4C4C4C', '$ui-disabled')}
|
|
44
|
+
|
|
45
|
+
<h2>Layout</h2>
|
|
46
|
+
${Swatch('#F0F0F0', '$background')}
|
|
47
|
+
${Swatch('#FAFAFA', '$backround-secondary')}
|
|
48
|
+
${Swatch('#D5D5D5', '$ui-border')}
|
|
49
|
+
|
|
50
|
+
<h2>Buttons</h2>
|
|
51
|
+
${Swatch('#1579C6', '$btn-accent')}
|
|
52
|
+
${Swatch('#146EB3', '$btn-accent-hover')}
|
|
53
|
+
${Swatch('#10609D', '$btn-accent-active')}
|
|
54
|
+
<div style="clear:both;"></div>
|
|
55
|
+
${Swatch('#FFFFFF', '$btn-default')}
|
|
56
|
+
${Swatch('#e6e6e6', '$btn-hover')}
|
|
57
|
+
${Swatch('#cccccc', '$btn-active')}
|
|
58
|
+
<div style="clear:both;"></div>
|
|
59
|
+
${Swatch('#DC0000', '$btn-danger')}
|
|
60
|
+
${Swatch('#C70101', '$btn-danger-hover')}
|
|
61
|
+
${Swatch('#B30303', '$btn-danger-active')}
|
|
62
|
+
<div style="clear:both;"></div>
|
|
63
|
+
${Swatch('#BDBDBD', '$btn-disabled')}
|
|
64
|
+
|
|
65
|
+
<h2>Severity</h2>
|
|
66
|
+
${Swatch('#DC0000', '$severity-critical')}
|
|
67
|
+
${Swatch('#F59500', '$severity-warning')}
|
|
68
|
+
${Swatch('#A2BB31', '$severity-success')}
|
|
69
|
+
${Swatch('#00187C', '$severity-info')}
|
|
70
|
+
<div style="clear:both;"></div>
|
|
71
|
+
${Swatch('#F2BEBE', '$message-critical')}
|
|
72
|
+
${Swatch('#F9E1BE', '$message-warning')}
|
|
73
|
+
${Swatch('#E4EBC9', '$message-success')}
|
|
74
|
+
${Swatch('#C2DAEE', '$message-info')}
|
|
75
|
+
|
|
76
|
+
<h2>Diverging</h2>
|
|
77
|
+
${Swatch('#0373A5', '$dv-lowest')}
|
|
78
|
+
${Swatch('#00C2D1', '$dv-very-low')}
|
|
79
|
+
${Swatch('#50A472', '$dv-low')}
|
|
80
|
+
${Swatch('#A2BB31', '$dv-med-low')}
|
|
81
|
+
${Swatch('#FDC500', '$dv-medium')}
|
|
82
|
+
${Swatch('#F59500', '$dv-med-high')}
|
|
83
|
+
${Swatch('#EA6100', '$dv-high')}
|
|
84
|
+
${Swatch('#DC0000', '$dv-very-high')}
|
|
85
|
+
${Swatch('#A20000', '$dv-highest')}
|
|
86
|
+
|
|
87
|
+
`;
|
|
88
|
+
export const Default = Template.bind({});
|