@3t-transform/threeteeui 0.1.8 → 0.1.10
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/{index-8ba406f6.js → index-dc6cc829.js} +82 -89
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/tttx-button.cjs.entry.js +1 -1
- package/dist/cjs/tttx-filter.cjs.entry.js +162 -0
- package/dist/cjs/tttx-form.cjs.entry.js +1 -1
- package/dist/cjs/tttx-icon.cjs.entry.js +1 -1
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +4 -3
- package/dist/cjs/tttx-list.cjs.entry.js +1 -1
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +1 -1
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +1 -1
- package/dist/cjs/tttx-toolbar.cjs.entry.js +1 -1
- package/dist/cjs/tttx.cjs.js +3 -7
- package/dist/collection/collection-manifest.json +3 -2
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.css +4 -0
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +2 -1
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.css +215 -0
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +325 -0
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +118 -0
- package/dist/components/index.d.ts +1 -9
- package/dist/components/index.js +2 -1
- package/dist/components/tttx-filter.d.ts +11 -0
- package/dist/components/tttx-filter.js +195 -0
- package/dist/components/tttx-keyvalue-block.js +3 -2
- package/dist/esm/{index-5f9b72ff.js → index-86faeaab.js} +82 -89
- package/dist/esm/loader.js +3 -4
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/tttx-button.entry.js +1 -1
- package/dist/esm/tttx-filter.entry.js +158 -0
- package/dist/esm/tttx-form.entry.js +1 -1
- package/dist/esm/tttx-icon.entry.js +1 -1
- package/dist/esm/tttx-keyvalue-block.entry.js +4 -3
- package/dist/esm/tttx-list.entry.js +1 -1
- package/dist/esm/tttx-loading-spinner.entry.js +1 -1
- package/dist/esm/tttx-standalone-input.entry.js +1 -1
- package/dist/esm/tttx-toolbar.entry.js +1 -1
- package/dist/esm/tttx.js +3 -4
- package/dist/tttx/p-12fc0b16.entry.js +3 -0
- package/dist/tttx/p-52a47b7c.js +2 -0
- package/dist/tttx/p-603f6ebe.entry.js +1 -0
- package/dist/tttx/{p-435c62b3.entry.js → p-8f3badad.entry.js} +1 -1
- package/dist/tttx/{p-0342cc46.entry.js → p-ae48fe5a.entry.js} +1 -1
- package/dist/tttx/{p-9cff9c64.entry.js → p-b0eedc78.entry.js} +1 -1
- package/dist/tttx/{p-405219b2.entry.js → p-bdb054b2.entry.js} +1 -1
- package/dist/tttx/p-dcd78796.entry.js +1 -0
- package/dist/tttx/{p-adf35f58.entry.js → p-e25d5fe2.entry.js} +1 -1
- package/dist/tttx/{p-4ecc9e8b.entry.js → p-f1d7eb35.entry.js} +1 -1
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +37 -0
- package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +43 -0
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +6 -6
- package/dist/types/components.d.ts +33 -0
- package/dist/types/stencil-public-runtime.d.ts +3 -59
- package/loader/index.d.ts +0 -9
- package/package.json +1 -1
- package/dist/tttx/p-1290dcd7.entry.js +0 -3
- package/dist/tttx/p-1b394414.entry.js +0 -1
- package/dist/tttx/p-c4b803fc.js +0 -2
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'molecules/Filter',
|
|
4
|
+
component: 'tttx-filter',
|
|
5
|
+
argTypes: {
|
|
6
|
+
filterButtonStyle: {
|
|
7
|
+
control: { type: 'select' },
|
|
8
|
+
options: ['list filter', 'list icon', 'table icon'],
|
|
9
|
+
},
|
|
10
|
+
showSearchField: {
|
|
11
|
+
control: { type: 'boolean' },
|
|
12
|
+
},
|
|
13
|
+
showSelectAll: {
|
|
14
|
+
control: { type: 'boolean' },
|
|
15
|
+
},
|
|
16
|
+
showOptionIcons: {
|
|
17
|
+
control: { type: 'boolean' },
|
|
18
|
+
},
|
|
19
|
+
filterHeader: {
|
|
20
|
+
control: { type: 'text' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
parameters: {
|
|
24
|
+
actions: {
|
|
25
|
+
handles: ['filterButtonClickEvent', 'applyFilterButtonClickEvent', 'filterOptionSelected'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
decorators: [withActions],
|
|
29
|
+
};
|
|
30
|
+
export const ExampleFilter = (args) => {
|
|
31
|
+
const filterButtonStyle = args.filterButtonStyle;
|
|
32
|
+
args.filterHeader = args.filterHeader || 'Qualification status';
|
|
33
|
+
const filterHeader = args.filterHeader;
|
|
34
|
+
const showSearchField = args.showSearchField;
|
|
35
|
+
const showSelectAll = args.showSelectAll;
|
|
36
|
+
const showOptionIcons = args.showOptionIcons;
|
|
37
|
+
const filterOptions = [
|
|
38
|
+
{ optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
|
|
39
|
+
{ optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
|
|
40
|
+
{ optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
|
|
41
|
+
];
|
|
42
|
+
const jsonFilterOptions = JSON.stringify(filterOptions);
|
|
43
|
+
return `<tttx-filter
|
|
44
|
+
filter-options='${jsonFilterOptions}'
|
|
45
|
+
show-search-field='${showSearchField}'
|
|
46
|
+
show-select-all='${showSelectAll}'
|
|
47
|
+
filter-button-style='${filterButtonStyle}'
|
|
48
|
+
show-option-icons='${showOptionIcons}'
|
|
49
|
+
filter-header='${filterHeader}'
|
|
50
|
+
filter-key='basic-filter'
|
|
51
|
+
/>`;
|
|
52
|
+
};
|
|
53
|
+
export const ListFilterWithoutSearchField = (args) => {
|
|
54
|
+
const filterButtonStyle = args.filterButtonStyle;
|
|
55
|
+
args.filterHeader = args.filterHeader || 'Qualification status';
|
|
56
|
+
const filterHeader = args.filterHeader;
|
|
57
|
+
const showSearchField = false;
|
|
58
|
+
const showSelectAll = args.showSelectAll;
|
|
59
|
+
const showOptionIcons = args.showOptionIcons;
|
|
60
|
+
const filterOptions = [
|
|
61
|
+
{ optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
|
|
62
|
+
{ optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
|
|
63
|
+
{ optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
|
|
64
|
+
];
|
|
65
|
+
const jsonFilterOptions = JSON.stringify(filterOptions);
|
|
66
|
+
return `<tttx-filter
|
|
67
|
+
filter-options='${jsonFilterOptions}'
|
|
68
|
+
show-search-field='${showSearchField}'
|
|
69
|
+
show-select-all='${showSelectAll}'
|
|
70
|
+
filter-button-style='${filterButtonStyle}'
|
|
71
|
+
show-option-icons='${showOptionIcons}'
|
|
72
|
+
filter-header='${filterHeader}'
|
|
73
|
+
/>`;
|
|
74
|
+
};
|
|
75
|
+
export const TableIconWithoutOptionIconsOrSelectAll = (args) => {
|
|
76
|
+
const filterButtonStyle = 'table icon';
|
|
77
|
+
args.filterHeader = args.filterHeader || 'Qualification status';
|
|
78
|
+
const filterHeader = args.filterHeader;
|
|
79
|
+
const showSearchField = args.showSearchField;
|
|
80
|
+
const showOptionIcons = false;
|
|
81
|
+
const showSelectAll = false;
|
|
82
|
+
const filterOptions = [
|
|
83
|
+
{ optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
|
|
84
|
+
{ optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
|
|
85
|
+
{ optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
|
|
86
|
+
];
|
|
87
|
+
const jsonFilterOptions = JSON.stringify(filterOptions);
|
|
88
|
+
return `<tttx-filter
|
|
89
|
+
filter-button-style='${filterButtonStyle}'
|
|
90
|
+
filter-options='${jsonFilterOptions}'
|
|
91
|
+
show-select-all='${showSelectAll}'
|
|
92
|
+
show-option-icons='${showOptionIcons}'
|
|
93
|
+
show-search-field='${showSearchField}'
|
|
94
|
+
filter-header='${filterHeader}'
|
|
95
|
+
/>`;
|
|
96
|
+
};
|
|
97
|
+
export const ListIconWithoutSearchField = (args) => {
|
|
98
|
+
const filterButtonStyle = 'list icon';
|
|
99
|
+
args.filterHeader = args.filterHeader || 'Qualification status';
|
|
100
|
+
const filterHeader = args.filterHeader;
|
|
101
|
+
const showSearchField = false;
|
|
102
|
+
const showOptionIcons = true;
|
|
103
|
+
const showSelectAll = args.showSelectAll;
|
|
104
|
+
const filterOptions = [
|
|
105
|
+
{ optionIcon: 'cancel', optionIconColor: 'exit', optionText: 'Expired' },
|
|
106
|
+
{ optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
|
|
107
|
+
{ optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
|
|
108
|
+
];
|
|
109
|
+
const jsonFilterOptions = JSON.stringify(filterOptions);
|
|
110
|
+
return `<tttx-filter
|
|
111
|
+
filter-button-style='${filterButtonStyle}'
|
|
112
|
+
filter-options='${jsonFilterOptions}'
|
|
113
|
+
show-select-all='${showSelectAll}'
|
|
114
|
+
show-option-icons='${showOptionIcons}'
|
|
115
|
+
show-search-field='${showSearchField}'
|
|
116
|
+
filter-header='${filterHeader}'
|
|
117
|
+
/>`;
|
|
118
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* tttx custom elements */
|
|
2
2
|
export { TttxButton as TttxButton } from '../types/components/atoms/tttx-button/tttx-button';
|
|
3
|
+
export { TttxFilter as TttxFilter } from '../types/components/molecules/tttx-filter/tttx-filter';
|
|
3
4
|
export { TttxForm as TttxForm } from '../types/components/molecules/tttx-form/tttx-form';
|
|
4
5
|
export { TttxIcon as TttxIcon } from '../types/components/atoms/tttx-icon/tttx-icon';
|
|
5
6
|
export { TttxKeyvalueBlock as TttxKeyvalueBlock } from '../types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block';
|
|
@@ -20,15 +21,6 @@ export { TttxToolbar as TttxToolbar } from '../types/components/molecules/tttx-t
|
|
|
20
21
|
*/
|
|
21
22
|
export declare const setAssetPath: (path: string) => void;
|
|
22
23
|
|
|
23
|
-
/**
|
|
24
|
-
* Used to specify a nonce value that corresponds with an application's CSP.
|
|
25
|
-
* When set, the nonce will be added to all dynamically created script and style tags at runtime.
|
|
26
|
-
* Alternatively, the nonce value can be set on a meta tag in the DOM head
|
|
27
|
-
* (<meta name="csp-nonce" content="{ nonce value here }" />) which
|
|
28
|
-
* will result in the same behavior.
|
|
29
|
-
*/
|
|
30
|
-
export declare const setNonce: (nonce: string) => void
|
|
31
|
-
|
|
32
24
|
export interface SetPlatformOptions {
|
|
33
25
|
raf?: (c: FrameRequestCallback) => number;
|
|
34
26
|
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { setAssetPath,
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
2
|
export { TttxButton, defineCustomElement as defineCustomElementTttxButton } from './tttx-button.js';
|
|
3
|
+
export { TttxFilter, defineCustomElement as defineCustomElementTttxFilter } from './tttx-filter.js';
|
|
3
4
|
export { TttxForm, defineCustomElement as defineCustomElementTttxForm } from './tttx-form.js';
|
|
4
5
|
export { TttxIcon, defineCustomElement as defineCustomElementTttxIcon } from './tttx-icon.js';
|
|
5
6
|
export { TttxKeyvalueBlock, defineCustomElement as defineCustomElementTttxKeyvalueBlock } from './tttx-keyvalue-block.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface TttxFilter extends Components.TttxFilter, HTMLElement {}
|
|
4
|
+
export const TttxFilter: {
|
|
5
|
+
prototype: TttxFilter;
|
|
6
|
+
new (): TttxFilter;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { d as defineCustomElement$2 } from './tttx-icon2.js';
|
|
3
|
+
|
|
4
|
+
const tttxFilterCss = ".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}.filter-container .filter-button{display:inline-flex;justify-content:center;align-items:center;font-size:14px;font-weight:400;font-family:\"Roboto\", serif;text-transform:uppercase;color:#212121;border:1px solid #d5d5d5;border-radius:4px;background:transparent;height:36px;width:95px;margin:0;padding-right:16px}.filter-container .filter-button .filter-icon{padding-left:8px;padding-right:4px}.filter-container .filter-button.--list-icon{font-size:0;width:36px;height:36px;padding:0}.filter-container .filter-button.--list-icon .filter-icon{padding:0}.filter-container .filter-button.--list-icon:hover{background:#e3e3e3}.filter-container .filter-button.--table-icon{font-size:0;width:36px;height:36px;padding:0;border:none}.filter-container .filter-button.--table-icon .filter-icon{padding:0;width:24px;height:24px}.filter-container .filter-button.--table-icon:hover{background:#e3e3e3;border-radius:50%;width:36px;height:36px}.filter-container .filter-button:hover{background:#e3e3e3}.filter-container .filter-popover-container{display:block;width:196px;border-radius:4px;box-shadow:0px 1px 5px #1111114D;position:absolute}.filter-container .filter-popover-container .filter-header{color:#757575;text-transform:uppercase;font-size:14px;font-weight:500;font-family:\"Roboto\", serif;padding-left:16px;padding-top:12px;padding-bottom:12px;margin:0}.filter-container .filter-popover-container .popover-divider{border:none;width:164px;display:flex;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:8px;height:1px;background-color:#d5d5d5}.filter-container .filter-popover-container .filter-option{display:flex;flex-direction:row;align-items:center;height:36px;padding-left:22px;padding-bottom:4px}.filter-container .filter-popover-container .filter-option .select-all-icon{padding-right:6px}.filter-container .filter-popover-container .filter-option .checkbox-icon{padding-right:8px}.filter-container .filter-popover-container .filter-option .filter-label{padding-left:8px;padding-bottom:3px;font-size:16px;font-weight:500;font-family:\"Roboto\", serif}.filter-container .filter-popover-container .filter-option:first-child{margin-top:8px}.filter-container .filter-popover-container .filter-option:last-child{margin-bottom:8px}.filter-container .filter-popover-container .filter-popover-button-container{display:flex;justify-content:flex-end;align-items:center;padding-bottom:8px}.filter-container .filter-popover-container .filter-popover-button-container .close-button{height:36px;width:74px;background-color:white;border:1px solid #d5d5d5;border-radius:4px;text-transform:uppercase;margin-right:8px;font-size:14px;font-weight:400;font-family:\"Roboto\", serif}.filter-container .filter-popover-container .filter-popover-button-container .apply-button{height:36px;width:73px;background-color:#1479c6;color:white;border-radius:4px;border:none;text-transform:uppercase;margin-right:16px;font-size:14px;font-weight:400;font-family:\"Roboto\", serif}.filter-container .filter-popover-container.--with-search-field{width:252px}.filter-container .filter-popover-container.--with-search-field .popover-divider{width:220px}.filter-container .filter-popover-container.--with-search-field .popover-divider:first-child{top:44px}.filter-container .filter-popover-container.--with-search-field .search-field-container{position:relative;color:#d5d5d5;width:220px;height:36px;padding:0 16px}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-icon{position:absolute;top:50%;padding-left:8px;padding-bottom:9.2px;height:17px;width:17px;transform:translateY(-50%)}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input{padding-left:36px;border:1px solid #d5d5d5;border-radius:4px;height:36px;width:220px;font-size:16px;font-family:\"Roboto\", serif;font-weight:500;color:#9e9e9e;box-sizing:border-box}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input:focus-visible,.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input:focus{outline:none;border:1px solid #1479c6}.filter-container .filter-popover-container.--with-search-field .search-field-container .search-input::placeholder{color:#9e9e9e;font-size:16px;font-family:\"Roboto\", serif;font-weight:500}.filter-container .filter-popover-container.--with-search-field .search-field-container .popover-divider{margin-top:8px}.filter-container .filter-popover-container.--with-search-field .filter-option:first-child{padding-top:8px}";
|
|
5
|
+
|
|
6
|
+
const TttxFilter$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.filterChangeEvent = createEvent(this, "filterChangeEvent", 7);
|
|
12
|
+
this.filterKey = undefined;
|
|
13
|
+
this.filterOptions = [
|
|
14
|
+
{ optionIcon: 'cancel', optionIconColor: 'darkred', optionText: 'Expired' },
|
|
15
|
+
{ optionIcon: 'warning', optionIconColor: 'orange', optionText: 'Expiring soon' },
|
|
16
|
+
{ optionIcon: 'check_circle', optionIconColor: 'green', optionText: 'Active' },
|
|
17
|
+
];
|
|
18
|
+
this.showSelectAll = true;
|
|
19
|
+
this.showSearchField = false;
|
|
20
|
+
this.showOptionIcons = true;
|
|
21
|
+
this.filterButtonStyle = 'list filter';
|
|
22
|
+
this.filterHeader = 'Qualification status';
|
|
23
|
+
this.showPopover = false;
|
|
24
|
+
this.selectedFilters = this.filterOptions.map((filterOption) => filterOption.optionText);
|
|
25
|
+
this.filterSearchTerm = '';
|
|
26
|
+
this.displayedFilterSettings = this.filterOptions;
|
|
27
|
+
this.allSelected = true;
|
|
28
|
+
}
|
|
29
|
+
emitFilterEvent() {
|
|
30
|
+
this.filterChangeEvent.emit({
|
|
31
|
+
selectedFilters: this.selectedFilters,
|
|
32
|
+
filterKey: this.filterKey,
|
|
33
|
+
allSelected: this.allSelected,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
onFilterButtonClick() {
|
|
37
|
+
this.togglePopover();
|
|
38
|
+
}
|
|
39
|
+
onCloseButtonClick() {
|
|
40
|
+
this.togglePopover();
|
|
41
|
+
}
|
|
42
|
+
onApplyFilterButtonClick() {
|
|
43
|
+
this.emitFilterEvent();
|
|
44
|
+
this.togglePopover();
|
|
45
|
+
}
|
|
46
|
+
onFilterOptionSelected(selectedOption) {
|
|
47
|
+
this.allSelected = false;
|
|
48
|
+
if (this.selectedFilters.includes(selectedOption)) {
|
|
49
|
+
this.selectedFilters = this.selectedFilters.filter((filter) => filter != selectedOption);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.selectedFilters = [...this.selectedFilters, selectedOption];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
togglePopover() {
|
|
56
|
+
this.showPopover = !this.showPopover;
|
|
57
|
+
// if(!this.showPopover) {
|
|
58
|
+
// // this._focussedElementIndex = -1;
|
|
59
|
+
// }
|
|
60
|
+
}
|
|
61
|
+
// Commented out keyboard interaction for now
|
|
62
|
+
// @Listen('keyup')
|
|
63
|
+
// handleKeyUp(event: KeyboardEvent) {
|
|
64
|
+
// const keyboardEventValue = event.key;
|
|
65
|
+
// if (document.activeElement.id != `filter__${this.filterKey}`) return;
|
|
66
|
+
// if (event.key == " " || event.code == "Space" || event.keyCode == 32) {
|
|
67
|
+
// if (this._focussedElementIndex == 0) {
|
|
68
|
+
// this.onSelectAllClick()
|
|
69
|
+
// } else {
|
|
70
|
+
// const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
|
|
71
|
+
// this.onFilterOptionSelected(options[this._focussedElementIndex].textContent)
|
|
72
|
+
// }
|
|
73
|
+
// return;
|
|
74
|
+
// }
|
|
75
|
+
// switch (keyboardEventValue) {
|
|
76
|
+
// case 'Enter':
|
|
77
|
+
// if(!this.showPopover) {
|
|
78
|
+
// this.showPopover=true
|
|
79
|
+
// } else {
|
|
80
|
+
// this.emitFilterEvent()
|
|
81
|
+
// }
|
|
82
|
+
// break;
|
|
83
|
+
// case 'Escape':
|
|
84
|
+
// this.showPopover = false;
|
|
85
|
+
// this._focussedElementIndex = -1;
|
|
86
|
+
// break;
|
|
87
|
+
// case 'ArrowDown':
|
|
88
|
+
// this.showPopover = true;
|
|
89
|
+
// if (this._focussedElementIndex == -1) {
|
|
90
|
+
// this._focussedElementIndex = 0;
|
|
91
|
+
// } else {
|
|
92
|
+
// const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
|
|
93
|
+
// const currentOption = options[this._focussedElementIndex] as HTMLElement;
|
|
94
|
+
// currentOption.blur();
|
|
95
|
+
// // options[this._focussedElementIndex].focus();
|
|
96
|
+
// this._focussedElementIndex + 1 < options.length ? this._focussedElementIndex++ : (this._focussedElementIndex = 0);
|
|
97
|
+
// }
|
|
98
|
+
// break;
|
|
99
|
+
// case 'ArrowUp':
|
|
100
|
+
// if (this._focussedElementIndex == -1) {
|
|
101
|
+
// this.showPopover = true;
|
|
102
|
+
// this._focussedElementIndex = 0;
|
|
103
|
+
// } else {
|
|
104
|
+
// const options = this.el.shadowRoot.querySelectorAll('.filter-option') as HTMLElement[];
|
|
105
|
+
// const currentOption = options[this._focussedElementIndex] as HTMLElement;
|
|
106
|
+
// currentOption.blur();
|
|
107
|
+
// // options[this._focussedElementIndex].focus();
|
|
108
|
+
// this._focussedElementIndex > 0 ? this._focussedElementIndex-- : (this._focussedElementIndex = options.length - 1);
|
|
109
|
+
// }
|
|
110
|
+
// break;
|
|
111
|
+
// }
|
|
112
|
+
// }
|
|
113
|
+
handleFilterChange(event) {
|
|
114
|
+
const target = event.target;
|
|
115
|
+
this.filterSearchTerm = target.value;
|
|
116
|
+
const filteredResults = this.filterOptions.filter((filterOption) => {
|
|
117
|
+
const lowercaseOption = filterOption.optionText.toLowerCase();
|
|
118
|
+
const filterTerm = this.filterSearchTerm.toLowerCase();
|
|
119
|
+
return lowercaseOption.includes(filterTerm);
|
|
120
|
+
});
|
|
121
|
+
this.displayedFilterSettings = filteredResults;
|
|
122
|
+
}
|
|
123
|
+
onSelectAllClick() {
|
|
124
|
+
this.allSelected = !this.allSelected;
|
|
125
|
+
if (this.allSelected) {
|
|
126
|
+
this.displayedFilterSettings.forEach((filterSetting) => { this.selectedFilters = [...this.selectedFilters, filterSetting.optionText]; });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.selectedFilters = [];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
getFilterButtonClassName(buttonStyle) {
|
|
133
|
+
switch (buttonStyle) {
|
|
134
|
+
case 'table icon': {
|
|
135
|
+
return '--table-icon';
|
|
136
|
+
}
|
|
137
|
+
case 'list icon': {
|
|
138
|
+
return '--list-icon';
|
|
139
|
+
}
|
|
140
|
+
default: {
|
|
141
|
+
return '';
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
render() {
|
|
146
|
+
const filterPopoverContainerClassNameModifier = this.showSearchField ? '--with-search-field' : '';
|
|
147
|
+
const selectAllCheckboxIcon = this.allSelected ? 'check_box' : 'check_box_outline_blank';
|
|
148
|
+
const selectAllCheckboxColor = this.allSelected ? 'blue' : 'grey';
|
|
149
|
+
const buttonStyleClassNameModifier = this.getFilterButtonClassName(this.filterButtonStyle);
|
|
150
|
+
const filterKey = `filter__${this.filterKey}`;
|
|
151
|
+
return (h(Host, { id: filterKey }, h("div", { class: 'filter-container' }, h("button", { class: `filter-button ${buttonStyleClassNameModifier}`, type: 'button', onClick: this.onFilterButtonClick.bind(this) }, h("tttx-icon", { icon: 'filter_list', class: 'filter-icon', color: 'black' }), "Filter"), this.showPopover && (h("div", { class: `filter-popover-container ${filterPopoverContainerClassNameModifier}` }, h("h4", { class: 'filter-header' }, this.filterHeader), h("hr", { class: 'popover-divider' }), this.showSearchField ? (h("div", { class: 'search-field-container' }, h("tttx-icon", { icon: 'search', class: 'search-icon' }), h("input", { type: 'text', class: 'search-input', placeholder: 'Search', value: this.filterSearchTerm, onInput: this.handleFilterChange.bind(this) }), h("hr", { class: 'popover-divider' }))) : (''), h("div", { class: 'filter-options-container' }, this.showSelectAll ? (h("div", { class: 'filter-option', tabIndex: -1, onClick: this.onSelectAllClick.bind(this) }, h("tttx-icon", { icon: selectAllCheckboxIcon, color: selectAllCheckboxColor, class: 'select-all-icon' }), h("label", { class: 'filter-label' }, "Select all"))) : (''), this.displayedFilterSettings.map((option) => {
|
|
152
|
+
const checkboxIcon = this.selectedFilters.includes(option.optionText) ? 'check_box' : 'check_box_outline_blank';
|
|
153
|
+
const checkboxColor = this.selectedFilters.includes(option.optionText) ? 'blue' : 'grey';
|
|
154
|
+
return h("div", { class: 'filter-option', tabIndex: -1, onClick: () => this.onFilterOptionSelected(option.optionText), key: option.optionText }, h("tttx-icon", { icon: checkboxIcon, color: checkboxColor, class: 'checkbox-icon' }), this.showOptionIcons && h("tttx-icon", { icon: option.optionIcon, color: option.optionIconColor }), h("label", { class: 'filter-label' }, option.optionText));
|
|
155
|
+
})), h("hr", { class: 'popover-divider' }), h("div", { class: 'filter-popover-button-container' }, h("button", { type: 'button', class: 'close-button', onClick: this.onCloseButtonClick.bind(this) }, "Close"), h("button", { type: 'button', class: 'apply-button', onClick: this.onApplyFilterButtonClick.bind(this) }, "Apply")))))));
|
|
156
|
+
}
|
|
157
|
+
get el() { return this; }
|
|
158
|
+
static get style() { return tttxFilterCss; }
|
|
159
|
+
}, [1, "tttx-filter", {
|
|
160
|
+
"filterKey": [1, "filter-key"],
|
|
161
|
+
"filterOptions": [16],
|
|
162
|
+
"showSelectAll": [4, "show-select-all"],
|
|
163
|
+
"showSearchField": [4, "show-search-field"],
|
|
164
|
+
"showOptionIcons": [4, "show-option-icons"],
|
|
165
|
+
"filterButtonStyle": [1, "filter-button-style"],
|
|
166
|
+
"filterHeader": [1, "filter-header"],
|
|
167
|
+
"showPopover": [32],
|
|
168
|
+
"selectedFilters": [32],
|
|
169
|
+
"filterSearchTerm": [32],
|
|
170
|
+
"displayedFilterSettings": [32],
|
|
171
|
+
"allSelected": [32]
|
|
172
|
+
}]);
|
|
173
|
+
function defineCustomElement$1() {
|
|
174
|
+
if (typeof customElements === "undefined") {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const components = ["tttx-filter", "tttx-icon"];
|
|
178
|
+
components.forEach(tagName => { switch (tagName) {
|
|
179
|
+
case "tttx-filter":
|
|
180
|
+
if (!customElements.get(tagName)) {
|
|
181
|
+
customElements.define(tagName, TttxFilter$1);
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case "tttx-icon":
|
|
185
|
+
if (!customElements.get(tagName)) {
|
|
186
|
+
defineCustomElement$2();
|
|
187
|
+
}
|
|
188
|
+
break;
|
|
189
|
+
} });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const TttxFilter = TttxFilter$1;
|
|
193
|
+
const defineCustomElement = defineCustomElement$1;
|
|
194
|
+
|
|
195
|
+
export { TttxFilter, defineCustomElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
|
|
3
|
-
const tttxKeyvalueBlockCss = ":host{display:block}dl{margin:0;padding:0;font-family:\"Roboto\", sans-serif;cursor:default}dt{font-weight:400;line-height:21px;font-size:16px}dt,dt.subTitle{color:#757575}dt.mainTitle{color:#212121}dd{margin:0;font-weight:400;font-size:16px;color:#212121;line-height:21px;margin-bottom:18px}dl.horizontal{display:flex;flex-direction:row;width:100%}dl.horizontal div{flex-grow:1}@media (max-width: 769px){dl.horizontal{flex-wrap:wrap}dl.horizontal div{width:50%}}@media (max-width: 600px){dl.horizontal div{width:100%}}";
|
|
3
|
+
const tttxKeyvalueBlockCss = ":host{display:block}dl{margin:0;padding:0;font-family:\"Roboto\", sans-serif;cursor:default}dt{font-weight:400;line-height:21px;font-size:16px}dt,dt.subTitle{color:#757575}dt.mainTitle{color:#212121}dt,dd{overflow-wrap:anywhere}dd{margin:0;font-weight:400;font-size:16px;color:#212121;line-height:21px;margin-bottom:18px}dl.horizontal{display:flex;flex-direction:row;width:100%}dl.horizontal div{flex-grow:1}@media (max-width: 769px){dl.horizontal{flex-wrap:wrap}dl.horizontal div{width:50%}}@media (max-width: 600px){dl.horizontal div{width:100%}}";
|
|
4
4
|
|
|
5
5
|
const TttxKeyvalueBlock$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
6
|
constructor() {
|
|
@@ -26,10 +26,11 @@ const TttxKeyvalueBlock$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLE
|
|
|
26
26
|
}
|
|
27
27
|
renderArrayElements(values) {
|
|
28
28
|
const elements = [];
|
|
29
|
+
const divSize = (100 / values.length).toString();
|
|
29
30
|
for (let i = 0; i < values.length; i++) {
|
|
30
31
|
const value = values[i];
|
|
31
32
|
if (this.horizontal) {
|
|
32
|
-
elements.push(h("div",
|
|
33
|
+
elements.push(h("div", { style: { maxWidth: divSize } }, h("dt", { class: 'mainTitle' }, value.title), h("dt", { class: 'subTitle' }, value.subTitle), h("dd", null, value.data)));
|
|
33
34
|
}
|
|
34
35
|
else {
|
|
35
36
|
elements.push(h("dt", { class: 'mainTitle' }, value.title));
|