@3t-transform/threeteeui 0.1.65 → 0.1.67

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.
Files changed (31) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/tttx-list.cjs.entry.js +51 -10
  3. package/dist/cjs/tttx-tag.cjs.entry.js +21 -0
  4. package/dist/cjs/tttx.cjs.js +1 -1
  5. package/dist/collection/collection-manifest.json +1 -0
  6. package/dist/collection/components/atoms/tttx-tag/tttx-tag.css +180 -0
  7. package/dist/collection/components/atoms/tttx-tag/tttx-tag.js +62 -0
  8. package/dist/collection/components/atoms/tttx-tag/tttx-tag.stories.js +39 -0
  9. package/dist/collection/components/molecules/tttx-list/tttx-list.css +29 -8
  10. package/dist/collection/components/molecules/tttx-list/tttx-list.js +97 -11
  11. package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +78 -3
  12. package/dist/components/index.d.ts +1 -0
  13. package/dist/components/index.js +1 -0
  14. package/dist/components/tttx-list.js +54 -11
  15. package/dist/components/tttx-tag.d.ts +11 -0
  16. package/dist/components/tttx-tag.js +38 -0
  17. package/dist/esm/loader.js +1 -1
  18. package/dist/esm/tttx-list.entry.js +51 -10
  19. package/dist/esm/tttx-tag.entry.js +17 -0
  20. package/dist/esm/tttx.js +1 -1
  21. package/dist/tttx/p-40c66a2e.entry.js +1 -0
  22. package/dist/tttx/p-68680d65.entry.js +1 -0
  23. package/dist/tttx/tttx.esm.js +1 -1
  24. package/dist/types/components/atoms/tttx-tag/tttx-tag.d.ts +5 -0
  25. package/dist/types/components/atoms/tttx-tag/tttx-tag.stories.d.ts +21 -0
  26. package/dist/types/components/molecules/tttx-list/interfaces.d.ts +7 -4
  27. package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +16 -2
  28. package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +1 -0
  29. package/dist/types/components.d.ts +20 -1
  30. package/package.json +1 -1
  31. package/dist/tttx/p-cec36804.entry.js +0 -1
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["tttx-dialog-box.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter.cjs",[[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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
17
+ return index.bootstrapLazy([["tttx-dialog-box.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter.cjs",[[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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32],"setAllCheckboxes":[64]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -6,37 +6,78 @@ const index = require('./index-43af0e62.js');
6
6
  const domsanitiser_options = require('./domsanitiser.options-1dfa7205.js');
7
7
  require('./_commonjsHelpers-537d719a.js');
8
8
 
9
- const tttxListCss = ".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}:host{display:flex;flex-direction:column}.list{margin:0;padding:0}.item{list-style:none;margin:0;padding:8px;border-bottom:1px solid #d5d5d5;min-height:36px;display:flex;align-items:center}.item:first-of-type{border-top:1px solid #d5d5d5}.item.clickable:hover{cursor:pointer}.item.clickable:active{background-color:#e6e6e6}.item:hover{background-color:#1111110D}.align-right{margin-left:auto}.item-content{display:flex;align-items:center}";
9
+ const tttxListCss = ".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}:host{display:flex;flex-direction:column}.list{margin:0;padding:0}li{display:flex;align-items:flex-start}li.item{list-style:none;margin:0;padding:8px;border-bottom:1px solid #d5d5d5;min-height:36px}li.item:first-of-type{border-top:1px solid #d5d5d5}li.item.clickable:hover{cursor:pointer}li.item.clickable:active{background-color:#e6e6e6}li.item .icons{display:flex;justify-content:flex-end;flex-grow:1;align-items:center;height:36px}li.item .icons tttx-icon:hover{cursor:pointer}li.item .icons *{display:flex}li:hover{background-color:#1111110D}.align-right{margin-left:auto}.item-content{display:flex;align-items:center;flex-grow:2;min-height:36px}.checkbox{padding:6px;margin-left:-8px}";
10
10
 
11
11
  const TttxList = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
14
  this.rowClick = index.createEvent(this, "listRowClick", 7);
15
+ this.rowCheckboxClick = index.createEvent(this, "listRowCheckboxClick", 7);
15
16
  this.data = undefined;
17
+ this._data = undefined;
16
18
  this.name = undefined;
17
19
  }
20
+ onDataChange() {
21
+ if (!this.data) {
22
+ return;
23
+ }
24
+ if (typeof this.data === 'string') {
25
+ this._data = JSON.parse(this.data);
26
+ }
27
+ else {
28
+ this._data = [...this.data];
29
+ }
30
+ for (const data of this._data) {
31
+ if (data.hasCheckbox && data.checked === undefined) {
32
+ data.checked = false;
33
+ }
34
+ }
35
+ }
36
+ componentWillLoad() {
37
+ // dynamic constructor: any props can be added later
38
+ this.onDataChange();
39
+ }
40
+ onRowCheckboxHandler(event, item) {
41
+ event.stopPropagation();
42
+ if (!item.rowData)
43
+ return;
44
+ if (item.hasCheckbox) {
45
+ item.checked = !item.checked;
46
+ }
47
+ // re-render component by updating its state
48
+ this._data = [...this._data];
49
+ this.rowCheckboxClick.emit({ key: item.key, name: this.name, data: item.rowData, checked: item.checked });
50
+ }
18
51
  onRowClickHandler(item) {
19
52
  if (!item.clickable || !item.rowData)
20
53
  return;
21
- this.rowClick.emit({ name: this.name, data: item.rowData });
54
+ this.rowClick.emit({ key: item.key, name: this.name, data: item.rowData });
55
+ }
56
+ async setAllCheckboxes(check) {
57
+ for (const data of this._data) {
58
+ if (data.hasCheckbox) {
59
+ data.checked = check;
60
+ }
61
+ }
62
+ // re-render component by updating its state
63
+ this._data = [...this._data];
22
64
  }
23
65
  renderListItem(item) {
24
66
  const cleanHTML = domsanitiser_options.purify.sanitize(item.element, domsanitiser_options.domSanitiserOptions);
25
67
  return (index.h("li", { class: `item ${item.clickable ? 'clickable' : ''}`, onClick: () => {
26
68
  this.onRowClickHandler(item);
27
- } }, item.element && index.h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && index.h("tttx-icon", { class: "align-right ", icon: item.icon })));
69
+ } }, item.hasCheckbox && (index.h("div", { class: "checkbox" }, index.h("tttx-icon", { icon: item.checked ? 'check_box' : 'check_box_outline_blank', color: item.checked ? 'blue' : 'grey', onClick: event => {
70
+ this.onRowCheckboxHandler(event, item);
71
+ } }))), item.element && index.h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && (index.h("span", { class: "icons" }, index.h("tttx-icon", { class: "align-right", icon: item.icon, color: 'black' })))));
28
72
  }
29
73
  render() {
30
- if (!this.data)
74
+ if (!this._data)
31
75
  return;
32
- if (typeof this.data === 'string') {
33
- this._data = JSON.parse(this.data);
34
- }
35
- else {
36
- this._data = this.data;
37
- }
38
76
  return index.h("ul", { class: "list" }, this._data.map((item) => this.renderListItem(item)));
39
77
  }
78
+ static get watchers() { return {
79
+ "data": ["onDataChange"]
80
+ }; }
40
81
  };
41
82
  TttxList.style = tttxListCss;
42
83
 
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-43af0e62.js');
6
+
7
+ const tttxTagCss = ".material-symbols-rounded{font-variation-settings:\"FILL\" 1, \"wght\" 400, \"GRAD\" 0, \"opsz\" 24}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:400}.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:inline-block}.tag{border-radius:20px;padding:4px;font-family:\"Roboto\", sans-serif;font-size:14px;font-weight:400}.tag span{margin-left:4px;margin-right:4px;color:#212121}.icon{height:18px;width:18px;font-weight:400}";
8
+
9
+ const TttxTag = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.text = undefined;
13
+ this.color = '#d5d5d5';
14
+ }
15
+ render() {
16
+ return (index.h(index.Host, null, index.h("div", { class: "tag", style: { 'background-color': this.color } }, index.h("span", null, this.text))));
17
+ }
18
+ };
19
+ TttxTag.style = tttxTagCss;
20
+
21
+ exports.tttx_tag = TttxTag;
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["tttx-dialog-box.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter.cjs",[[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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
20
+ return index.bootstrapLazy([["tttx-dialog-box.cjs",[[1,"tttx-dialog-box",{"data":[1025],"size":[1],"open":[1028],"elementSize":[32]},[[9,"resize","handleResize"]]]]],["tttx-select-box.cjs",[[1,"tttx-select-box",{"optionsData":[1,"options-data"],"label":[1],"inline":[4],"placeholder":[1],"searchEnabled":[4,"search-enabled"],"open":[32],"selectedItem":[32],"searchTerm":[32]},[[0,"closeSelectBox","handleCloseSelectBox"],[0,"blur","handleBlur"]]]]],["tttx-tree-view.cjs",[[1,"tttx-tree-view",{"data":[1040],"treeData":[32]}]]],["tttx-filter.cjs",[[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"]]]]],["tttx-list.cjs",[[1,"tttx-list",{"data":[1025],"name":[1],"_data":[32],"setAllCheckboxes":[64]}]]],["tttx-sorter.cjs",[[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"]]]]],["tttx-form.cjs",[[1,"tttx-form",{"formschema":[1032],"data":[1032],"submit":[64]}]]],["tttx-keyvalue-block.cjs",[[1,"tttx-keyvalue-block",{"keyvalues":[8],"horizontal":[4]}]]],["tttx-loading-spinner.cjs",[[1,"tttx-loading-spinner",{"loadingMessage":[1028,"loading-message"],"size":[1025]}]]],["tttx-qrcode.cjs",[[1,"tttx-qrcode",{"link":[1025],"size":[1026]}]]],["tttx-tag.cjs",[[1,"tttx-tag",{"text":[1],"color":[1]}]]],["tttx-toolbar.cjs",[[1,"tttx-toolbar",{"border":[4]}]]],["tttx-icon.cjs",[[1,"tttx-icon",{"icon":[1],"color":[1]}]]],["tttx-standalone-input.cjs",[[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]}]]],["tttx-button.cjs",[[1,"tttx-button",{"notext":[4],"icon":[1],"iconposition":[1],"iconcolor":[1025],"design":[1]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -7,6 +7,7 @@
7
7
  "./components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js",
8
8
  "./components/atoms/tttx-loading-spinner/tttx-loading-spinner.js",
9
9
  "./components/atoms/tttx-qrcode/tttx-qrcode.js",
10
+ "./components/atoms/tttx-tag/tttx-tag.js",
10
11
  "./components/molecules/tttx-dialog-box/tttx-dialog-box.js",
11
12
  "./components/molecules/tttx-form/tttx-form.js",
12
13
  "./components/molecules/tttx-list/tttx-list.js",
@@ -0,0 +1,180 @@
1
+ .material-symbols-rounded {
2
+ font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
3
+ }
4
+
5
+ button {
6
+ cursor: pointer;
7
+ }
8
+
9
+ .button {
10
+ font-family: Roboto, serif;
11
+ box-sizing: border-box;
12
+ height: 36px;
13
+ min-width: 36px;
14
+ padding: 0;
15
+ margin: 0;
16
+ background: transparent;
17
+ color: #212121;
18
+ border: 1px solid #c8c8c8;
19
+ border-radius: 4px;
20
+ text-transform: uppercase;
21
+ display: flex;
22
+ justify-content: left;
23
+ align-items: center;
24
+ font-size: 14px;
25
+ font-weight: 400;
26
+ }
27
+
28
+ .button-content {
29
+ display: block;
30
+ padding: 0 16px;
31
+ }
32
+
33
+ .icon-left,
34
+ .icon-right {
35
+ margin-top: 4px;
36
+ }
37
+
38
+ .iconleft {
39
+ padding-left: 8px;
40
+ }
41
+
42
+ .iconleft .button-content {
43
+ padding-left: 4px;
44
+ }
45
+
46
+ .iconright {
47
+ padding-right: 8px;
48
+ }
49
+
50
+ .iconright .button-content {
51
+ padding-right: 4px;
52
+ }
53
+
54
+ .notext {
55
+ padding: 0 6px;
56
+ }
57
+
58
+ .button:active {
59
+ background: rgba(17, 17, 17, 0.2);
60
+ border: 1px solid #d5d5d5;
61
+ }
62
+
63
+ .primary {
64
+ background: #1479c6;
65
+ border: 1px solid #1479c6;
66
+ color: white;
67
+ }
68
+
69
+ .primary:active {
70
+ background: #1464a2;
71
+ border: 1px solid #1464a2;
72
+ }
73
+
74
+ .borderless {
75
+ background: transparent;
76
+ border: none;
77
+ color: #212121;
78
+ }
79
+
80
+ .borderless:active {
81
+ background: rgba(17, 17, 17, 0.2);
82
+ border: none;
83
+ }
84
+
85
+ .borderless-circle {
86
+ background: transparent;
87
+ border: none;
88
+ color: #212121;
89
+ border-radius: 50%;
90
+ }
91
+
92
+ .borderless-circle:active {
93
+ border: none;
94
+ }
95
+
96
+ .borderless-circle:focus {
97
+ border-color: transparent;
98
+ }
99
+
100
+ .danger {
101
+ background: #dc0000;
102
+ border: 1px solid #dc0000;
103
+ color: white;
104
+ }
105
+
106
+ .danger:active {
107
+ background: #b00000;
108
+ border: 1px solid #b00000;
109
+ }
110
+
111
+ .disabled {
112
+ background: #aeaeae;
113
+ border: none;
114
+ color: #4c4c4c;
115
+ cursor: not-allowed;
116
+ }
117
+
118
+ .disabled:active {
119
+ background: #aeaeae;
120
+ border: none;
121
+ color: #4c4c4c;
122
+ cursor: not-allowed;
123
+ }
124
+
125
+ @media (hover: hover) {
126
+ .button:hover {
127
+ background: rgba(17, 17, 17, 0.1);
128
+ border: 1px solid #d5d5d5;
129
+ }
130
+
131
+ .primary:hover {
132
+ background: #146eb3;
133
+ border: 1px solid #146eb3;
134
+ }
135
+
136
+ .borderless:hover {
137
+ background: rgba(17, 17, 17, 0.1);
138
+ border: none;
139
+ }
140
+
141
+ .borderless-circle:hover {
142
+ background: rgba(17, 17, 17, 0.1);
143
+ border: none;
144
+ }
145
+
146
+ .danger:hover {
147
+ background: #c60000;
148
+ border: 1px solid #c60000;
149
+ }
150
+
151
+ .disabled:hover {
152
+ background: #aeaeae;
153
+ border: none;
154
+ color: #4c4c4c;
155
+ cursor: not-allowed;
156
+ }
157
+ }
158
+ :host {
159
+ display: inline-block;
160
+ }
161
+
162
+ .tag {
163
+ border-radius: 20px;
164
+ padding: 4px;
165
+ font-family: "Roboto", sans-serif;
166
+ font-size: 14px;
167
+ font-weight: 400;
168
+ }
169
+
170
+ .tag span {
171
+ margin-left: 4px;
172
+ margin-right: 4px;
173
+ color: #212121;
174
+ }
175
+
176
+ .icon {
177
+ height: 18px;
178
+ width: 18px;
179
+ font-weight: 400;
180
+ }
@@ -0,0 +1,62 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import { Host, h } from '@stencil/core';
3
+ export class TttxTag {
4
+ constructor() {
5
+ this.text = undefined;
6
+ this.color = '#d5d5d5';
7
+ }
8
+ render() {
9
+ return (h(Host, null, h("div", { class: "tag", style: { 'background-color': this.color } }, h("span", null, this.text))));
10
+ }
11
+ static get is() { return "tttx-tag"; }
12
+ static get encapsulation() { return "shadow"; }
13
+ static get originalStyleUrls() {
14
+ return {
15
+ "$": ["tttx-tag.scss"]
16
+ };
17
+ }
18
+ static get styleUrls() {
19
+ return {
20
+ "$": ["tttx-tag.css"]
21
+ };
22
+ }
23
+ static get properties() {
24
+ return {
25
+ "text": {
26
+ "type": "string",
27
+ "mutable": false,
28
+ "complexType": {
29
+ "original": "string",
30
+ "resolved": "string",
31
+ "references": {}
32
+ },
33
+ "required": false,
34
+ "optional": false,
35
+ "docs": {
36
+ "tags": [],
37
+ "text": ""
38
+ },
39
+ "attribute": "text",
40
+ "reflect": false
41
+ },
42
+ "color": {
43
+ "type": "string",
44
+ "mutable": false,
45
+ "complexType": {
46
+ "original": "string",
47
+ "resolved": "string",
48
+ "references": {}
49
+ },
50
+ "required": false,
51
+ "optional": false,
52
+ "docs": {
53
+ "tags": [],
54
+ "text": ""
55
+ },
56
+ "attribute": "color",
57
+ "reflect": false,
58
+ "defaultValue": "'#d5d5d5'"
59
+ }
60
+ };
61
+ }
62
+ }
@@ -0,0 +1,39 @@
1
+ export default {
2
+ title: 'Atoms/Tag',
3
+ component: 'tttx-tag',
4
+ argTypes: {
5
+ text: {
6
+ control: { type: 'text' },
7
+ default: 'tag',
8
+ },
9
+ color: {
10
+ control: { type: 'text' },
11
+ default: '#d5d5d5',
12
+ }
13
+ },
14
+ };
15
+ const Template = ({ text, color }) => {
16
+ return `<tttx-tag text="${text}" color="${color}" ></tttx-tag>`;
17
+ };
18
+ export const tag = Template.bind({});
19
+ tag.args = {
20
+ text: 'tag',
21
+ color: '#d5d5d5',
22
+ };
23
+ const tagTemplates = () => `
24
+ <h2>Default</h2>
25
+ <tttx-tag text="Default" color="#d5d5d5"></tttx-tag>
26
+ <hr />
27
+ <h2>Critical</h2>
28
+ <tttx-tag text="Critical" color="#f2bebe"></tttx-tag>
29
+ <hr />
30
+ <h2>Warning</h2>
31
+ <tttx-tag text="Warning" color="#f9e1be"></tttx-tag>
32
+ <hr />
33
+ <h2>Success</h2>
34
+ <tttx-tag text="Success" color="#e4ebc9"></tttx-tag>
35
+ <hr />
36
+ <h2>Info</h2>
37
+ <tttx-tag text="Info" color="#c2daee"></tttx-tag>
38
+ `;
39
+ export const tags = tagTemplates.bind({});
@@ -29,26 +29,40 @@
29
29
  padding: 0;
30
30
  }
31
31
 
32
- .item {
32
+ li {
33
+ display: flex;
34
+ align-items: flex-start;
35
+ }
36
+ li.item {
33
37
  list-style: none;
34
38
  margin: 0;
35
39
  padding: 8px;
36
40
  border-bottom: 1px solid #d5d5d5;
37
41
  min-height: 36px;
38
- /* center the contents vertically */
39
- display: flex;
40
- align-items: center;
41
42
  }
42
- .item:first-of-type {
43
+ li.item:first-of-type {
43
44
  border-top: 1px solid #d5d5d5;
44
45
  }
45
- .item.clickable:hover {
46
+ li.item.clickable:hover {
46
47
  cursor: pointer;
47
48
  }
48
- .item.clickable:active {
49
+ li.item.clickable:active {
49
50
  background-color: #e6e6e6;
50
51
  }
51
- .item:hover {
52
+ li.item .icons {
53
+ display: flex;
54
+ justify-content: flex-end;
55
+ flex-grow: 1;
56
+ align-items: center;
57
+ height: 36px;
58
+ }
59
+ li.item .icons tttx-icon:hover {
60
+ cursor: pointer;
61
+ }
62
+ li.item .icons * {
63
+ display: flex;
64
+ }
65
+ li:hover {
52
66
  background-color: #1111110D;
53
67
  }
54
68
 
@@ -59,4 +73,11 @@
59
73
  .item-content {
60
74
  display: flex;
61
75
  align-items: center;
76
+ flex-grow: 2;
77
+ min-height: 36px;
78
+ }
79
+
80
+ .checkbox {
81
+ padding: 6px;
82
+ margin-left: -8px;
62
83
  }
@@ -5,28 +5,65 @@ import domSanitiserOptions from '../../../shared/domsanitiser.options';
5
5
  export class TttxList {
6
6
  constructor() {
7
7
  this.data = undefined;
8
+ this._data = undefined;
8
9
  this.name = undefined;
9
10
  }
11
+ onDataChange() {
12
+ if (!this.data) {
13
+ return;
14
+ }
15
+ if (typeof this.data === 'string') {
16
+ this._data = JSON.parse(this.data);
17
+ }
18
+ else {
19
+ this._data = [...this.data];
20
+ }
21
+ for (const data of this._data) {
22
+ if (data.hasCheckbox && data.checked === undefined) {
23
+ data.checked = false;
24
+ }
25
+ }
26
+ }
27
+ componentWillLoad() {
28
+ // dynamic constructor: any props can be added later
29
+ this.onDataChange();
30
+ }
31
+ onRowCheckboxHandler(event, item) {
32
+ event.stopPropagation();
33
+ if (!item.rowData)
34
+ return;
35
+ if (item.hasCheckbox) {
36
+ item.checked = !item.checked;
37
+ }
38
+ // re-render component by updating its state
39
+ this._data = [...this._data];
40
+ this.rowCheckboxClick.emit({ key: item.key, name: this.name, data: item.rowData, checked: item.checked });
41
+ }
10
42
  onRowClickHandler(item) {
11
43
  if (!item.clickable || !item.rowData)
12
44
  return;
13
- this.rowClick.emit({ name: this.name, data: item.rowData });
45
+ this.rowClick.emit({ key: item.key, name: this.name, data: item.rowData });
46
+ }
47
+ async setAllCheckboxes(check) {
48
+ for (const data of this._data) {
49
+ if (data.hasCheckbox) {
50
+ data.checked = check;
51
+ }
52
+ }
53
+ // re-render component by updating its state
54
+ this._data = [...this._data];
14
55
  }
15
56
  renderListItem(item) {
16
57
  const cleanHTML = DOMPurify.sanitize(item.element, domSanitiserOptions);
17
58
  return (h("li", { class: `item ${item.clickable ? 'clickable' : ''}`, onClick: () => {
18
59
  this.onRowClickHandler(item);
19
- } }, item.element && h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && h("tttx-icon", { class: "align-right ", icon: item.icon })));
60
+ } }, item.hasCheckbox && (h("div", { class: "checkbox" }, h("tttx-icon", { icon: item.checked ? 'check_box' : 'check_box_outline_blank', color: item.checked ? 'blue' : 'grey', onClick: event => {
61
+ this.onRowCheckboxHandler(event, item);
62
+ } }))), item.element && h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && (h("span", { class: "icons" }, h("tttx-icon", { class: "align-right", icon: item.icon, color: 'black' })))));
20
63
  }
21
64
  render() {
22
- if (!this.data)
65
+ if (!this._data)
23
66
  return;
24
- if (typeof this.data === 'string') {
25
- this._data = JSON.parse(this.data);
26
- }
27
- else {
28
- this._data = this.data;
29
- }
30
67
  return h("ul", { class: "list" }, this._data.map((item) => this.renderListItem(item)));
31
68
  }
32
69
  static get is() { return "tttx-list"; }
@@ -84,6 +121,11 @@ export class TttxList {
84
121
  }
85
122
  };
86
123
  }
124
+ static get states() {
125
+ return {
126
+ "_data": {}
127
+ };
128
+ }
87
129
  static get events() {
88
130
  return [{
89
131
  "method": "rowClick",
@@ -96,10 +138,54 @@ export class TttxList {
96
138
  "text": ""
97
139
  },
98
140
  "complexType": {
99
- "original": "any",
100
- "resolved": "any",
141
+ "original": "{ key: string; name: string; data: any }",
142
+ "resolved": "{ key: string; name: string; data: any; }",
143
+ "references": {}
144
+ }
145
+ }, {
146
+ "method": "rowCheckboxClick",
147
+ "name": "listRowCheckboxClick",
148
+ "bubbles": true,
149
+ "cancelable": true,
150
+ "composed": true,
151
+ "docs": {
152
+ "tags": [],
153
+ "text": ""
154
+ },
155
+ "complexType": {
156
+ "original": "{ key: string; name: string; data: any; checked: boolean }",
157
+ "resolved": "{ key: string; name: string; data: any; checked: boolean; }",
101
158
  "references": {}
102
159
  }
103
160
  }];
104
161
  }
162
+ static get methods() {
163
+ return {
164
+ "setAllCheckboxes": {
165
+ "complexType": {
166
+ "signature": "(check: boolean) => Promise<void>",
167
+ "parameters": [{
168
+ "tags": [],
169
+ "text": ""
170
+ }],
171
+ "references": {
172
+ "Promise": {
173
+ "location": "global"
174
+ }
175
+ },
176
+ "return": "Promise<void>"
177
+ },
178
+ "docs": {
179
+ "text": "",
180
+ "tags": []
181
+ }
182
+ }
183
+ };
184
+ }
185
+ static get watchers() {
186
+ return [{
187
+ "propName": "data",
188
+ "methodName": "onDataChange"
189
+ }];
190
+ }
105
191
  }