@getflip/swirl-components 0.158.0 → 0.159.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.
Files changed (33) hide show
  1. package/components.json +41 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/swirl-components.cjs.js +1 -1
  4. package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
  5. package/dist/cjs/swirl-table-row-group.cjs.entry.js +36 -2
  6. package/dist/cjs/swirl-time-input.cjs.entry.js +1 -1
  7. package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
  8. package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.css +21 -1
  9. package/dist/collection/components/swirl-table/swirl-table.stories.js +3 -0
  10. package/dist/collection/components/swirl-table-row-group/swirl-table-row-group.css +20 -0
  11. package/dist/collection/components/swirl-table-row-group/swirl-table-row-group.js +76 -1
  12. package/dist/collection/components/swirl-table-row-group/swirl-table-row-group.spec.js +29 -3
  13. package/dist/collection/components/swirl-time-input/swirl-time-input.js +1 -1
  14. package/dist/collection/components/swirl-time-input/swirl-time-input.spec.js +1 -1
  15. package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
  16. package/dist/components/swirl-shell-layout.js +1 -1
  17. package/dist/components/swirl-table-row-group.js +47 -4
  18. package/dist/components/swirl-time-input.js +1 -1
  19. package/dist/esm/loader.js +1 -1
  20. package/dist/esm/swirl-components.js +1 -1
  21. package/dist/esm/swirl-shell-layout.entry.js +1 -1
  22. package/dist/esm/swirl-table-row-group.entry.js +36 -2
  23. package/dist/esm/swirl-time-input.entry.js +1 -1
  24. package/dist/swirl-components/{p-aaac06b5.entry.js → p-c15923d0.entry.js} +1 -1
  25. package/dist/swirl-components/p-d4c52edd.entry.js +1 -0
  26. package/dist/swirl-components/p-f737a7a8.entry.js +1 -0
  27. package/dist/swirl-components/swirl-components.esm.js +1 -1
  28. package/dist/types/components/swirl-table-row-group/swirl-table-row-group.d.ts +6 -0
  29. package/dist/types/components.d.ts +4 -0
  30. package/package.json +1 -1
  31. package/vscode-data.json +8 -0
  32. package/dist/swirl-components/p-726539e8.entry.js +0 -1
  33. package/dist/swirl-components/p-7579edfa.entry.js +0 -1
@@ -76,6 +76,26 @@
76
76
 
77
77
  @media (min-width: 992px) {
78
78
 
79
+ .shell-layout--navigation-collapsed .shell-layout__nav:hover {
80
+ width: var(--swirl-shell-extended-nav-width);
81
+ padding-right: var(--s-space-12)
82
+ }
83
+ }
84
+
85
+ @media (min-width: 992px) {
86
+ .shell-layout--navigation-collapsed .shell-layout__nav:not(:hover) {
87
+ scrollbar-width: none;
88
+ }
89
+
90
+ .shell-layout--navigation-collapsed .shell-layout__nav:not(:hover)::-webkit-scrollbar {
91
+ width: 0;
92
+ background: transparent;
93
+ -webkit-appearance: none;
94
+ }
95
+ }
96
+
97
+ @media (min-width: 992px) {
98
+
79
99
  .shell-layout--navigation-collapsed {
80
100
  grid-template-columns: var(--swirl-shell-collapsed-nav-width) 1fr 0
81
101
  }
@@ -298,7 +318,7 @@
298
318
  max-width: 18.75rem;
299
319
  color: var(--swirl-shell-text-color);
300
320
  background-color: var(--s-surface-overlay-default);
301
- transition: transform 0.2s, box-shadow 0.2s;
321
+ transition: transform 0.2s, box-shadow 0.2s, width 0.2s;
302
322
  transform: translate3d(-100%, 0, 0);
303
323
  grid-area: nav;
304
324
  }
