@3t-transform/threeteeui 0.2.93 → 0.2.95
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/tttx-dialog.cjs.entry.js +2 -2
- package/dist/cjs/tttx-form.cjs.entry.js +5 -0
- package/dist/cjs/tttx-tabs.cjs.entry.js +5 -3
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.css +3 -0
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.js +1 -1
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +5 -0
- package/dist/collection/components/molecules/tttx-tabs/tttx-tabs.js +5 -3
- package/dist/components/tttx-dialog.js +2 -2
- package/dist/components/tttx-form.js +5 -0
- package/dist/components/tttx-tabs.js +5 -3
- package/dist/esm/tttx-dialog.entry.js +2 -2
- package/dist/esm/tttx-form.entry.js +5 -0
- package/dist/esm/tttx-tabs.entry.js +5 -3
- package/dist/tttx/p-a19ad838.entry.js +1 -0
- package/dist/tttx/p-a4c2cb80.entry.js +1 -0
- package/dist/tttx/p-feea36cb.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/package.json +1 -1
- package/dist/tttx/p-b189ca0f.entry.js +0 -1
- package/dist/tttx/p-cdac34b5.entry.js +0 -1
- package/dist/tttx/p-e2dda35e.entry.js +0 -1
|
@@ -11,7 +11,7 @@ const ICON_TYPES = {
|
|
|
11
11
|
warning: { iconName: 'warning', iconColor: 'orange' },
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
14
|
+
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
15
15
|
|
|
16
16
|
const TttxDialog = class {
|
|
17
17
|
constructor(hostRef) {
|
|
@@ -50,7 +50,7 @@ const TttxDialog = class {
|
|
|
50
50
|
renderHeader() {
|
|
51
51
|
const iconEnabled = typeof this.type !== 'undefined';
|
|
52
52
|
const { iconName, iconColor } = this.headerIconDetails(iconEnabled);
|
|
53
|
-
return (index.h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && index.h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), index.h("h3", { class: "title" }, this.header), this.closeEnabled && (index.h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, index.h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
53
|
+
return (index.h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && index.h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), index.h("h3", { class: "title", title: this.header }, this.header), this.closeEnabled && (index.h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, index.h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
54
54
|
}
|
|
55
55
|
body() {
|
|
56
56
|
return (index.h("div", { class: `body ${!this.allowOverflow ? 'overflow-hidden' : ''}` }, index.h("span", { class: "body-content" }, index.h("slot", null))));
|
|
@@ -65,6 +65,11 @@ function validityCheck(event) {
|
|
|
65
65
|
default:
|
|
66
66
|
hasError = false;
|
|
67
67
|
}
|
|
68
|
+
//handle whitespace-only input
|
|
69
|
+
if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
|
|
70
|
+
errorMessage = 'Whitespace-only not allowed';
|
|
71
|
+
hasError = true;
|
|
72
|
+
}
|
|
68
73
|
// Return the error state
|
|
69
74
|
return { target, hasError, errorMessage };
|
|
70
75
|
}
|
|
@@ -80,13 +80,15 @@ const TttxTabs = class {
|
|
|
80
80
|
if (!this.tabs || this.tabs.length == 0) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
+
let currentTab = this._tabs[0];
|
|
84
|
+
if (this.tabFocus > -1) {
|
|
85
|
+
currentTab = this._tabs[this.tabFocus];
|
|
86
|
+
}
|
|
83
87
|
return (index.h(index.Host, null, index.h("div", null, index.h("div", { class: "tab-bar", role: "tablist", "aria-label": this.tabsName, ref: el => (this.tabList = el) }, this.navigation && (index.h("div", { class: "left-navigation", tabindex: "0", onClick: this.handleLeftNavigation.bind(this) }, index.h("tttx-icon", { icon: "navigate_before", color: "black" }))), index.h("div", { class: 'tabs-container' + (this.wide ? ' wide' : '') }, this._tabs.map(tab => {
|
|
84
88
|
return (index.h("a", { key: tab.id, id: tab.id, role: "tab", "aria-controls": tab.controls, tabindex: tab.tabIndex, "aria-selected": tab.selected, onClick: () => {
|
|
85
89
|
this.handleTabClick(tab);
|
|
86
90
|
} }, tab.tabName));
|
|
87
|
-
})), this.navigation && (index.h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, index.h("tttx-icon", { icon: "navigate_next", color: "black" })))),
|
|
88
|
-
return (index.h("article", { key: tab.id, id: tab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": tab.id, "aria-expanded": tab.selected, innerHTML: domsanitiser_options.purify.sanitize(tab.pageContent, domsanitiser_options.domSanitiserOptions), hidden: !tab.selected }));
|
|
89
|
-
}))));
|
|
91
|
+
})), this.navigation && (index.h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, index.h("tttx-icon", { icon: "navigate_next", color: "black" })))), index.h("article", { key: currentTab.id, id: currentTab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": currentTab.id, "aria-expanded": currentTab.selected, innerHTML: domsanitiser_options.purify.sanitize(currentTab.pageContent, domsanitiser_options.domSanitiserOptions), hidden: !currentTab.selected }))));
|
|
90
92
|
}
|
|
91
93
|
static get watchers() { return {
|
|
92
94
|
"tabs": ["onDataChange"]
|
|
@@ -36,7 +36,7 @@ export class TttxDialog {
|
|
|
36
36
|
renderHeader() {
|
|
37
37
|
const iconEnabled = typeof this.type !== 'undefined';
|
|
38
38
|
const { iconName, iconColor } = this.headerIconDetails(iconEnabled);
|
|
39
|
-
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title" }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
39
|
+
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title", title: this.header }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
40
40
|
}
|
|
41
41
|
body() {
|
|
42
42
|
return (h("div", { class: `body ${!this.allowOverflow ? 'overflow-hidden' : ''}` }, h("span", { class: "body-content" }, h("slot", null))));
|
|
@@ -57,6 +57,11 @@ function validityCheck(event) {
|
|
|
57
57
|
default:
|
|
58
58
|
hasError = false;
|
|
59
59
|
}
|
|
60
|
+
//handle whitespace-only input
|
|
61
|
+
if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
|
|
62
|
+
errorMessage = 'Whitespace-only not allowed';
|
|
63
|
+
hasError = true;
|
|
64
|
+
}
|
|
60
65
|
// Return the error state
|
|
61
66
|
return { target, hasError, errorMessage };
|
|
62
67
|
}
|
|
@@ -69,13 +69,15 @@ export class TttxTabs {
|
|
|
69
69
|
if (!this.tabs || this.tabs.length == 0) {
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
+
let currentTab = this._tabs[0];
|
|
73
|
+
if (this.tabFocus > -1) {
|
|
74
|
+
currentTab = this._tabs[this.tabFocus];
|
|
75
|
+
}
|
|
72
76
|
return (h(Host, null, h("div", null, h("div", { class: "tab-bar", role: "tablist", "aria-label": this.tabsName, ref: el => (this.tabList = el) }, this.navigation && (h("div", { class: "left-navigation", tabindex: "0", onClick: this.handleLeftNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_before", color: "black" }))), h("div", { class: 'tabs-container' + (this.wide ? ' wide' : '') }, this._tabs.map(tab => {
|
|
73
77
|
return (h("a", { key: tab.id, id: tab.id, role: "tab", "aria-controls": tab.controls, tabindex: tab.tabIndex, "aria-selected": tab.selected, onClick: () => {
|
|
74
78
|
this.handleTabClick(tab);
|
|
75
79
|
} }, tab.tabName));
|
|
76
|
-
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))),
|
|
77
|
-
return (h("article", { key: tab.id, id: tab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": tab.id, "aria-expanded": tab.selected, innerHTML: DOMPurify.sanitize(tab.pageContent, domSanitiserOptions), hidden: !tab.selected }));
|
|
78
|
-
}))));
|
|
80
|
+
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))), h("article", { key: currentTab.id, id: currentTab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": currentTab.id, "aria-expanded": currentTab.selected, innerHTML: DOMPurify.sanitize(currentTab.pageContent, domSanitiserOptions), hidden: !currentTab.selected }))));
|
|
79
81
|
}
|
|
80
82
|
static get is() { return "tttx-tabs"; }
|
|
81
83
|
static get encapsulation() { return "scoped"; }
|
|
@@ -8,7 +8,7 @@ const ICON_TYPES = {
|
|
|
8
8
|
warning: { iconName: 'warning', iconColor: 'orange' },
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
11
|
+
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
12
12
|
|
|
13
13
|
const TttxDialog$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
@@ -49,7 +49,7 @@ const TttxDialog$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
49
49
|
renderHeader() {
|
|
50
50
|
const iconEnabled = typeof this.type !== 'undefined';
|
|
51
51
|
const { iconName, iconColor } = this.headerIconDetails(iconEnabled);
|
|
52
|
-
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title" }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
52
|
+
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title", title: this.header }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
53
53
|
}
|
|
54
54
|
body() {
|
|
55
55
|
return (h("div", { class: `body ${!this.allowOverflow ? 'overflow-hidden' : ''}` }, h("span", { class: "body-content" }, h("slot", null))));
|
|
@@ -60,6 +60,11 @@ function validityCheck(event) {
|
|
|
60
60
|
default:
|
|
61
61
|
hasError = false;
|
|
62
62
|
}
|
|
63
|
+
//handle whitespace-only input
|
|
64
|
+
if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
|
|
65
|
+
errorMessage = 'Whitespace-only not allowed';
|
|
66
|
+
hasError = true;
|
|
67
|
+
}
|
|
63
68
|
// Return the error state
|
|
64
69
|
return { target, hasError, errorMessage };
|
|
65
70
|
}
|
|
@@ -77,13 +77,15 @@ const TttxTabs$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
77
77
|
if (!this.tabs || this.tabs.length == 0) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
+
let currentTab = this._tabs[0];
|
|
81
|
+
if (this.tabFocus > -1) {
|
|
82
|
+
currentTab = this._tabs[this.tabFocus];
|
|
83
|
+
}
|
|
80
84
|
return (h(Host, null, h("div", null, h("div", { class: "tab-bar", role: "tablist", "aria-label": this.tabsName, ref: el => (this.tabList = el) }, this.navigation && (h("div", { class: "left-navigation", tabindex: "0", onClick: this.handleLeftNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_before", color: "black" }))), h("div", { class: 'tabs-container' + (this.wide ? ' wide' : '') }, this._tabs.map(tab => {
|
|
81
85
|
return (h("a", { key: tab.id, id: tab.id, role: "tab", "aria-controls": tab.controls, tabindex: tab.tabIndex, "aria-selected": tab.selected, onClick: () => {
|
|
82
86
|
this.handleTabClick(tab);
|
|
83
87
|
} }, tab.tabName));
|
|
84
|
-
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))),
|
|
85
|
-
return (h("article", { key: tab.id, id: tab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": tab.id, "aria-expanded": tab.selected, innerHTML: purify.sanitize(tab.pageContent, domSanitiserOptions), hidden: !tab.selected }));
|
|
86
|
-
}))));
|
|
88
|
+
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))), h("article", { key: currentTab.id, id: currentTab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": currentTab.id, "aria-expanded": currentTab.selected, innerHTML: purify.sanitize(currentTab.pageContent, domSanitiserOptions), hidden: !currentTab.selected }))));
|
|
87
89
|
}
|
|
88
90
|
static get watchers() { return {
|
|
89
91
|
"tabs": ["onDataChange"]
|
|
@@ -7,7 +7,7 @@ const ICON_TYPES = {
|
|
|
7
7
|
warning: { iconName: 'warning', iconColor: 'orange' },
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
10
|
+
const tttxDialogCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}.material-symbols-rounded{font-family:\"Material Symbols Rounded\", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:\"Roboto\", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}";
|
|
11
11
|
|
|
12
12
|
const TttxDialog = class {
|
|
13
13
|
constructor(hostRef) {
|
|
@@ -46,7 +46,7 @@ const TttxDialog = class {
|
|
|
46
46
|
renderHeader() {
|
|
47
47
|
const iconEnabled = typeof this.type !== 'undefined';
|
|
48
48
|
const { iconName, iconColor } = this.headerIconDetails(iconEnabled);
|
|
49
|
-
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title" }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
49
|
+
return (h("div", { class: `padding header ${this.type || ''}` }, iconEnabled && h("tttx-icon", { class: "icon", icon: iconName, color: iconColor }), h("h3", { class: "title", title: this.header }, this.header), this.closeEnabled && (h("div", { class: "align-right close-button", onClick: () => this.onCloseClickHandler() }, h("tttx-icon", { class: "icon-close clickable", icon: "close", color: "black" })))));
|
|
50
50
|
}
|
|
51
51
|
body() {
|
|
52
52
|
return (h("div", { class: `body ${!this.allowOverflow ? 'overflow-hidden' : ''}` }, h("span", { class: "body-content" }, h("slot", null))));
|
|
@@ -61,6 +61,11 @@ function validityCheck(event) {
|
|
|
61
61
|
default:
|
|
62
62
|
hasError = false;
|
|
63
63
|
}
|
|
64
|
+
//handle whitespace-only input
|
|
65
|
+
if (!target.value.replace(/\s/g, '').length && target.value.length !== 0) {
|
|
66
|
+
errorMessage = 'Whitespace-only not allowed';
|
|
67
|
+
hasError = true;
|
|
68
|
+
}
|
|
64
69
|
// Return the error state
|
|
65
70
|
return { target, hasError, errorMessage };
|
|
66
71
|
}
|
|
@@ -76,13 +76,15 @@ const TttxTabs = class {
|
|
|
76
76
|
if (!this.tabs || this.tabs.length == 0) {
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
+
let currentTab = this._tabs[0];
|
|
80
|
+
if (this.tabFocus > -1) {
|
|
81
|
+
currentTab = this._tabs[this.tabFocus];
|
|
82
|
+
}
|
|
79
83
|
return (h(Host, null, h("div", null, h("div", { class: "tab-bar", role: "tablist", "aria-label": this.tabsName, ref: el => (this.tabList = el) }, this.navigation && (h("div", { class: "left-navigation", tabindex: "0", onClick: this.handleLeftNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_before", color: "black" }))), h("div", { class: 'tabs-container' + (this.wide ? ' wide' : '') }, this._tabs.map(tab => {
|
|
80
84
|
return (h("a", { key: tab.id, id: tab.id, role: "tab", "aria-controls": tab.controls, tabindex: tab.tabIndex, "aria-selected": tab.selected, onClick: () => {
|
|
81
85
|
this.handleTabClick(tab);
|
|
82
86
|
} }, tab.tabName));
|
|
83
|
-
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))),
|
|
84
|
-
return (h("article", { key: tab.id, id: tab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": tab.id, "aria-expanded": tab.selected, innerHTML: purify.sanitize(tab.pageContent, domSanitiserOptions), hidden: !tab.selected }));
|
|
85
|
-
}))));
|
|
87
|
+
})), this.navigation && (h("div", { class: "right-navigation", tabindex: "0", onClick: this.handleRightNavigation.bind(this) }, h("tttx-icon", { icon: "navigate_next", color: "black" })))), h("article", { key: currentTab.id, id: currentTab.controls, role: "tabpanel", tabindex: "0", "aria-labelledby": currentTab.id, "aria-expanded": currentTab.selected, innerHTML: purify.sanitize(currentTab.pageContent, domSanitiserOptions), hidden: !currentTab.selected }))));
|
|
86
88
|
}
|
|
87
89
|
static get watchers() { return {
|
|
88
90
|
"tabs": ["onDataChange"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as a,H as i}from"./p-65bb4035.js";import{p as r,d as o}from"./p-88ee2406.js";import"./p-112455b1.js";const e=class{constructor(a){t(this,a),this.tabClick=s(this,"tabClick",7),this.leftNavigation=s(this,"leftNavigation",7),this.rightNavigation=s(this,"rightNavigation",7),this.tabFocus=0,this.tabsName=void 0,this.navigation=void 0,this.wide=void 0,this.tabs=void 0,this._tabs=void 0}onDataChange(){this.tabs&&(this._tabs="string"==typeof this.tabs?JSON.parse(this.tabs):[...this.tabs],this.tabFocus=this._tabs.findIndex((t=>-1!==t.tabIndex)))}componentWillLoad(){this.onDataChange()}handleTabClick(t){this.tabClick.emit({tabId:t.id})}handleLeftNavigation(){this.leftNavigation.emit()}handleRightNavigation(){this.rightNavigation.emit()}handleKeyDown(t){const s=this.tabList.getAttribute("aria-orientation"),a=s&&"vertical"===s?"ArrowUp":"ArrowLeft",i=s&&"vertical"===s?"ArrowDown":"ArrowRight";t.key===a||t.key===i?(this._tabs[this.tabFocus].tabIndex=-1,t.key===a?(this.tabFocus--,this.tabFocus<0&&(this.tabFocus=this._tabs.length-1)):t.key===i&&(this.tabFocus++,this.tabFocus>=this._tabs.length&&(this.tabFocus=0)),this._tabs[this.tabFocus].tabIndex=0,this.tabList.querySelectorAll('[role="tab"]')[this.tabFocus].focus(),this._tabs=[...this._tabs]):"Space"!==t.code&&"Enter"!==t.code||this.tabClick.emit({tabId:this._tabs[this.tabFocus].id})}render(){if(!this.tabs||0==this.tabs.length)return;let t=this._tabs[0];return this.tabFocus>-1&&(t=this._tabs[this.tabFocus]),a(i,null,a("div",null,a("div",{class:"tab-bar",role:"tablist","aria-label":this.tabsName,ref:t=>this.tabList=t},this.navigation&&a("div",{class:"left-navigation",tabindex:"0",onClick:this.handleLeftNavigation.bind(this)},a("tttx-icon",{icon:"navigate_before",color:"black"})),a("div",{class:"tabs-container"+(this.wide?" wide":"")},this._tabs.map((t=>a("a",{key:t.id,id:t.id,role:"tab","aria-controls":t.controls,tabindex:t.tabIndex,"aria-selected":t.selected,onClick:()=>{this.handleTabClick(t)}},t.tabName)))),this.navigation&&a("div",{class:"right-navigation",tabindex:"0",onClick:this.handleRightNavigation.bind(this)},a("tttx-icon",{icon:"navigate_next",color:"black"}))),a("article",{key:t.id,id:t.controls,role:"tabpanel",tabindex:"0","aria-labelledby":t.id,"aria-expanded":t.selected,innerHTML:r.sanitize(t.pageContent,o),hidden:!t.selected})))}static get watchers(){return{tabs:["onDataChange"]}}};e.style='.material-symbols-rounded.sc-tttx-tabs{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.sc-tttx-tabs-h{display:block}.tab-bar.sc-tttx-tabs{display:flex;height:52px}.tab-bar.sc-tttx-tabs>.left-navigation.sc-tttx-tabs,.tab-bar.sc-tttx-tabs>.right-navigation.sc-tttx-tabs{padding:14px 8px;cursor:pointer}.tab-bar.sc-tttx-tabs>.left-navigation.sc-tttx-tabs>*.sc-tttx-tabs,.tab-bar.sc-tttx-tabs>.right-navigation.sc-tttx-tabs>*.sc-tttx-tabs{height:24px;width:24px;cursor:pointer}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs{display:flex;border-bottom:1px solid #d5d5d5}.tab-bar.sc-tttx-tabs>.tabs-container.wide.sc-tttx-tabs{flex-grow:1}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab].sc-tttx-tabs{padding:18px 16px;line-height:16px;font-size:14px;font-weight:500;text-transform:uppercase;user-select:none;color:#757575;cursor:pointer}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab].sc-tttx-tabs:hover{background-color:rgba(17, 17, 17, 0.05)}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab][aria-selected].sc-tttx-tabs{color:#212121;cursor:default;border-bottom:3px solid #1579c6}';export{e as tttx_tabs}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,c as i,h as t,g as e}from"./p-65bb4035.js";const n={critical:{iconName:"report",iconColor:"red"},info:{iconName:"info",iconColor:"blue"},success:{iconName:"check_circle",iconColor:"green"},warning:{iconName:"warning",iconColor:"orange"}},l=class{constructor(t){o(this,t),this.closeButtonClick=i(this,"closeButtonClick",6),this.header=void 0,this.type=void 0,this.size="regular",this.open=!1,this.allowOverflow=!1,this.closeEnabled=!0,this.elementSize=void 0}handleResize(){this.elementSize=window.innerWidth<698?"mobile":this.size}preventCancelOnDialog(o){o.preventDefault()}componentDidLoad(){this.dialog.addEventListener("cancel",this.preventCancelOnDialog)}onCloseClickHandler(){this.closeButtonClick.emit()}headerIconDetails(o){return o?n[this.type]:{iconName:void 0,iconColor:void 0}}renderHeader(){const o=void 0!==this.type,{iconName:i,iconColor:e}=this.headerIconDetails(o);return t("div",{class:`padding header ${this.type||""}`},o&&t("tttx-icon",{class:"icon",icon:i,color:e}),t("h3",{class:"title",title:this.header},this.header),this.closeEnabled&&t("div",{class:"align-right close-button",onClick:()=>this.onCloseClickHandler()},t("tttx-icon",{class:"icon-close clickable",icon:"close",color:"black"})))}body(){return t("div",{class:"body "+(this.allowOverflow?"":"overflow-hidden")},t("span",{class:"body-content"},t("slot",null)))}footer(){if(this.el.querySelector('[slot="buttons"]'))return t("div",{class:"padding footer"},t("div",{class:"align-right"},t("slot",{name:"buttons"})))}componentDidRender(){this.open?this.dialog.open||this.dialog.showModal():this.dialog.close()}componentWillLoad(){this.handleResize()}render(){return t("dialog",{ref:o=>this.dialog=o,class:`dialog-box ${this.allowOverflow?"overflow-visible":""} ${this.elementSize}`},t("div",{class:"contents"},this.renderHeader(),this.body(),this.footer()))}get el(){return e(this)}};l.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.material-symbols-rounded{font-family:"Material Symbols Rounded", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:"Roboto", serif;text-overflow:ellipsis;overflow-x:hidden;white-space:nowrap}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:"Roboto", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}';export{l as tttx_dialog}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as t,h as o,H as i}from"./p-65bb4035.js";import{p as n,d as r}from"./p-88ee2406.js";import"./p-112455b1.js";function a(e,t,o,i){let n;if(n=void 0!==i?i.querySelector(".errorBubble"):"label"===e.parentElement.nodeName.toLowerCase()?e.parentElement.querySelector(".errorBubble"):e.parentElement.parentElement.querySelector(".errorBubble"),t){e.classList.add("invalid"),n.classList.add("visible");const t=document.createElement("span");t.className="material-symbols-rounded",t.textContent="warning",n.innerHTML="",n.append(t),n.append(o)}else n.classList.remove("visible"),e.classList.remove("invalid"),n.innerHTML=""}const l=class{constructor(o){e(this,o),this.dataSubmitted=t(this,"dataSubmitted",7),this.dataChanged=t(this,"dataChanged",7),this.template=document.createElement("template"),this.formschema=void 0,this.data=void 0}onFormSchemaChange(e){if(!this.data&&this.form&&this._formSchema){const e=new FormData(this.form);this._data=Object.fromEntries(Object.keys(this._formSchema.properties).map((t=>[t,e.get(t)])))}this._formSchema="string"==typeof e?JSON.parse(e):e}onDataChange(e){this._data="string"==typeof e?JSON.parse(e):e}fieldChanged(e){this.dataChanged.emit({name:e.target.name,value:e.target.value})}async submit(){this.submitButton.click()}doSubmit(e){e.preventDefault();const t=new FormData(e.target);this.dataSubmitted.emit(t)}componentWillLoad(){this.onFormSchemaChange(this.formschema),this.data&&this.onDataChange(this.data)}componentWillRender(){this.template=document.createElement("template"),this.populateFormFromSchema()}createSelect(e,t){var o;const i=document.createElement("select");return i.setAttribute("name",e),t.options.forEach((e=>{this.appendOption(i,e)})),(null===(o=this._data)||void 0===o?void 0:o[e])&&i.classList.remove("placeholder"),i}appendOption(e,t){const o=document.createElement("option");o.setAttribute("value",t.value),t.placeholder&&(o.setAttribute("disabled",""),o.setAttribute("selected",""),o.setAttribute("hidden",""),e.classList.add("placeholder")),t.label&&(o.innerHTML=n.sanitize(t.label,r)),e.appendChild(o)}createInput(e,t){var o;const i=document.createElement("input");return i.name=e,i.type=t.type,i.placeholder=null!==(o=t.placeholder)&&void 0!==o?o:"",i.autocomplete="off",i.autocapitalize="off",t.readonly&&(i.readOnly=!0),i}applyValidation(e,t){var o,i;t.required&&(e.setAttribute("required",""),e.setAttribute("data-required",null!==(o=t.required.message)&&void 0!==o?o:"")),t.pattern&&(e.setAttribute("pattern",t.pattern.pattern),e.setAttribute("data-pattern",null!==(i=t.pattern.message)&&void 0!==i?i:"")),t.badInput&&e.setAttribute("data-badinput",t.badInput.message),t.minmax&&(e.setAttribute("min",t.minmax.min),e.setAttribute("max",t.minmax.max),e.setAttribute("data-range",t.minmax.message)),t.maxlength&&e.setAttribute("maxlength",t.maxlength)}createErrorBubble(){const e=document.createElement("div");return e.className="errorBubble",e}appendCheckboxInput(e,t,o){if(e.label){const e=document.createElement("br");o.appendChild(e)}if(o.appendChild(t),!e.inlineLabel)return;const i=document.createElement("span");i.className="inlineLabel",i.textContent=e.inlineLabel,o.appendChild(i)}createLabel(e,t,o){const i=document.createElement("div");i.className="outer-container inputBlock";const n=document.createElement("label");if(n.innerText=e.label,!e.validation){const e=document.createElement("span");e.className="optional",e.innerHTML=" (optional)",n.appendChild(e)}return e.readonly&&n.classList.add("readonly"),"checkbox"===e.type?this.appendCheckboxInput(e,t,n):i.appendChild(t),"checkbox"!==e.type&&n.appendChild(i),n.appendChild(o),n}populateFormFromSchema(){if(!this._formSchema)return;const e=this._formSchema.properties;Object.keys(e).forEach((t=>{const o=e[t].form,i="select"===o.type?this.createSelect(t,o):this.createInput(t,o);o.validation&&this.applyValidation(i,o.validation);const n=this.createErrorBubble(),r=this.createLabel(o,i,n);this.template.content.append(r)}))}componentDidRender(){if(!this._formSchema)return;const e=this.template.content.cloneNode(!0),t=this._formSchema.properties;Object.keys(t).forEach((o=>{var i,n;const r=e.querySelector(`[name=${o}]`);if(r.oninvalid=this.validityCheckWrapper.bind(this),r.onblur=this.validityCheckWrapper.bind(this),r.onkeyup=this.fieldChanged.bind(this),r.onchange=this.fieldChanged.bind(this),void 0!==(null===(i=this._data)||void 0===i?void 0:i[o])&&null!==this._data[o]&&(r.value=this._data[o]),null===(n=t[o].form.validation)||void 0===n?void 0:n.invalid){const e=t[o].form.validation.invalid.message;r.setCustomValidity(e),a(r,!0,e)}"select"===t[o].form.type&&r.classList.contains("placeholder")&&r.addEventListener("change",(()=>{r.classList.remove("placeholder")}))})),this.fieldset.replaceChildren(e)}validityCheckWrapper(e){const{target:t,hasError:o,errorMessage:i}=function(e){var t,o,i,n;e.preventDefault();const r=e.target;let a=!0,l="";switch(!0){case r.validity.valueMissing:l=null!==(t=r.dataset.required)&&void 0!==t?t:"This field is required";break;case r.validity.patternMismatch:l=null!==(o=r.dataset.pattern)&&void 0!==o?o:"Incorrect format";break;case r.validity.badInput:l=null!==(i=r.dataset.badinput)&&void 0!==i?i:"Wrong input type";break;case r.validity.rangeOverflow||r.validity.rangeUnderflow:l=null!==(n=r.dataset.range)&&void 0!==n?n:"Invalid value";break;case r.validity.customError:l=r.validationMessage;break;default:a=!1}return r.value.replace(/\s/g,"").length||0===r.value.length||(l="Whitespace-only not allowed",a=!0),{target:r,hasError:a,errorMessage:l}}(e);a(t,o,i)}render(){return o(i,null,o("form",{ref:e=>this.form=e,onSubmit:this.doSubmit.bind(this)},o("fieldset",{ref:e=>this.fieldset=e}),o("input",{type:"submit",ref:e=>this.submitButton=e,style:{display:"none"}})))}static get watchers(){return{formschema:["onFormSchemaChange"],data:["onDataChange"]}}};l.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}label{font-weight:500;font-size:16px;line-height:19px;color:#212121}label .optional{color:#757575;font-weight:normal}label .outer-container{position:relative}label .outer-container .left-icons,label .outer-container .right-icons{display:flex;position:absolute;height:24px;gap:8px}label .outer-container .left-icons tttx-icon,label .outer-container .right-icons tttx-icon{height:24px;width:24px}label .outer-container .left-icons{left:8px}label .outer-container .right-icons{right:8px}label .outer-container input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px;}label .outer-container input.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon{padding-right:40px}label .outer-container input.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]){font-family:"Roboto", serif;width:100%;height:36px;font-size:16px;line-height:19px}label .outer-container input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus{border-color:#1479c6}label .outer-container input:focus-visible{outline:none}label .outer-container.inputBlock{display:flex;align-items:center;line-height:21px}label .outer-container.inputBlock .left-icons,label .outer-container.inputBlock .right-icons{margin-top:4px}label .outer-container.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}label .outer-container.inputInline{display:flex;white-space:nowrap;align-items:center;margin:0}label .outer-container.inputInline input{margin-top:0}label .secondarylabel{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label .errorBubble:not(.visible){display:none}label .errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}.material-symbols-rounded{font-family:"Material Symbols Rounded", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}button{cursor:pointer}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:500}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #d5d5d5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:active{background:#1464a2;border:1px solid #1464a2}.borderless{background:transparent;border:none;color:#212121}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.borderless-circle{background:transparent;border:none;color:#212121;border-radius:50%}.borderless-circle:active{border:none}.borderless-circle:focus{border-color:transparent}.danger{background:#dc0000;border:1px solid #dc0000;color:white}.danger:active{background:#b00000;border:1px solid #b00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}@media (hover: hover){.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #d5d5d5}.primary:hover{background:#146eb3;border:1px solid #146eb3}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless-circle:hover{background:rgba(17, 17, 17, 0.1);border:none}.danger:hover{background:#c60000;border:1px solid #c60000}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}}:host{display:block}fieldset{margin:0;padding:0;border:none}label{display:block;position:relative;margin-bottom:16px}.inlineLabel{font-weight:400;display:inline-block;vertical-align:top;padding-top:4px}input[type=checkbox]{width:18px;height:18px}input~label{font-weight:400}select{font-family:"Roboto", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}.placeholder{color:#9e9e9e}.placeholder option{color:initial}select.invalid:invalid{border:1px solid #dc0000}select~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}select~.errorBubble:not(.visible){visibility:hidden}select~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}select.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;visibility:visible}select:focus{border-color:#1479c6}select:focus-visible{outline:none}.button{padding:0 16px}.footer{display:flex;gap:16px;flex-direction:row-reverse}';export{l as tttx_form}
|
package/dist/tttx/tttx.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-65bb4035.js";export{s as setNonce}from"./p-65bb4035.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-7f1452fb",[[1,"tttx-data-pattern",{data:[1],sorteroptions:[1],filteroptions:[1],filterheader:[1]}]]],["p-9ad58b75",[[1,"tttx-multiselect-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],htmlVisibleValue:[4,"html-visible-value"],visibleValue:[1,"visible-value"],open:[32],unsavedSelectedItems:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-bc363141",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-d3a9fc42",[[1,"tttx-select-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],selectedValue:[1,"selected-value"],open:[32],selectedItem:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-d5b6dd17",[[1,"tttx-tree-view",{data:[1040],treeData:[32],selectedId:[32]}]]],["p-61ef7773",[[0,"tttx-checkbox",{checkboxId:[1,"checkbox-id"],label:[1],inline:[4],indeterminate:[4],checked:[4]}]]],["p-
|
|
1
|
+
import{p as e,b as t}from"./p-65bb4035.js";export{s as setNonce}from"./p-65bb4035.js";(()=>{const t=import.meta.url,o={};return""!==t&&(o.resourcesUrl=new URL(".",t).href),e(o)})().then((e=>t([["p-7f1452fb",[[1,"tttx-data-pattern",{data:[1],sorteroptions:[1],filteroptions:[1],filterheader:[1]}]]],["p-9ad58b75",[[1,"tttx-multiselect-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],htmlVisibleValue:[4,"html-visible-value"],visibleValue:[1,"visible-value"],open:[32],unsavedSelectedItems:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-bc363141",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-d3a9fc42",[[1,"tttx-select-box",{optionsData:[1,"options-data"],label:[1],inline:[4],placeholder:[1],searchEnabled:[4,"search-enabled"],selectedValue:[1,"selected-value"],open:[32],selectedItem:[32],searchTerm:[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["p-d5b6dd17",[[1,"tttx-tree-view",{data:[1040],treeData:[32],selectedId:[32]}]]],["p-61ef7773",[[0,"tttx-checkbox",{checkboxId:[1,"checkbox-id"],label:[1],inline:[4],indeterminate:[4],checked:[4]}]]],["p-a4c2cb80",[[1,"tttx-dialog",{header:[1],type:[1],size:[1],open:[4],allowOverflow:[4,"allow-overflow"],closeEnabled:[4,"close-enabled"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-87b6e5a9",[[1,"tttx-expander",{name:[1],open:[4],lefticon:[1],lefticoncolor:[1],isExpanded:[32]}]]],["p-a19ad838",[[2,"tttx-tabs",{tabsName:[1,"tabs-name"],navigation:[4],wide:[4],tabs:[1],_tabs:[32]},[[0,"keydown","handleKeyDown"]]]]],["p-67f24d17",[[1,"tttx-checkbox-group"]]],["p-a64c9910",[[4,"tttx-checkbox-group-caption"]]],["p-80e3bd36",[[4,"tttx-checkbox-group-heading"]]],["p-feea36cb",[[1,"tttx-form",{formschema:[1025],data:[1032],submit:[64]}]]],["p-15b7a577",[[1,"tttx-keyvalue-block",{keyvalues:[1],horizontal:[4],spacedout:[4],_elements:[32]}]]],["p-fe6c321b",[[1,"tttx-loading-spinner",{loadingMessage:[1028,"loading-message"],size:[1025]}]]],["p-be16cf2d",[[2,"tttx-percentage-bar",{percentage:[8],thresholds:[1],color:[1],min:[1],labelid:[1],_percentage:[32],_ranges:[32],_min:[32]}]]],["p-69642b71",[[1,"tttx-qrcode",{link:[1025],size:[1026]}]]],["p-e7b7d2e2",[[1,"tttx-tag",{text:[1],color:[1],textColor:[1,"text-color"]}]]],["p-34f328f9",[[2,"tttx-textarea",{label:[1],secondarylabel:[1],showerrormsg:[4],showerrorbubble:[4],errormsg:[1],rows:[2],textareaautofocus:[4],inputkeyhint:[1],inputindex:[8],inputtitle:[1],disabled:[4],maxlength:[8],name:[1],placeholder:[1],readonly:[8],required:[4],value:[1032]}]]],["p-a94f7efc",[[1,"tttx-icon",{icon:[1],color:[1]}]]],["p-93e63568",[[2,"tttx-standalone-input",{label:[1],secondarylabel:[1],showerrormsg:[4],showerrorbubble:[4],errormsg:[1],iconleft:[1],iconleftcolor:[1],iconright:[1],iconrightcolor:[1],inputicon:[1],inputiconcolor:[1],inline:[4],inputautocapitalize:[1],inputautofocus:[4],inputkeyhint:[1],inputindex:[8],inputtitle:[1],autocomplete:[1],checked:[4],disabled:[4],max:[8],maxlength:[8],min:[8],minlength:[8],name:[1],pattern:[1],placeholder:[1],readonly:[8],required:[4],step:[8],type:[1],value:[1032]}]]],["p-f27adb48",[[1,"tttx-filter",{filterKey:[1,"filter-key"],filterOptions:[1,"filter-options"],showSelectAll:[4,"show-select-all"],showSearchField:[4,"show-search-field"],showOptionIcons:[4,"show-option-icons"],filterButtonStyle:[1,"filter-button-style"],filterHeader:[1,"filter-header"],defaultFilterOptions:[1,"default-filter-options"],popoverWidth:[1,"popover-width"],showPopover:[32],displayedFilterSettings:[32],selectedFilters:[32],filterSearchTerm:[32],allSelected:[32]},[[0,"closeFilter","handleCloseFilter"]]],[1,"tttx-list",{data:[1025],name:[1],_data:[32]}],[1,"tttx-sorter",{sorterKey:[1,"sorter-key"],defaultSortDirection:[1,"default-sort-direction"],fieldOptionsData:[1,"field-options-data"],defaultOption:[1,"default-option"],selectedField:[32],sortDirection:[32],dropdownExpand:[32],dropdownOptions:[32]},[[0,"closeSorter","handleCloseSorter"]]],[1,"tttx-toolbar",{border:[4],viewSize:[32]},[[9,"resize","handleResize"]]]]],["p-61741832",[[1,"tttx-button",{notext:[4],icon:[1],iconposition:[1],iconcolor:[1025],design:[1]}]]]],e)));
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as a,H as i}from"./p-65bb4035.js";import{p as o,d as r}from"./p-88ee2406.js";import"./p-112455b1.js";const e=class{constructor(a){t(this,a),this.tabClick=s(this,"tabClick",7),this.leftNavigation=s(this,"leftNavigation",7),this.rightNavigation=s(this,"rightNavigation",7),this.tabFocus=0,this.tabsName=void 0,this.navigation=void 0,this.wide=void 0,this.tabs=void 0,this._tabs=void 0}onDataChange(){this.tabs&&(this._tabs="string"==typeof this.tabs?JSON.parse(this.tabs):[...this.tabs],this.tabFocus=this._tabs.findIndex((t=>-1!==t.tabIndex)))}componentWillLoad(){this.onDataChange()}handleTabClick(t){this.tabClick.emit({tabId:t.id})}handleLeftNavigation(){this.leftNavigation.emit()}handleRightNavigation(){this.rightNavigation.emit()}handleKeyDown(t){const s=this.tabList.getAttribute("aria-orientation"),a=s&&"vertical"===s?"ArrowUp":"ArrowLeft",i=s&&"vertical"===s?"ArrowDown":"ArrowRight";t.key===a||t.key===i?(this._tabs[this.tabFocus].tabIndex=-1,t.key===a?(this.tabFocus--,this.tabFocus<0&&(this.tabFocus=this._tabs.length-1)):t.key===i&&(this.tabFocus++,this.tabFocus>=this._tabs.length&&(this.tabFocus=0)),this._tabs[this.tabFocus].tabIndex=0,this.tabList.querySelectorAll('[role="tab"]')[this.tabFocus].focus(),this._tabs=[...this._tabs]):"Space"!==t.code&&"Enter"!==t.code||this.tabClick.emit({tabId:this._tabs[this.tabFocus].id})}render(){if(this.tabs&&0!=this.tabs.length)return a(i,null,a("div",null,a("div",{class:"tab-bar",role:"tablist","aria-label":this.tabsName,ref:t=>this.tabList=t},this.navigation&&a("div",{class:"left-navigation",tabindex:"0",onClick:this.handleLeftNavigation.bind(this)},a("tttx-icon",{icon:"navigate_before",color:"black"})),a("div",{class:"tabs-container"+(this.wide?" wide":"")},this._tabs.map((t=>a("a",{key:t.id,id:t.id,role:"tab","aria-controls":t.controls,tabindex:t.tabIndex,"aria-selected":t.selected,onClick:()=>{this.handleTabClick(t)}},t.tabName)))),this.navigation&&a("div",{class:"right-navigation",tabindex:"0",onClick:this.handleRightNavigation.bind(this)},a("tttx-icon",{icon:"navigate_next",color:"black"}))),this._tabs.map((t=>a("article",{key:t.id,id:t.controls,role:"tabpanel",tabindex:"0","aria-labelledby":t.id,"aria-expanded":t.selected,innerHTML:o.sanitize(t.pageContent,r),hidden:!t.selected})))))}static get watchers(){return{tabs:["onDataChange"]}}};e.style='.material-symbols-rounded.sc-tttx-tabs{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.sc-tttx-tabs-h{display:block}.tab-bar.sc-tttx-tabs{display:flex;height:52px}.tab-bar.sc-tttx-tabs>.left-navigation.sc-tttx-tabs,.tab-bar.sc-tttx-tabs>.right-navigation.sc-tttx-tabs{padding:14px 8px;cursor:pointer}.tab-bar.sc-tttx-tabs>.left-navigation.sc-tttx-tabs>*.sc-tttx-tabs,.tab-bar.sc-tttx-tabs>.right-navigation.sc-tttx-tabs>*.sc-tttx-tabs{height:24px;width:24px;cursor:pointer}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs{display:flex;border-bottom:1px solid #d5d5d5}.tab-bar.sc-tttx-tabs>.tabs-container.wide.sc-tttx-tabs{flex-grow:1}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab].sc-tttx-tabs{padding:18px 16px;line-height:16px;font-size:14px;font-weight:500;text-transform:uppercase;user-select:none;color:#757575;cursor:pointer}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab].sc-tttx-tabs:hover{background-color:rgba(17, 17, 17, 0.05)}.tab-bar.sc-tttx-tabs>.tabs-container.sc-tttx-tabs>*[role=tab][aria-selected].sc-tttx-tabs{color:#212121;cursor:default;border-bottom:3px solid #1579c6}';export{e as tttx_tabs}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,c as i,h as t,g as e}from"./p-65bb4035.js";const n={critical:{iconName:"report",iconColor:"red"},info:{iconName:"info",iconColor:"blue"},success:{iconName:"check_circle",iconColor:"green"},warning:{iconName:"warning",iconColor:"orange"}},s=class{constructor(t){o(this,t),this.closeButtonClick=i(this,"closeButtonClick",6),this.header=void 0,this.type=void 0,this.size="regular",this.open=!1,this.allowOverflow=!1,this.closeEnabled=!0,this.elementSize=void 0}handleResize(){this.elementSize=window.innerWidth<698?"mobile":this.size}preventCancelOnDialog(o){o.preventDefault()}componentDidLoad(){this.dialog.addEventListener("cancel",this.preventCancelOnDialog)}onCloseClickHandler(){this.closeButtonClick.emit()}headerIconDetails(o){return o?n[this.type]:{iconName:void 0,iconColor:void 0}}renderHeader(){const o=void 0!==this.type,{iconName:i,iconColor:e}=this.headerIconDetails(o);return t("div",{class:`padding header ${this.type||""}`},o&&t("tttx-icon",{class:"icon",icon:i,color:e}),t("h3",{class:"title"},this.header),this.closeEnabled&&t("div",{class:"align-right close-button",onClick:()=>this.onCloseClickHandler()},t("tttx-icon",{class:"icon-close clickable",icon:"close",color:"black"})))}body(){return t("div",{class:"body "+(this.allowOverflow?"":"overflow-hidden")},t("span",{class:"body-content"},t("slot",null)))}footer(){if(this.el.querySelector('[slot="buttons"]'))return t("div",{class:"padding footer"},t("div",{class:"align-right"},t("slot",{name:"buttons"})))}componentDidRender(){this.open?this.dialog.open||this.dialog.showModal():this.dialog.close()}componentWillLoad(){this.handleResize()}render(){return t("dialog",{ref:o=>this.dialog=o,class:`dialog-box ${this.allowOverflow?"overflow-visible":""} ${this.elementSize}`},t("div",{class:"contents"},this.renderHeader(),this.body(),this.footer()))}get el(){return e(this)}};s.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.material-symbols-rounded{font-family:"Material Symbols Rounded", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}h3{margin-block-start:0em;margin-block-end:0em}.dialog-box{background-color:#ffffff;border:1px solid #d5d5d5;border-radius:4px;box-shadow:0px 1px 5px #1111114d;padding:0}.dialog-box.small{width:400px;min-height:200px}.dialog-box.regular{width:600px;min-height:200px}.dialog-box.large{width:900px;min-height:200px}.dialog-box.mobile{max-width:424px;width:calc(100vw - 20px)}.overflow-visible{overflow:visible}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.padding{padding:8px 16px}.align-right{margin-left:auto;display:flex}.header{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;align-items:center;height:36px}.title{font-size:18;font-weight:500;font-family:"Roboto", serif}.icon{padding-right:8px;width:24px;height:24px}.icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.body-content{font-size:16;font-weight:400;font-family:"Roboto", serif}.body{text-overflow:ellipsis;padding:16px}.footer{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}::slotted([slot=buttons]){display:flex;gap:8px}.header.info{border-bottom:1px solid #1479c6}.header.success{border-bottom:1px solid #a2bb31}.header.warning{border-bottom:1px solid #f59500}.header.critical{border-bottom:1px solid #dc0000}';export{s as tttx_dialog}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,c as t,h as o,H as i}from"./p-65bb4035.js";import{p as n,d as r}from"./p-88ee2406.js";import"./p-112455b1.js";function a(e,t,o,i){let n;if(n=void 0!==i?i.querySelector(".errorBubble"):"label"===e.parentElement.nodeName.toLowerCase()?e.parentElement.querySelector(".errorBubble"):e.parentElement.parentElement.querySelector(".errorBubble"),t){e.classList.add("invalid"),n.classList.add("visible");const t=document.createElement("span");t.className="material-symbols-rounded",t.textContent="warning",n.innerHTML="",n.append(t),n.append(o)}else n.classList.remove("visible"),e.classList.remove("invalid"),n.innerHTML=""}const l=class{constructor(o){e(this,o),this.dataSubmitted=t(this,"dataSubmitted",7),this.dataChanged=t(this,"dataChanged",7),this.template=document.createElement("template"),this.formschema=void 0,this.data=void 0}onFormSchemaChange(e){if(!this.data&&this.form&&this._formSchema){const e=new FormData(this.form);this._data=Object.fromEntries(Object.keys(this._formSchema.properties).map((t=>[t,e.get(t)])))}this._formSchema="string"==typeof e?JSON.parse(e):e}onDataChange(e){this._data="string"==typeof e?JSON.parse(e):e}fieldChanged(e){this.dataChanged.emit({name:e.target.name,value:e.target.value})}async submit(){this.submitButton.click()}doSubmit(e){e.preventDefault();const t=new FormData(e.target);this.dataSubmitted.emit(t)}componentWillLoad(){this.onFormSchemaChange(this.formschema),this.data&&this.onDataChange(this.data)}componentWillRender(){this.template=document.createElement("template"),this.populateFormFromSchema()}createSelect(e,t){var o;const i=document.createElement("select");return i.setAttribute("name",e),t.options.forEach((e=>{this.appendOption(i,e)})),(null===(o=this._data)||void 0===o?void 0:o[e])&&i.classList.remove("placeholder"),i}appendOption(e,t){const o=document.createElement("option");o.setAttribute("value",t.value),t.placeholder&&(o.setAttribute("disabled",""),o.setAttribute("selected",""),o.setAttribute("hidden",""),e.classList.add("placeholder")),t.label&&(o.innerHTML=n.sanitize(t.label,r)),e.appendChild(o)}createInput(e,t){var o;const i=document.createElement("input");return i.name=e,i.type=t.type,i.placeholder=null!==(o=t.placeholder)&&void 0!==o?o:"",i.autocomplete="off",i.autocapitalize="off",t.readonly&&(i.readOnly=!0),i}applyValidation(e,t){var o,i;t.required&&(e.setAttribute("required",""),e.setAttribute("data-required",null!==(o=t.required.message)&&void 0!==o?o:"")),t.pattern&&(e.setAttribute("pattern",t.pattern.pattern),e.setAttribute("data-pattern",null!==(i=t.pattern.message)&&void 0!==i?i:"")),t.badInput&&e.setAttribute("data-badinput",t.badInput.message),t.minmax&&(e.setAttribute("min",t.minmax.min),e.setAttribute("max",t.minmax.max),e.setAttribute("data-range",t.minmax.message)),t.maxlength&&e.setAttribute("maxlength",t.maxlength)}createErrorBubble(){const e=document.createElement("div");return e.className="errorBubble",e}appendCheckboxInput(e,t,o){if(e.label){const e=document.createElement("br");o.appendChild(e)}if(o.appendChild(t),!e.inlineLabel)return;const i=document.createElement("span");i.className="inlineLabel",i.textContent=e.inlineLabel,o.appendChild(i)}createLabel(e,t,o){const i=document.createElement("div");i.className="outer-container inputBlock";const n=document.createElement("label");if(n.innerText=e.label,!e.validation){const e=document.createElement("span");e.className="optional",e.innerHTML=" (optional)",n.appendChild(e)}return e.readonly&&n.classList.add("readonly"),"checkbox"===e.type?this.appendCheckboxInput(e,t,n):i.appendChild(t),"checkbox"!==e.type&&n.appendChild(i),n.appendChild(o),n}populateFormFromSchema(){if(!this._formSchema)return;const e=this._formSchema.properties;Object.keys(e).forEach((t=>{const o=e[t].form,i="select"===o.type?this.createSelect(t,o):this.createInput(t,o);o.validation&&this.applyValidation(i,o.validation);const n=this.createErrorBubble(),r=this.createLabel(o,i,n);this.template.content.append(r)}))}componentDidRender(){if(!this._formSchema)return;const e=this.template.content.cloneNode(!0),t=this._formSchema.properties;Object.keys(t).forEach((o=>{var i,n;const r=e.querySelector(`[name=${o}]`);if(r.oninvalid=this.validityCheckWrapper.bind(this),r.onblur=this.validityCheckWrapper.bind(this),r.onkeyup=this.fieldChanged.bind(this),r.onchange=this.fieldChanged.bind(this),void 0!==(null===(i=this._data)||void 0===i?void 0:i[o])&&null!==this._data[o]&&(r.value=this._data[o]),null===(n=t[o].form.validation)||void 0===n?void 0:n.invalid){const e=t[o].form.validation.invalid.message;r.setCustomValidity(e),a(r,!0,e)}"select"===t[o].form.type&&r.classList.contains("placeholder")&&r.addEventListener("change",(()=>{r.classList.remove("placeholder")}))})),this.fieldset.replaceChildren(e)}validityCheckWrapper(e){const{target:t,hasError:o,errorMessage:i}=function(e){var t,o,i,n;e.preventDefault();const r=e.target;let a=!0,l="";switch(!0){case r.validity.valueMissing:l=null!==(t=r.dataset.required)&&void 0!==t?t:"This field is required";break;case r.validity.patternMismatch:l=null!==(o=r.dataset.pattern)&&void 0!==o?o:"Incorrect format";break;case r.validity.badInput:l=null!==(i=r.dataset.badinput)&&void 0!==i?i:"Wrong input type";break;case r.validity.rangeOverflow||r.validity.rangeUnderflow:l=null!==(n=r.dataset.range)&&void 0!==n?n:"Invalid value";break;case r.validity.customError:l=r.validationMessage;break;default:a=!1}return{target:r,hasError:a,errorMessage:l}}(e);a(t,o,i)}render(){return o(i,null,o("form",{ref:e=>this.form=e,onSubmit:this.doSubmit.bind(this)},o("fieldset",{ref:e=>this.fieldset=e}),o("input",{type:"submit",ref:e=>this.submitButton=e,style:{display:"none"}})))}static get watchers(){return{formschema:["onFormSchemaChange"],data:["onDataChange"]}}};l.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}label{font-weight:500;font-size:16px;line-height:19px;color:#212121}label .optional{color:#757575;font-weight:normal}label .outer-container{position:relative}label .outer-container .left-icons,label .outer-container .right-icons{display:flex;position:absolute;height:24px;gap:8px}label .outer-container .left-icons tttx-icon,label .outer-container .right-icons tttx-icon{height:24px;width:24px}label .outer-container .left-icons{left:8px}label .outer-container .right-icons{right:8px}label .outer-container input{color:#212121;box-sizing:border-box;border:1px solid #d5d5d5;border-radius:4px;padding:0;padding-left:16px;padding-right:16px;margin-top:4px;}label .outer-container input.has-input-icon{padding-left:40px}label .outer-container input.has-input-icon.has-left-icon{padding-left:72px}label .outer-container input.has-left-icon{padding-left:40px}label .outer-container input.has-right-icon{padding-right:40px}label .outer-container input.invalid{border:1px solid #dc0000}label .outer-container input:not([type=submit]){font-family:"Roboto", serif;width:100%;height:36px;font-size:16px;line-height:19px}label .outer-container input[type=date]{background:white;display:block;min-width:calc(100% - 18px);line-height:37px}label .outer-container input[readonly]{cursor:default;pointer-events:none;user-select:none;color:gray}label .outer-container input:focus{border-color:#1479c6}label .outer-container input:focus-visible{outline:none}label .outer-container.inputBlock{display:flex;align-items:center;line-height:21px}label .outer-container.inputBlock .left-icons,label .outer-container.inputBlock .right-icons{margin-top:4px}label .outer-container.inputBlock.readonly{pointer-events:none;user-select:none;color:gray}label .outer-container.inputInline{display:flex;white-space:nowrap;align-items:center;margin:0}label .outer-container.inputInline input{margin-top:0}label .secondarylabel{color:#757575;font-size:14px;line-height:16px;font-weight:normal;display:flex;margin-top:4px}label .errorBubble{position:relative;font-size:14px;line-height:16px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center;margin-top:4px}label .errorBubble:not(.visible){display:none}label .errorBubble span{color:#dc0000;font-size:16px;margin-right:4px}.material-symbols-rounded{font-family:"Material Symbols Rounded", sans-serif;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;color:#9e9e9e}button{cursor:pointer}.button{font-family:Roboto, serif;box-sizing:border-box;height:36px;min-width:36px;padding:0;margin:0;background:transparent;color:#212121;border:1px solid #c8c8c8;border-radius:4px;text-transform:uppercase;display:flex;justify-content:left;align-items:center;font-size:14px;font-weight:500}.button-content{display:block;padding:0 16px}.icon-left,.icon-right{margin-top:4px}.iconleft{padding-left:8px}.iconleft .button-content{padding-left:4px}.iconright{padding-right:8px}.iconright .button-content{padding-right:4px}.notext{padding:0 6px}.button:active{background:rgba(17, 17, 17, 0.2);border:1px solid #d5d5d5}.primary{background:#1479c6;border:1px solid #1479c6;color:white}.primary:active{background:#1464a2;border:1px solid #1464a2}.borderless{background:transparent;border:none;color:#212121}.borderless:active{background:rgba(17, 17, 17, 0.2);border:none}.borderless-circle{background:transparent;border:none;color:#212121;border-radius:50%}.borderless-circle:active{border:none}.borderless-circle:focus{border-color:transparent}.danger{background:#dc0000;border:1px solid #dc0000;color:white}.danger:active{background:#b00000;border:1px solid #b00000}.disabled{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}.disabled:active{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}@media (hover: hover){.button:hover{background:rgba(17, 17, 17, 0.1);border:1px solid #d5d5d5}.primary:hover{background:#146eb3;border:1px solid #146eb3}.borderless:hover{background:rgba(17, 17, 17, 0.1);border:none}.borderless-circle:hover{background:rgba(17, 17, 17, 0.1);border:none}.danger:hover{background:#c60000;border:1px solid #c60000}.disabled:hover{background:#aeaeae;border:none;color:#4c4c4c;cursor:not-allowed}}:host{display:block}fieldset{margin:0;padding:0;border:none}label{display:block;position:relative;margin-bottom:16px}.inlineLabel{font-weight:400;display:inline-block;vertical-align:top;padding-top:4px}input[type=checkbox]{width:18px;height:18px}input~label{font-weight:400}select{font-family:"Roboto", serif;box-sizing:border-box;width:100%;height:36px;padding:0 16px;font-size:16px;border:1px solid #d5d5d5;border-radius:4px;margin-top:4px}.placeholder{color:#9e9e9e}.placeholder option{color:initial}select.invalid:invalid{border:1px solid #dc0000}select~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;display:flex;align-content:center;align-items:center;justify-items:center}select~.errorBubble:not(.visible){visibility:hidden}select~.errorBubble span{color:#dc0000;font-size:16px;margin-right:4px;height:16px}select.invalid:invalid~.errorBubble{position:relative;font-size:14px;font-weight:normal;width:100%;font-family:"Roboto", sans-serif;color:#dc0000;visibility:visible}select:focus{border-color:#1479c6}select:focus-visible{outline:none}.button{padding:0 16px}.footer{display:flex;gap:16px;flex-direction:row-reverse}';export{l as tttx_form}
|