@getflip/swirl-components 0.94.1 → 0.95.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 (40) hide show
  1. package/components.json +17 -32
  2. package/dist/cjs/index-506fe4ea.js +4 -4
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/swirl-components.cjs.js +1 -1
  5. package/dist/cjs/swirl-dialog.cjs.entry.js +2 -2
  6. package/dist/cjs/swirl-modal.cjs.entry.js +8 -3
  7. package/dist/cjs/swirl-switch.cjs.entry.js +2 -3
  8. package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
  9. package/dist/collection/collection-manifest.json +1 -1
  10. package/dist/collection/components/swirl-dialog/swirl-dialog.css +48 -5
  11. package/dist/collection/components/swirl-dialog/swirl-dialog.js +1 -1
  12. package/dist/collection/components/swirl-dialog/swirl-dialog.spec.js +1 -1
  13. package/dist/collection/components/swirl-dialog/swirl-dialog.stories.js +1 -1
  14. package/dist/collection/components/swirl-modal/swirl-modal.css +4 -2
  15. package/dist/collection/components/swirl-modal/swirl-modal.js +24 -2
  16. package/dist/collection/components/swirl-switch/swirl-switch.css +28 -19
  17. package/dist/collection/components/swirl-switch/swirl-switch.js +1 -25
  18. package/dist/collection/components/swirl-switch/swirl-switch.spec.js +1 -1
  19. package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
  20. package/dist/components/swirl-dialog.js +4 -16
  21. package/dist/components/swirl-modal.js +9 -3
  22. package/dist/components/swirl-switch.js +2 -4
  23. package/dist/esm/index-99d0060d.js +4 -4
  24. package/dist/esm/loader.js +1 -1
  25. package/dist/esm/swirl-components.js +1 -1
  26. package/dist/esm/swirl-dialog.entry.js +2 -2
  27. package/dist/esm/swirl-modal.entry.js +8 -3
  28. package/dist/esm/swirl-switch.entry.js +2 -3
  29. package/dist/swirl-components/p-075d7b3a.entry.js +1 -0
  30. package/dist/swirl-components/p-789efdba.entry.js +10 -0
  31. package/dist/swirl-components/p-9ab0c192.entry.js +1 -0
  32. package/dist/swirl-components/swirl-components.esm.js +1 -1
  33. package/dist/types/components/swirl-modal/swirl-modal.d.ts +1 -0
  34. package/dist/types/components/swirl-switch/swirl-switch.d.ts +0 -2
  35. package/dist/types/components.d.ts +2 -4
  36. package/package.json +1 -1
  37. package/vscode-data.json +4 -12
  38. package/dist/swirl-components/p-4867b806.entry.js +0 -1
  39. package/dist/swirl-components/p-5fcf5a79.entry.js +0 -1
  40. package/dist/swirl-components/p-f96c78e2.entry.js +0 -10
@@ -39,7 +39,6 @@
39
39
  "./components/swirl-skeleton-text/swirl-skeleton-text.js",
40
40
  "./components/swirl-spinner/swirl-spinner.js",
41
41
  "./components/swirl-status-indicator/swirl-status-indicator.js",
42
- "./components/swirl-switch/swirl-switch.js",
43
42
  "./components/swirl-tab-bar/swirl-tab-bar.js",
44
43
  "./components/swirl-table-column/swirl-table-column.js",
45
44
  "./components/swirl-tag/swirl-tag.js",
@@ -229,6 +228,7 @@
229
228
  "./components/swirl-select/swirl-select.js",
230
229
  "./components/swirl-shell-layout/swirl-shell-layout.js",
231
230
  "./components/swirl-shell-navigation-item/swirl-shell-navigation-item.js",
231
+ "./components/swirl-switch/swirl-switch.js",
232
232
  "./components/swirl-symbol/symbols/swirl-symbol-cloud.js",
233
233
  "./components/swirl-symbol/swirl-symbol.js",
234
234
  "./components/swirl-symbol/symbols/swirl-symbol-account-circle.js",
