@3t-transform/threeteeui 0.2.113 → 0.2.114
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-select-box.cjs.entry.js +26 -6
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.css +36 -2
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.js +26 -6
- package/dist/collection/components/molecules/tttx-select-box/tttx-select-box.stories.js +4 -4
- package/dist/components/tttx-select-box.js +27 -7
- package/dist/esm/tttx-select-box.entry.js +27 -7
- package/dist/tttx/p-ab0282bb.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-select-box/interfaces.d.ts +1 -0
- package/package.json +1 -1
- package/dist/tttx/p-6b6da818.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 tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.truncated-text{white-space:nowrap;overflow
|
|
9
|
+
const tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;justify-content:space-between;border:1px solid #d5d5d5;display:flex;flex-direction:row}.dropdown-selector>.left-wrapper{flex:1;min-width:0}.description{color:#757575;font-size:14px;line-height:18.75px}.description>p{margin:0}.description-dd{color:#757575;font-size:14px;line-height:18.75px}.description-dd>p{margin:0}.truncated-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#212121;font-size:16px;line-height:16.41px}.dropdown-selector-chevron{height:24px}.dropdown-selector-chevron-offset{height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body-container{position:relative;z-index:2}.dropdown-body{position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.searchbox{padding:8px 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}";
|
|
10
10
|
|
|
11
11
|
const TttxSelectBox = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -51,9 +51,27 @@ const TttxSelectBox = class {
|
|
|
51
51
|
this.handleBlur();
|
|
52
52
|
}
|
|
53
53
|
dropdownSelectorContent() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
let title;
|
|
55
|
+
let subtitle;
|
|
56
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
57
|
+
const icon = index.h("tttx-icon", { icon: chevronIcon, color: "black" });
|
|
58
|
+
let chevron = index.h("div", { class: 'dropdown-selector-chevron' }, icon);
|
|
59
|
+
if (!this.selectedItem) {
|
|
60
|
+
title = index.h("div", { class: "placeholder" }, this.placeholder);
|
|
61
|
+
return index.h(index.Fragment, null, title, chevron);
|
|
62
|
+
}
|
|
63
|
+
else if (this.selectedItem.html) {
|
|
64
|
+
title = index.h("div", { title: this.selectedItem.label, class: "truncated-text", innerHTML: this.selectedItem.html });
|
|
65
|
+
return index.h(index.Fragment, null, title, chevron);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
title = index.h("div", { title: this.selectedItem.label, class: "truncated-text" }, this.selectedItem.label);
|
|
69
|
+
if (this.selectedItem.description) {
|
|
70
|
+
subtitle = index.h("div", { class: "description" }, index.h("p", null, this.selectedItem.description));
|
|
71
|
+
chevron = index.h("div", { class: 'dropdown-selector-chevron-offset' }, icon);
|
|
72
|
+
}
|
|
73
|
+
return index.h(index.Fragment, null, index.h("div", { class: "left-wrapper" }, title, subtitle), chevron);
|
|
74
|
+
}
|
|
57
75
|
}
|
|
58
76
|
dropdownOption(option) {
|
|
59
77
|
/* istanbul ignore next */
|
|
@@ -64,6 +82,9 @@ const TttxSelectBox = class {
|
|
|
64
82
|
/* istanbul ignore next */
|
|
65
83
|
return (index.h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label, innerHTML: sanitisedHTML }));
|
|
66
84
|
}
|
|
85
|
+
else if (option.description) {
|
|
86
|
+
return (index.h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label, index.h("div", { class: "description-dd" }, index.h("p", null, option.description))));
|
|
87
|
+
}
|
|
67
88
|
/* istanbul ignore next */
|
|
68
89
|
return (index.h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label));
|
|
69
90
|
}
|
|
@@ -91,8 +112,7 @@ const TttxSelectBox = class {
|
|
|
91
112
|
if (!this.optionsData)
|
|
92
113
|
return;
|
|
93
114
|
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
94
|
-
|
|
95
|
-
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", ref: (el) => this.dropdownSelector = el, 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({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
115
|
+
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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (index.h("div", { class: "dropdown-body-container" }, index.h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
96
116
|
/* istanbul ignore next */
|
|
97
117
|
index.h("div", { class: "searchbox" }, index.h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), index.h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
|
|
98
118
|
return this.dropdownOption(option);
|
|
@@ -46,17 +46,48 @@
|
|
|
46
46
|
gap: 8px;
|
|
47
47
|
padding: 8px 8px 8px 16px;
|
|
48
48
|
cursor: pointer;
|
|
49
|
+
justify-content: space-between;
|
|
49
50
|
border: 1px solid #d5d5d5;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
}
|
|
54
|
+
.dropdown-selector > .left-wrapper {
|
|
55
|
+
flex: 1;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.description {
|
|
60
|
+
color: #757575;
|
|
61
|
+
font-size: 14px;
|
|
62
|
+
line-height: 18.75px;
|
|
63
|
+
}
|
|
64
|
+
.description > p {
|
|
65
|
+
margin: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.description-dd {
|
|
69
|
+
color: #757575;
|
|
70
|
+
font-size: 14px;
|
|
71
|
+
line-height: 18.75px;
|
|
72
|
+
}
|
|
73
|
+
.description-dd > p {
|
|
74
|
+
margin: 0;
|
|
50
75
|
}
|
|
51
76
|
|
|
52
77
|
.truncated-text {
|
|
53
78
|
white-space: nowrap;
|
|
54
|
-
overflow
|
|
79
|
+
overflow: hidden;
|
|
55
80
|
text-overflow: ellipsis;
|
|
81
|
+
color: #212121;
|
|
82
|
+
font-size: 16px;
|
|
83
|
+
line-height: 16.41px;
|
|
56
84
|
}
|
|
57
85
|
|
|
58
86
|
.dropdown-selector-chevron {
|
|
59
|
-
|
|
87
|
+
height: 24px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.dropdown-selector-chevron-offset {
|
|
60
91
|
height: 24px;
|
|
61
92
|
}
|
|
62
93
|
|
|
@@ -97,6 +128,9 @@
|
|
|
97
128
|
|
|
98
129
|
.placeholder {
|
|
99
130
|
color: #757575;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
overflow-x: hidden;
|
|
133
|
+
text-overflow: ellipsis;
|
|
100
134
|
}
|
|
101
135
|
|
|
102
136
|
.searchbox {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { h, Host, Fragment } from '@stencil/core';
|
|
3
3
|
import * as DOMPurify from 'dompurify';
|
|
4
4
|
import domSanitiserOptions from '../../../shared/domsanitiser.options';
|
|
5
5
|
export class TttxSelectBox {
|
|
@@ -42,9 +42,27 @@ export class TttxSelectBox {
|
|
|
42
42
|
this.handleBlur();
|
|
43
43
|
}
|
|
44
44
|
dropdownSelectorContent() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
let title;
|
|
46
|
+
let subtitle;
|
|
47
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
48
|
+
const icon = h("tttx-icon", { icon: chevronIcon, color: "black" });
|
|
49
|
+
let chevron = h("div", { class: 'dropdown-selector-chevron' }, icon);
|
|
50
|
+
if (!this.selectedItem) {
|
|
51
|
+
title = h("div", { class: "placeholder" }, this.placeholder);
|
|
52
|
+
return h(Fragment, null, title, chevron);
|
|
53
|
+
}
|
|
54
|
+
else if (this.selectedItem.html) {
|
|
55
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text", innerHTML: this.selectedItem.html });
|
|
56
|
+
return h(Fragment, null, title, chevron);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text" }, this.selectedItem.label);
|
|
60
|
+
if (this.selectedItem.description) {
|
|
61
|
+
subtitle = h("div", { class: "description" }, h("p", null, this.selectedItem.description));
|
|
62
|
+
chevron = h("div", { class: 'dropdown-selector-chevron-offset' }, icon);
|
|
63
|
+
}
|
|
64
|
+
return h(Fragment, null, h("div", { class: "left-wrapper" }, title, subtitle), chevron);
|
|
65
|
+
}
|
|
48
66
|
}
|
|
49
67
|
dropdownOption(option) {
|
|
50
68
|
/* istanbul ignore next */
|
|
@@ -55,6 +73,9 @@ export class TttxSelectBox {
|
|
|
55
73
|
/* istanbul ignore next */
|
|
56
74
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label, innerHTML: sanitisedHTML }));
|
|
57
75
|
}
|
|
76
|
+
else if (option.description) {
|
|
77
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label, h("div", { class: "description-dd" }, h("p", null, option.description))));
|
|
78
|
+
}
|
|
58
79
|
/* istanbul ignore next */
|
|
59
80
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label));
|
|
60
81
|
}
|
|
@@ -82,8 +103,7 @@ export class TttxSelectBox {
|
|
|
82
103
|
if (!this.optionsData)
|
|
83
104
|
return;
|
|
84
105
|
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
85
|
-
|
|
86
|
-
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", ref: (el) => this.dropdownSelector = el, 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({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
106
|
+
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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
87
107
|
/* istanbul ignore next */
|
|
88
108
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
|
|
89
109
|
return this.dropdownOption(option);
|
|
@@ -3,12 +3,12 @@ export default {
|
|
|
3
3
|
component: 'tttx-select-box',
|
|
4
4
|
};
|
|
5
5
|
const options = [
|
|
6
|
-
{ value: 'Bonnie', label: 'Steuber' },
|
|
7
|
-
{ value: 'Priscilla', label: 'Lowe' },
|
|
6
|
+
{ value: 'Bonnie', label: 'Steuber', description: 'Practical Course' },
|
|
7
|
+
{ value: 'Priscilla', label: 'Lowe', description: 'E-learn course' },
|
|
8
8
|
{ value: 'Andy', label: 'Thompson-Keebler', html: '<span style="color: red">Thompson-Keebler</span>' },
|
|
9
|
-
{ value: 'egg', label: 'egg', html: '<tttx-icon icon="egg" />' },
|
|
9
|
+
{ value: 'egg', label: 'egg', html: '<tttx-icon icon="egg" />', description: 'Practical Course' },
|
|
10
10
|
{ value: 'Terence', label: 'Hyatt' },
|
|
11
|
-
{ value: 'Ruben', label: 'Toy' },
|
|
11
|
+
{ value: 'Ruben', label: 'Toy', description: 'E-learn course' },
|
|
12
12
|
{ value: 'Rhiannon', label: 'Hills' },
|
|
13
13
|
{ value: 'Trent', label: 'Mueller' },
|
|
14
14
|
{ value: 'Penelope', label: 'Mann' },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Fragment, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options.js';
|
|
3
3
|
import { d as defineCustomElement$3 } from './tttx-icon2.js';
|
|
4
4
|
import { d as defineCustomElement$2 } from './tttx-standalone-input2.js';
|
|
5
5
|
|
|
6
|
-
const tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.truncated-text{white-space:nowrap;overflow
|
|
6
|
+
const tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;justify-content:space-between;border:1px solid #d5d5d5;display:flex;flex-direction:row}.dropdown-selector>.left-wrapper{flex:1;min-width:0}.description{color:#757575;font-size:14px;line-height:18.75px}.description>p{margin:0}.description-dd{color:#757575;font-size:14px;line-height:18.75px}.description-dd>p{margin:0}.truncated-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#212121;font-size:16px;line-height:16.41px}.dropdown-selector-chevron{height:24px}.dropdown-selector-chevron-offset{height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body-container{position:relative;z-index:2}.dropdown-body{position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.searchbox{padding:8px 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}";
|
|
7
7
|
|
|
8
8
|
const TttxSelectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -50,9 +50,27 @@ const TttxSelectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
50
50
|
this.handleBlur();
|
|
51
51
|
}
|
|
52
52
|
dropdownSelectorContent() {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let title;
|
|
54
|
+
let subtitle;
|
|
55
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
56
|
+
const icon = h("tttx-icon", { icon: chevronIcon, color: "black" });
|
|
57
|
+
let chevron = h("div", { class: 'dropdown-selector-chevron' }, icon);
|
|
58
|
+
if (!this.selectedItem) {
|
|
59
|
+
title = h("div", { class: "placeholder" }, this.placeholder);
|
|
60
|
+
return h(Fragment, null, title, chevron);
|
|
61
|
+
}
|
|
62
|
+
else if (this.selectedItem.html) {
|
|
63
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text", innerHTML: this.selectedItem.html });
|
|
64
|
+
return h(Fragment, null, title, chevron);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text" }, this.selectedItem.label);
|
|
68
|
+
if (this.selectedItem.description) {
|
|
69
|
+
subtitle = h("div", { class: "description" }, h("p", null, this.selectedItem.description));
|
|
70
|
+
chevron = h("div", { class: 'dropdown-selector-chevron-offset' }, icon);
|
|
71
|
+
}
|
|
72
|
+
return h(Fragment, null, h("div", { class: "left-wrapper" }, title, subtitle), chevron);
|
|
73
|
+
}
|
|
56
74
|
}
|
|
57
75
|
dropdownOption(option) {
|
|
58
76
|
/* istanbul ignore next */
|
|
@@ -63,6 +81,9 @@ const TttxSelectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
63
81
|
/* istanbul ignore next */
|
|
64
82
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label, innerHTML: sanitisedHTML }));
|
|
65
83
|
}
|
|
84
|
+
else if (option.description) {
|
|
85
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label, h("div", { class: "description-dd" }, h("p", null, option.description))));
|
|
86
|
+
}
|
|
66
87
|
/* istanbul ignore next */
|
|
67
88
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label));
|
|
68
89
|
}
|
|
@@ -90,8 +111,7 @@ const TttxSelectBox$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
90
111
|
if (!this.optionsData)
|
|
91
112
|
return;
|
|
92
113
|
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
93
|
-
|
|
94
|
-
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", ref: (el) => this.dropdownSelector = el, 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({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
114
|
+
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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
95
115
|
/* istanbul ignore next */
|
|
96
116
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
|
|
97
117
|
return this.dropdownOption(option);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-b11965d8.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, F as Fragment, H as Host, g as getElement } from './index-b11965d8.js';
|
|
2
2
|
import { p as purify, d as domSanitiserOptions } from './domsanitiser.options-68752a19.js';
|
|
3
3
|
import './_commonjsHelpers-9943807e.js';
|
|
4
4
|
|
|
5
|
-
const tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.truncated-text{white-space:nowrap;overflow
|
|
5
|
+
const tttxSelectBoxCss = ".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:8px 8px 8px 16px;cursor:pointer;justify-content:space-between;border:1px solid #d5d5d5;display:flex;flex-direction:row}.dropdown-selector>.left-wrapper{flex:1;min-width:0}.description{color:#757575;font-size:14px;line-height:18.75px}.description>p{margin:0}.description-dd{color:#757575;font-size:14px;line-height:18.75px}.description-dd>p{margin:0}.truncated-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#212121;font-size:16px;line-height:16.41px}.dropdown-selector-chevron{height:24px}.dropdown-selector-chevron-offset{height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body-container{position:relative;z-index:2}.dropdown-body{position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.searchbox{padding:8px 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}";
|
|
6
6
|
|
|
7
7
|
const TttxSelectBox = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -47,9 +47,27 @@ const TttxSelectBox = class {
|
|
|
47
47
|
this.handleBlur();
|
|
48
48
|
}
|
|
49
49
|
dropdownSelectorContent() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
let title;
|
|
51
|
+
let subtitle;
|
|
52
|
+
const chevronIcon = this.open ? 'expand_less' : 'expand_more';
|
|
53
|
+
const icon = h("tttx-icon", { icon: chevronIcon, color: "black" });
|
|
54
|
+
let chevron = h("div", { class: 'dropdown-selector-chevron' }, icon);
|
|
55
|
+
if (!this.selectedItem) {
|
|
56
|
+
title = h("div", { class: "placeholder" }, this.placeholder);
|
|
57
|
+
return h(Fragment, null, title, chevron);
|
|
58
|
+
}
|
|
59
|
+
else if (this.selectedItem.html) {
|
|
60
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text", innerHTML: this.selectedItem.html });
|
|
61
|
+
return h(Fragment, null, title, chevron);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
title = h("div", { title: this.selectedItem.label, class: "truncated-text" }, this.selectedItem.label);
|
|
65
|
+
if (this.selectedItem.description) {
|
|
66
|
+
subtitle = h("div", { class: "description" }, h("p", null, this.selectedItem.description));
|
|
67
|
+
chevron = h("div", { class: 'dropdown-selector-chevron-offset' }, icon);
|
|
68
|
+
}
|
|
69
|
+
return h(Fragment, null, h("div", { class: "left-wrapper" }, title, subtitle), chevron);
|
|
70
|
+
}
|
|
53
71
|
}
|
|
54
72
|
dropdownOption(option) {
|
|
55
73
|
/* istanbul ignore next */
|
|
@@ -60,6 +78,9 @@ const TttxSelectBox = class {
|
|
|
60
78
|
/* istanbul ignore next */
|
|
61
79
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label, innerHTML: sanitisedHTML }));
|
|
62
80
|
}
|
|
81
|
+
else if (option.description) {
|
|
82
|
+
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label, h("div", { class: "description-dd" }, h("p", null, option.description))));
|
|
83
|
+
}
|
|
63
84
|
/* istanbul ignore next */
|
|
64
85
|
return (h("div", { class: `dropdown-option ${hideOption ? 'hidden' : ''} ${selected ? 'selected' : ''}`, onClick: this.onItemSelected.bind(this, option), key: option.label }, option.label));
|
|
65
86
|
}
|
|
@@ -87,8 +108,7 @@ const TttxSelectBox = class {
|
|
|
87
108
|
if (!this.optionsData)
|
|
88
109
|
return;
|
|
89
110
|
this._optionsData = typeof this.optionsData === 'string' ? JSON.parse(this.optionsData) : this.optionsData;
|
|
90
|
-
|
|
91
|
-
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", ref: (el) => this.dropdownSelector = el, 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({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
111
|
+
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", ref: (el) => this.dropdownSelector = el, onClick: this.onDropdownClicked.bind(this) }, this.dropdownSelectorContent()), this.open && (h("div", { class: "dropdown-body-container" }, h("div", { class: "dropdown-body", style: Object.assign({ width: `${this.dropdownSelector.offsetWidth}px` }, this.bodyOffset) }, this.searchEnabled &&
|
|
92
112
|
/* istanbul ignore next */
|
|
93
113
|
h("div", { class: "searchbox" }, h("tttx-standalone-input", { type: "text", label: "", required: true, showerrorbubble: false, iconleft: 'search', onInput: this.handleSearchInput.bind(this) })), h("div", { class: "dropdown-options-list" }, this._optionsData.map((option) => {
|
|
94
114
|
return this.dropdownOption(option);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as o,h as i,F as e,H as s,g as n}from"./p-65bb4035.js";import{p as d,d as r}from"./p-88ee2406.js";import"./p-112455b1.js";const l=class{constructor(i){t(this,i),this.selectItemEvent=o(this,"selectItemEvent",3),this.toggleOpen=o(this,"toggleOpen",3),this.bodyOffset={},this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.selectedValue=void 0,this.open=!1,this.selectedItem=void 0,this.searchTerm=""}async componentWillLoad(){if(this.optionsData){const t=("string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData).filter((t=>t.value==this.selectedValue));this.selectedItem=t.length>0?t[0]:void 0}}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.calculateDropdownMenuOffset(),this.toggleOpen.emit(this.open)}onItemSelected(t){this.selectedItem=t,this.selectItemEvent.emit(this.selectedItem),this.handleBlur()}dropdownSelectorContent(){let t,o;const s=i("tttx-icon",{icon:this.open?"expand_less":"expand_more",color:"black"});let n=i("div",{class:"dropdown-selector-chevron"},s);return this.selectedItem?this.selectedItem.html?(t=i("div",{title:this.selectedItem.label,class:"truncated-text",innerHTML:this.selectedItem.html}),i(e,null,t,n)):(t=i("div",{title:this.selectedItem.label,class:"truncated-text"},this.selectedItem.label),this.selectedItem.description&&(o=i("div",{class:"description"},i("p",null,this.selectedItem.description)),n=i("div",{class:"dropdown-selector-chevron-offset"},s)),i(e,null,i("div",{class:"left-wrapper"},t,o),n)):(t=i("div",{class:"placeholder"},this.placeholder),i(e,null,t,n))}dropdownOption(t){const o=this.searchEnabled&&-1===t.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()),e=this.selectedItem&&t.value===this.selectedItem.value;if(t.html){const s=d.sanitize(t.html,r);return i("div",{class:`dropdown-option ${o?"hidden":""} ${e?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label,innerHTML:s})}return t.description?i("div",{class:`dropdown-option ${o?"hidden":""} ${e?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},t.label,i("div",{class:"description-dd"},i("p",null,t.description))):i("div",{class:`dropdown-option ${o?"hidden":""} ${e?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},t.label)}handleSearchInput(t){this.searchTerm=t.target.value}calculateDropdownMenuOffset(){const t=this.el.shadowRoot.querySelector(".dropdown-selector"),o=this.dropdownSelector.getBoundingClientRect().bottom;let i=Math.min(368,36*this._optionsData.length)+8;this.searchEnabled&&(i+=52);const e=t.getBoundingClientRect();this.bodyOffset=o+i>window.innerHeight?{top:window.innerHeight-(i+16)+"px",position:"fixed",width:`${t.offsetWidth}px`,zIndex:"10"}:{position:"fixed",left:e.left,top:e.top,width:e.width-2+"px",zIndex:"10"}}render(){if(this.optionsData)return this._optionsData="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData,i(s,{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",ref:t=>this.dropdownSelector=t,onClick:this.onDropdownClicked.bind(this)},this.dropdownSelectorContent()),this.open&&i("div",{class:"dropdown-body-container"},i("div",{class:"dropdown-body",style:Object.assign({width:`${this.dropdownSelector.offsetWidth}px`},this.bodyOffset)},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this)})),i("div",{class:"dropdown-options-list"},this._optionsData.map((t=>this.dropdownOption(t))))))))}get el(){return n(this)}};l.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:8px 8px 8px 16px;cursor:pointer;justify-content:space-between;border:1px solid #d5d5d5;display:flex;flex-direction:row}.dropdown-selector>.left-wrapper{flex:1;min-width:0}.description{color:#757575;font-size:14px;line-height:18.75px}.description>p{margin:0}.description-dd{color:#757575;font-size:14px;line-height:18.75px}.description-dd>p{margin:0}.truncated-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#212121;font-size:16px;line-height:16.41px}.dropdown-selector-chevron{height:24px}.dropdown-selector-chevron-offset{height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body-container{position:relative;z-index:2}.dropdown-body{position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575;white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.searchbox{padding:8px 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}';export{l as tttx_select_box}
|
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-f8c7f162",[[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-c476e635",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["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-f8c7f162",[[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-c476e635",[[1,"tttx-dialog-box",{data:[1025],size:[1],open:[1028],allowOverflow:[4,"allow-overflow"],elementSize:[32]},[[9,"resize","handleResize"]]]]],["p-ab0282bb",[[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-69e15a92",[[0,"tttx-checkbox",{checkboxId:[1,"checkbox-id"],label:[1],inline:[4],indeterminate:[4],checked:[4]}]]],["p-20d3d8fb",[[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-562eafbd",[[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-ed9ebbfb",[[1,"tttx-form",{formschema:[1025],data:[1032],submit:[64],setSelectOptions:[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-bf5e95e2",[[2,"tttx-standalone-input",{label:[1],secondarylabel:[1],showerrormsg:[4],showerrorbubble:[4],errormsg:[1],iconleft:[1],iconleftcolor:[1],iconright:[1],iconrightcolor:[1],inputicon:[1],inputiconcolor:[1],inline:[4],inputautocapitalize:[1],inputautofocus:[4],inputkeyhint:[1],inputindex:[8],inputtitle:[1],autocomplete:[1],checked:[4],disabled:[4],max:[8],maxlength:[8],min:[8],minlength:[8],name:[1],pattern:[1],placeholder:[1],readonly:[8],required:[4],step:[8],type:[1],value:[1032]}]]],["p-f27adb48",[[1,"tttx-filter",{filterKey:[1,"filter-key"],filterOptions:[1,"filter-options"],showSelectAll:[4,"show-select-all"],showSearchField:[4,"show-search-field"],showOptionIcons:[4,"show-option-icons"],filterButtonStyle:[1,"filter-button-style"],filterHeader:[1,"filter-header"],defaultFilterOptions:[1,"default-filter-options"],popoverWidth:[1,"popover-width"],showPopover:[32],displayedFilterSettings:[32],selectedFilters:[32],filterSearchTerm:[32],allSelected:[32]},[[0,"closeFilter","handleCloseFilter"]]],[1,"tttx-list",{data:[1025],name:[1],_data:[32]}],[1,"tttx-sorter",{sorterKey:[1,"sorter-key"],defaultSortDirection:[1,"default-sort-direction"],fieldOptionsData:[1,"field-options-data"],defaultOption:[1,"default-option"],selectedField:[32],sortDirection:[32],dropdownExpand:[32],dropdownOptions:[32]},[[0,"closeSorter","handleCloseSorter"]]],[1,"tttx-toolbar",{border:[4],viewSize:[32]},[[9,"resize","handleResize"]]]]],["p-61741832",[[1,"tttx-button",{notext:[4],icon:[1],iconposition:[1],iconcolor:[1025],design:[1]}]]]],e)));
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as o,h as i,H as s,g as e}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",3),this.toggleOpen=o(this,"toggleOpen",3),this.bodyOffset={},this.optionsData=null,this.label=void 0,this.inline=void 0,this.placeholder="",this.searchEnabled=void 0,this.selectedValue=void 0,this.open=!1,this.selectedItem=void 0,this.searchTerm=""}async componentWillLoad(){if(this.optionsData){const t=("string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData).filter((t=>t.value==this.selectedValue));this.selectedItem=t.length>0?t[0]:void 0}}handleCloseSelectBox(){this.open=!1}handleBlur(){this.open=!1,this.toggleOpen.emit(!1)}onDropdownClicked(){this.open=!this.open,this.searchTerm="",this.calculateDropdownMenuOffset(),this.toggleOpen.emit(this.open)}onItemSelected(t){this.selectedItem=t,this.selectItemEvent.emit(this.selectedItem),this.handleBlur()}dropdownSelectorContent(){return this.selectedItem?this.selectedItem.html?i("div",{title:this.selectedItem.label,class:"truncated-text",innerHTML:this.selectedItem.html}):i("div",{title:this.selectedItem.label,class:"truncated-text"},this.selectedItem.label):i("div",{class:"placeholder"},this.placeholder)}dropdownOption(t){const o=this.searchEnabled&&-1===t.label.toLowerCase().indexOf(this.searchTerm.toLowerCase()),s=this.selectedItem&&t.value===this.selectedItem.value;if(t.html){const e=n.sanitize(t.html,d);return i("div",{class:`dropdown-option ${o?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label,innerHTML:e})}return i("div",{class:`dropdown-option ${o?"hidden":""} ${s?"selected":""}`,onClick:this.onItemSelected.bind(this,t),key:t.label},t.label)}handleSearchInput(t){this.searchTerm=t.target.value}calculateDropdownMenuOffset(){const t=this.el.shadowRoot.querySelector(".dropdown-selector"),o=this.dropdownSelector.getBoundingClientRect().bottom;let i=Math.min(368,36*this._optionsData.length)+8;this.searchEnabled&&(i+=52);const s=t.getBoundingClientRect();this.bodyOffset=o+i>window.innerHeight?{top:window.innerHeight-(i+16)+"px",position:"fixed",width:`${t.offsetWidth}px`,zIndex:"10"}:{position:"fixed",left:s.left,top:s.top,width:s.width-2+"px",zIndex:"10"}}render(){if(!this.optionsData)return;this._optionsData="string"==typeof this.optionsData?JSON.parse(this.optionsData):this.optionsData;const t=this.open?"expand_less":"expand_more";return i(s,{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",ref:t=>this.dropdownSelector=t,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({width:`${this.dropdownSelector.offsetWidth}px`},this.bodyOffset)},this.searchEnabled&&i("div",{class:"searchbox"},i("tttx-standalone-input",{type:"text",label:"",required:!0,showerrorbubble:!1,iconleft:"search",onInput:this.handleSearchInput.bind(this)})),i("div",{class:"dropdown-options-list"},this._optionsData.map((t=>this.dropdownOption(t))))))))}get el(){return e(this)}};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:8px 8px 8px 16px;cursor:pointer;border:1px solid #d5d5d5}.truncated-text{white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis}.dropdown-selector-chevron{margin-left:auto;height:24px}.dropdown-selector-chevron>tttx-icon{cursor:pointer}.dropdown-body-container{position:relative;z-index:2}.dropdown-body{position:absolute;flex-direction:column;box-shadow:0px 1px 5px #1111114D;padding-bottom:8px;border:1px solid #d5d5d5}.dropdown-options-list{display:flex;flex-direction:column;overflow-y:auto;max-height:368px}.dropdown-option{padding:6px 8px 6px 16px;cursor:pointer}.dropdown-option:hover{background-color:#1111110d}.dropdown-option:active,.dropdown-option.selected{background-color:#ebfbfc}.placeholder{color:#757575}.searchbox{padding:8px 16px}.searchbox tttx-standalone-input{margin-top:-4px}.hidden{display:none}';export{r as tttx_select_box}
|