@otto-de/b2b-core-components 1.2.0 → 1.3.2

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 (205) hide show
  1. package/dist/b2b-core-components/b2b-core-components.esm.js +1 -1
  2. package/dist/b2b-core-components/{p-41e83c36.entry.js → p-08a50b6c.entry.js} +1 -1
  3. package/dist/b2b-core-components/p-09995310.entry.js +1 -0
  4. package/dist/b2b-core-components/p-144a3c59.entry.js +1 -0
  5. package/dist/b2b-core-components/{p-dfa3663c.entry.js → p-1493f7df.entry.js} +1 -1
  6. package/dist/b2b-core-components/{p-6dc0211c.entry.js → p-14f1b674.entry.js} +1 -1
  7. package/dist/b2b-core-components/{p-977d2fff.entry.js → p-15a499b0.entry.js} +1 -1
  8. package/dist/b2b-core-components/p-1fbb8c18.entry.js +1 -0
  9. package/dist/b2b-core-components/{p-2672e477.entry.js → p-22dab2b4.entry.js} +1 -1
  10. package/dist/b2b-core-components/{p-ee1d70fc.entry.js → p-400b3111.entry.js} +1 -1
  11. package/dist/b2b-core-components/{p-893f600f.entry.js → p-48d4d224.entry.js} +1 -1
  12. package/dist/b2b-core-components/p-4b25559c.entry.js +1 -0
  13. package/dist/b2b-core-components/{p-ca2722e8.entry.js → p-515eb49e.entry.js} +1 -1
  14. package/dist/b2b-core-components/{p-7149e60c.entry.js → p-5952fa73.entry.js} +1 -1
  15. package/dist/b2b-core-components/{p-3651b482.entry.js → p-686d6598.entry.js} +1 -1
  16. package/dist/b2b-core-components/p-6c9b0c23.entry.js +1 -0
  17. package/dist/b2b-core-components/p-6ddad1ab.entry.js +1 -0
  18. package/dist/b2b-core-components/{p-c8585513.entry.js → p-6e3b27cd.entry.js} +1 -1
  19. package/dist/b2b-core-components/{p-c8ec3c18.entry.js → p-7ca9b704.entry.js} +1 -1
  20. package/dist/b2b-core-components/{p-66399e78.entry.js → p-81a52d1a.entry.js} +1 -1
  21. package/dist/b2b-core-components/{p-414fef03.entry.js → p-83542aec.entry.js} +1 -1
  22. package/dist/b2b-core-components/{p-3cbf9cd2.entry.js → p-8970ae74.entry.js} +1 -1
  23. package/dist/b2b-core-components/{p-22cc8a9f.entry.js → p-9184036b.entry.js} +1 -1
  24. package/dist/b2b-core-components/{p-5048bec7.entry.js → p-925e40af.entry.js} +1 -1
  25. package/dist/b2b-core-components/{p-99d63c7c.entry.js → p-965ae161.entry.js} +1 -1
  26. package/dist/b2b-core-components/{p-2125ea38.entry.js → p-99f8cf34.entry.js} +1 -1
  27. package/dist/b2b-core-components/{p-a1832e33.entry.js → p-9facba86.entry.js} +1 -1
  28. package/dist/b2b-core-components/{p-9f670297.entry.js → p-a6248754.entry.js} +1 -1
  29. package/dist/b2b-core-components/p-a7417890.js +2 -0
  30. package/dist/b2b-core-components/{p-5b1bc987.entry.js → p-b6e0a6ea.entry.js} +1 -1
  31. package/dist/b2b-core-components/{p-5b40beba.entry.js → p-ba74cde5.entry.js} +1 -1
  32. package/dist/b2b-core-components/{p-84608432.entry.js → p-c2bcf0a8.entry.js} +1 -1
  33. package/dist/b2b-core-components/{p-ff4d56aa.entry.js → p-d6ce3259.entry.js} +1 -1
  34. package/dist/b2b-core-components/{p-72c780a5.entry.js → p-da6a1f55.entry.js} +1 -1
  35. package/dist/b2b-core-components/p-dacfc1ab.js +1 -0
  36. package/dist/b2b-core-components/{p-ad2548ba.entry.js → p-f0aa5e83.entry.js} +1 -1
  37. package/dist/b2b-core-components/p-f57b891b.entry.js +1 -0
  38. package/dist/b2b-core-components/{p-c2855f32.entry.js → p-fc639b29.entry.js} +1 -1
  39. package/dist/b2b-core-components/{p-7e28e0f2.entry.js → p-fd34bf31.entry.js} +1 -1
  40. package/dist/cjs/b2b-alert.cjs.entry.js +1 -1
  41. package/dist/cjs/b2b-anchor.cjs.entry.js +1 -1
  42. package/dist/cjs/b2b-button_2.cjs.entry.js +1 -1
  43. package/dist/cjs/b2b-card.cjs.entry.js +47 -0
  44. package/dist/cjs/b2b-checkbox-group.cjs.entry.js +1 -1
  45. package/dist/cjs/b2b-checkbox.cjs.entry.js +1 -1
  46. package/dist/cjs/b2b-core-components.cjs.js +2 -2
  47. package/dist/cjs/b2b-dropdown.cjs.entry.js +1 -1
  48. package/dist/cjs/b2b-grid-col.cjs.entry.js +1 -1
  49. package/dist/cjs/b2b-grid-row.cjs.entry.js +1 -1
  50. package/dist/cjs/b2b-grid.cjs.entry.js +1 -1
  51. package/dist/cjs/b2b-headline.cjs.entry.js +1 -1
  52. package/dist/cjs/b2b-icon.cjs.entry.js +4 -2
  53. package/dist/cjs/b2b-input-group_2.cjs.entry.js +3 -2
  54. package/dist/cjs/b2b-input-label.cjs.entry.js +1 -1
  55. package/dist/cjs/b2b-input_2.cjs.entry.js +1 -1
  56. package/dist/cjs/b2b-label.cjs.entry.js +1 -1
  57. package/dist/cjs/b2b-modal.cjs.entry.js +2 -2
  58. package/dist/cjs/b2b-pagination.cjs.entry.js +1 -1
  59. package/dist/cjs/b2b-paragraph.cjs.entry.js +1 -1
  60. package/dist/cjs/b2b-radio-button.cjs.entry.js +1 -1
  61. package/dist/cjs/b2b-radio-group.cjs.entry.js +1 -1
  62. package/dist/cjs/b2b-required-separator.cjs.entry.js +1 -1
  63. package/dist/cjs/b2b-scrollable-container.cjs.entry.js +1 -1
  64. package/dist/cjs/b2b-search.cjs.entry.js +3 -2
  65. package/dist/cjs/b2b-separator.cjs.entry.js +1 -1
  66. package/dist/cjs/b2b-tab-group.cjs.entry.js +1 -1
  67. package/dist/cjs/b2b-tab-panel.cjs.entry.js +1 -1
  68. package/dist/cjs/b2b-tab.cjs.entry.js +1 -1
  69. package/dist/cjs/{b2b-table-header.cjs.entry.js → b2b-table-cell_2.cjs.entry.js} +47 -2
  70. package/dist/cjs/b2b-table-row.cjs.entry.js +22 -5
  71. package/dist/cjs/b2b-table-rowgroup.cjs.entry.js +58 -4
  72. package/dist/cjs/b2b-table.cjs.entry.js +2 -2
  73. package/dist/cjs/b2b-textarea.cjs.entry.js +1 -1
  74. package/dist/cjs/b2b-toggle-button.cjs.entry.js +1 -1
  75. package/dist/cjs/b2b-toggle-group.cjs.entry.js +1 -1
  76. package/dist/cjs/b2b-tooltip.cjs.entry.js +1 -1
  77. package/dist/cjs/{index-494f6064.js → index-496aa5dd.js} +11 -8
  78. package/dist/cjs/loader.cjs.js +2 -2
  79. package/dist/cjs/{types-9f580c92.js → types-4a59c127.js} +6 -0
  80. package/dist/collection/collection-manifest.json +2 -1
  81. package/dist/collection/components/alert/alert.css +2 -2
  82. package/dist/collection/components/anchor/anchor.css +2 -2
  83. package/dist/collection/components/button/button.css +2 -2
  84. package/dist/collection/components/card/card.css +257 -0
  85. package/dist/collection/components/card/card.js +138 -0
  86. package/dist/collection/components/card/card.stories.js +41 -0
  87. package/dist/collection/components/checkbox/checkbox.css +2 -2
  88. package/dist/collection/components/checkbox-group/checkbox-group.css +2 -2
  89. package/dist/collection/components/dropdown/dropdown.css +2 -2
  90. package/dist/collection/components/headline/headline.css +2 -2
  91. package/dist/collection/components/icon/icon.css +5 -2
  92. package/dist/collection/components/icon/icon.js +20 -0
  93. package/dist/collection/components/input/input.css +2 -2
  94. package/dist/collection/components/input-group/input-group.css +2 -2
  95. package/dist/collection/components/input-group/input-group.stories.js +7 -7
  96. package/dist/collection/components/input-list/input-list.css +2 -2
  97. package/dist/collection/components/input-list/input-list.js +21 -2
  98. package/dist/collection/components/input-list/input-list.stories.js +6 -1
  99. package/dist/collection/components/label/label.css +2 -2
  100. package/dist/collection/components/modal/modal.css +9 -4
  101. package/dist/collection/components/pagination/pagination.css +2 -2
  102. package/dist/collection/components/paragraph/paragraph.css +2 -2
  103. package/dist/collection/components/radio/radio.css +2 -2
  104. package/dist/collection/components/radio-group/radio-group.css +2 -2
  105. package/dist/collection/components/required-separator/required-separator.css +2 -2
  106. package/dist/collection/components/scrollable-container/scrollable-container.css +2 -2
  107. package/dist/collection/components/search/search.js +20 -1
  108. package/dist/collection/components/search/search.stories.js +12 -4
  109. package/dist/collection/components/separator/separator.css +2 -2
  110. package/dist/collection/components/spinner/spinner.css +2 -2
  111. package/dist/collection/components/tab/tab.css +2 -2
  112. package/dist/collection/components/tab-panel/tab-panel.css +2 -2
  113. package/dist/collection/components/table/table-cell/table-cell.css +2 -2
  114. package/dist/collection/components/table/table-cell/table-cell.js +4 -4
  115. package/dist/collection/components/table/table-header/table-header.css +2 -2
  116. package/dist/collection/components/table/table-row/table-row.css +26 -12
  117. package/dist/collection/components/table/table-row/table-row.js +92 -8
  118. package/dist/collection/components/table/table-rowgroup/table-rowgroup.css +2 -2
  119. package/dist/collection/components/table/table-rowgroup/table-rowgroup.js +101 -2
  120. package/dist/collection/components/table/table.css +2 -2
  121. package/dist/collection/components/table/table.stories.js +51 -1
  122. package/dist/collection/components/table/types.js +5 -0
  123. package/dist/collection/components/textarea/textarea.css +2 -2
  124. package/dist/collection/components/toggle-button/toggle-button.css +2 -2
  125. package/dist/collection/components/toggle-group/toggle-group.css +2 -2
  126. package/dist/collection/components/tooltip/tooltip.css +2 -2
  127. package/dist/components/b2b-card.d.ts +11 -0
  128. package/dist/components/b2b-card.js +65 -0
  129. package/dist/components/b2b-modal.js +1 -1
  130. package/dist/components/b2b-search.js +3 -1
  131. package/dist/components/b2b-table-cell.js +1 -68
  132. package/dist/components/b2b-table-header.js +1 -89
  133. package/dist/components/b2b-table-row.js +45 -7
  134. package/dist/components/b2b-table-rowgroup.js +61 -5
  135. package/dist/components/icon.js +4 -1
  136. package/dist/components/input-list.js +3 -1
  137. package/dist/{esm/b2b-table-cell.entry.js → components/table-cell.js} +31 -9
  138. package/dist/{esm/b2b-table-header.entry.js → components/table-header.js} +30 -9
  139. package/dist/components/types.js +6 -1
  140. package/dist/custom-elements.json +65 -1
  141. package/dist/esm/b2b-alert.entry.js +1 -1
  142. package/dist/esm/b2b-anchor.entry.js +1 -1
  143. package/dist/esm/b2b-button_2.entry.js +1 -1
  144. package/dist/esm/b2b-card.entry.js +43 -0
  145. package/dist/esm/b2b-checkbox-group.entry.js +1 -1
  146. package/dist/esm/b2b-checkbox.entry.js +1 -1
  147. package/dist/esm/b2b-core-components.js +3 -3
  148. package/dist/esm/b2b-dropdown.entry.js +1 -1
  149. package/dist/esm/b2b-grid-col.entry.js +1 -1
  150. package/dist/esm/b2b-grid-row.entry.js +1 -1
  151. package/dist/esm/b2b-grid.entry.js +1 -1
  152. package/dist/esm/b2b-headline.entry.js +1 -1
  153. package/dist/esm/b2b-icon.entry.js +4 -2
  154. package/dist/esm/b2b-input-group_2.entry.js +3 -2
  155. package/dist/esm/b2b-input-label.entry.js +1 -1
  156. package/dist/esm/b2b-input_2.entry.js +1 -1
  157. package/dist/esm/b2b-label.entry.js +1 -1
  158. package/dist/esm/b2b-modal.entry.js +2 -2
  159. package/dist/esm/b2b-pagination.entry.js +1 -1
  160. package/dist/esm/b2b-paragraph.entry.js +1 -1
  161. package/dist/esm/b2b-radio-button.entry.js +1 -1
  162. package/dist/esm/b2b-radio-group.entry.js +1 -1
  163. package/dist/esm/b2b-required-separator.entry.js +1 -1
  164. package/dist/esm/b2b-scrollable-container.entry.js +1 -1
  165. package/dist/esm/b2b-search.entry.js +3 -2
  166. package/dist/esm/b2b-separator.entry.js +1 -1
  167. package/dist/esm/b2b-tab-group.entry.js +1 -1
  168. package/dist/esm/b2b-tab-panel.entry.js +1 -1
  169. package/dist/esm/b2b-tab.entry.js +1 -1
  170. package/dist/esm/b2b-table-cell_2.entry.js +114 -0
  171. package/dist/esm/b2b-table-row.entry.js +22 -5
  172. package/dist/esm/b2b-table-rowgroup.entry.js +58 -4
  173. package/dist/esm/b2b-table.entry.js +2 -2
  174. package/dist/esm/b2b-textarea.entry.js +1 -1
  175. package/dist/esm/b2b-toggle-button.entry.js +1 -1
  176. package/dist/esm/b2b-toggle-group.entry.js +1 -1
  177. package/dist/esm/b2b-tooltip.entry.js +1 -1
  178. package/dist/esm/{index-ffd21e30.js → index-026605c2.js} +11 -8
  179. package/dist/esm/loader.js +3 -3
  180. package/dist/esm/{types-b6ef0c78.js → types-a2bb01cb.js} +6 -1
  181. package/dist/types/components/card/card.d.ts +16 -0
  182. package/dist/types/components/card/card.stories.d.ts +6 -0
  183. package/dist/types/components/icon/icon.d.ts +2 -0
  184. package/dist/types/components/input-list/input-list.d.ts +3 -0
  185. package/dist/types/components/input-list/input-list.stories.d.ts +1 -0
  186. package/dist/types/components/search/search.d.ts +2 -0
  187. package/dist/types/components/search/search.stories.d.ts +2 -1
  188. package/dist/types/components/table/table-cell/table-cell.d.ts +3 -4
  189. package/dist/types/components/table/table-row/table-row.d.ts +11 -2
  190. package/dist/types/components/table/table-rowgroup/table-rowgroup.d.ts +15 -0
  191. package/dist/types/components/table/table.stories.d.ts +1 -0
  192. package/dist/types/components/table/types.d.ts +7 -0
  193. package/dist/types/components.d.ts +116 -12
  194. package/dist/web-types.json +128 -4
  195. package/package.json +9 -9
  196. package/dist/b2b-core-components/p-4cc68a17.entry.js +0 -1
  197. package/dist/b2b-core-components/p-6000aa40.js +0 -2
  198. package/dist/b2b-core-components/p-81a32656.entry.js +0 -1
  199. package/dist/b2b-core-components/p-8d5e14b1.js +0 -1
  200. package/dist/b2b-core-components/p-9cab38a6.entry.js +0 -1
  201. package/dist/b2b-core-components/p-b35d3924.entry.js +0 -1
  202. package/dist/b2b-core-components/p-cfdb21b6.entry.js +0 -1
  203. package/dist/b2b-core-components/p-da6ddbb2.entry.js +0 -1
  204. package/dist/b2b-core-components/p-f6105da5.entry.js +0 -1
  205. package/dist/cjs/b2b-table-cell.cjs.entry.js +0 -52
