@3t-transform/threeteeui 0.1.5 → 0.1.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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/css-shim-211819bc.js +6 -0
- package/dist/cjs/dom-9deb26c8.js +75 -0
- package/dist/cjs/index-11cfdabe.js +3297 -0
- package/dist/cjs/{index-906c2757.js → index-451f61dd.js} +3 -102
- package/dist/cjs/loader.cjs.js +19 -4
- package/dist/cjs/shadow-css-bf3843d2.js +389 -0
- package/dist/cjs/{tttx-button_2.cjs.entry.js → tttx-button.cjs.entry.js} +24 -50
- package/dist/cjs/tttx-form.cjs.entry.js +364 -364
- package/dist/cjs/tttx-icon.cjs.entry.js +21 -0
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +57 -57
- package/dist/cjs/tttx-list.cjs.entry.js +76 -46
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +61 -58
- package/dist/cjs/tttx-toolbar.cjs.entry.js +20 -0
- package/dist/cjs/tttx.cjs.js +117 -9
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +83 -0
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -116
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +9 -0
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +16 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.css +4 -0
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
- package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +216 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +107 -107
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
- package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +64 -0
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +35 -35
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.spec.js +38 -0
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -58
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.spec.js +214 -0
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.e2e.js +9 -0
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.spec.js +232 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +32 -3
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +364 -364
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +127 -127
- package/dist/collection/components/molecules/tttx-list/test/ttttx-list.spec.e2e.js +26 -0
- package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +183 -0
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +9 -0
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +219 -0
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +32 -3
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +627 -572
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +148 -135
- package/dist/collection/components/molecules/tttx-toolbar/test/tttx-toolbar.test.js +0 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.css +30 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -0
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +20 -0
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/collection/shared/domsanitiser.options.js +14 -14
- package/dist/collection/shared/test/domsanitiser.options.spec.js +23 -0
- package/dist/components/index.d.ts +1 -9
- package/dist/components/index.js +6 -1
- package/dist/components/tttx-button.js +48 -59
- package/dist/components/tttx-form.js +381 -381
- package/dist/components/tttx-icon2.js +29 -29
- package/dist/components/tttx-keyvalue-block.js +74 -74
- package/dist/components/tttx-list.js +98 -68
- package/dist/components/tttx-loading-spinner.js +33 -33
- package/dist/components/tttx-standalone-input.js +108 -102
- package/dist/components/tttx-toolbar.d.ts +11 -0
- package/dist/components/tttx-toolbar.js +36 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/css-shim-9d54a2f2.js +4 -0
- package/dist/esm/dom-6be6f662.js +73 -0
- package/dist/esm/{index-4010ad69.js → index-0350f122.js} +4 -101
- package/dist/esm/index-dbe25028.js +3262 -0
- package/dist/esm/loader.js +19 -4
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/shadow-css-ed4599f8.js +387 -0
- package/dist/esm/{tttx-button_2.entry.js → tttx-button.entry.js} +25 -50
- package/dist/esm/tttx-form.entry.js +364 -364
- package/dist/esm/tttx-icon.entry.js +17 -0
- package/dist/esm/tttx-keyvalue-block.entry.js +57 -57
- package/dist/esm/tttx-list.entry.js +76 -46
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-standalone-input.entry.js +61 -58
- package/dist/esm/tttx-toolbar.entry.js +16 -0
- package/dist/esm/tttx.js +117 -6
- package/dist/tttx/app-globals-0f993ce5.js +3 -0
- package/dist/tttx/css-shim-9d54a2f2.js +4 -0
- package/dist/tttx/dom-6be6f662.js +73 -0
- package/dist/tttx/index-dbe25028.js +3262 -0
- package/dist/tttx/index.esm.js +1 -0
- package/dist/tttx/p-0a85dda4.entry.js +1 -0
- package/dist/tttx/{p-3281444a.entry.js → p-1b015a9d.entry.js} +1 -1
- package/dist/tttx/p-4f3958fa.entry.js +1 -0
- package/dist/tttx/p-5cae1beb.entry.js +1 -0
- package/dist/tttx/p-62869344.js +2 -0
- package/dist/tttx/p-92465671.entry.js +1 -0
- package/dist/tttx/{p-dab7ee1b.entry.js → p-a0179cb1.entry.js} +1 -1
- package/dist/tttx/p-cc6644c9.entry.js +1 -0
- package/dist/tttx/p-cd1565e0.entry.js +3 -0
- package/dist/tttx/shadow-css-ed4599f8.js +387 -0
- package/dist/tttx/tttx-button.entry.js +30 -0
- package/dist/tttx/tttx-form.entry.js +373 -0
- package/dist/tttx/tttx-icon.entry.js +17 -0
- package/dist/tttx/tttx-keyvalue-block.entry.js +63 -0
- package/dist/tttx/tttx-list.entry.js +1730 -0
- package/dist/tttx/tttx-loading-spinner.entry.js +22 -0
- package/dist/tttx/tttx-standalone-input.entry.js +66 -0
- package/dist/tttx/tttx-toolbar.entry.js +16 -0
- package/dist/tttx/tttx.esm.js +129 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -13
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
- package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
- package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +1 -0
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/test/tttx-form.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/test/tttx-form.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +114 -114
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +13 -13
- package/dist/types/components/molecules/tttx-list/test/ttttx-list.spec.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +1 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +56 -53
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +122 -106
- package/dist/types/components/molecules/tttx-toolbar/test/tttx-toolbar.test.d.ts +0 -0
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -0
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -0
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +21 -0
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared/domsanitiser.options.d.ts +10 -10
- package/dist/types/shared/test/domsanitiser.options.spec.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/loader/index.d.ts +0 -9
- package/package.json +1 -1
- package/dist/collection/transform-tag-name.js +0 -5
- package/dist/tttx/p-083eeedc.entry.js +0 -1
- package/dist/tttx/p-5687f4ad.js +0 -2
- package/dist/tttx/p-5c9a1626.entry.js +0 -3
- package/dist/tttx/p-931e42c9.entry.js +0 -1
- package/dist/tttx/p-b5c1dd86.entry.js +0 -1
- package/dist/types/transform-tag-name.d.ts +0 -1
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { Host, h } from '@stencil/core';
|
|
3
|
-
export class TttxIcon {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.icon = undefined;
|
|
6
|
-
this.color = 'grey';
|
|
7
|
-
}
|
|
8
|
-
render() {
|
|
9
|
-
return (h(Host, null, h("span", { class: `material-symbols-rounded ${this.color ? this.color : ''}` }, this.icon)));
|
|
10
|
-
}
|
|
11
|
-
static get is() { return "tttx-icon"; }
|
|
12
|
-
static get encapsulation() { return "shadow"; }
|
|
13
|
-
static get originalStyleUrls() {
|
|
14
|
-
return {
|
|
15
|
-
"$": ["tttx-icon.scss"]
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
static get styleUrls() {
|
|
19
|
-
return {
|
|
20
|
-
"$": ["tttx-icon.css"]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
static get properties() {
|
|
24
|
-
return {
|
|
25
|
-
"icon": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"mutable": false,
|
|
28
|
-
"complexType": {
|
|
29
|
-
"original": "string",
|
|
30
|
-
"resolved": "string",
|
|
31
|
-
"references": {}
|
|
32
|
-
},
|
|
33
|
-
"required": false,
|
|
34
|
-
"optional": false,
|
|
35
|
-
"docs": {
|
|
36
|
-
"tags": [],
|
|
37
|
-
"text": ""
|
|
38
|
-
},
|
|
39
|
-
"attribute": "icon",
|
|
40
|
-
"reflect": false
|
|
41
|
-
},
|
|
42
|
-
"color": {
|
|
43
|
-
"type": "string",
|
|
44
|
-
"mutable": false,
|
|
45
|
-
"complexType": {
|
|
46
|
-
"original": "string",
|
|
47
|
-
"resolved": "string",
|
|
48
|
-
"references": {}
|
|
49
|
-
},
|
|
50
|
-
"required": false,
|
|
51
|
-
"optional": false,
|
|
52
|
-
"docs": {
|
|
53
|
-
"tags": [],
|
|
54
|
-
"text": ""
|
|
55
|
-
},
|
|
56
|
-
"attribute": "color",
|
|
57
|
-
"reflect": false,
|
|
58
|
-
"defaultValue": "'grey'"
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { Host, h } from '@stencil/core';
|
|
3
|
+
export class TttxIcon {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.icon = undefined;
|
|
6
|
+
this.color = 'grey';
|
|
7
|
+
}
|
|
8
|
+
render() {
|
|
9
|
+
return (h(Host, null, h("span", { class: `material-symbols-rounded ${this.color ? this.color : ''}` }, this.icon)));
|
|
10
|
+
}
|
|
11
|
+
static get is() { return "tttx-icon"; }
|
|
12
|
+
static get encapsulation() { return "shadow"; }
|
|
13
|
+
static get originalStyleUrls() {
|
|
14
|
+
return {
|
|
15
|
+
"$": ["tttx-icon.scss"]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
static get styleUrls() {
|
|
19
|
+
return {
|
|
20
|
+
"$": ["tttx-icon.css"]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
static get properties() {
|
|
24
|
+
return {
|
|
25
|
+
"icon": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"mutable": false,
|
|
28
|
+
"complexType": {
|
|
29
|
+
"original": "string",
|
|
30
|
+
"resolved": "string",
|
|
31
|
+
"references": {}
|
|
32
|
+
},
|
|
33
|
+
"required": false,
|
|
34
|
+
"optional": false,
|
|
35
|
+
"docs": {
|
|
36
|
+
"tags": [],
|
|
37
|
+
"text": ""
|
|
38
|
+
},
|
|
39
|
+
"attribute": "icon",
|
|
40
|
+
"reflect": false
|
|
41
|
+
},
|
|
42
|
+
"color": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"mutable": false,
|
|
45
|
+
"complexType": {
|
|
46
|
+
"original": "string",
|
|
47
|
+
"resolved": "string",
|
|
48
|
+
"references": {}
|
|
49
|
+
},
|
|
50
|
+
"required": false,
|
|
51
|
+
"optional": false,
|
|
52
|
+
"docs": {
|
|
53
|
+
"tags": [],
|
|
54
|
+
"text": ""
|
|
55
|
+
},
|
|
56
|
+
"attribute": "color",
|
|
57
|
+
"reflect": false,
|
|
58
|
+
"defaultValue": "'grey'"
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import icons from './../../../icons';
|
|
2
|
-
const colors = ['red', 'blue', 'black', '
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Atoms/Icons',
|
|
5
|
-
component: 'tttx-icon',
|
|
6
|
-
argTypes: {
|
|
7
|
-
icon: {
|
|
8
|
-
control: { type: 'select' },
|
|
9
|
-
options: icons,
|
|
10
|
-
},
|
|
11
|
-
color: {
|
|
12
|
-
control: { type: 'select' },
|
|
13
|
-
options: colors,
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
const Template = ({ icon, color }) => `<tttx-icon icon="${icon}" color="${color}" />`;
|
|
18
|
-
export const Icon = Template.bind({});
|
|
19
|
-
Icon.args = {
|
|
20
|
-
icon: 'warning',
|
|
21
|
-
color: 'red',
|
|
22
|
-
};
|
|
1
|
+
import icons from './../../../icons';
|
|
2
|
+
const colors = ['red', 'blue', 'black', 'white', 'gray', 'green', 'orange', 'darkred'];
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Atoms/Icons',
|
|
5
|
+
component: 'tttx-icon',
|
|
6
|
+
argTypes: {
|
|
7
|
+
icon: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: icons,
|
|
10
|
+
},
|
|
11
|
+
color: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: colors,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const Template = ({ icon, color }) => `<tttx-icon icon="${icon}" color="${color}" />`;
|
|
18
|
+
export const Icon = Template.bind({});
|
|
19
|
+
Icon.args = {
|
|
20
|
+
icon: 'warning',
|
|
21
|
+
color: 'red',
|
|
22
|
+
};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
import { newSpecPage } from '@stencil/core/testing';
|
|
3
|
+
import { TttxKeyvalueBlock } from '../tttx-keyvalue-block';
|
|
4
|
+
describe('tttx-keyvalue-block', () => {
|
|
5
|
+
it('renders multiple key value pairs', async () => {
|
|
6
|
+
const keyValuePair = {
|
|
7
|
+
'Name': 'John Doe',
|
|
8
|
+
'Date of birth': '14 Jan 1981',
|
|
9
|
+
'Start of postcode': 'AB10'
|
|
10
|
+
};
|
|
11
|
+
const page = await newSpecPage({
|
|
12
|
+
components: [TttxKeyvalueBlock],
|
|
13
|
+
html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValuePair)}' />`
|
|
14
|
+
});
|
|
15
|
+
await page.waitForChanges();
|
|
16
|
+
expect(page.root).toEqualHtml(`
|
|
17
|
+
<tttx-keyvalue-block keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
|
|
18
|
+
<mock:shadow-root>
|
|
19
|
+
<dl>
|
|
20
|
+
<dt>
|
|
21
|
+
Name
|
|
22
|
+
</dt>
|
|
23
|
+
<dd>
|
|
24
|
+
John Doe
|
|
25
|
+
</dd>
|
|
26
|
+
<dt>
|
|
27
|
+
Date of birth
|
|
28
|
+
</dt>
|
|
29
|
+
<dd>
|
|
30
|
+
14 Jan 1981
|
|
31
|
+
</dd>
|
|
32
|
+
<dt>
|
|
33
|
+
Start of postcode
|
|
34
|
+
</dt>
|
|
35
|
+
<dd>
|
|
36
|
+
AB10
|
|
37
|
+
</dd>
|
|
38
|
+
</dl>
|
|
39
|
+
</mock:shadow-root>
|
|
40
|
+
</tttx-keyvalue-block>
|
|
41
|
+
`);
|
|
42
|
+
});
|
|
43
|
+
it('renders multiple key value pairs from a stencil template', async () => {
|
|
44
|
+
const keyValuePair = {
|
|
45
|
+
'Name': 'John Doe',
|
|
46
|
+
'Date of birth': '14 Jan 1981',
|
|
47
|
+
'Start of postcode': 'AB10'
|
|
48
|
+
};
|
|
49
|
+
const page = await newSpecPage({
|
|
50
|
+
components: [TttxKeyvalueBlock],
|
|
51
|
+
template: () => (h("tttx-keyvalue-block", { keyvalues: keyValuePair }))
|
|
52
|
+
});
|
|
53
|
+
await page.waitForChanges();
|
|
54
|
+
expect(page.root).toEqualHtml(`
|
|
55
|
+
<tttx-keyvalue-block>
|
|
56
|
+
<mock:shadow-root>
|
|
57
|
+
<dl>
|
|
58
|
+
<dt>
|
|
59
|
+
Name
|
|
60
|
+
</dt>
|
|
61
|
+
<dd>
|
|
62
|
+
John Doe
|
|
63
|
+
</dd>
|
|
64
|
+
<dt>
|
|
65
|
+
Date of birth
|
|
66
|
+
</dt>
|
|
67
|
+
<dd>
|
|
68
|
+
14 Jan 1981
|
|
69
|
+
</dd>
|
|
70
|
+
<dt>
|
|
71
|
+
Start of postcode
|
|
72
|
+
</dt>
|
|
73
|
+
<dd>
|
|
74
|
+
AB10
|
|
75
|
+
</dd>
|
|
76
|
+
</dl>
|
|
77
|
+
</mock:shadow-root>
|
|
78
|
+
</tttx-keyvalue-block>
|
|
79
|
+
`);
|
|
80
|
+
});
|
|
81
|
+
it('renders with missing keyvalue object', async () => {
|
|
82
|
+
const page = await newSpecPage({
|
|
83
|
+
components: [TttxKeyvalueBlock],
|
|
84
|
+
template: () => (h("tttx-keyvalue-block", null))
|
|
85
|
+
});
|
|
86
|
+
await page.waitForChanges();
|
|
87
|
+
expect(page.root).toEqualHtml(`
|
|
88
|
+
<tttx-keyvalue-block>
|
|
89
|
+
<mock:shadow-root>
|
|
90
|
+
</mock:shadow-root>
|
|
91
|
+
</tttx-keyvalue-block>
|
|
92
|
+
`);
|
|
93
|
+
});
|
|
94
|
+
it('renders an array of key value subtitles', async () => {
|
|
95
|
+
const keyValueArray = [
|
|
96
|
+
{ title: 'title', subTitle: 'sub', data: 'data' },
|
|
97
|
+
{ title: 'title2', subTitle: 'sub2', data: 'data2' }
|
|
98
|
+
];
|
|
99
|
+
const page = await newSpecPage({
|
|
100
|
+
components: [TttxKeyvalueBlock],
|
|
101
|
+
html: `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`
|
|
102
|
+
});
|
|
103
|
+
await page.waitForChanges();
|
|
104
|
+
expect(page.root).toEqualHtml(`
|
|
105
|
+
<tttx-keyvalue-block keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
|
|
106
|
+
<mock:shadow-root>
|
|
107
|
+
<dl>
|
|
108
|
+
<dt class="mainTitle">
|
|
109
|
+
title
|
|
110
|
+
</dt>
|
|
111
|
+
<dt class="subTitle">
|
|
112
|
+
sub
|
|
113
|
+
</dt>
|
|
114
|
+
<dd>
|
|
115
|
+
data
|
|
116
|
+
</dd>
|
|
117
|
+
<dt class="mainTitle">
|
|
118
|
+
title2
|
|
119
|
+
</dt>
|
|
120
|
+
<dt class="subTitle">
|
|
121
|
+
sub2
|
|
122
|
+
</dt>
|
|
123
|
+
<dd>
|
|
124
|
+
data2
|
|
125
|
+
</dd>
|
|
126
|
+
</dl>
|
|
127
|
+
</mock:shadow-root>
|
|
128
|
+
</tttx-keyvalue-block>
|
|
129
|
+
`);
|
|
130
|
+
});
|
|
131
|
+
it('renders multiple horizontal key value pairs', async () => {
|
|
132
|
+
const keyValuePair = {
|
|
133
|
+
'Name': 'John Doe',
|
|
134
|
+
'Date of birth': '14 Jan 1981',
|
|
135
|
+
'Start of postcode': 'AB10'
|
|
136
|
+
};
|
|
137
|
+
const page = await newSpecPage({
|
|
138
|
+
components: [TttxKeyvalueBlock],
|
|
139
|
+
html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValuePair)}' />`
|
|
140
|
+
});
|
|
141
|
+
await page.waitForChanges();
|
|
142
|
+
expect(page.root).toEqualHtml(`
|
|
143
|
+
<tttx-keyvalue-block horizontal="true" keyvalues='{"Name":"John Doe","Date of birth":"14 Jan 1981","Start of postcode":"AB10"}'>
|
|
144
|
+
<mock:shadow-root>
|
|
145
|
+
<dl class="horizontal">
|
|
146
|
+
<div>
|
|
147
|
+
<dt>
|
|
148
|
+
Name
|
|
149
|
+
</dt>
|
|
150
|
+
<dd>
|
|
151
|
+
John Doe
|
|
152
|
+
</dd>
|
|
153
|
+
</div>
|
|
154
|
+
<div>
|
|
155
|
+
<dt>
|
|
156
|
+
Date of birth
|
|
157
|
+
</dt>
|
|
158
|
+
<dd>
|
|
159
|
+
14 Jan 1981
|
|
160
|
+
</dd>
|
|
161
|
+
</div>
|
|
162
|
+
<div>
|
|
163
|
+
<dt>
|
|
164
|
+
Start of postcode
|
|
165
|
+
</dt>
|
|
166
|
+
<dd>
|
|
167
|
+
AB10
|
|
168
|
+
</dd>
|
|
169
|
+
</div>
|
|
170
|
+
</dl>
|
|
171
|
+
</mock:shadow-root>
|
|
172
|
+
</tttx-keyvalue-block>
|
|
173
|
+
`);
|
|
174
|
+
});
|
|
175
|
+
it('renders an array of horizontal key value subtitles', async () => {
|
|
176
|
+
const keyValueArray = [
|
|
177
|
+
{ title: 'title', subTitle: 'sub', data: 'data' },
|
|
178
|
+
{ title: 'title2', subTitle: 'sub2', data: 'data2' }
|
|
179
|
+
];
|
|
180
|
+
const page = await newSpecPage({
|
|
181
|
+
components: [TttxKeyvalueBlock],
|
|
182
|
+
html: `<tttx-keyvalue-block horizontal="true" keyvalues='${JSON.stringify(keyValueArray)}' />`
|
|
183
|
+
});
|
|
184
|
+
await page.waitForChanges();
|
|
185
|
+
expect(page.root).toEqualHtml(`
|
|
186
|
+
<tttx-keyvalue-block horizontal="true" keyvalues='[{"title":"title","subTitle":"sub","data":"data"},{"title":"title2","subTitle":"sub2","data":"data2"}]'>
|
|
187
|
+
<mock:shadow-root>
|
|
188
|
+
<dl class="horizontal">
|
|
189
|
+
<div>
|
|
190
|
+
<dt class="mainTitle">
|
|
191
|
+
title
|
|
192
|
+
</dt>
|
|
193
|
+
<dt class="subTitle">
|
|
194
|
+
sub
|
|
195
|
+
</dt>
|
|
196
|
+
<dd>
|
|
197
|
+
data
|
|
198
|
+
</dd>
|
|
199
|
+
</div>
|
|
200
|
+
<div>
|
|
201
|
+
<dt class="mainTitle">
|
|
202
|
+
title2
|
|
203
|
+
</dt>
|
|
204
|
+
<dt class="subTitle">
|
|
205
|
+
sub2
|
|
206
|
+
</dt>
|
|
207
|
+
<dd>
|
|
208
|
+
data2
|
|
209
|
+
</dd>
|
|
210
|
+
</div>
|
|
211
|
+
</dl>
|
|
212
|
+
</mock:shadow-root>
|
|
213
|
+
</tttx-keyvalue-block>
|
|
214
|
+
`);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { h, Host } from '@stencil/core';
|
|
3
|
-
export class TttxKeyvalueBlock {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.keyvalues = undefined;
|
|
6
|
-
this.horizontal = undefined;
|
|
7
|
-
}
|
|
8
|
-
renderSingleElements(values) {
|
|
9
|
-
const keys = Object.keys(values);
|
|
10
|
-
const elements = [];
|
|
11
|
-
for (let i = 0; i < keys.length; i++) {
|
|
12
|
-
if (this.horizontal) {
|
|
13
|
-
elements.push(h("div", null, h("dt", null, keys[i]), h("dd", null, values[keys[i]])));
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
elements.push(h("dt", null, keys[i]));
|
|
17
|
-
elements.push(h("dd", null, values[keys[i]]));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return elements;
|
|
21
|
-
}
|
|
22
|
-
renderArrayElements(values) {
|
|
23
|
-
const elements = [];
|
|
24
|
-
for (let i = 0; i < values.length; i++) {
|
|
25
|
-
const value = values[i];
|
|
26
|
-
if (this.horizontal) {
|
|
27
|
-
elements.push(h("div", null, h("dt", { class: 'mainTitle' }, value.title), h("dt", { class: 'subTitle' }, value.subTitle), h("dd", null, value.data)));
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
elements.push(h("dt", { class: 'mainTitle' }, value.title));
|
|
31
|
-
elements.push(h("dt", { class: 'subTitle' }, value.subTitle));
|
|
32
|
-
elements.push(h("dd", null, value.data));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return elements;
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
if (!this.keyvalues) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
let values;
|
|
42
|
-
if (typeof this.keyvalues === 'string') {
|
|
43
|
-
values = JSON.parse(this.keyvalues);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
values = this.keyvalues;
|
|
47
|
-
}
|
|
48
|
-
let elements;
|
|
49
|
-
if (Array.isArray(values)) {
|
|
50
|
-
elements = this.renderArrayElements(values);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
elements = this.renderSingleElements(values);
|
|
54
|
-
}
|
|
55
|
-
return (h(Host, null, h("dl", { class: this.horizontal ? 'horizontal' : null }, elements)));
|
|
56
|
-
}
|
|
57
|
-
static get is() { return "tttx-keyvalue-block"; }
|
|
58
|
-
static get encapsulation() { return "shadow"; }
|
|
59
|
-
static get originalStyleUrls() {
|
|
60
|
-
return {
|
|
61
|
-
"$": ["tttx-keyvalue-block.scss"]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
static get styleUrls() {
|
|
65
|
-
return {
|
|
66
|
-
"$": ["tttx-keyvalue-block.css"]
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
static get properties() {
|
|
70
|
-
return {
|
|
71
|
-
"keyvalues": {
|
|
72
|
-
"type": "any",
|
|
73
|
-
"mutable": false,
|
|
74
|
-
"complexType": {
|
|
75
|
-
"original": "any | any[] | string",
|
|
76
|
-
"resolved": "any",
|
|
77
|
-
"references": {}
|
|
78
|
-
},
|
|
79
|
-
"required": false,
|
|
80
|
-
"optional": false,
|
|
81
|
-
"docs": {
|
|
82
|
-
"tags": [],
|
|
83
|
-
"text": ""
|
|
84
|
-
},
|
|
85
|
-
"attribute": "keyvalues",
|
|
86
|
-
"reflect": false
|
|
87
|
-
},
|
|
88
|
-
"horizontal": {
|
|
89
|
-
"type": "boolean",
|
|
90
|
-
"mutable": false,
|
|
91
|
-
"complexType": {
|
|
92
|
-
"original": "boolean",
|
|
93
|
-
"resolved": "boolean",
|
|
94
|
-
"references": {}
|
|
95
|
-
},
|
|
96
|
-
"required": false,
|
|
97
|
-
"optional": false,
|
|
98
|
-
"docs": {
|
|
99
|
-
"tags": [],
|
|
100
|
-
"text": ""
|
|
101
|
-
},
|
|
102
|
-
"attribute": "horizontal",
|
|
103
|
-
"reflect": false
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { h, Host } from '@stencil/core';
|
|
3
|
+
export class TttxKeyvalueBlock {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.keyvalues = undefined;
|
|
6
|
+
this.horizontal = undefined;
|
|
7
|
+
}
|
|
8
|
+
renderSingleElements(values) {
|
|
9
|
+
const keys = Object.keys(values);
|
|
10
|
+
const elements = [];
|
|
11
|
+
for (let i = 0; i < keys.length; i++) {
|
|
12
|
+
if (this.horizontal) {
|
|
13
|
+
elements.push(h("div", null, h("dt", null, keys[i]), h("dd", null, values[keys[i]])));
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
elements.push(h("dt", null, keys[i]));
|
|
17
|
+
elements.push(h("dd", null, values[keys[i]]));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return elements;
|
|
21
|
+
}
|
|
22
|
+
renderArrayElements(values) {
|
|
23
|
+
const elements = [];
|
|
24
|
+
for (let i = 0; i < values.length; i++) {
|
|
25
|
+
const value = values[i];
|
|
26
|
+
if (this.horizontal) {
|
|
27
|
+
elements.push(h("div", null, h("dt", { class: 'mainTitle' }, value.title), h("dt", { class: 'subTitle' }, value.subTitle), h("dd", null, value.data)));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
elements.push(h("dt", { class: 'mainTitle' }, value.title));
|
|
31
|
+
elements.push(h("dt", { class: 'subTitle' }, value.subTitle));
|
|
32
|
+
elements.push(h("dd", null, value.data));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return elements;
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
if (!this.keyvalues) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let values;
|
|
42
|
+
if (typeof this.keyvalues === 'string') {
|
|
43
|
+
values = JSON.parse(this.keyvalues);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
values = this.keyvalues;
|
|
47
|
+
}
|
|
48
|
+
let elements;
|
|
49
|
+
if (Array.isArray(values)) {
|
|
50
|
+
elements = this.renderArrayElements(values);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
elements = this.renderSingleElements(values);
|
|
54
|
+
}
|
|
55
|
+
return (h(Host, null, h("dl", { class: this.horizontal ? 'horizontal' : null }, elements)));
|
|
56
|
+
}
|
|
57
|
+
static get is() { return "tttx-keyvalue-block"; }
|
|
58
|
+
static get encapsulation() { return "shadow"; }
|
|
59
|
+
static get originalStyleUrls() {
|
|
60
|
+
return {
|
|
61
|
+
"$": ["tttx-keyvalue-block.scss"]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static get styleUrls() {
|
|
65
|
+
return {
|
|
66
|
+
"$": ["tttx-keyvalue-block.css"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static get properties() {
|
|
70
|
+
return {
|
|
71
|
+
"keyvalues": {
|
|
72
|
+
"type": "any",
|
|
73
|
+
"mutable": false,
|
|
74
|
+
"complexType": {
|
|
75
|
+
"original": "any | any[] | string",
|
|
76
|
+
"resolved": "any",
|
|
77
|
+
"references": {}
|
|
78
|
+
},
|
|
79
|
+
"required": false,
|
|
80
|
+
"optional": false,
|
|
81
|
+
"docs": {
|
|
82
|
+
"tags": [],
|
|
83
|
+
"text": ""
|
|
84
|
+
},
|
|
85
|
+
"attribute": "keyvalues",
|
|
86
|
+
"reflect": false
|
|
87
|
+
},
|
|
88
|
+
"horizontal": {
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"mutable": false,
|
|
91
|
+
"complexType": {
|
|
92
|
+
"original": "boolean",
|
|
93
|
+
"resolved": "boolean",
|
|
94
|
+
"references": {}
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"optional": false,
|
|
98
|
+
"docs": {
|
|
99
|
+
"tags": [],
|
|
100
|
+
"text": ""
|
|
101
|
+
},
|
|
102
|
+
"attribute": "horizontal",
|
|
103
|
+
"reflect": false
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: 'atoms/Key Value Block',
|
|
3
|
-
component: 'tttx-keyvalue-block'
|
|
4
|
-
};
|
|
5
|
-
const keyValues = {
|
|
6
|
-
'Name': 'John Doe',
|
|
7
|
-
'Date of birth': '14 Jan 1981',
|
|
8
|
-
'Start of postcode': 'AB10'
|
|
9
|
-
};
|
|
10
|
-
export const KeyValueBlock = () => {
|
|
11
|
-
return `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
12
|
-
};
|
|
13
|
-
const keyValueArray = [
|
|
14
|
-
{
|
|
15
|
-
title: "Electrical Designer",
|
|
16
|
-
subTitle: "Satchwell",
|
|
17
|
-
data: "18 Oct 2021 - Present"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
title: "Electrical Inspector",
|
|
21
|
-
subTitle: "Fastned",
|
|
22
|
-
data: "20 Dec 2016 - 10 Oct 2021"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: "Electrical Tech Prof I - Eng",
|
|
26
|
-
subTitle: "Voltech",
|
|
27
|
-
data: "20 Dec 2009 - 20 Nov 2016"
|
|
28
|
-
},
|
|
29
|
-
];
|
|
30
|
-
export const KeyValueSubtitleBlock = () => {
|
|
31
|
-
return `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
32
|
-
};
|
|
33
|
-
export const HorizontalKeyValueBlock = () => {
|
|
34
|
-
return `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
35
|
-
};
|
|
36
|
-
export const HorizontalKeyValueSubtitleBlock = () => {
|
|
37
|
-
return `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
38
|
-
};
|
|
1
|
+
export default {
|
|
2
|
+
title: 'atoms/Key Value Block',
|
|
3
|
+
component: 'tttx-keyvalue-block'
|
|
4
|
+
};
|
|
5
|
+
const keyValues = {
|
|
6
|
+
'Name': 'John Doe',
|
|
7
|
+
'Date of birth': '14 Jan 1981',
|
|
8
|
+
'Start of postcode': 'AB10'
|
|
9
|
+
};
|
|
10
|
+
export const KeyValueBlock = () => {
|
|
11
|
+
return `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
12
|
+
};
|
|
13
|
+
const keyValueArray = [
|
|
14
|
+
{
|
|
15
|
+
title: "Electrical Designer",
|
|
16
|
+
subTitle: "Satchwell",
|
|
17
|
+
data: "18 Oct 2021 - Present"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
title: "Electrical Inspector",
|
|
21
|
+
subTitle: "Fastned",
|
|
22
|
+
data: "20 Dec 2016 - 10 Oct 2021"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Electrical Tech Prof I - Eng",
|
|
26
|
+
subTitle: "Voltech",
|
|
27
|
+
data: "20 Dec 2009 - 20 Nov 2016"
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
export const KeyValueSubtitleBlock = () => {
|
|
31
|
+
return `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
32
|
+
};
|
|
33
|
+
export const HorizontalKeyValueBlock = () => {
|
|
34
|
+
return `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
35
|
+
};
|
|
36
|
+
export const HorizontalKeyValueSubtitleBlock = () => {
|
|
37
|
+
return `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
38
|
+
};
|