@getflip/swirl-components 0.447.0 → 0.448.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.
- package/components.json +41 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-popover_2.cjs.entry.js +11 -5
- package/dist/collection/components/swirl-popover/swirl-popover.css +6 -2
- package/dist/collection/components/swirl-popover/swirl-popover.js +36 -4
- package/dist/components/swirl-popover2.js +12 -5
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-popover_2.entry.js +11 -5
- package/dist/swirl-components/p-0e94bce2.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-popover/swirl-popover.d.ts +4 -0
- package/dist/types/components.d.ts +10 -2
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-7f6b60ed.entry.js +0 -1
|
@@ -197,7 +197,8 @@
|
|
|
197
197
|
background: var(--s-translucent-low-default);
|
|
198
198
|
-webkit-backdrop-filter: blur(var(--s-blur-l));
|
|
199
199
|
backdrop-filter: blur(var(--s-blur-l));
|
|
200
|
-
outline: var(--s-border-width-default) solid
|
|
200
|
+
outline: var(--s-border-width-default) solid
|
|
201
|
+
var(--s-border-translucent-outline);
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
.popover--translucent .popover__handle {
|
|
@@ -244,8 +245,11 @@
|
|
|
244
245
|
right: unset;
|
|
245
246
|
bottom: unset;
|
|
246
247
|
left: unset;
|
|
248
|
+
border-radius: var(
|
|
249
|
+
--swirl-popover-border-radius,
|
|
250
|
+
var(--s-border-radius-base)
|
|
251
|
+
);
|
|
247
252
|
max-width: 22.5rem;
|
|
248
|
-
border-radius: var(--s-border-radius-base);
|
|
249
253
|
animation: none;
|
|
250
254
|
box-shadow: var(--s-shadow-level-2)
|
|
251
255
|
}
|
|
@@ -2,8 +2,9 @@ import { autoUpdate, computePosition, flip, offset, shift, } from "@floating-ui/
|
|
|
2
2
|
import { h, Host, } from "@stencil/core";
|
|
3
3
|
import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
|
|
4
4
|
import classnames from "classnames";
|
|
5
|
-
import { getActiveElement, getPixelsFromRemToken, isMobileViewport, querySelectorAllDeep, } from "../../utils";
|
|
6
5
|
import { tabbable } from "tabbable";
|
|
6
|
+
import { getActiveElement, getPixelsFromRemToken, isMobileViewport, querySelectorAllDeep, } from "../../utils";
|
|
7
|
+
const swirlPopoverBorderRadiusTokens = ["xs", "sm", "base", "l", "xl"];
|
|
7
8
|
/**
|
|
8
9
|
* @slot slot - The popover content.
|
|
9
10
|
*/
|
|
@@ -16,6 +17,7 @@ export class SwirlPopover {
|
|
|
16
17
|
this.padded = true;
|
|
17
18
|
this.placement = "bottom-start";
|
|
18
19
|
this.returnFocusToTrigger = true;
|
|
20
|
+
this.borderRadius = "base";
|
|
19
21
|
this.active = false;
|
|
20
22
|
this.closing = false;
|
|
21
23
|
this.togglePopover = (event) => {
|
|
@@ -286,6 +288,9 @@ export class SwirlPopover {
|
|
|
286
288
|
}
|
|
287
289
|
render() {
|
|
288
290
|
const mobile = !window.matchMedia("(min-width: 768px)").matches;
|
|
291
|
+
const borderRadius = swirlPopoverBorderRadiusTokens.includes(this.borderRadius)
|
|
292
|
+
? `var(--s-border-radius-${this.borderRadius})`
|
|
293
|
+
: this.borderRadius;
|
|
289
294
|
const className = classnames("popover", `popover--animation-${this.animation}`, `popover--placement-${this.position?.placement}`, {
|
|
290
295
|
"popover--active": this.active,
|
|
291
296
|
"popover--closing": this.closing,
|
|
@@ -295,14 +300,15 @@ export class SwirlPopover {
|
|
|
295
300
|
"popover--transparent": this.transparent,
|
|
296
301
|
"popover--padded": this.padded,
|
|
297
302
|
});
|
|
298
|
-
return (h(Host, { key: '
|
|
303
|
+
return (h(Host, { key: 'a2a763e0cf93585b67adfca26fcf24fbd62ffd70' }, h("div", { key: '245f55eba39ea78e9451998a4f306ceb3c144749', popover: "manual", class: className, onKeyDown: this.onKeydown, ref: (el) => (this.popoverEl = el) }, h("div", { key: '971e861993eba21da4404d93ecabe6ff098a23ce', "aria-hidden": !this.active ? "true" : "false", "aria-label": this.label, class: "popover__content", id: this.popoverId, part: "popover__content", role: "dialog", ref: (el) => (this.contentContainer = el), style: {
|
|
299
304
|
top: Boolean(this.position) ? `${this.position?.y}px` : "",
|
|
300
305
|
left: Boolean(this.position) ? `${this.position?.x}px` : "",
|
|
301
|
-
|
|
306
|
+
"--swirl-popover-border-radius": borderRadius,
|
|
307
|
+
}, tabindex: "-1" }, h("span", { key: '76f0726441b1f18753b8215c65ce2c62c262d73c', class: "popover__handle" }), h("div", { key: '633139376e5cabfa0ead3985b60154fbbb803fa1', class: "popover__scroll-container", part: "popover__scroll-container", ref: (el) => (this.scrollContainer = el), style: {
|
|
302
308
|
maxHeight: !mobile && Boolean(this.maxHeight)
|
|
303
309
|
? this.maxHeight
|
|
304
310
|
: undefined,
|
|
305
|
-
} }, h("slot", { key: '
|
|
311
|
+
} }, h("slot", { key: 'cec72df14222730bf06ee988e64b1ea6b296ed8c' }))), this.active && (h("div", { key: 'bad63d1ee57e5a7cc845fe2effead56b0399e233', class: "popover__backdrop", onClick: this.onCloseButtonClick })))));
|
|
306
312
|
}
|
|
307
313
|
static get is() { return "swirl-popover"; }
|
|
308
314
|
static get encapsulation() { return "shadow"; }
|
|
@@ -649,6 +655,32 @@ export class SwirlPopover {
|
|
|
649
655
|
"getter": false,
|
|
650
656
|
"setter": false,
|
|
651
657
|
"reflect": false
|
|
658
|
+
},
|
|
659
|
+
"borderRadius": {
|
|
660
|
+
"type": "string",
|
|
661
|
+
"attribute": "border-radius",
|
|
662
|
+
"mutable": false,
|
|
663
|
+
"complexType": {
|
|
664
|
+
"original": "SwirlPopoverBorderRadius",
|
|
665
|
+
"resolved": "string",
|
|
666
|
+
"references": {
|
|
667
|
+
"SwirlPopoverBorderRadius": {
|
|
668
|
+
"location": "local",
|
|
669
|
+
"path": "/home/runner/work/swirl/swirl/packages/swirl-components/src/components/swirl-popover/swirl-popover.tsx",
|
|
670
|
+
"id": "src/components/swirl-popover/swirl-popover.tsx::SwirlPopoverBorderRadius"
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
"required": false,
|
|
675
|
+
"optional": true,
|
|
676
|
+
"docs": {
|
|
677
|
+
"tags": [],
|
|
678
|
+
"text": ""
|
|
679
|
+
},
|
|
680
|
+
"getter": false,
|
|
681
|
+
"setter": false,
|
|
682
|
+
"reflect": false,
|
|
683
|
+
"defaultValue": "\"base\""
|
|
652
684
|
}
|
|
653
685
|
};
|
|
654
686
|
}
|
|
@@ -2,11 +2,12 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
|
|
|
2
2
|
import { c as computePosition, a as autoUpdate, s as shift, o as offset, f as flip } from './floating-ui.dom.js';
|
|
3
3
|
import { d as disableBodyScroll, e as enableBodyScroll } from './bodyScrollLock.esm.js';
|
|
4
4
|
import { c as classNames } from './index2.js';
|
|
5
|
-
import { i as isMobileViewport, t as getPixelsFromRemToken, k as getActiveElement, q as querySelectorAllDeep } from './utils.js';
|
|
6
5
|
import { t as tabbable } from './index.esm.js';
|
|
6
|
+
import { i as isMobileViewport, t as getPixelsFromRemToken, k as getActiveElement, q as querySelectorAllDeep } from './utils.js';
|
|
7
7
|
|
|
8
|
-
const swirlPopoverCss = ":host{position:relative;z-index:var(--s-z-40);display:contents}:host *{box-sizing:border-box}.popover{border:none;padding:0;margin:0}.popover::backdrop{display:none}.popover--active:not(.popover--closing) .popover__backdrop{animation:0.15s popover-fade-in}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__backdrop{animation:none}}.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-slide-in}@media (min-width: 768px){.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-scale-in-xy}}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__content{animation:none}}.popover--closing .popover__backdrop{animation:0.15s popover-fade-out forwards}@media (prefers-reduced-motion){.popover--closing .popover__backdrop{animation:none}}.popover--closing .popover__content{animation:0.15s popover-slide-out forwards}@media (min-width: 768px){.popover--closing .popover__content{animation:0.15s popover-fade-out forwards}}@media (prefers-reduced-motion){.popover--closing .popover__content{animation:none}}.popover--inactive .popover__content{display:none}@media (max-width: 767px){.popover--fullscreen-bottom-sheet.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-in}@media (prefers-reduced-motion){.popover--fullscreen-bottom-sheet.popover--active:not(.popover--closing) .popover__content{animation:none}}.popover--fullscreen-bottom-sheet.popover--closing .popover__content{animation:0.15s popover-fade-out forwards}@media (prefers-reduced-motion){.popover--fullscreen-bottom-sheet.popover--closing .popover__content{animation:none}}.popover--fullscreen-bottom-sheet .popover__backdrop{display:none}.popover--fullscreen-bottom-sheet .popover__content{top:0;border-top-left-radius:0;border-top-right-radius:0}.popover--fullscreen-bottom-sheet .popover__scroll-container{height:100%;max-height:none;padding-top:0;padding-bottom:0}.popover--fullscreen-bottom-sheet .popover__handle{display:none}}@media (min-width: 768px){.popover--animation-scale-in-y.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-scale-in-y}}@media (prefers-reduced-motion){.popover--animation-scale-in-y.popover--active:not(.popover--closing) .popover__content{animation:none}}@media (min-width: 768px){.popover--animation-fade-in.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-in}}@media (prefers-reduced-motion){.popover--animation-fade-in.popover--active:not(.popover--closing) .popover__content{animation:none}}@media (min-width: 768px){.popover--placement-bottom .popover__content,.popover--placement-bottom-start .popover__content,.popover--placement-right .popover__content,.popover--placement-right-start .popover__content{transform-origin:top left}}@media (min-width: 768px){.popover--placement-bottom-end .popover__content,.popover--placement-left .popover__content,.popover--placement-left-start .popover__content{transform-origin:top right}}@media (min-width: 768px){.popover--placement-top .popover__content,.popover--placement-top-start .popover__content,.popover--placement-right-end .popover__content{transform-origin:bottom left}}@media (min-width: 768px){.popover--placement-top-end .popover__content,.popover--placement-left-end .popover__content{transform-origin:bottom right}}@media (min-width: 768px){.popover--transparent .popover__content{background-color:transparent;box-shadow:none}}@media (min-width: 768px){.popover--transparent .popover__scroll-container{padding:0}}.popover--translucent .popover__content{background:var(--s-translucent-low-default);-webkit-backdrop-filter:blur(var(--s-blur-l));backdrop-filter:blur(var(--s-blur-l));outline:var(--s-border-width-default) solid
|
|
8
|
+
const swirlPopoverCss = ":host{position:relative;z-index:var(--s-z-40);display:contents}:host *{box-sizing:border-box}.popover{border:none;padding:0;margin:0}.popover::backdrop{display:none}.popover--active:not(.popover--closing) .popover__backdrop{animation:0.15s popover-fade-in}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__backdrop{animation:none}}.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-slide-in}@media (min-width: 768px){.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-scale-in-xy}}@media (prefers-reduced-motion){.popover--active:not(.popover--closing) .popover__content{animation:none}}.popover--closing .popover__backdrop{animation:0.15s popover-fade-out forwards}@media (prefers-reduced-motion){.popover--closing .popover__backdrop{animation:none}}.popover--closing .popover__content{animation:0.15s popover-slide-out forwards}@media (min-width: 768px){.popover--closing .popover__content{animation:0.15s popover-fade-out forwards}}@media (prefers-reduced-motion){.popover--closing .popover__content{animation:none}}.popover--inactive .popover__content{display:none}@media (max-width: 767px){.popover--fullscreen-bottom-sheet.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-in}@media (prefers-reduced-motion){.popover--fullscreen-bottom-sheet.popover--active:not(.popover--closing) .popover__content{animation:none}}.popover--fullscreen-bottom-sheet.popover--closing .popover__content{animation:0.15s popover-fade-out forwards}@media (prefers-reduced-motion){.popover--fullscreen-bottom-sheet.popover--closing .popover__content{animation:none}}.popover--fullscreen-bottom-sheet .popover__backdrop{display:none}.popover--fullscreen-bottom-sheet .popover__content{top:0;border-top-left-radius:0;border-top-right-radius:0}.popover--fullscreen-bottom-sheet .popover__scroll-container{height:100%;max-height:none;padding-top:0;padding-bottom:0}.popover--fullscreen-bottom-sheet .popover__handle{display:none}}@media (min-width: 768px){.popover--animation-scale-in-y.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-scale-in-y}}@media (prefers-reduced-motion){.popover--animation-scale-in-y.popover--active:not(.popover--closing) .popover__content{animation:none}}@media (min-width: 768px){.popover--animation-fade-in.popover--active:not(.popover--closing) .popover__content{animation:0.15s popover-fade-in}}@media (prefers-reduced-motion){.popover--animation-fade-in.popover--active:not(.popover--closing) .popover__content{animation:none}}@media (min-width: 768px){.popover--placement-bottom .popover__content,.popover--placement-bottom-start .popover__content,.popover--placement-right .popover__content,.popover--placement-right-start .popover__content{transform-origin:top left}}@media (min-width: 768px){.popover--placement-bottom-end .popover__content,.popover--placement-left .popover__content,.popover--placement-left-start .popover__content{transform-origin:top right}}@media (min-width: 768px){.popover--placement-top .popover__content,.popover--placement-top-start .popover__content,.popover--placement-right-end .popover__content{transform-origin:bottom left}}@media (min-width: 768px){.popover--placement-top-end .popover__content,.popover--placement-left-end .popover__content{transform-origin:bottom right}}@media (min-width: 768px){.popover--transparent .popover__content{background-color:transparent;box-shadow:none}}@media (min-width: 768px){.popover--transparent .popover__scroll-container{padding:0}}.popover--translucent .popover__content{background:var(--s-translucent-low-default);-webkit-backdrop-filter:blur(var(--s-blur-l));backdrop-filter:blur(var(--s-blur-l));outline:var(--s-border-width-default) solid\n var(--s-border-translucent-outline)}.popover--translucent .popover__handle{background-color:var(--s-border-on-translucent)}.popover__backdrop{position:fixed;z-index:0;background-color:rgba(0, 0, 0, 0.2);animation:0.15s popover-backdrop-fade-in;inset:0}@media (prefers-reduced-motion){.popover__backdrop{animation:none}}@media (min-width: 768px){.popover__backdrop{display:none}}.popover__content{position:fixed;z-index:2;right:0;bottom:0;left:0;overflow:hidden;border-top-left-radius:var(--s-border-radius-xl);border-top-right-radius:var(--s-border-radius-xl);background-color:var(--s-surface-overlay-default)}@media (min-width: 768px){.popover__content{right:unset;bottom:unset;left:unset;border-radius:var(\n --swirl-popover-border-radius,\n var(--s-border-radius-base)\n );max-width:22.5rem;animation:none;box-shadow:var(--s-shadow-level-2)}}.popover__scroll-container{overflow-x:hidden;overflow-y:auto;width:100%;max-height:90vh;padding-top:var(--s-space-24);padding-bottom:var(--s-space-24);overscroll-behavior:contain}@media (min-width: 768px){.popover__scroll-container{max-height:22rem;padding-top:0;padding-bottom:0}}@media (min-width: 768px){.popover--padded .popover__scroll-container{padding:var(--s-space-4)}}.popover__handle{position:absolute;top:var(--s-space-8);left:50%;width:2.5rem;height:0.375rem;border-radius:0.1875rem;background-color:var(--s-border-default);transform:translatex(-50%)}@media (min-width: 768px){.popover__handle{display:none}}@keyframes popover-slide-in{from{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes popover-slide-out{from{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes popover-fade-in{from{opacity:0}to{opacity:1}}@keyframes popover-fade-out{from{opacity:1}to{opacity:0}}@keyframes popover-fade-scale-in-xy{from{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@keyframes popover-fade-scale-in-y{from{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}";
|
|
9
9
|
|
|
10
|
+
const swirlPopoverBorderRadiusTokens = ["xs", "sm", "base", "l", "xl"];
|
|
10
11
|
const SwirlPopover = /*@__PURE__*/ proxyCustomElement(class SwirlPopover extends HTMLElement {
|
|
11
12
|
constructor() {
|
|
12
13
|
super();
|
|
@@ -21,6 +22,7 @@ const SwirlPopover = /*@__PURE__*/ proxyCustomElement(class SwirlPopover extends
|
|
|
21
22
|
this.padded = true;
|
|
22
23
|
this.placement = "bottom-start";
|
|
23
24
|
this.returnFocusToTrigger = true;
|
|
25
|
+
this.borderRadius = "base";
|
|
24
26
|
this.active = false;
|
|
25
27
|
this.closing = false;
|
|
26
28
|
this.togglePopover = (event) => {
|
|
@@ -291,6 +293,9 @@ const SwirlPopover = /*@__PURE__*/ proxyCustomElement(class SwirlPopover extends
|
|
|
291
293
|
}
|
|
292
294
|
render() {
|
|
293
295
|
const mobile = !window.matchMedia("(min-width: 768px)").matches;
|
|
296
|
+
const borderRadius = swirlPopoverBorderRadiusTokens.includes(this.borderRadius)
|
|
297
|
+
? `var(--s-border-radius-${this.borderRadius})`
|
|
298
|
+
: this.borderRadius;
|
|
294
299
|
const className = classNames("popover", `popover--animation-${this.animation}`, `popover--placement-${this.position?.placement}`, {
|
|
295
300
|
"popover--active": this.active,
|
|
296
301
|
"popover--closing": this.closing,
|
|
@@ -300,14 +305,15 @@ const SwirlPopover = /*@__PURE__*/ proxyCustomElement(class SwirlPopover extends
|
|
|
300
305
|
"popover--transparent": this.transparent,
|
|
301
306
|
"popover--padded": this.padded,
|
|
302
307
|
});
|
|
303
|
-
return (h(Host, { key: '
|
|
308
|
+
return (h(Host, { key: 'a2a763e0cf93585b67adfca26fcf24fbd62ffd70' }, h("div", { key: '245f55eba39ea78e9451998a4f306ceb3c144749', popover: "manual", class: className, onKeyDown: this.onKeydown, ref: (el) => (this.popoverEl = el) }, h("div", { key: '971e861993eba21da4404d93ecabe6ff098a23ce', "aria-hidden": !this.active ? "true" : "false", "aria-label": this.label, class: "popover__content", id: this.popoverId, part: "popover__content", role: "dialog", ref: (el) => (this.contentContainer = el), style: {
|
|
304
309
|
top: Boolean(this.position) ? `${this.position?.y}px` : "",
|
|
305
310
|
left: Boolean(this.position) ? `${this.position?.x}px` : "",
|
|
306
|
-
|
|
311
|
+
"--swirl-popover-border-radius": borderRadius,
|
|
312
|
+
}, tabindex: "-1" }, h("span", { key: '76f0726441b1f18753b8215c65ce2c62c262d73c', class: "popover__handle" }), h("div", { key: '633139376e5cabfa0ead3985b60154fbbb803fa1', class: "popover__scroll-container", part: "popover__scroll-container", ref: (el) => (this.scrollContainer = el), style: {
|
|
307
313
|
maxHeight: !mobile && Boolean(this.maxHeight)
|
|
308
314
|
? this.maxHeight
|
|
309
315
|
: undefined,
|
|
310
|
-
} }, h("slot", { key: '
|
|
316
|
+
} }, h("slot", { key: 'cec72df14222730bf06ee988e64b1ea6b296ed8c' }))), this.active && (h("div", { key: 'bad63d1ee57e5a7cc845fe2effead56b0399e233', class: "popover__backdrop", onClick: this.onCloseButtonClick })))));
|
|
311
317
|
}
|
|
312
318
|
get el() { return this; }
|
|
313
319
|
static get style() { return swirlPopoverCss; }
|
|
@@ -328,6 +334,7 @@ const SwirlPopover = /*@__PURE__*/ proxyCustomElement(class SwirlPopover extends
|
|
|
328
334
|
"trigger": [1],
|
|
329
335
|
"triggerContainer": [16, "trigger-container"],
|
|
330
336
|
"useContainerWidth": [8, "use-container-width"],
|
|
337
|
+
"borderRadius": [1, "border-radius"],
|
|
331
338
|
"active": [32],
|
|
332
339
|
"closing": [32],
|
|
333
340
|
"position": [32],
|