@@ -13,10 +13,11 @@ export class SearchComponent {
13
13
  this.placeholder = undefined;
14
14
  this.optionsList = [];
15
15
  this.value = null;
16
+ this.disabled = false;
16
17
  this.closed = undefined;
17
18
  }
18
19
  render() {
19
- return (h(Host, null, h("b2b-input-group", null, h("b2b-input-list", { slot: "start", value: this.value, placeholder: this.placeholder, optionsList: this.optionsList, "onb2b-input": this.onInput, "onb2b-option-selected": this.onOptionSelected }, h("slot", null)), h("b2b-button", { slot: "end", variant: "primary", onClick: this.onSearchClicked }, h("b2b-icon", { icon: "b2b_icon-search" })))));
20
+ return (h(Host, null, h("b2b-input-group", { disabled: this.disabled }, h("b2b-input-list", { slot: "start", value: this.value, placeholder: this.placeholder, optionsList: this.optionsList, "onb2b-input": this.onInput, "onb2b-option-selected": this.onOptionSelected }, h("slot", null)), h("b2b-button", { slot: "end", variant: "primary", onClick: this.onSearchClicked }, h("b2b-icon", { icon: "b2b_icon-search" })))));
20
21
  }
21
22
  static get is() { return "b2b-search"; }
22
23
  static get encapsulation() { return "shadow"; }