@@ -70,9 +70,9 @@
70
70
  width: 18.5rem;
71
71
  max-height: 90vh;
72
72
  padding-top: var(--s-space-24);
73
- padding-right: var(--s-space-8);
74
- padding-bottom: var(--s-space-8);
75
- padding-left: var(--s-space-8);
73
+ padding-right: var(--s-space-16);
74
+ padding-bottom: var(--s-space-16);
75
+ padding-left: var(--s-space-16);
76
76
  border-radius: var(--s-border-radius-l);
77
77
  background-color: var(--s-surface-overlay-default);
78
78
  text-align: center;
@@ -82,13 +82,23 @@
82
82
  @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
83
83
 
84
84
  .dialog__body {
85
+ width: 25rem;
85
86
  border-radius: var(--s-border-radius-base)
86
87
  }
87
88
  }
88
89
 
90
+ @media (min-width: 992px) {
91
+
92
+ .dialog__body {
93
+ text-align: start
94
+ }
95
+ }
96
+
89
97
  .dialog__heading {
90
98
  margin: 0;
91
99
  margin-bottom: var(--s-space-8);
100
+ padding-right: var(--s-space-8);
101
+ padding-left: var(--s-space-8);
92
102
  font-size: var(--s-font-size-lg);
93
103
  font-weight: var(--s-font-weight-semibold);
94
104
  line-height: var(--s-line-height-lg);
@@ -97,13 +107,14 @@
97
107
  @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
98
108
 
99
109
  .dialog__heading {
100
- font-size: var(--s-font-size-base);
101
110
  line-height: var(--s-line-height-base)
102
111
  }
103
112
  }
104
113
 
105
114
  .dialog__content {
106
- margin-bottom: var(--s-space-24);
115
+ margin-bottom: var(--s-space-20);
116
+ padding-right: var(--s-space-8);
117
+ padding-left: var(--s-space-8);
107
118
  line-height: var(--s-line-height-base);
108
119
  }
109
120
 
@@ -119,6 +130,38 @@
119
130
  }
120
131
  }
121
132
 
133
+ @media (min-width: 992px) {
134
+
135
+ .dialog__content {
136
+ margin-bottom: var(--s-space-24)
137
+ }
138
+ }
139
+
140
+ .dialog__controls {
141
+ display: flex;
142
+ flex-wrap: wrap;
143
+ justify-content: stretch;
144
+ gap: var(--s-space-8);
145
+ }
146
+
147
+ .dialog__controls > * {
148
+ flex-grow: 1;
149
+ }
150
+
151
+ @media (min-width: 992px) {
152
+
153
+ .dialog__controls > * {
154
+ flex-grow: 0
155
+ }
156
+ }
157
+
158
+ @media (min-width: 992px) {
159
+
160
+ .dialog__controls {
161
+ justify-content: flex-end
162
+ }
163
+ }
164
+
122
165
  @keyframes dialog-scale-in {
123
166
  from {
124
167
  transform: scale(0);
@@ -61,7 +61,7 @@ export class SwirlDialog {
61
61
  }
62
62
  render() {
63
63
  const className = classnames("dialog", { "dialog--closing": this.closing });
64
- return (h(Host, null, h("div", { "aria-describedby": "content", "aria-hidden": "true", "aria-labelledby": this.hideLabel ? undefined : "label", "aria-label": this.hideLabel ? this.label : undefined, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, ref: (el) => (this.dialogEl = el), role: "alertdialog" }, h("div", { class: "dialog__backdrop", onClick: this.onBackdropClick }), h("div", { class: "dialog__body", part: "dialog__body", role: "document" }, !this.hideLabel && (h("h2", { class: "dialog__heading", part: "dialog__heading", id: "label" }, this.label)), h("div", { class: "dialog__content", part: "dialog__content", id: "content" }, h("slot", null)), h("swirl-button-group", { class: "dialog__controls", ref: (el) => (this.controlsContainerEl = el), stretch: true, wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: this.intent, label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: this.intent === "critical" ? "ghost" : "flat" })))))));
64
+ return (h(Host, null, h("div", { "aria-describedby": "content", "aria-hidden": "true", "aria-labelledby": this.hideLabel ? undefined : "label", "aria-label": this.hideLabel ? this.label : undefined, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, ref: (el) => (this.dialogEl = el), role: "alertdialog" }, h("div", { class: "dialog__backdrop", onClick: this.onBackdropClick }), h("div", { class: "dialog__body", part: "dialog__body", role: "document" }, !this.hideLabel && (h("h2", { class: "dialog__heading", part: "dialog__heading", id: "label" }, this.label)), h("div", { class: "dialog__content", part: "dialog__content", id: "content" }, h("slot", null)), h("div", { class: "dialog__controls", ref: (el) => (this.controlsContainerEl = el) }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: this.intent, label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: this.intent === "critical" ? "ghost" : "flat" })))))));
65
65
  }
