@3t-transform/threeteeui 0.2.101 → 0.2.103
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-box.cjs.entry.js +1 -1
- package/dist/cjs/tttx-dialog.cjs.entry.js +1 -1
- package/dist/cjs/tttx-form.cjs.entry.js +2 -1
- package/dist/cjs/tttx-multiselect-box.cjs.entry.js +3 -1
- package/dist/collection/components/molecules/tttx-dialog/tttx-dialog.css +8 -0
- package/dist/collection/components/molecules/tttx-dialog-box/tttx-dialog-box.css +8 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +2 -1
- package/dist/collection/components/molecules/tttx-multiselect-box/tttx-multiselect-box.js +3 -1
- package/dist/components/tttx-dialog-box.js +1 -1
- package/dist/components/tttx-dialog.js +1 -1
- package/dist/components/tttx-form.js +2 -1
- package/dist/components/tttx-multiselect-box.js +3 -1
- package/dist/esm/tttx-dialog-box.entry.js +1 -1
- package/dist/esm/tttx-dialog.entry.js +1 -1
- package/dist/esm/tttx-form.entry.js +2 -1
- package/dist/esm/tttx-multiselect-box.entry.js +3 -1
- package/dist/tttx/{p-9b17982c.entry.js → p-2576076f.entry.js} +1 -1
- package/dist/tttx/p-b2cfa283.entry.js +1 -0
- package/dist/tttx/p-ba7a789c.entry.js +1 -0
- package/dist/tttx/{p-cb84eaae.entry.js → p-bb560af6.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/package.json +3 -3
- package/dist/tttx/p-22bef33d.entry.js +0 -1
- package/dist/tttx/p-d43aa1d0.entry.js +0 -1
|
@@ -6,7 +6,7 @@ const index = require('./index-992a9fb3.js');
|
|
|
6
6
|
const domsanitiser_options = require('./domsanitiser.options-32e670aa.js');
|
|
7
7
|
require('./_commonjsHelpers-537d719a.js');
|
|
8
8
|
|
|
9
|
-
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
9
|
+
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;z-index:2;background:white}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;z-index:2;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
10
10
|
|
|
11
11
|
const TttxDialogBox = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -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-y:auto}.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}";
|
|
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-y:auto}.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;position:sticky;z-index:2;top:0;background:white}.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;position:sticky;z-index:2;background:white;bottom:0}::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) {
|
|
@@ -392,13 +392,14 @@ const TttxForm = class {
|
|
|
392
392
|
* @return {HTMLLabelElement} - The new label element.
|
|
393
393
|
*/
|
|
394
394
|
createLabel(formProperties, input, errorBubble) {
|
|
395
|
+
var _a;
|
|
395
396
|
const outerContainer = document.createElement('div');
|
|
396
397
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
397
398
|
// Create a new <label> element with the "inputBlock" class and the specified text
|
|
398
399
|
const label = document.createElement('label');
|
|
399
400
|
label.innerText = formProperties.label;
|
|
400
401
|
// If the form property has no validation object, add an "optional" span element to the label
|
|
401
|
-
if (!formProperties.validation && formProperties.label) {
|
|
402
|
+
if (!((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) && formProperties.label) {
|
|
402
403
|
const optionalSpan = document.createElement('span');
|
|
403
404
|
optionalSpan.className = 'optional';
|
|
404
405
|
optionalSpan.innerHTML = ' (optional)';
|
|
@@ -103,6 +103,7 @@ const TttxMultiselectBox = class {
|
|
|
103
103
|
calculateDropdownMenuOffset() {
|
|
104
104
|
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
105
105
|
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
106
|
+
const clientRectangle = dropdownSelector.getBoundingClientRect();
|
|
106
107
|
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
107
108
|
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
108
109
|
if (this.searchEnabled)
|
|
@@ -111,7 +112,7 @@ const TttxMultiselectBox = class {
|
|
|
111
112
|
this.bodyOffset = { top: `${window.innerHeight - (dropdownMenuMaxHeight + 16)}px`, position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
|
-
this.bodyOffset = {};
|
|
115
|
+
this.bodyOffset = { position: 'fixed', left: clientRectangle.left, top: clientRectangle.top, width: (clientRectangle.width - 2) + 'px', zIndex: '10' };
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
render() {
|
|
@@ -123,6 +124,7 @@ const TttxMultiselectBox = class {
|
|
|
123
124
|
if (!this.unsavedSelectedItems)
|
|
124
125
|
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
125
126
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
127
|
+
console.log(this.bodyOffset);
|
|
126
128
|
return (index.h(index.Host, { class: this.inline ? 'inline' : 'block' }, this.label && index.h("div", { class: "label" }, this.label), index.h("div", { tabindex: "0", class: "dropdown-container" }, index.h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), index.h("div", { class: "dropdown-selector-chevron" }, index.h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (index.h("div", { class: "dropdown-body-container" }, index.h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
127
129
|
/* istanbul ignore next */
|
|
128
130
|
index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input", { type: "text", placeholder: 'Search', label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), index.h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
@@ -85,6 +85,10 @@ dialog::backdrop {
|
|
|
85
85
|
flex-direction: row;
|
|
86
86
|
align-items: center;
|
|
87
87
|
height: 36px;
|
|
88
|
+
position: sticky;
|
|
89
|
+
z-index: 2;
|
|
90
|
+
top: 0;
|
|
91
|
+
background: white;
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
.title {
|
|
@@ -126,6 +130,10 @@ dialog::backdrop {
|
|
|
126
130
|
margin-top: auto;
|
|
127
131
|
border-top: 1px solid #d5d5d5;
|
|
128
132
|
height: 36px;
|
|
133
|
+
position: sticky;
|
|
134
|
+
z-index: 2;
|
|
135
|
+
background: white;
|
|
136
|
+
bottom: 0;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
::slotted([slot=buttons]) {
|
|
@@ -88,6 +88,10 @@ dialog::backdrop {
|
|
|
88
88
|
display: flex;
|
|
89
89
|
flex-direction: row;
|
|
90
90
|
height: 36px;
|
|
91
|
+
position: sticky;
|
|
92
|
+
top: 0;
|
|
93
|
+
z-index: 2;
|
|
94
|
+
background: white;
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
.dialog-box-header {
|
|
@@ -135,6 +139,10 @@ dialog::backdrop {
|
|
|
135
139
|
margin-top: auto;
|
|
136
140
|
border-top: 1px solid #d5d5d5;
|
|
137
141
|
height: 36px;
|
|
142
|
+
position: sticky;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
z-index: 2;
|
|
145
|
+
background: white;
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
.dialog-box-footer {
|
|
@@ -264,13 +264,14 @@ export class TttxForm {
|
|
|
264
264
|
* @return {HTMLLabelElement} - The new label element.
|
|
265
265
|
*/
|
|
266
266
|
createLabel(formProperties, input, errorBubble) {
|
|
267
|
+
var _a;
|
|
267
268
|
const outerContainer = document.createElement('div');
|
|
268
269
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
269
270
|
// Create a new <label> element with the "inputBlock" class and the specified text
|
|
270
271
|
const label = document.createElement('label');
|
|
271
272
|
label.innerText = formProperties.label;
|
|
272
273
|
// If the form property has no validation object, add an "optional" span element to the label
|
|
273
|
-
if (!formProperties.validation && formProperties.label) {
|
|
274
|
+
if (!((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) && formProperties.label) {
|
|
274
275
|
const optionalSpan = document.createElement('span');
|
|
275
276
|
optionalSpan.className = 'optional';
|
|
276
277
|
optionalSpan.innerHTML = ' (optional)';
|
|
@@ -93,6 +93,7 @@ export class TttxMultiselectBox {
|
|
|
93
93
|
calculateDropdownMenuOffset() {
|
|
94
94
|
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
95
95
|
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
96
|
+
const clientRectangle = dropdownSelector.getBoundingClientRect();
|
|
96
97
|
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
97
98
|
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
98
99
|
if (this.searchEnabled)
|
|
@@ -101,7 +102,7 @@ export class TttxMultiselectBox {
|
|
|
101
102
|
this.bodyOffset = { top: `${window.innerHeight - (dropdownMenuMaxHeight + 16)}px`, position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
|
-
this.bodyOffset = {};
|
|
105
|
+
this.bodyOffset = { position: 'fixed', left: clientRectangle.left, top: clientRectangle.top, width: (clientRectangle.width - 2) + 'px', zIndex: '10' };
|
|
105
106
|
}
|
|
106
107
|
}
|
|
107
108
|
render() {
|
|
@@ -113,6 +114,7 @@ export class TttxMultiselectBox {
|
|
|
113
114
|
if (!this.unsavedSelectedItems)
|
|
114
115
|
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
115
116
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
117
|
+
console.log(this.bodyOffset);
|
|
116
118
|
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
117
119
|
/* istanbul ignore next */
|
|
118
120
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", placeholder: 'Search', label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
@@ -3,7 +3,7 @@ import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js
|
|
|
3
3
|
import { d as defineCustomElement$3 } from './tttx-button2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './tttx-icon2.js';
|
|
5
5
|
|
|
6
|
-
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
6
|
+
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;z-index:2;background:white}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;z-index:2;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
7
7
|
|
|
8
8
|
const TttxDialogBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -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-y:auto}.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
|
+
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-y:auto}.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;position:sticky;z-index:2;top:0;background:white}.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;position:sticky;z-index:2;background:white;bottom:0}::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() {
|
|
@@ -389,13 +389,14 @@ const TttxForm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
389
389
|
* @return {HTMLLabelElement} - The new label element.
|
|
390
390
|
*/
|
|
391
391
|
createLabel(formProperties, input, errorBubble) {
|
|
392
|
+
var _a;
|
|
392
393
|
const outerContainer = document.createElement('div');
|
|
393
394
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
394
395
|
// Create a new <label> element with the "inputBlock" class and the specified text
|
|
395
396
|
const label = document.createElement('label');
|
|
396
397
|
label.innerText = formProperties.label;
|
|
397
398
|
// If the form property has no validation object, add an "optional" span element to the label
|
|
398
|
-
if (!formProperties.validation && formProperties.label) {
|
|
399
|
+
if (!((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) && formProperties.label) {
|
|
399
400
|
const optionalSpan = document.createElement('span');
|
|
400
401
|
optionalSpan.className = 'optional';
|
|
401
402
|
optionalSpan.innerHTML = ' (optional)';
|
|
@@ -103,6 +103,7 @@ const TttxMultiselectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
103
103
|
calculateDropdownMenuOffset() {
|
|
104
104
|
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
105
105
|
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
106
|
+
const clientRectangle = dropdownSelector.getBoundingClientRect();
|
|
106
107
|
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
107
108
|
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
108
109
|
if (this.searchEnabled)
|
|
@@ -111,7 +112,7 @@ const TttxMultiselectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
111
112
|
this.bodyOffset = { top: `${window.innerHeight - (dropdownMenuMaxHeight + 16)}px`, position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
112
113
|
}
|
|
113
114
|
else {
|
|
114
|
-
this.bodyOffset = {};
|
|
115
|
+
this.bodyOffset = { position: 'fixed', left: clientRectangle.left, top: clientRectangle.top, width: (clientRectangle.width - 2) + 'px', zIndex: '10' };
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
render() {
|
|
@@ -123,6 +124,7 @@ const TttxMultiselectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
123
124
|
if (!this.unsavedSelectedItems)
|
|
124
125
|
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
125
126
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
127
|
+
console.log(this.bodyOffset);
|
|
126
128
|
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
127
129
|
/* istanbul ignore next */
|
|
128
130
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", placeholder: 'Search', label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, g as getElement } from './i
|
|
|
2
2
|
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options-68752a19.js';
|
|
3
3
|
import './_commonjsHelpers-9943807e.js';
|
|
4
4
|
|
|
5
|
-
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
5
|
+
const tttxDialogBoxCss = ".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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;z-index:2;background:white}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:\"Roboto\", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:\"Roboto\", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;z-index:2;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}";
|
|
6
6
|
|
|
7
7
|
const TttxDialogBox = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -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-y:auto}.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}";
|
|
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-y:auto}.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;position:sticky;z-index:2;top:0;background:white}.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;position:sticky;z-index:2;background:white;bottom:0}::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) {
|
|
@@ -388,13 +388,14 @@ const TttxForm = class {
|
|
|
388
388
|
* @return {HTMLLabelElement} - The new label element.
|
|
389
389
|
*/
|
|
390
390
|
createLabel(formProperties, input, errorBubble) {
|
|
391
|
+
var _a;
|
|
391
392
|
const outerContainer = document.createElement('div');
|
|
392
393
|
let outerContainerClassName = 'outer-container inputBlock';
|
|
393
394
|
// Create a new <label> element with the "inputBlock" class and the specified text
|
|
394
395
|
const label = document.createElement('label');
|
|
395
396
|
label.innerText = formProperties.label;
|
|
396
397
|
// If the form property has no validation object, add an "optional" span element to the label
|
|
397
|
-
if (!formProperties.validation && formProperties.label) {
|
|
398
|
+
if (!((_a = formProperties.validation) === null || _a === void 0 ? void 0 : _a.required) && formProperties.label) {
|
|
398
399
|
const optionalSpan = document.createElement('span');
|
|
399
400
|
optionalSpan.className = 'optional';
|
|
400
401
|
optionalSpan.innerHTML = ' (optional)';
|
|
@@ -99,6 +99,7 @@ const TttxMultiselectBox = class {
|
|
|
99
99
|
calculateDropdownMenuOffset() {
|
|
100
100
|
const dropdownSelector = this.el.shadowRoot.querySelector('.dropdown-selector');
|
|
101
101
|
const bottomPosY = dropdownSelector.getBoundingClientRect().bottom;
|
|
102
|
+
const clientRectangle = dropdownSelector.getBoundingClientRect();
|
|
102
103
|
// (Max list height OR 36px * number of items) + 52px for search bar + 45px for footer + 8px padding at bottom
|
|
103
104
|
let dropdownMenuMaxHeight = Math.min((288), 36 * this._optionsData.length) + 45 + 8;
|
|
104
105
|
if (this.searchEnabled)
|
|
@@ -107,7 +108,7 @@ const TttxMultiselectBox = class {
|
|
|
107
108
|
this.bodyOffset = { top: `${window.innerHeight - (dropdownMenuMaxHeight + 16)}px`, position: 'fixed', width: `${dropdownSelector.offsetWidth}px` };
|
|
108
109
|
}
|
|
109
110
|
else {
|
|
110
|
-
this.bodyOffset = {};
|
|
111
|
+
this.bodyOffset = { position: 'fixed', left: clientRectangle.left, top: clientRectangle.top, width: (clientRectangle.width - 2) + 'px', zIndex: '10' };
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
render() {
|
|
@@ -119,6 +120,7 @@ const TttxMultiselectBox = class {
|
|
|
119
120
|
if (!this.unsavedSelectedItems)
|
|
120
121
|
this.unsavedSelectedItems = this.safelyCloneArray(this._optionsData);
|
|
121
122
|
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
123
|
+
console.log(this.bodyOffset);
|
|
122
124
|
return (h(Host, { class: this.inline ? 'inline' : 'block' }, this.label && h("div", { class: "label" }, this.label), h("div", { tabindex: "0", class: "dropdown-container" }, h("div", { class: "dropdown-selector", onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent(), h("div", { class: "dropdown-selector-chevron" }, h("tttx-icon", { icon: chevronIcon, color: "black" }))), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({}, this.bodyOffset) }, this.searchEnabled &&
|
|
123
125
|
/* istanbul ignore next */
|
|
124
126
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", placeholder: 'Search', label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this), inline: true })), h("div", { class: "dropdown-options-list" }, this.unsavedSelectedItems.map((option) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as o,h as i,H as e,g as s}from"./p-65bb4035.js";import{p as n,d}from"./p-88ee2406.js";import"./p-112455b1.js";const r=class{constructor(i){t(this,i),this.selectItemEvent=o(this,"selectItemEvent",7),this.toggleOpen=o(this,"toggleOpen",7),this.changesApplied=o(this,"changesApplied",7),this.bodyOffset={},this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.htmlVisibleValue=void 0,this.visibleValue=void 0,this.open=!1,this.unsavedSelectedItems=void 0,this.searchTerm=""}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}handleOptionsDataChange(){this.unsavedSelectedItems="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData}safelyCloneArray(t){return JSON.parse(JSON.stringify(t))}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.calculateDropdownMenuOffset(),this.toggleOpen.emit(this.open)}onCancel(){this.open=!1,this.unsavedSelectedItems=this.safelyCloneArray(this._optionsData),this.toggleOpen.emit(!1)}applyChanges(){this.open=!1,this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems))}onItemSelected(t){const o=this.unsavedSelectedItems.findIndex((o=>o.value===t.value));this.unsavedSelectedItems[o]=Object.assign(Object.assign({},t),{selected:!t.selected}),this.unsavedSelectedItems=[...this.unsavedSelectedItems],this.selectItemEvent.emit(t)}dropdownSelectorContent(){if(!this._optionsData.find((t=>t.selected)))return i("div",{class:"placeholder"},this.placeholder);if(this.htmlVisibleValue){const t=n.sanitize(this.visibleValue,d);return i("div",{class:"dropdown-selector-html-content",innerHTML:t})}return i("div",null,this.visibleValue)}optionFoundInSearchTerm(t){return-1===t.label.toLowerCase().indexOf(this.searchTerm.toLowerCase())}dropdownOption(t){const o=this.searchEnabled&&this.optionFoundInSearchTerm(t),e=t.selected?"check_box":"check_box_outline_blank",s=t.selected?"blue":"grey";if(t.html){const r=n.sanitize(t.html,d);return i("div",{class:`dropdown-option ${o?"hidden":""} ${t.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},i("tttx-icon",{icon:e,color:s,class:"checkbox-icon"}),i("div",{innerHTML:r}))}return i("div",{class:`dropdown-option ${o?"hidden":""} ${t.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},i("tttx-icon",{icon:e,color:s,class:"checkbox-icon"}),i("div",{class:"plaintext-option"},t.label))}handleSearchInput(t){this.searchTerm=t.target.value}calculateDropdownMenuOffset(){const t=this.el.shadowRoot.querySelector(".dropdown-selector"),o=t.getBoundingClientRect().bottom;let
|
|
1
|
+
import{r as t,c as o,h as i,H as e,g as s}from"./p-65bb4035.js";import{p as n,d}from"./p-88ee2406.js";import"./p-112455b1.js";const r=class{constructor(i){t(this,i),this.selectItemEvent=o(this,"selectItemEvent",7),this.toggleOpen=o(this,"toggleOpen",7),this.changesApplied=o(this,"changesApplied",7),this.bodyOffset={},this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.htmlVisibleValue=void 0,this.visibleValue=void 0,this.open=!1,this.unsavedSelectedItems=void 0,this.searchTerm=""}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}handleOptionsDataChange(){this.unsavedSelectedItems="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData}safelyCloneArray(t){return JSON.parse(JSON.stringify(t))}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.calculateDropdownMenuOffset(),this.toggleOpen.emit(this.open)}onCancel(){this.open=!1,this.unsavedSelectedItems=this.safelyCloneArray(this._optionsData),this.toggleOpen.emit(!1)}applyChanges(){this.open=!1,this.changesApplied.emit(this.safelyCloneArray(this.unsavedSelectedItems))}onItemSelected(t){const o=this.unsavedSelectedItems.findIndex((o=>o.value===t.value));this.unsavedSelectedItems[o]=Object.assign(Object.assign({},t),{selected:!t.selected}),this.unsavedSelectedItems=[...this.unsavedSelectedItems],this.selectItemEvent.emit(t)}dropdownSelectorContent(){if(!this._optionsData.find((t=>t.selected)))return i("div",{class:"placeholder"},this.placeholder);if(this.htmlVisibleValue){const t=n.sanitize(this.visibleValue,d);return i("div",{class:"dropdown-selector-html-content",innerHTML:t})}return i("div",null,this.visibleValue)}optionFoundInSearchTerm(t){return-1===t.label.toLowerCase().indexOf(this.searchTerm.toLowerCase())}dropdownOption(t){const o=this.searchEnabled&&this.optionFoundInSearchTerm(t),e=t.selected?"check_box":"check_box_outline_blank",s=t.selected?"blue":"grey";if(t.html){const r=n.sanitize(t.html,d);return i("div",{class:`dropdown-option ${o?"hidden":""} ${t.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},i("tttx-icon",{icon:e,color:s,class:"checkbox-icon"}),i("div",{innerHTML:r}))}return i("div",{class:`dropdown-option ${o?"hidden":""} ${t.selected?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},i("tttx-icon",{icon:e,color:s,class:"checkbox-icon"}),i("div",{class:"plaintext-option"},t.label))}handleSearchInput(t){this.searchTerm=t.target.value}calculateDropdownMenuOffset(){const t=this.el.shadowRoot.querySelector(".dropdown-selector"),o=t.getBoundingClientRect().bottom,i=t.getBoundingClientRect();let e=Math.min(288,36*this._optionsData.length)+45+8;this.searchEnabled&&(e+=52),this.bodyOffset=o+e>window.innerHeight?{top:window.innerHeight-(e+16)+"px",position:"fixed",width:`${t.offsetWidth}px`}:{position:"fixed",left:i.left,top:i.top,width:i.width-2+"px",zIndex:"10"}}render(){if(!this.optionsData)return;this._optionsData="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData,this.unsavedSelectedItems||(this.unsavedSelectedItems=this.safelyCloneArray(this._optionsData));const t=this.open?"expand_less":"expand_more";return console.log(this.bodyOffset),i(e,{class:this.inline?"inline":"block"},this.label&&i("div",{class:"label"},this.label),i("div",{tabindex:"0",class:"dropdown-container"},i("div",{class:"dropdown-selector",onClick:this.onDropdownClicked.bind(this)},this.dropdownSelectorContent(),i("div",{class:"dropdown-selector-chevron"},i("tttx-icon",{icon:t,color:"black"}))),this.open&&i("div",{class:"dropdown-body-container"},i("div",{class:"dropdown-body",style:Object.assign({},this.bodyOffset)},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",placeholder:"Search",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this),inline:!0})),i("div",{class:"dropdown-options-list"},this.unsavedSelectedItems.map((t=>this.dropdownOption(t)))),i("div",{class:"footer"},i("tttx-button",{design:"primary",onClick:this.applyChanges.bind(this)},"Apply"),i("tttx-button",{onClick:this.onCancel.bind(this)},"Cancel"))))))}get el(){return s(this)}static get watchers(){return{optionsData:["handleOptionsDataChange"]}}};r.style='.material-symbols-rounded{font-variation-settings:"FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24}:host{display:flex;gap:4px}.label{font-size:16px;font-style:normal;font-weight:500;line-height:normal}:host(.inline) .label{padding-top:8px}:host(.block){flex-direction:column}.dropdown-container{position:relative;display:flex;flex-direction:column;width:100%}.dropdown-container:focus-visible{outline:none}.dropdown-container:focus .dropdown-selector{border:1px solid #1479c6}.dropdown-selector,.dropdown-body{display:flex;border-radius:4px;background-color:white}.dropdown-selector{align-items:center;gap:8px;padding:6px 8px 6px 16px;cursor:pointer;border:1px solid #d5d5d5}.dropdown-selector-chevron{margin-left:auto;height:24px;align-self:flex-start}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-selector-html-content{display:flex;gap:8px;flex-wrap:wrap}.dropdown-body-container{position:relative}.dropdown-body{position:absolute;display:flex;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5;width:100%}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;scrollbar-gutter:stable;max-height:288px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer;display:flex;gap:8px}.dropdown-option .checkbox-icon{height:24px}.dropdown-option .plaintext-option{line-height:24px}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#9e9e9e}.searchbox{padding:8px 16px 8px 16px;height:52px;box-sizing:border-box}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}.footer{display:flex;gap:8px;flex-direction:row-reverse;padding:8px 16px 0 16px;border-top:1px solid #d5d5d5}';export{r as tttx_multiselect_box}
|
|
@@ -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"),n)if(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),o=this._formSchema.properties;for(const e of Object.keys(o))"checkbox"!==o[e].form.type||t.has(e)||t.append(e,"off");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){var i;const n=document.createElement("div");let r="outer-container inputBlock";const a=document.createElement("label");if(a.innerText=e.label,!(null===(i=e.validation)||void 0===i?void 0:i.required)&&e.label){const e=document.createElement("span");e.className="optional",e.innerHTML=" (optional)",a.appendChild(e)}return"radio"===e.type&&(r+=" radioBlock"),n.className=r,e.readonly&&a.classList.add("readonly"),"checkbox"===e.type?this.appendCheckboxInput(e,t,a):n.appendChild(t),"checkbox"!==e.type&&a.appendChild(n),a.appendChild(o),a}createRadio(e,t){var o,i;const n=new DocumentFragment;for(const r of t.options){const a=document.createElement("input");a.type="radio",a.name=e,a.value=r.value,(null===(o=null==t?void 0:t.validation)||void 0===o?void 0:o.required)&&(a.setAttribute("required","required"),a.setAttribute("data-required",null!==(i=t.validation.required.message)&&void 0!==i?i:""));const l=document.createElement("span");l.innerText=r.label,n.appendChild(a),n.appendChild(l),n.appendChild(document.createElement("br"))}return n}populateFormFromSchema(){if(!this._formSchema)return;const e=this._formSchema.properties;Object.keys(e).forEach((t=>{const o=e[t].form;let i;switch(o.type){case"select":i=this.createSelect(t,o);break;case"radio":i=this.createRadio(t,o);break;default:i=this.createInput(t,o)}o.validation&&"radio"!==o.type&&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.querySelectorAll(`[name=${o}]`);for(const e of r){if(e.oninvalid=this.validityCheckWrapper.bind(this),e.onblur=this.validityCheckWrapper.bind(this),e.onkeyup=this.fieldChanged.bind(this),e.onchange=this.fieldChanged.bind(this),null===(i=this._data)||void 0===i?void 0:i[o])switch(e.type){case"checkbox":"on"===this._data[o]&&(e.checked=!0);break;case"radio":e.value===this._data[o]&&(e.checked=!0);break;default:e.value=this._data[o]}if(null===(n=t[o].form.validation)||void 0===n?void 0:n.invalid){const i=t[o].form.validation.invalid.message;e.setCustomValidity(i),a(e,!0,i)}"select"===t[o].form.type&&e.classList.contains("placeholder")&&e.addEventListener("change",(()=>{e.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(r.value.length&&!r.value.replace(/\s/g,"").length?(l="This field cannot be left blank",r.setCustomValidity(l)):(l="",r.setCustomValidity&&r.setCustomValidity("")),!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=radio]{width:20px;height:20px}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.inputBlock.radioBlock{display:block}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}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,c as i,h as t,g as e}from"./p-65bb4035.js";import{p as d,d as l}from"./p-88ee2406.js";import"./p-112455b1.js";const a=class{constructor(t){o(this,t),this.closeButtonClick=i(this,"closeButtonClick",6),this.buttonClick=i(this,"buttonClick",7),this.data=void 0,this.size="regular",this.open=!1,this.allowOverflow=!1,this.elementSize=void 0}handleResize(){this.elementSize=window.innerWidth<698?"mobile":this.size}componentDidRender(){this.dialog()&&(this.open?this.dialog().open||this.dialog().showModal():this.dialog().close())}preventCancelOnDialog(o){o.preventDefault()}componentDidLoad(){var o;null===(o=this.dialog())||void 0===o||o.addEventListener("cancel",this.preventCancelOnDialog)}disconnectedCallback(){var o;null===(o=this.dialog())||void 0===o||o.removeEventListener("cancel",this.preventCancelOnDialog)}onCloseClickHandler(){this.open=!1,this.closeButtonClick.emit({close:!0})}onButtonClickHandler(o){this.buttonClick.emit({buttonNumber:o,buttonClicked:!0})}dialog(){return this.el.shadowRoot.querySelector("dialog")}renderHeader(o){const i=o.title,e=!!o.hasClose;return t("div",{class:"dialog-box-header"},!!o.hasIcon&&t("tttx-icon",{class:"dialog-box-icon",icon:o.iconName,color:o.iconColor}),t("h3",{class:"dialog-box-title"},i),e&&t("div",{class:"dialog-box-align-right close-button",onClick:()=>this.onCloseClickHandler()},t("tttx-icon",{class:"dialog-box-icon-close dialog-box-clickable",icon:"close",color:"black"})))}renderContent(o){if(o.isCustomHtml){const i=d.sanitize(o.customHtml,l);return t("div",{class:"dialog-box-body "+(this.allowOverflow?"":"overflow-hidden")},t("div",{innerHTML:i}))}return t("div",{class:"dialog-box-body "+(this.allowOverflow?"":"overflow-hidden")},t("span",{class:"dialog-box-content"},o.contentText))}renderFooter(o){const i=o.buttons,e=i.length>0,d=i.length>1,l="mobile"===this.elementSize;return t("div",{class:"dialog-box-footer"},t("div",{class:"dialog-box-align-right"},3==i.length&&t("tttx-button",{class:"dialog-box-spacing-button",onClick:()=>this.onButtonClickHandler(3),design:i[2].type,notext:l,icon:i[2].icon},!l&&i[2].name),d&&t("tttx-button",{class:"dialog-box-spacing-button",onClick:()=>this.onButtonClickHandler(2),design:i[1].type,icon:i[1].icon},i[1].name),e&&t("tttx-button",{onClick:()=>this.onButtonClickHandler(1),design:i[0].type,icon:i[0].icon},i[0].name)))}componentWillLoad(){this.elementSize=window.innerWidth<698?"mobile":this.size}render(){if(this.data)return this._data="string"==typeof this.data?JSON.parse(this.data):this.data,t("dialog",{class:`dialog-box ${this.allowOverflow?"overflow-visible":""} ${this.elementSize}`},t("div",{class:"contents"},t("div",{class:`dialog-box-padding dialog-box-header-box ${this._data.type||""}`},this.renderHeader(this._data.header)),t("div",{class:"dialog-box-padding dialog-box-body-box"},this.renderContent(this._data.body)),t("div",{class:"dialog-box-padding dialog-box-footer-box"},this.renderFooter(this._data.footer))))}get el(){return e(this)}};a.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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px;position:sticky;top:0;z-index:2;background:white}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:"Roboto", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:"Roboto", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px;position:sticky;bottom:0;z-index:2;background:white}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}';export{a as tttx_dialog_box}
|
|
@@ -1 +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"}},
|
|
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",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)}};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-y:auto}.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;position:sticky;z-index:2;top:0;background:white}.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;position:sticky;z-index:2;background:white;bottom:0}::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}
|
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-
|
|
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-2576076f",[[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-ba7a789c",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-aa7f5822",[[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-888fb9ee",[[1,"tttx-tree-view",{data:[1040],firstSelected:[1028,"first-selected"],treeData:[32],selectedId:[32]}]]],["p-61ef7773",[[0,"tttx-checkbox",{checkboxId:[1,"checkbox-id"],label:[1],inline:[4],indeterminate:[4],checked:[4]}]]],["p-bb560af6",[[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-b2cfa283",[[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-bcf3844e",[[1,"tttx-icon",{icon:[1],color:[1]}]]],["p-6e0fac85",[[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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3t-transform/threeteeui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.103",
|
|
4
4
|
"description": "3t Design System",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "stencil build --docs",
|
|
19
19
|
"start": "stencil build --watch --serve",
|
|
20
|
-
"test": "stencil test --spec --e2e",
|
|
21
|
-
"coverage": "yarn test --coverage --no-cache",
|
|
20
|
+
"test": "stencil test --spec --e2e --no-cache --silent",
|
|
21
|
+
"coverage": "yarn test --coverage --no-cache --silent",
|
|
22
22
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
23
23
|
"generate": "stencil generate",
|
|
24
24
|
"storybook": "storybook dev -p 6006",
|
|
@@ -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"),n)if(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),o=this._formSchema.properties;for(const e of Object.keys(o))"checkbox"!==o[e].form.type||t.has(e)||t.append(e,"off");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");let n="outer-container inputBlock";const r=document.createElement("label");if(r.innerText=e.label,!e.validation&&e.label){const e=document.createElement("span");e.className="optional",e.innerHTML=" (optional)",r.appendChild(e)}return"radio"===e.type&&(n+=" radioBlock"),i.className=n,e.readonly&&r.classList.add("readonly"),"checkbox"===e.type?this.appendCheckboxInput(e,t,r):i.appendChild(t),"checkbox"!==e.type&&r.appendChild(i),r.appendChild(o),r}createRadio(e,t){var o,i;const n=new DocumentFragment;for(const r of t.options){const a=document.createElement("input");a.type="radio",a.name=e,a.value=r.value,(null===(o=null==t?void 0:t.validation)||void 0===o?void 0:o.required)&&(a.setAttribute("required","required"),a.setAttribute("data-required",null!==(i=t.validation.required.message)&&void 0!==i?i:""));const l=document.createElement("span");l.innerText=r.label,n.appendChild(a),n.appendChild(l),n.appendChild(document.createElement("br"))}return n}populateFormFromSchema(){if(!this._formSchema)return;const e=this._formSchema.properties;Object.keys(e).forEach((t=>{const o=e[t].form;let i;switch(o.type){case"select":i=this.createSelect(t,o);break;case"radio":i=this.createRadio(t,o);break;default:i=this.createInput(t,o)}o.validation&&"radio"!==o.type&&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.querySelectorAll(`[name=${o}]`);for(const e of r){if(e.oninvalid=this.validityCheckWrapper.bind(this),e.onblur=this.validityCheckWrapper.bind(this),e.onkeyup=this.fieldChanged.bind(this),e.onchange=this.fieldChanged.bind(this),null===(i=this._data)||void 0===i?void 0:i[o])switch(e.type){case"checkbox":"on"===this._data[o]&&(e.checked=!0);break;case"radio":e.value===this._data[o]&&(e.checked=!0);break;default:e.value=this._data[o]}if(null===(n=t[o].form.validation)||void 0===n?void 0:n.invalid){const i=t[o].form.validation.invalid.message;e.setCustomValidity(i),a(e,!0,i)}"select"===t[o].form.type&&e.classList.contains("placeholder")&&e.addEventListener("change",(()=>{e.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(r.value.length&&!r.value.replace(/\s/g,"").length?(l="This field cannot be left blank",r.setCustomValidity(l)):(l="",r.setCustomValidity&&r.setCustomValidity("")),!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=radio]{width:20px;height:20px}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.inputBlock.radioBlock{display:block}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}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,c as i,h as t,g as e}from"./p-65bb4035.js";import{p as l,d}from"./p-88ee2406.js";import"./p-112455b1.js";const a=class{constructor(t){o(this,t),this.closeButtonClick=i(this,"closeButtonClick",6),this.buttonClick=i(this,"buttonClick",7),this.data=void 0,this.size="regular",this.open=!1,this.allowOverflow=!1,this.elementSize=void 0}handleResize(){this.elementSize=window.innerWidth<698?"mobile":this.size}componentDidRender(){this.dialog()&&(this.open?this.dialog().open||this.dialog().showModal():this.dialog().close())}preventCancelOnDialog(o){o.preventDefault()}componentDidLoad(){var o;null===(o=this.dialog())||void 0===o||o.addEventListener("cancel",this.preventCancelOnDialog)}disconnectedCallback(){var o;null===(o=this.dialog())||void 0===o||o.removeEventListener("cancel",this.preventCancelOnDialog)}onCloseClickHandler(){this.open=!1,this.closeButtonClick.emit({close:!0})}onButtonClickHandler(o){this.buttonClick.emit({buttonNumber:o,buttonClicked:!0})}dialog(){return this.el.shadowRoot.querySelector("dialog")}renderHeader(o){const i=o.title,e=!!o.hasClose;return t("div",{class:"dialog-box-header"},!!o.hasIcon&&t("tttx-icon",{class:"dialog-box-icon",icon:o.iconName,color:o.iconColor}),t("h3",{class:"dialog-box-title"},i),e&&t("div",{class:"dialog-box-align-right close-button",onClick:()=>this.onCloseClickHandler()},t("tttx-icon",{class:"dialog-box-icon-close dialog-box-clickable",icon:"close",color:"black"})))}renderContent(o){if(o.isCustomHtml){const i=l.sanitize(o.customHtml,d);return t("div",{class:"dialog-box-body "+(this.allowOverflow?"":"overflow-hidden")},t("div",{innerHTML:i}))}return t("div",{class:"dialog-box-body "+(this.allowOverflow?"":"overflow-hidden")},t("span",{class:"dialog-box-content"},o.contentText))}renderFooter(o){const i=o.buttons,e=i.length>0,l=i.length>1,d="mobile"===this.elementSize;return t("div",{class:"dialog-box-footer"},t("div",{class:"dialog-box-align-right"},3==i.length&&t("tttx-button",{class:"dialog-box-spacing-button",onClick:()=>this.onButtonClickHandler(3),design:i[2].type,notext:d,icon:i[2].icon},!d&&i[2].name),l&&t("tttx-button",{class:"dialog-box-spacing-button",onClick:()=>this.onButtonClickHandler(2),design:i[1].type,icon:i[1].icon},i[1].name),e&&t("tttx-button",{onClick:()=>this.onButtonClickHandler(1),design:i[0].type,icon:i[0].icon},i[0].name)))}componentWillLoad(){this.elementSize=window.innerWidth<698?"mobile":this.size}render(){if(this.data)return this._data="string"==typeof this.data?JSON.parse(this.data):this.data,t("dialog",{class:`dialog-box ${this.allowOverflow?"overflow-visible":""} ${this.elementSize}`},t("div",{class:"contents"},t("div",{class:`dialog-box-padding dialog-box-header-box ${this._data.type||""}`},this.renderHeader(this._data.header)),t("div",{class:"dialog-box-padding dialog-box-body-box"},this.renderContent(this._data.body)),t("div",{class:"dialog-box-padding dialog-box-footer-box"},this.renderFooter(this._data.footer))))}get el(){return e(this)}};a.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}.overflow-visible{overflow-y:auto}.overflow-hidden{overflow:hidden}dialog::backdrop{background-color:#75757580}.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)}.dialog-box-clickable{cursor:pointer}.contents{display:flex;flex-direction:column;min-height:inherit}.dialog-box-padding{padding:8px 16px}.dialog-box-align-right{margin-left:auto;display:flex}.dialog-box-header-box{border-bottom:1px solid #d5d5d5;display:flex;flex-direction:row;height:36px}.dialog-box-header{display:flex;align-items:center;width:100%}.dialog-box-title{font-size:18;font-weight:500;font-family:"Roboto", serif}.dialog-box-icon{padding-right:8px;width:24px;height:24px}.dialog-box-icon-close{margin-left:auto;padding-top:3px;width:24px;height:24px}.dialog-box-content{font-size:16;font-weight:400;font-family:"Roboto", serif}.dialog-box-body{text-overflow:ellipsis}.dialog-box-body-box{padding:16px}.dialog-box-footer-box{display:flex;flex-direction:row;margin-top:auto;border-top:1px solid #d5d5d5;height:36px}.dialog-box-footer{display:flex;align-items:center;width:100%}.dialog-box-spacing-button{margin-right:8px}.dialog-box-header-box.info{border-bottom:1px solid #1479c6}.dialog-box-header-box.success{border-bottom:1px solid #a2bb31}.dialog-box-header-box.warning{border-bottom:1px solid #f59500}.dialog-box-header-box.critical{border-bottom:1px solid #dc0000}';export{a as tttx_dialog_box}
|