@@ -72,6 +73,24 @@ export class SearchComponent {
72
73
  "attribute": "value",
73
74
  "reflect": true,
74
75
  "defaultValue": "null"
76
+ },
77
+ "disabled": {
78
+ "type": "boolean",
79
+ "mutable": false,
80
+ "complexType": {
81
+ "original": "boolean",
82
+ "resolved": "boolean",
83
+ "references": {}
84
+ },
85
+ "required": false,
86
+ "optional": false,
87
+ "docs": {
88
+ "tags": [],
89
+ "text": "Whether or not the input is disabled. Default is false."
90
+ },
91
+ "attribute": "disabled",
92
+ "reflect": true,
93
+ "defaultValue": "false"
75
94
  }
76
95
  };
77
96
  }
@@ -4,7 +4,7 @@ import { useArgs } from '@storybook/client-api';
4
4
  import dedent from 'ts-dedent';
5
5
  import searchDocs from './search.docs.mdx';
6
6
  import fruits from './stories.data.json';
7
- const Template = ({ placeholder, optionsList }) => {
7
+ const Template = ({ placeholder, optionsList, disabled }) => {
8
8
  const [_, updateArgs] = useArgs();
9
9
  const onInput = event => {
10
10
  var _a;
@@ -26,6 +26,7 @@ const Template = ({ placeholder, optionsList }) => {
26
26
  <b2b-search
27
27
  contenteditable
28
28
  data-testid="search-element"
29
+ disabled=${disabled}
29
30
  placeholder="${placeholder}"
30
31
  .optionsList=${optionsList}
31
32
  @b2b-input=${onInput}></b2b-search>
@@ -34,6 +35,7 @@ const Template = ({ placeholder, optionsList }) => {
34
35
  const defaultArgs = {
35
36
  placeholder: 'Search here',
36
37
  optionsList: [],
38
+ disabled: false,
37
39
  };
38
40
  export const story010Search = Template.bind({});
39
41
  story010Search.args = Object.assign({}, defaultArgs);
@@ -52,6 +54,12 @@ story010Search.parameters = {
52
54
  },
53
55
  },
54
56
  };
57
+ export const story020SearchDisabled = Template.bind({});
58
+ story020SearchDisabled.storyName = 'Disabled';
59
+ story020SearchDisabled.args = {
60
+ placeholder: 'Input List Component',
61
+ disabled: true,
62
+ };
55
63
  const CustomSearchTemplate = ({ placeholder, optionsList }) => {
56
64
  return html `<div style="width: 500px; height: 130px;">
57
65
  <b2b-input-group>
@@ -69,9 +77,9 @@ const CustomSearchTemplate = ({ placeholder, optionsList }) => {
69
77
  </b2b-input-group>
70
78
  </div>`;
71
79
  };
72
- export const story020CustomSearch = CustomSearchTemplate.bind({});
73
- story020CustomSearch.storyName = 'Custom Search';
74
- story020CustomSearch.args = {
80
+ export const story030CustomSearch = CustomSearchTemplate.bind({});
81
+ story030CustomSearch.storyName = 'Custom Search';
82
+ story030CustomSearch.args = {
75
83
  placeholder: 'Input List Component',
76
84
  optionsList: ['result A', 'result B'],
77
85
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -63,7 +63,7 @@ export class TableCellComponent {
63
63
  "optional": false,
64
64
  "docs": {
65
65
  "tags": [],
66
- "text": "Weather text should wrap or truncate.\nIt will only truncate when table size is equal\n*"
66
+ "text": "Whether text should wrap or truncate.\nIt will only truncate when table size is equal\n*"
67
67
  },
68
68
  "attribute": "text-wrap",
69
69
  "reflect": true,
@@ -137,12 +137,12 @@ export class TableCellComponent {
137
137
  "type": "string",
138
138
  "mutable": false,
139
139
  "complexType": {
140
- "original": "B2BTableColourOptions",
140
+ "original": "TableColourOptions",
141
141
  "resolved": "\"default\" | \"group\" | \"selected\"",
142
142
  "references": {
143
- "B2BTableColourOptions": {
143
+ "TableColourOptions": {
144
144
  "location": "import",
145
- "path": "../table-row/table-row"
145
+ "path": "../types"
146
146
  }
147
147
  }
148
148
  },
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -218,33 +218,47 @@
218
218
  border-bottom: 1px solid var(--b2b-color-grey-200);
219
219
  display: table-row;
220
220
  }
221
- :host(.b2b-table-row-color-default) {
221
+ :host .b2b-table-row__accordion-icon {
222
+ transform: rotate(0);
223
+ transition: transform 0.2s ease-in-out;
224
+ padding: 0;
225
+ background-color: transparent;
226
+ border: none;
227
+ }
228
+ :host .b2b-table-row__accordion-icon--open {
229
+ transform: rotate(90deg);
230
+ transition: transform 0.2s ease-in-out;
231
+ }
232
+ :host(.b2b-table-row--color-default) {
222
233
  background-color: inherit;
223
234
  }
224
- :host(.b2b-table-row-color-selected) {
235
+ :host(.b2b-table-row--color-selected) {
225
236
  background-color: var(--b2b-color-table-selected-default);
226
237
  }
227
- :host(.b2b-table-row-color-group) {
238
+ :host(.b2b-table-row--color-group) {
228
239
  background-color: var(--b2b-color-table-expand-default);
229
240
  }
230
- :host(.b2b-table-row-color-default:hover) {
241
+ :host(.b2b-table-row--color-default:hover) {
231
242
  background-color: inherit;
232
243
  }
233
- :host(.b2b-table-row-highlight:hover) {
244
+ :host(.b2b-table-row__accordion-parent) {
245
+ background-color: var(--b2b-color-grey-50);
246
+ }
247
+ :host(.b2b-table-row--highlight:hover) {
234
248
  background-color: var(--b2b-color-table-hover);
235
249
  }
236
- :host(.b2b-table-row-highlight:hover) ::slotted(*) {
250
+ :host(.b2b-table-row--highlight:hover) ::slotted(*) {
237
251
  --b2b-table-cell-text-expand-bg: var(--b2b-color-table-hover);
238
252
  }
239
- :host(.b2b-table-row-color-selected:hover) {
253
+ :host(.b2b-table-row--color-selected:hover) {
240
254
  background-color: var(--b2b-color-red-100);
241
255
  }
242
- :host(.b2b-table-row-color-selected:hover) ::slotted(*) {
256
+ :host(.b2b-table-row--color-selected:hover) ::slotted(*) {
243
257
  --b2b-table-cell-text-expand-bg: var(--b2b-color-red-100);
244
258
  }
245
- :host(.b2b-table-row-color-group:hover) {
259
+ :host(.b2b-table-row--color-group:hover) {
246
260
  background-color: var(--b2b-color-table-expand-hover);
247
261
  }
248
- :host(.b2b-table-row-color-group:hover) ::slotted(*) {
262
+ :host(.b2b-table-row--color-group:hover) ::slotted(*) {
249
263
  --b2b-table-cell-text-expand-bg: var(--b2b-color-table-expand-hover);
250
264
  }
@@ -1,15 +1,31 @@
1
- import { h, Host } from '@stencil/core';
1
+ import { h, Host, } from '@stencil/core';
2
+ import { TableRowTypes } from '../types';
2
3
  export class TableRowComponent {
3
4
  constructor() {
5
+ this.toggleOpen = () => {
6
+ this.isOpen = !this.isOpen;
7
+ this.b2bOpen.emit(this.isOpen);
8
+ };
4
9
  this.highlight = true;
5
10
  this.color = 'default';
11
+ this.type = undefined;
12
+ this.isOpen = false;
13
+ }
14
+ /** Will toggle the accordion opened or closed. */
15
+ async toggleAccordion(isOpen) {
16
+ this.isOpen = isOpen;
17
+ this.b2bOpen.emit(isOpen);
6
18
  }
7
19
  render() {
8
20
  return (h(Host, { class: {
9
21
  'b2b-table-row': true,
10
- ['b2b-table-row-highlight']: this.highlight,
11
- [`b2b-table-row-color-${this.color}`]: true,
12
- }, role: "row" }, h("slot", null)));
22
+ 'b2b-table-row__accordion-parent': this.type === TableRowTypes.PARENT,
23
+ ['b2b-table-row--highlight']: this.highlight,
24
+ [`b2b-table-row--color-${this.color}`]: true,
25
+ }, role: "row" }, this.type === TableRowTypes.PARENT && (h("b2b-table-cell", null, h("button", { onClick: this.toggleOpen, class: {
26
+ 'b2b-table-row__accordion-icon': true,
27
+ 'b2b-table-row__accordion-icon--open': this.isOpen,
28
+ } }, h("b2b-icon", { icon: "b2b_icon-arrow-right", clickable: true })))), this.type === TableRowTypes.CHILD && h("b2b-table-cell", null), this.type === TableRowTypes.HEADER && (h("b2b-table-header", null)), h("slot", null)));
13
29
  }
14
30
  static get is() { return "b2b-table-row"; }
15
31
  static get encapsulation() { return "shadow"; }
@@ -47,12 +63,12 @@ export class TableRowComponent {
47
63
  "type": "string",
48
64
  "mutable": false,
49
65
  "complexType": {
50
- "original": "B2BTableColourOptions",
66
+ "original": "TableColourOptions",
51
67
  "resolved": "\"default\" | \"group\" | \"selected\"",
52
68
  "references": {
53
- "B2BTableColourOptions": {
54
- "location": "local",
55
- "path": "/home/runner/work/b2b-design-system/b2b-design-system/packages/core-components/src/components/table/table-row/table-row.tsx"
69
+ "TableColourOptions": {
70
+ "location": "import",
71
+ "path": "../types"
56
72
  }
57
73
  }
58
74
  },
@@ -65,6 +81,74 @@ export class TableRowComponent {
65
81
  "attribute": "color",
66
82
  "reflect": false,
67
83
  "defaultValue": "'default'"
84
+ },
85
+ "type": {
86
+ "type": "string",
87
+ "mutable": false,
88
+ "complexType": {
89
+ "original": "TableRowTypes",
90
+ "resolved": "\"child\" | \"header\" | \"parent\"",
91
+ "references": {
92
+ "TableRowTypes": {
93
+ "location": "import",
94
+ "path": "../types"
95
+ }
96
+ }
97
+ },
98
+ "required": false,
99
+ "optional": false,
100
+ "docs": {
101
+ "tags": [],
102
+ "text": "Determined by the parent rowgroup for accordion rowgroups. Do not set manually."
103
+ },
104
+ "attribute": "type",
105
+ "reflect": false
106
+ }
107
+ };
108
+ }
109
+ static get states() {
110
+ return {
111
+ "isOpen": {}
112
+ };
113
+ }
114
+ static get events() {
115
+ return [{
116
+ "method": "b2bOpen",
117
+ "name": "b2b-open",
118
+ "bubbles": true,
119
+ "cancelable": true,
120
+ "composed": true,
121
+ "docs": {
122
+ "tags": [],
123
+ "text": "Emits if the parent rowgroup is an accordion and the row is a top-level accordion row. Determines if the child rows will be shown."
124
+ },
125
+ "complexType": {
126
+ "original": "boolean",
127
+ "resolved": "boolean",
128
+ "references": {}
129
+ }
130
+ }];
131
+ }
132
+ static get methods() {
133
+ return {
134
+ "toggleAccordion": {
135
+ "complexType": {
136
+ "signature": "(isOpen: any) => Promise<void>",
137
+ "parameters": [{
138
+ "tags": [],
139
+ "text": ""
140
+ }],
141
+ "references": {
142
+ "Promise": {
143
+ "location": "global"
144
+ }
145
+ },
146
+ "return": "Promise<void>"
147
+ },
148
+ "docs": {
149
+ "text": "Will toggle the accordion opened or closed.",
150
+ "tags": []
151
+ }
68
152
  }
69
153
  };
70
154
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -2,14 +2,68 @@ import { h, Host } from '@stencil/core';
2
2
  import { TableRowgroupTypes } from '../types';
3
3
  export class TableRowgroupComponent {
4
4
  constructor() {
5
+ this.getFirstRow = () => {
6
+ const firstRow = this.host.querySelector('b2b-table-row');
7
+ if (firstRow != null) {
8
+ return firstRow;
9
+ }
10
+ };
11
+ this.getRemainingRows = () => {
12
+ const children = Array.from(this.host.querySelectorAll('b2b-table-row'));
13
+ return Array.from(children.slice(1));
14
+ };
15
+ this.addAccordionControlColumn = () => {
16
+ const children = this.getRemainingRows();
17
+ children &&
18
+ children.forEach(child => {
19
+ child.setAttribute('type', 'child');
20
+ });
21
+ const firstRow = this.getFirstRow();
22
+ if (this.type === 'header') {
23
+ firstRow && firstRow.setAttribute('type', 'header');
24
+ }
25
+ else {
26
+ firstRow && firstRow.setAttribute('type', 'parent');
27
+ }
28
+ };
29
+ this.toggleInitialVisibility = () => {
30
+ const firstRow = this.getFirstRow();
31
+ (async () => {
32
+ firstRow && (await firstRow.toggleAccordion(this.opened));
33
+ })();
34
+ };
35
+ this.toggleChildRowVisibility = (isOpen) => {
36
+ const children = this.getRemainingRows();
37
+ if (isOpen) {
38
+ children.forEach(child => {
39
+ child.style.visibility = 'visible';
40
+ });
41
+ }
42
+ else {
43
+ children.forEach(child => {
44
+ child.style.visibility = 'collapse';
45
+ });
46
+ }
47
+ };
5
48
  this.type = TableRowgroupTypes.HEADER;
49
+ this.accordion = false;
50
+ this.opened = false;
51
+ }
52
+ handleOpenChange(event) {
53
+ this.toggleChildRowVisibility(event.detail);
6
54
  }
7
55
  makeHeaderRowNotSelectable() {
8
- const firstRow = this.host.querySelector('b2b-table-row');
9
- if (firstRow != null && this.type === TableRowgroupTypes.HEADER) {
56
+ const firstRow = this.getFirstRow();
57
+ if (this.type === TableRowgroupTypes.HEADER) {
10
58
  firstRow.setAttribute('highlight', 'false');
11
59
  }
12
60
  }
61
+ componentWillLoad() {
62
+ if (this.accordion) {
63
+ this.addAccordionControlColumn();
64
+ this.toggleInitialVisibility();
65
+ }
66
+ }
13
67
  componentDidRender() {
14
68
  this.makeHeaderRowNotSelectable();
15
69
  }
@@ -54,8 +108,53 @@ export class TableRowgroupComponent {
54
108
  "attribute": "type",
55
109
  "reflect": false,
56
110
  "defaultValue": "TableRowgroupTypes.HEADER"
111
+ },
112
+ "accordion": {
113
+ "type": "boolean",
114
+ "mutable": false,
115
+ "complexType": {
116
+ "original": "boolean",
117
+ "resolved": "boolean",
118
+ "references": {}
119
+ },
120
+ "required": false,
121
+ "optional": false,
122
+ "docs": {
123
+ "tags": [],
124
+ "text": "Renders the rowgroup as an accordion. Both header and body must have accordion set to true.\nOne table can contain multiple rowgroups of type body, each of which represents an accordion row with children."
125
+ },
126
+ "attribute": "accordion",
127
+ "reflect": false,
128
+ "defaultValue": "false"
129
+ },
130
+ "opened": {
131
+ "type": "boolean",
132
+ "mutable": false,
133
+ "complexType": {
134
+ "original": "boolean",
135
+ "resolved": "boolean",
136
+ "references": {}
137
+ },
138
+ "required": false,
139
+ "optional": false,
140
+ "docs": {
141
+ "tags": [],
142
+ "text": "Only use when accordion property is true.\nWill render the accordion opened if set to true. By default, is false."
143
+ },
144
+ "attribute": "opened",
145
+ "reflect": true,
146
+ "defaultValue": "false"
57
147
  }
58
148
  };
59
149
  }
60
150
  static get elementRef() { return "host"; }
151
+ static get listeners() {
152
+ return [{
153
+ "name": "b2b-open",
154
+ "method": "handleOpenChange",
155
+ "target": undefined,
156
+ "capture": false,
157
+ "passive": false
158
+ }];
159
+ }
61
160
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Thu, 25 May 2023 12:11:57 GMT
3
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
4
4
  */
5
5
  :root, :host {
6
6
  --b2b-size-200: 5rem; /* 80px */
@@ -123,7 +123,7 @@
123
123
  }
124
124
  /**
125
125
  * Do not edit directly
126
- * Generated on Thu, 25 May 2023 12:11:57 GMT
126
+ * Generated on Wed, 07 Jun 2023 20:04:52 GMT
127
127
  */
128
128
  :root [data-theme="dark"] {
129
129
  --b2b-size-200: 5rem; /* 80px */
@@ -191,6 +191,56 @@ const TemplateSorting = ({ data, firstColumnWidth, size, textWrap, align, highli
191
191
  export const story110Sorting = TemplateSorting.bind({});
192
192
  story110Sorting.args = Object.assign(Object.assign({}, defaultArgs), { withDividers: true, size: 'expand', data: userSampleData });
193
193
  story110Sorting.storyName = 'Table with Sorting';
194
+ const TemplateAccordion = ({ data, firstColumnWidth, size, textWrap, align, highlight, withDividers, color, }) => {
195
+ return html `
196
+ <div>
197
+ <b2b-table size="${size}">
198
+ <b2b-table-rowgroup type="header" accordion>
199
+ <b2b-table-row>
200
+ ${data.columns.map((columnName, index) => {
201
+ return html ` <b2b-table-header
202
+ ?divider=${withDividers && index !== data.columns.length - 1}
203
+ style=${index === 0 ? `width: ${firstColumnWidth}` : ''}
204
+ >${columnName}</b2b-table-header
205
+ >`;
206
+ })}
207
+ </b2b-table-row>
208
+ </b2b-table-rowgroup>
209
+ <b2b-table-rowgroup type="body" accordion>
210
+ ${data.rows.map((row, index) => {
211
+ return html `<b2b-table-row
212
+ highlight="${highlight}"
213
+ color=${index === 0 ? color : 'default'}>
214
+ ${row.map(data => html `<b2b-table-cell
215
+ ?divider=${withDividers}
216
+ align="${align}"
217
+ text-wrap="${textWrap}"
218
+ >${data}</b2b-table-cell
219
+ >`)}
220
+ </b2b-table-row>`;
221
+ })}
222
+ </b2b-table-rowgroup>
223
+ <b2b-table-rowgroup type="body" accordion opened>
224
+ ${data.rows.map((row, index) => {
225
+ return html `<b2b-table-row
226
+ highlight="${highlight}"
227
+ color=${index === 0 ? color : 'default'}>
228
+ ${row.map(data => html `<b2b-table-cell
229
+ ?divider=${withDividers}
230
+ align="${align}"
231
+ text-wrap="${textWrap}"
232
+ >${data}</b2b-table-cell
233
+ >`)}
234
+ </b2b-table-row>`;
235
+ })}
236
+ </b2b-table-rowgroup>
237
+ </b2b-table>
238
+ </div>
239
+ `;
240
+ };
241
+ export const story120Accordion = TemplateAccordion.bind({});
242
+ story120Accordion.args = Object.assign(Object.assign({}, defaultArgs), { data: sampleData });
243
+ story120Accordion.storyName = 'Accordion Table';
194
244
  const tableArgs = getArgTypes('b2b-table');
195
245
  const rowGroupArgs = getArgTypes('b2b-table-rowgroup');
196
246
  const rowArgs = getArgTypes('b2b-table-row');
@@ -224,7 +274,7 @@ argsTableData.data = {
224
274
  };
225
275
  export default {
226
276
  title: 'Components/Content/Table',
227
- argTypes: Object.assign(Object.assign({}, argsTableData), { sortDirection: false }),
277
+ argTypes: Object.assign(Object.assign({}, argsTableData), { sortDirection: false, type: false }),
228
278
  viewmode: 'docs',
229
279
  parameters: {
230
280
  controls: { expanded: true },
@@ -17,3 +17,8 @@ export const TableSortDirections = {
17
17
  ASC: 'ascending',
18
18
  DESC: 'descending',
19
19
  };
20
+ export const TableRowTypes = {
21
+ PARENT: 'parent',
22
+ CHILD: 'child',
23
+ HEADER: 'header'
24
+ };