@1024pix/pix-ui 54.10.0 → 54.12.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,4 +1,4 @@
1
- <div class="pix-table">
1
+ <div class="pix-table" ...attributes>
2
2
  <table class={{this.tableClass}}>
3
3
  <caption class="screen-reader-only">{{this.caption}}</caption>
4
4
  <thead class={{this.headerClass}}>
@@ -7,9 +7,12 @@
7
7
  </tr>
8
8
  </thead>
9
9
  <tbody>
10
- {{#each @data as |row|}}
11
- <tr>
12
- {{yield row "cell" to="columns"}}
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"}}
13
16
  </tr>
14
17
  {{/each}}
15
18
  </tbody>
@@ -1,4 +1,5 @@
1
1
  import { warn } from '@ember/debug';
2
+ import { action } from '@ember/object';
2
3
  import Component from '@glimmer/component';
3
4
 
4
5
  export default class PixTable extends Component {
@@ -39,4 +40,16 @@ export default class PixTable extends Component {
39
40
  get headerClass() {
40
41
  return `pix-table-header--${this.variant}`;
41
42
  }
43
+
44
+ get hasOnRowClick() {
45
+ return typeof this.args.onRowClick === 'function';
46
+ }
47
+
48
+ @action
49
+ onClick(row, event) {
50
+ event.stopPropagation();
51
+ if (this.hasOnRowClick) {
52
+ this.args.onRowClick(row);
53
+ }
54
+ }
42
55
  }
@@ -11,18 +11,38 @@
11
11
 
12
12
  @extend %pix-body-s;
13
13
 
14
- .pix-table__condensed {
14
+ &__condensed {
15
15
  th, td {
16
16
  padding: var(--pix-spacing-2x) var(--pix-spacing-4x);
17
17
  }
18
18
  }
19
19
 
20
+ &__clickable-row {
21
+ cursor: pointer;
22
+
23
+ &:hover, &:focus, &:active {
24
+ transition: 0.25s ease;
25
+ }
26
+
27
+ &:hover {
28
+ background-color: rgba(var(--pix-neutral-100-inline), 0.50);
29
+ }
30
+
31
+ &:focus {
32
+ background-color: rgba(var(--pix-neutral-100-inline), 0.40);
33
+ }
34
+
35
+ &:active {
36
+ background-color: rgba(var(--pix-neutral-100-inline), 0.75);
37
+ }
38
+ }
39
+
20
40
  table {
21
41
  min-width: 100%;
22
42
  border-collapse: collapse;
23
43
 
24
- tbody > tr:nth-of-type(even) {
25
- background-color: var(--pix-neutral-20);
44
+ tbody > tr:nth-of-type(even):not(.pix-table__clickable-row:hover, .pix-table__clickable-row:focus, .pix-table__clickable-row:active) {
45
+ background-color: rgba(var(--pix-neutral-20-inline), 0.80);
26
46
  }
27
47
 
28
48
  thead.pix-table-header {
@@ -13,7 +13,6 @@
13
13
  @use 'pix-notification-alert';
14
14
  @use 'pix-multi-select';
15
15
  @use 'pix-progress-bar';
16
- @use 'pix-return-to';
17
16
  @use 'pix-select';
18
17
  @use 'pix-select-list';
19
18
  @use 'pix-stars';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "54.10.0",
3
+ "version": "54.12.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,13 +0,0 @@
1
- <LinkTo
2
- @route={{this.route}}
3
- @models={{if @model (array @model) this.defaultModel}}
4
- class="pix-return-to pix-return-to--{{this.shade}}"
5
- ...attributes
6
- >
7
- {{#if (has-block)}}
8
- <PixIcon @name="arrowLeft" @ariaHidden={{true}} class="pix-return-to__icon" />
9
- <span class="pix-return-to__text"> {{yield}} </span>
10
- {{else}}
11
- <PixIcon class="pix-return-to__icon" aria-label={{@arrowLabel}} @name="arrowLeft" />
12
- {{/if}}
13
- </LinkTo>
@@ -1,21 +0,0 @@
1
- import { warn } from '@ember/debug';
2
- import Component from '@glimmer/component';
3
-
4
- export default class PixReturnTo extends Component {
5
- text = 'pix-return-to';
6
- availableShades = ['neutral-dark', 'neutral-light'];
7
- defaultModel = [];
8
-
9
- get route() {
10
- const routeParam = this.args.route;
11
- warn('PixReturnTo: @route param is not provided', routeParam !== undefined, {
12
- id: 'pix-ui.returnTo.route.required',
13
- });
14
- return routeParam;
15
- }
16
-
17
- get shade() {
18
- const shadeParam = this.args.shade;
19
- return this.availableShades.includes(shadeParam) ? shadeParam : this.availableShades[0];
20
- }
21
- }
@@ -1,65 +0,0 @@
1
- @use "pix-design-tokens/typography";
2
-
3
- .pix-return-to {
4
- @extend %pix-body-l;
5
-
6
- display: inline-flex;
7
- gap: var(--pix-spacing-1x);
8
- align-items: center;
9
- text-decoration: none;
10
- border-bottom: transparent solid 2px;
11
-
12
- &__icon {
13
- position: relative;
14
- width: 2.3rem;
15
- height: 2.3rem;
16
- padding: var(--pix-spacing-1x) var(--pix-spacing-2x);
17
- }
18
-
19
- &:focus,
20
- &:hover,
21
- &:active {
22
- background-color: transparent;
23
- border-bottom-color: transparent;
24
- outline: 0;
25
- cursor: pointer;
26
- }
27
-
28
- @mixin coloriseLink($defaultColor, $focusColor) {
29
- color: $defaultColor;
30
-
31
- &:hover {
32
- .pix-return-to__icon {
33
- color: var(--pix-neutral-900);
34
- background-color: var(--pix-neutral-20);
35
- border-radius: 50%;
36
- }
37
- }
38
-
39
- &:focus {
40
- .pix-return-to__icon {
41
- color: $focusColor;
42
- background-color: $defaultColor;
43
- border-radius: 50%;
44
- outline: 1px solid $focusColor;
45
- outline-offset: -3px;
46
- }
47
- }
48
-
49
- &:active {
50
- .pix-return-to__icon {
51
- color: var(--pix-neutral-900);
52
- background-color: var(--pix-neutral-100);
53
- border-radius: 50%;
54
- }
55
- }
56
- }
57
-
58
- &--neutral-light {
59
- @include coloriseLink(var(--pix-neutral-20), var(--pix-neutral-900));
60
- }
61
-
62
- &--neutral-dark {
63
- @include coloriseLink(var(--pix-neutral-900), var(--pix-neutral-0));
64
- }
65
- }
@@ -1 +0,0 @@
1
- export { default } from '@1024pix/pix-ui/components/pix-return-to';