@3t-transform/threeteeui 0.2.75 → 0.2.76
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/tttx-button.cjs.entry.js +2 -2
- package/dist/cjs/tttx-form.cjs.entry.js +78 -49
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +17 -14
- package/dist/cjs/tttx-list.cjs.entry.js +1 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +8 -3
- package/dist/cjs/tttx-tag.cjs.entry.js +1 -1
- package/dist/cjs/tttx.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/tttx-button/tttx-button.css +1 -1
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +1 -2
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +1 -1
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +0 -1
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.css +14 -5
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +46 -18
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +85 -29
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.css +1 -1
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +0 -1
- package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +1 -1
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +14 -3
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +15 -13
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +107 -177
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +56 -36
- package/dist/collection/components/molecules/tttx-list/tttx-list.css +1 -1
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +102 -198
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +7 -2
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +23 -5
- package/dist/components/tttx-button2.js +2 -2
- package/dist/components/tttx-form.js +79 -50
- package/dist/components/tttx-keyvalue-block.js +21 -16
- package/dist/components/tttx-list.js +1 -1
- package/dist/components/tttx-standalone-input2.js +8 -3
- package/dist/components/tttx-tag.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/tttx-button.entry.js +2 -2
- package/dist/esm/tttx-form.entry.js +78 -49
- package/dist/esm/tttx-keyvalue-block.entry.js +17 -14
- package/dist/esm/tttx-list.entry.js +1 -1
- package/dist/esm/tttx-standalone-input.entry.js +8 -3
- package/dist/esm/tttx-tag.entry.js +1 -1
- package/dist/esm/tttx.js +1 -1
- package/dist/tttx/p-09b92178.entry.js +1 -0
- package/dist/tttx/{p-750cf31b.entry.js → p-129df5a2.entry.js} +1 -1
- package/dist/tttx/{p-a6582ab0.entry.js → p-25acdd4c.entry.js} +1 -1
- package/dist/tttx/{p-5b7b8539.entry.js → p-4ade2866.entry.js} +1 -1
- package/dist/tttx/p-b30a1025.entry.js +1 -0
- package/dist/tttx/p-d1ff1456.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -1
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +6 -4
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +3 -2
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +5 -7
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +74 -29
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +7 -0
- package/dist/types/components.d.ts +7 -4
- package/package.json +1 -1
- package/dist/tttx/p-6fe0af4e.entry.js +0 -1
- package/dist/tttx/p-818574fe.entry.js +0 -1
- package/dist/tttx/p-895526aa.entry.js +0 -1
|
@@ -11,11 +11,12 @@ dl {
|
|
|
11
11
|
|
|
12
12
|
dt {
|
|
13
13
|
font-weight: 400;
|
|
14
|
-
line-height: 21px;
|
|
15
14
|
font-size: 16px;
|
|
15
|
+
margin-bottom: 4px;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
dt,
|
|
18
|
+
dt,
|
|
19
|
+
dt.subTitle {
|
|
19
20
|
color: #757575;
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -23,7 +24,8 @@ dt.mainTitle {
|
|
|
23
24
|
color: #212121;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
dt,
|
|
27
|
+
dt,
|
|
28
|
+
dd {
|
|
27
29
|
overflow-wrap: anywhere;
|
|
28
30
|
}
|
|
29
31
|
|
|
@@ -32,16 +34,23 @@ dd {
|
|
|
32
34
|
font-weight: 400;
|
|
33
35
|
font-size: 16px;
|
|
34
36
|
color: #212121;
|
|
35
|
-
line-height: 21px;
|
|
36
|
-
margin-bottom: 18px;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
dd:not(:last-child) {
|
|
40
|
+
margin-bottom: 16px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
dl.spacedout,
|
|
39
44
|
dl.horizontal {
|
|
40
45
|
display: flex;
|
|
41
46
|
flex-direction: row;
|
|
42
47
|
width: 100%;
|
|
43
48
|
}
|
|
44
49
|
|
|
50
|
+
dl.spacedout {
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
dl.horizontal div {
|
|
46
55
|
flex-grow: 1;
|
|
47
56
|
}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
1
|
import { h, Host } from '@stencil/core';
|
|
3
2
|
export class TttxKeyvalueBlock {
|
|
4
3
|
constructor() {
|
|
5
4
|
this.keyvalues = undefined;
|
|
6
5
|
this.horizontal = undefined;
|
|
6
|
+
this.spacedout = undefined;
|
|
7
|
+
this._elements = undefined;
|
|
7
8
|
}
|
|
8
9
|
renderSingleElements(values) {
|
|
9
10
|
const keys = Object.keys(values);
|
|
10
11
|
const elements = [];
|
|
11
12
|
const divSize = (100 / keys.length).toString() + '%';
|
|
12
|
-
for (
|
|
13
|
-
if (this.horizontal) {
|
|
14
|
-
elements.push(h("div", { style: { maxWidth: divSize } }, h("dt", null,
|
|
13
|
+
for (const element of keys) {
|
|
14
|
+
if (this.horizontal || this.spacedout) {
|
|
15
|
+
elements.push(h("div", { style: { maxWidth: divSize } }, h("dt", null, element), h("dd", null, values[element])));
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
17
|
-
elements.push(h("dt", null,
|
|
18
|
-
elements.push(h("dd", null, values[
|
|
18
|
+
elements.push(h("dt", null, element));
|
|
19
|
+
elements.push(h("dd", null, values[element]));
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
return elements;
|
|
@@ -23,9 +24,9 @@ export class TttxKeyvalueBlock {
|
|
|
23
24
|
renderArrayElements(values) {
|
|
24
25
|
const elements = [];
|
|
25
26
|
const divSize = (100 / values.length).toString() + '%';
|
|
26
|
-
for (
|
|
27
|
-
const value =
|
|
28
|
-
if (this.horizontal) {
|
|
27
|
+
for (const element of values) {
|
|
28
|
+
const value = element;
|
|
29
|
+
if (this.horizontal || this.spacedout) {
|
|
29
30
|
elements.push(h("div", { style: { maxWidth: divSize } }, h("dt", { class: 'mainTitle' }, value.title), h("dt", { class: 'subTitle' }, value.subTitle), h("dd", null, value.data)));
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
@@ -36,7 +37,7 @@ export class TttxKeyvalueBlock {
|
|
|
36
37
|
}
|
|
37
38
|
return elements;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
componentWillRender() {
|
|
40
41
|
if (!this.keyvalues) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
@@ -47,14 +48,15 @@ export class TttxKeyvalueBlock {
|
|
|
47
48
|
else {
|
|
48
49
|
values = this.keyvalues;
|
|
49
50
|
}
|
|
50
|
-
let elements;
|
|
51
51
|
if (Array.isArray(values)) {
|
|
52
|
-
|
|
52
|
+
this._elements = this.renderArrayElements(values);
|
|
53
53
|
}
|
|
54
54
|
else {
|
|
55
|
-
|
|
55
|
+
this._elements = this.renderSingleElements(values);
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
return (h(Host, null, h("dl", { class: [this.horizontal ? 'horizontal' : undefined, this.spacedout ? ' spacedout' : undefined].join(' ').trim() }, this._elements)));
|
|
58
60
|
}
|
|
59
61
|
static get is() { return "tttx-keyvalue-block"; }
|
|
60
62
|
static get encapsulation() { return "shadow"; }
|
|
@@ -71,12 +73,16 @@ export class TttxKeyvalueBlock {
|
|
|
71
73
|
static get properties() {
|
|
72
74
|
return {
|
|
73
75
|
"keyvalues": {
|
|
74
|
-
"type": "
|
|
76
|
+
"type": "string",
|
|
75
77
|
"mutable": false,
|
|
76
78
|
"complexType": {
|
|
77
|
-
"original": "
|
|
78
|
-
"resolved": "
|
|
79
|
-
"references": {
|
|
79
|
+
"original": "KeyBlockValues | KeyBlockValues[] | string",
|
|
80
|
+
"resolved": "KeyBlockValues | KeyBlockValues[] | string",
|
|
81
|
+
"references": {
|
|
82
|
+
"KeyBlockValues": {
|
|
83
|
+
"location": "local"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
80
86
|
},
|
|
81
87
|
"required": false,
|
|
82
88
|
"optional": false,
|
|
@@ -103,7 +109,29 @@ export class TttxKeyvalueBlock {
|
|
|
103
109
|
},
|
|
104
110
|
"attribute": "horizontal",
|
|
105
111
|
"reflect": false
|
|
112
|
+
},
|
|
113
|
+
"spacedout": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"mutable": false,
|
|
116
|
+
"complexType": {
|
|
117
|
+
"original": "boolean",
|
|
118
|
+
"resolved": "boolean",
|
|
119
|
+
"references": {}
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"optional": false,
|
|
123
|
+
"docs": {
|
|
124
|
+
"tags": [],
|
|
125
|
+
"text": ""
|
|
126
|
+
},
|
|
127
|
+
"attribute": "spacedout",
|
|
128
|
+
"reflect": false
|
|
106
129
|
}
|
|
107
130
|
};
|
|
108
131
|
}
|
|
132
|
+
static get states() {
|
|
133
|
+
return {
|
|
134
|
+
"_elements": {}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
109
137
|
}
|
|
@@ -1,38 +1,94 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
title: 'atoms/Key Value Block',
|
|
3
|
-
component: 'tttx-keyvalue-block'
|
|
3
|
+
component: 'tttx-keyvalue-block',
|
|
4
4
|
};
|
|
5
|
-
const keyValues =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
const keyValueArray = [
|
|
14
|
-
{
|
|
15
|
-
title: "Electrical Designer",
|
|
16
|
-
subTitle: "Satchwell",
|
|
17
|
-
data: "18 Oct 2021 - Present"
|
|
5
|
+
const TemplateKeyValueBlock = ({ keyValues }) => `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
6
|
+
export const BasicKeyValueBlock = TemplateKeyValueBlock.bind({});
|
|
7
|
+
BasicKeyValueBlock.args = {
|
|
8
|
+
keyValues: {
|
|
9
|
+
'Name': 'John Doe',
|
|
10
|
+
'Date of birth': '14 Jan 1981',
|
|
11
|
+
'Start of postcode': 'AB10',
|
|
18
12
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
};
|
|
14
|
+
const TemplateHorizontalKeyValueBlock = ({ keyValues }) => `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
15
|
+
export const HorizontalKeyValueBlock = TemplateHorizontalKeyValueBlock.bind({});
|
|
16
|
+
HorizontalKeyValueBlock.args = {
|
|
17
|
+
keyValues: {
|
|
18
|
+
'Name': 'John Doe',
|
|
19
|
+
'Date of birth': '14 Jan 1981',
|
|
20
|
+
'Start of postcode': 'AB10',
|
|
23
21
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
};
|
|
23
|
+
const TemplateSpacedoutKeyValueBlock = ({ keyValues }) => `<tttx-keyvalue-block spacedout='true' keyvalues='${JSON.stringify(keyValues)}' />`;
|
|
24
|
+
export const SpacedoutKeyValueBlock = TemplateSpacedoutKeyValueBlock.bind({});
|
|
25
|
+
SpacedoutKeyValueBlock.args = {
|
|
26
|
+
keyValues: {
|
|
27
|
+
'Name': 'John Doe',
|
|
28
|
+
'Date of birth': '14 Jan 1981',
|
|
29
|
+
'Start of postcode': 'AB10',
|
|
28
30
|
},
|
|
29
|
-
];
|
|
30
|
-
export const KeyValueSubtitleBlock = () => {
|
|
31
|
-
return `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
32
31
|
};
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const TemplateKeyValueBlockArray = ({ keyValueArray }) => `<tttx-keyvalue-block keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
33
|
+
export const BasicKeyValueBlockArray = TemplateKeyValueBlockArray.bind({});
|
|
34
|
+
BasicKeyValueBlockArray.args = {
|
|
35
|
+
keyValueArray: [
|
|
36
|
+
{
|
|
37
|
+
title: 'Electrical Designer',
|
|
38
|
+
subTitle: 'Satchwell',
|
|
39
|
+
data: '18 Oct 2021 - Present',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'Electrical Inspector',
|
|
43
|
+
subTitle: 'Fastned',
|
|
44
|
+
data: '20 Dec 2016 - 10 Oct 2021',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
title: 'Electrical Tech Prof I - Eng',
|
|
48
|
+
subTitle: 'Voltech',
|
|
49
|
+
data: '20 Dec 2009 - 20 Nov 2016',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
const TemplateHorizontalKeyValueBlockArray = ({ keyValueArray }) => `<tttx-keyvalue-block horizontal='true' keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
54
|
+
export const HorizontalKeyValueBlockArray = TemplateHorizontalKeyValueBlockArray.bind({});
|
|
55
|
+
HorizontalKeyValueBlockArray.args = {
|
|
56
|
+
keyValueArray: [
|
|
57
|
+
{
|
|
58
|
+
title: 'Electrical Designer',
|
|
59
|
+
subTitle: 'Satchwell',
|
|
60
|
+
data: '18 Oct 2021 - Present',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: 'Electrical Inspector',
|
|
64
|
+
subTitle: 'Fastned',
|
|
65
|
+
data: '20 Dec 2016 - 10 Oct 2021',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
title: 'Electrical Tech Prof I - Eng',
|
|
69
|
+
subTitle: 'Voltech',
|
|
70
|
+
data: '20 Dec 2009 - 20 Nov 2016',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
35
73
|
};
|
|
36
|
-
|
|
37
|
-
|
|
74
|
+
const TemplateSpacedoutKeyValueBlockArray = ({ keyValueArray }) => `<tttx-keyvalue-block spacedout='true' keyvalues='${JSON.stringify(keyValueArray)}' />`;
|
|
75
|
+
export const SpacedoutKeyValueBlockArray = TemplateSpacedoutKeyValueBlockArray.bind({});
|
|
76
|
+
SpacedoutKeyValueBlockArray.args = {
|
|
77
|
+
keyValueArray: [
|
|
78
|
+
{
|
|
79
|
+
title: 'Electrical Designer',
|
|
80
|
+
subTitle: 'Satchwell',
|
|
81
|
+
data: '18 Oct 2021 - Present',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
title: 'Electrical Inspector',
|
|
85
|
+
subTitle: 'Fastned',
|
|
86
|
+
data: '20 Dec 2016 - 10 Oct 2021',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
title: 'Electrical Tech Prof I - Eng',
|
|
90
|
+
subTitle: 'Voltech',
|
|
91
|
+
data: '20 Dec 2009 - 20 Nov 2016',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
38
94
|
};
|
|
@@ -4,14 +4,25 @@
|
|
|
4
4
|
* displays the error message in an error bubble. If no error was detected,
|
|
5
5
|
* it removes the "invalid" class from the input field and clears the error bubble.
|
|
6
6
|
*
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {FormField} target - The input field to update.
|
|
8
8
|
* @param {boolean} hasError - Whether an error was detected in the field.
|
|
9
9
|
* @param {string} errorMessage - The error message to display (if any).
|
|
10
10
|
* @return {void}
|
|
11
11
|
*/
|
|
12
|
-
function setErrorState(target, hasError, errorMessage) {
|
|
12
|
+
function setErrorState(target, hasError, errorMessage, parent = undefined) {
|
|
13
13
|
// Find the error bubble element for the input field
|
|
14
|
-
|
|
14
|
+
let errorBubble;
|
|
15
|
+
if (parent !== undefined) {
|
|
16
|
+
errorBubble = parent.querySelector('.errorBubble');
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
if (target.parentElement.nodeName.toLowerCase() === 'label') {
|
|
20
|
+
errorBubble = target.parentElement.querySelector('.errorBubble');
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
errorBubble = target.parentElement.parentElement.querySelector('.errorBubble');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
15
26
|
// If an error was detected, set the input field's class to "invalid" and display the error message in the error bubble
|
|
16
27
|
if (hasError) {
|
|
17
28
|
target.classList.add('invalid');
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* sets an error message if there's an issue, and emits a "dataChanged" event to
|
|
4
4
|
* the parent component with the field name and its new value.
|
|
5
5
|
*
|
|
6
|
-
* @param {Event} event - The focusout event triggered by the input field.
|
|
7
|
-
* @return {
|
|
6
|
+
* @param {Event | FocusEvent} event - The focusout event triggered by the input field.
|
|
7
|
+
* @return {{ target: FormField; hasError: boolean; errorMessage: string; }}
|
|
8
8
|
*/
|
|
9
9
|
function validityCheck(event) {
|
|
10
10
|
var _a, _b, _c, _d;
|
|
@@ -13,17 +13,19 @@ function validityCheck(event) {
|
|
|
13
13
|
let hasError = true;
|
|
14
14
|
let errorMessage = '';
|
|
15
15
|
// validity object on HTML5 inputs has the following options
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
16
|
+
/*
|
|
17
|
+
badInput
|
|
18
|
+
customError
|
|
19
|
+
patternMismatch
|
|
20
|
+
rangeOverflow
|
|
21
|
+
rangeUnderflow
|
|
22
|
+
stepMismatch
|
|
23
|
+
tooLong
|
|
24
|
+
tooShort
|
|
25
|
+
typeMismatch
|
|
26
|
+
valid
|
|
27
|
+
valueMissing
|
|
28
|
+
*/
|
|
27
29
|
// customErrors can be set with
|
|
28
30
|
// target.setCustomValidity('custom error!');
|
|
29
31
|
// and cleared with
|