66
66
  static get is() { return "swirl-dialog"; }
67
67
  static get encapsulation() { return "shadow"; }
@@ -18,7 +18,7 @@ describe("swirl-dialog", () => {
18
18
  <div class="dialog__content" part="dialog__content" id="content">
19
19
  <slot></slot>
20
20
  </div>
21
- <swirl-button-group class="dialog__controls" stretch="" wrap=""></swirl-button-group>
21
+ <div class="dialog__controls"></div>
22
22
  </div>
23
23
  </div>
24
24
  </mock:shadow-root>
@@ -34,7 +34,7 @@ const Template = (args) => {
34
34
  };
35
35
  export const SwirlDialog = Template.bind({});
36
36
  SwirlDialog.args = {
37
- intent: "critical",
37
+ intent: "primary",
38
38
  label: "Dialog",
39
39
  primaryActionLabel: "Leave",
40
40
  secondaryActionLabel: "Cancel",
@@ -19,6 +19,8 @@
19
19
  --swirl-resource-list-item-background-pressed: var(
20
20
  --s-surface-overlay-pressed
21
21
  );
22
+ --swirl-modal-height: auto;
23
+ --swirl-modal-max-height: 90vh;
22
24
 
23
25
  position: fixed;
24
26
  z-index: var(--s-z-40);
@@ -263,7 +265,7 @@
263
265
 
264
266
  .modal__body {
265
267
  width: 90vw;
266
- max-height: 90vh;
268
+ max-height: var(--swirl-modal-max-height);
267
269
  border-radius: var(--s-border-radius-base);
268
270
  box-shadow: var(--s-shadow-level-3)
269
271
  }
@@ -272,7 +274,7 @@
272
274
  @media (min-width: 992px) {
273
275
 
274
276
  .modal__body {
275
- height: auto
277
+ height: var(--swirl-modal-height)
276
278
  }
277
279
  }
278
280
 
@@ -44,6 +44,7 @@ export class SwirlModal {
44
44
  };
45
45
  this.closable = true;
46
46
  this.closeButtonLabel = "Close modal";
47
+ this.height = undefined;
47
48
  this.hideCloseButton = undefined;
48
49
  this.hideLabel = undefined;
49
50
  this.label = undefined;
@@ -81,7 +82,7 @@ export class SwirlModal {
81
82
  });
82
83
  }
83
84
  disconnectedCallback() {
84
- this.focusTrap.deactivate();
85
+ this.focusTrap?.deactivate();
85
86
  this.unlockBodyScroll();
86
87
  }
87
88
  onWindowResize() {
@@ -162,7 +163,11 @@ export class SwirlModal {
162
163
  "modal--scrolled": this.scrolled,
163
164
  "modal--scrolled-down": this.scrolledDown,
164
165
  });
165
- return (h(Host, null, h("section", { "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", style: { maxHeight: this.maxHeight, maxWidth: this.maxWidth } }, h("header", { class: "modal__custom-header" }, h("slot", { name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { class: "modal__header" }, h("div", { class: "modal__header-bar" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
166
+ return (h(Host, null, h("section", { "aria-hidden": String(!this.isOpen), "aria-label": this.label, "aria-modal": "true", class: className, onKeyDown: this.onKeyDown, role: "dialog", ref: (el) => (this.modalEl = el) }, h("div", { class: "modal__backdrop", onClick: this.onBackdropClick }), h("div", { class: "modal__body", style: {
167
+ "--swirl-modal-max-height": this.maxHeight,
168
+ "--swirl-modal-height": this.height,
169
+ maxWidth: this.maxWidth,
170
+ } }, h("header", { class: "modal__custom-header" }, h("slot", { name: "custom-header" })), (!this.hideLabel || !this.hideCloseButton) && (h("header", { class: "modal__header" }, h("div", { class: "modal__header-bar" }, !this.hideCloseButton && (h("swirl-button", { class: "modal__close-button", hideLabel: true, icon: this.variant === "default"
166
171
  ? "<swirl-icon-close></swirl-icon-close>"
167
172
  : "<swirl-icon-double-arrow-right></swirl-icon-double-arrow-right>", label: this.closeButtonLabel, onClick: this.onCloseButtonClick })), !this.hideLabel && (h("swirl-heading", { as: "h2", class: "modal__heading", level: 3, text: this.label }))))), h("div", { class: "modal__content-container" }, h("div", { class: "modal__primary-content" }, h("div", { class: "modal__header-tools" }, h("slot", { name: "header-tools" })), h("div", { class: "modal__content", onScroll: this.determineScrollStatus, ref: (el) => (this.scrollContainer = el) }, h("slot", null))), h("div", { class: "modal__secondary-content" }, h("slot", { name: "secondary-content" }))), h("div", { class: "modal__custom-footer" }, h("slot", { name: "custom-footer" })), showControls && (h("footer", { class: "modal__controls" }, h("swirl-button-group", { wrap: true }, this.secondaryActionLabel && (h("swirl-button", { label: this.secondaryActionLabel, onClick: this.onSecondaryAction })), this.primaryActionLabel && (h("swirl-button", { intent: "primary", label: this.primaryActionLabel, onClick: this.onPrimaryAction, variant: "flat" })))))))));
168
173
  }
@@ -215,6 +220,23 @@ export class SwirlModal {
215
220
  "reflect": false,
216
221
  "defaultValue": "\"Close modal\""
217
222
  },
223
+ "height": {
224
+ "type": "string",
225
+ "mutable": false,
226
+ "complexType": {
227
+ "original": "string",
228
+ "resolved": "string",
229
+ "references": {}
230
+ },
231
+ "required": false,
232
+ "optional": true,
233
+ "docs": {
234
+ "tags": [],
235
+ "text": ""
236
+ },
237
+ "attribute": "height",
238
+ "reflect": false
239
+ },
218
240
  "hideCloseButton": {
219
241
  "type": "boolean",
220
242
  "mutable": false,
@@ -17,29 +17,21 @@
17
17
  0 0 0 0.1875rem var(--s-focus-default);
18
18
  }
19
19
 
20
- .switch--size-m .switch__control {
21
- width: 2.75rem;
22
- height: 1.5rem;
23
- border-radius: calc(1.5rem / 2);
20
+ .switch--on .switch__thumb {
21
+ left: calc(100% - 1.25rem - var(--s-space-2));
24
22
  }
25
23
 
26
- .switch--size-m .switch__thumb {
27
- width: 1.25rem;
28
- height: 1.25rem;
29
- }
24
+ @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
30
25
 
31
- .switch--on.switch--size-m .switch__thumb {
32
- left: calc(100% - 1.25rem - var(--s-space-2));
26
+ .switch--on .switch__thumb {
27
+ left: calc(100% - 0.875rem - var(--s-space-2))
28
+ }
33
29
  }
34
30
 
35
31
  .switch--on .switch__control {
36
32
  background-color: var(--s-interactive-primary-default);
37
33
  }
38
34
 
39
- .switch--on .switch__thumb {
40
- left: calc(100% - 0.875rem - var(--s-space-2));
41
- }
42
-
43
35
  .switch--disabled .switch__control {
44
36
  background-color: var(--s-interactive-primary-disabled);
45
37
  cursor: default;
@@ -55,10 +47,10 @@
55
47
 
56
48
  .switch__control {
57
49
  position: relative;
58
- width: 1.875rem;
59
- height: 1.125rem;
50
+ width: 2.75rem;
51
+ height: 1.5rem;
60
52
  flex-shrink: 0;
61
- border-radius: calc(1.125rem / 2);
53
+ border-radius: calc(1.5rem / 2);
62
54
  background-color: var(--s-interactive-primary-disabled);
63
55
  cursor: pointer;
64
56
  transition: background-color 0.2s;
@@ -71,12 +63,21 @@
71
63
  }
72
64
  }
73
65
 
66
+ @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
67
+
68
+ .switch__control {
69
+ width: 1.875rem;
70
+ height: 1.125rem;
71
+ border-radius: calc(1.125rem / 2)
72
+ }
73
+ }
74
+
74
75
  .switch__thumb {
75
76
  position: absolute;
76
77
  top: var(--s-space-2);
77
78
  left: var(--s-space-2);
78
- width: 0.875rem;
79
- height: 0.875rem;
79
+ width: 1.25rem;
80
+ height: 1.25rem;
80
81
  border-radius: 50%;
81
82
  background-color: var(--s-surface-default);
82
83
  transition: left 0.2s;
@@ -90,6 +91,14 @@
90
91
  }
91
92
  }
92
93
 
94
+ @media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
95
+
96
+ .switch__thumb {
97
+ width: 0.875rem;
98
+ height: 0.875rem
99
+ }
100
+ }
101
+
93
102
  .switch__label {
94
103
  position: relative;
95
104
  z-index: 1;
@@ -63,7 +63,6 @@ export class SwirlSwitch {
63
63
  this.inputId = undefined;
64
64
  this.inputName = undefined;
65
65
  this.label = undefined;
66
- this.size = "m";
67
66
  this.value = undefined;
68
67
  }
69
68
  onWindowPointerUp() {
@@ -73,7 +72,7 @@ export class SwirlSwitch {
73
72
  const off = !this.checked;
74
73
  const on = this.checked;
75
74
  const ariaCheckedLabel = on ? "true" : "false";
76
- const className = classnames("switch", `switch--size-${this.size}`, {
75
+ const className = classnames("switch", {
77
76
  "switch--off": off,
78
77
  "switch--on": on,
79
78
  "switch--disabled": this.disabled,
@@ -181,29 +180,6 @@ export class SwirlSwitch {
181
180
  "attribute": "label",
182
181
  "reflect": false
183
182
  },
184
- "size": {
185
- "type": "string",
186
- "mutable": false,
187
- "complexType": {
188
- "original": "SwirlSwitchSize",
189
- "resolved": "\"m\" | \"s\"",
190
- "references": {
191
- "SwirlSwitchSize": {
192
- "location": "local",
193
- "path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-switch/swirl-switch.tsx"
194
- }
195
- }
196
- },
197
- "required": false,
198
- "optional": true,
199
- "docs": {
200
- "tags": [],
201
- "text": ""
202
- },
203
- "attribute": "size",
204
- "reflect": false,
205
- "defaultValue": "\"m\""
206
- },
207
183
  "value": {
208
184
  "type": "string",
209
185
  "mutable": false,
@@ -8,7 +8,7 @@ describe("swirl-switch", () => {
8
8
  });
9
9
  expect(page.root).toMatchInlineSnapshot(`
10
10
  <swirl-switch checked="true" disabled="true" input-id="switch" input-name="switch" label="Label" value="Value">
11
- <label class="switch switch--disabled switch--on switch--size-m" htmlfor="switch">
11
+ <label class="switch switch--disabled switch--on" htmlfor="switch">
12
12
  <span class="switch__control">
13
13
  <swirl-visually-hidden>
14
14
  <input aria-checked="true" checked="" class="switch__input" disabled="" id="switch" name="switch" role="switch" type="checkbox" value="Value">