@1024pix/pix-ui 55.16.5 → 55.17.0

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.
@@ -1,8 +1,12 @@
1
1
  import { VARIANTS } from '@1024pix/pix-ui/helpers/variants';
2
2
  import { warn } from '@ember/debug';
3
+ import { fn } from '@ember/helper';
4
+ import { on } from '@ember/modifier';
3
5
  import { action } from '@ember/object';
4
6
  import Component from '@glimmer/component';
5
7
 
8
+ import PixBlock from './pix-block';
9
+
6
10
  export default class PixTable extends Component {
7
11
  get variant() {
8
12
  const value = this.args.variant ?? 'primary';
@@ -44,6 +48,10 @@ export default class PixTable extends Component {
44
48
  return `pix-table-header--${this.variant}`;
45
49
  }
46
50
 
51
+ get captionClass() {
52
+ return this.args.displayCaption ? 'pix-table__caption' : 'screen-reader-only';
53
+ }
54
+
47
55
  get hasOnRowClick() {
48
56
  return typeof this.args.onRowClick === 'function';
49
57
  }
@@ -55,4 +63,27 @@ export default class PixTable extends Component {
55
63
  this.args.onRowClick(row);
56
64
  }
57
65
  }
66
+
67
+ <template>
68
+ <PixBlock @variant={{@variant}} class={{this.tableClass}} ...attributes>
69
+ <table>
70
+ <caption class={{this.captionClass}}>{{this.caption}}</caption>
71
+ <thead class={{this.headerClass}}>
72
+ <tr>
73
+ {{yield null "header" to="columns"}}
74
+ </tr>
75
+ </thead>
76
+ <tbody>
77
+ {{#each @data as |row index|}}
78
+ <tr
79
+ class={{if this.hasOnRowClick "pix-table__clickable-row" ""}}
80
+ {{on "click" (fn this.onClick row)}}
81
+ >
82
+ {{yield row "cell" index to="columns"}}
83
+ </tr>
84
+ {{/each}}
85
+ </tbody>
86
+ </table>
87
+ </PixBlock>
88
+ </template>
58
89
  }
@@ -11,6 +11,14 @@
11
11
 
12
12
  @extend %pix-body-s;
13
13
 
14
+ &__caption {
15
+ margin-bottom: var(--pix-spacing-3x);
16
+ text-align: left;
17
+ caption-side: top;
18
+
19
+ @extend %pix-title-xxs;
20
+ }
21
+
14
22
  &__clickable-row {
15
23
  cursor: pointer;
16
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.16.5",
3
+ "version": "55.17.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -1,20 +0,0 @@
1
- <PixBlock @variant={{@variant}} class={{this.tableClass}} ...attributes>
2
- <table>
3
- <caption class="screen-reader-only">{{this.caption}}</caption>
4
- <thead class={{this.headerClass}}>
5
- <tr>
6
- {{yield null "header" to="columns"}}
7
- </tr>
8
- </thead>
9
- <tbody>
10
- {{#each @data as |row index|}}
11
- <tr
12
- class={{if this.hasOnRowClick "pix-table__clickable-row" ""}}
13
- {{on "click" (fn this.onClick row)}}
14
- >
15
- {{yield row "cell" index to="columns"}}
16
- </tr>
17
- {{/each}}
18
- </tbody>
19
- </table>
20
- </PixBlock>