@@ -28,6 +28,7 @@ const Template = (args) => {
28
28
  <swirl-table-column sticky width="74px"><swirl-visually-hidden>Tools</swirl-visually-hidden></swirl-table-column>
29
29
  </div>
30
30
  <div slot="rows">
31
+ <swirl-table-row-group label="Active users">
31
32
  <swirl-table-row>
32
33
  <swirl-table-cell>
33
34
  <swirl-checkbox swirl-aria-label="Select Isabel Lakin" input-id="select-1" input-name="select-1">
@@ -59,6 +60,7 @@ const Template = (args) => {
59
60
  </swirl-tooltip>
60
61
  </swirl-table-cell>
61
62
  </swirl-table-row>
63
+ </swirl-table-row-group>
62
64
  <swirl-table-row-group label="Pending users">
63
65
  <swirl-table-row>
64
66
  <swirl-table-cell>
@@ -118,6 +120,7 @@ const Template = (args) => {
118
120
  <swirl-button hide-label icon="<swirl-icon-more-vertikal></swirl-icon-more-vertikal>" label="Options"></swirl-button>
119
121
  </swirl-table-cell>
120
122
  </swirl-table-row>
123
+
121
124
  </swirl-table-row-group>
122
125
  </div>
123
126
  `;
@@ -22,6 +22,8 @@
22
22
  font-size: var(--s-font-size-sm);
23
23
  font-weight: var(--s-font-weight-medium);
24
24
  line-height: var(--s-line-height-sm);
25
+ display: flex;
26
+ align-items: center;
25
27
  }
26
28
 
27
29
  @media (min-width: 768px) {
@@ -41,3 +43,21 @@
41
43
  .table-row-group__tooltip-icon {
42
44
  color: var(--s-icon-default);
43
45
  }
46
+
47
+ .table-row-group__collapse-icon {
48
+ color: var(--s-icon-default);
49
+ padding-right: var(--s-space-20);
50
+ }
51
+
52
+ .table-row-group__rows-container {
53
+ overflow: hidden;
54
+ transition: height 0.3s ease-out;
55
+ }
56
+
57
+ .table-row-group__rows-container.is-hidden {
58
+ height: 0;
59
+ }
60
+
61
+ .sc-swirl-button-h {
62
+ display: flex;
63
+ }
@@ -4,12 +4,46 @@ import { h, Host } from "@stencil/core";
4
4
  */
5
5
  export class SwirlTableRowGroup {
6
6
  constructor() {
7
+ this.toggleShowItems = () => {
8
+ this.headerRowElement.focus();
9
+ if (!this.tableRowElements)
10
+ return;
11
+ const naturalHeight = this.tableRowElements.scrollHeight + "px";
12
+ if (this.isVisible) {
13
+ requestAnimationFrame(() => {
14
+ this.tableRowElements.style.height = naturalHeight;
15
+ this.tableRowElements.setAttribute("aria-hidden", "true");
16
+ requestAnimationFrame(() => {
17
+ this.tableRowElements.style.height = "0";
18
+ });
19
+ });
20
+ }
21
+ else {
22
+ requestAnimationFrame(() => {
23
+ this.tableRowElements.style.height = naturalHeight;
24
+ this.tableRowElements.removeAttribute("aria-hidden");
25
+ setTimeout(() => {
26
+ this.tableRowElements.style.height = "auto";
27
+ }, 300);
28
+ });
29
+ }
30
+ this.isVisible = !this.isVisible;
31
+ };
7
32
  this.label = undefined;
8
33
  this.tooltip = undefined;
34
+ this.collapsible = false;
35
+ this.collapseButtonLabel = "Previous slide";
36
+ this.isVisible = true;
9
37
  }
10
38
  render() {
11
39
  const rowspan = this.el.querySelectorAll("swirl-table-row").length;
12
- return (h(Host, { class: "table-row-group", role: "rowgroup" }, h("div", { class: "table-row-group__header-row", role: "row" }, h("span", { "aria-rowspan": rowspan, class: "table-row-group__label", role: "rowheader" }, this.label, this.tooltip && (h("span", { class: "table-row-group__tooltip" }, h("swirl-tooltip", { content: this.tooltip, position: "top", positioning: "fixed" }, h("swirl-icon-info", { size: 16, tabIndex: 0, class: "table-row-group__tooltip-icon" })))))), h("slot", null)));
40
+ const iconType = this.isVisible
41
+ ? "<swirl-icon-expand-less></swirl-icon-expand-less"
42
+ : "<swirl-icon-expand-more></swirl-icon-expand-more";
43
+ return (h(Host, { class: "table-row-group", role: "rowgroup" }, h("div", { class: "table-row-group__header-row", role: "row", ref: (el) => (this.headerRowElement = el) }, this.collapsible && (h("swirl-button", { class: "table-row-group__collapse-icon", icon: iconType, label: this.collapseButtonLabel, onClick: this.toggleShowItems, swirlAriaExpanded: String(this.isVisible), variant: "plain", hideLabel: true })), h("span", { "aria-rowspan": rowspan, class: "table-row-group__label", role: "rowheader" }, this.label, this.tooltip && (h("span", { class: "table-row-group__tooltip" }, h("swirl-tooltip", { content: this.tooltip, position: "top", positioning: "fixed" }, h("swirl-icon-info", { size: 16, tabIndex: 0, class: "table-row-group__tooltip-icon" })))))), h("div", { class: {
44
+ "table-row-group__rows-container": true,
45
+ "table-row-group__rows-container--is-hidden": this.isVisible,
46
+ }, "aria-hidden": !this.isVisible, ref: (el) => (this.tableRowElements = el) }, h("slot", null))));
13
47
  }
14
48
  static get is() { return "swirl-table-row-group"; }
15
49
  static get encapsulation() { return "shadow"; }
@@ -58,8 +92,49 @@ export class SwirlTableRowGroup {
58
92
  },
59
93
  "attribute": "tooltip",
60
94
  "reflect": false
95
+ },
96
+ "collapsible": {
97
+ "type": "boolean",
98
+ "mutable": false,
99
+ "complexType": {
100
+ "original": "boolean",
101
+ "resolved": "boolean",
102
+ "references": {}
103
+ },
104
+ "required": false,
105
+ "optional": true,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": ""
109
+ },
110
+ "attribute": "collapsible",
111
+ "reflect": false,
112
+ "defaultValue": "false"
113
+ },
114
+ "collapseButtonLabel": {
115
+ "type": "string",
116
+ "mutable": false,
117
+ "complexType": {
118
+ "original": "string",
119
+ "resolved": "string",
120
+ "references": {}
121
+ },
122
+ "required": false,
123
+ "optional": true,
124
+ "docs": {
125
+ "tags": [],
126
+ "text": ""
127
+ },
128
+ "attribute": "collapse-button-label",
129
+ "reflect": false,
130
+ "defaultValue": "\"Previous slide\""
61
131
  }
62
132
  };
63
133
  }
134
+ static get states() {
135
+ return {
136
+ "isVisible": {}
137
+ };
138
+ }
64
139
  static get elementRef() { return "el"; }
65
140
  }
@@ -14,9 +14,11 @@ describe("swirl-table-row-group", () => {
14
14
  Label
15
15
  </span>
16
16
  </div>
17
- <slot></slot>
17
+ <div class="table-row-group__rows-container table-row-group__rows-container--is-hidden">
18
+ <slot></slot>
19
+ </div>
18
20
  </mock:shadow-root>
19
- Content
21
+ Content
20
22
  </swirl-table-row-group>
21
23
  `);
22
24
  });
@@ -38,10 +40,34 @@ describe("swirl-table-row-group", () => {
38
40
  </span>
39
41
  </span>
40
42
  </div>
41
- <slot></slot>
43
+ <div class="table-row-group__rows-container table-row-group__rows-container--is-hidden">
44
+ <slot></slot>
45
+ </div>
42
46
  </mock:shadow-root>
43
47
  Content
44
48
  </swirl-table-row-group>
45
49
  `);
46
50
  });
51
+ it("renders collapsible button", async () => {
52
+ const page = await newSpecPage({
53
+ components: [SwirlTableRowGroup],
54
+ html: `<swirl-table-row-group label="Label" collapsible="true">Content</swirl-table-row-group>`,
55
+ });
56
+ expect(page.root).toEqualHtml(`
57
+ <swirl-table-row-group class="table-row-group" label="Label" role="rowgroup" collapsible="true">
58
+ <mock:shadow-root>
59
+ <div class="table-row-group__header-row" role="row">
60
+ <swirl-button class="table-row-group__collapse-icon" hidelabel="" icon="<swirl-icon-expand-less></swirl-icon-expand-less" label="Previous slide" swirlariaexpanded="true" variant="plain"></swirl-button>
61
+ <span aria-rowspan="0" class="table-row-group__label" role="rowheader">
62
+ Label
63
+ </span>
64
+ </div>
65
+ <div class="table-row-group__rows-container table-row-group__rows-container--is-hidden">
66
+ <slot></slot>
67
+ </div>
68
+ </mock:shadow-root>
69
+ Content
70
+ </swirl-table-row-group>
71
+ `);
72
+ });
47
73
  });
@@ -117,7 +117,7 @@ export class SwirlTimeInput {
117
117
  const className = classnames("time-input", {
118
118
  "time-input--inline": this.inline,
119
119
  });
120
- return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
120
+ return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, inputmode: "numeric", onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
121
121
  }
122
122
  static get is() { return "swirl-time-input"; }
123
123
  static get encapsulation() { return "scoped"; }
@@ -16,7 +16,7 @@ describe("swirl-time-input", () => {
16
16
  expect(page.root).toEqualHtml(`
17
17
  <swirl-time-input>
18
18
  <div class="time-input">
19
- <input class="time-input__input" id="swirl-time-input-0" placeholder="hh:mm" type="text">
19
+ <input class="time-input__input" id="swirl-time-input-0" inputmode="numeric" placeholder="hh:mm" type="text">
20
20
  <span class="time-input__icon">
21
21
  <swirl-icon-time-outlined size="24"></swirl-icon-time-outlined>
22
22
  </span>